初始化仓库

This commit is contained in:
tao
2025-12-18 14:11:48 +08:00
parent e96f277a68
commit 54ec472bd4
1107 changed files with 158756 additions and 0 deletions

View File

@@ -0,0 +1,219 @@
<template>
<view class="container">
<uni-forms ref="form" :modelValue="formData" labelWidth="120px" :rules="rules">
<uni-forms-item label="盘点作业单" name="wmsMatInvCode" required>
<uni-easyinput v-model="formData.wmsMatInvCode" suffixIcon="scan" type="text" :focus='true'
@iconClick="scanInvCode" @change="clearInvDeatil" />
</uni-forms-item>
<uni-forms-item label="物料批号" name="batchNo" required>
<uni-easyinput v-model="formData.batchNo" suffixIcon="scan" type="text" @iconClick="scanBatchNo"
@change="getInvDeatil" />
</uni-forms-item>
<u-divider text="盘点单信息"></u-divider>
<uni-forms-item label="盘点单明细编码" name="wmsInvDetailDefCode">
<uni-data-select v-model="formData.wmsInvDetailDefCode" :localdata="invJobDetailSelectList"
@change="changeDetail" :clear="false"></uni-data-select>
</uni-forms-item>
<u-divider text="详细信息"></u-divider>
<uni-forms-item label="物料编码" name="materialCode">
<uni-easyinput v-model="formData.materialCode" type="text" disabled />
</uni-forms-item>
<uni-forms-item label="物料名称" name="materialName">
<uni-easyinput v-model="formData.materialName" type="text" disabled />
</uni-forms-item>
<uni-forms-item label="仓库编码" name="whCode">
<uni-easyinput v-model="formData.whCode" type="text" disabled />
</uni-forms-item>
<uni-forms-item label="库区编码" name="areaCode">
<uni-easyinput v-model="formData.areaCode" type="text" disabled />
</uni-forms-item>
<uni-forms-item label="库位编码" name="storageLocationCode">
<uni-easyinput v-model="formData.storageLocationCode" type="text" disabled />
</uni-forms-item>
<uni-forms-item label="账面数量" name="theoryNumber">
<uni-easyinput v-model="formData.theoryNumber" type="number" disabled />
</uni-forms-item>
<uni-forms-item label="实盘数量" name="actualNumber">
<u-number-box v-model="formData.actualNumber" inputWidth="auto" button-size="36" min="0"></u-number-box>
</uni-forms-item>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
getInvJob,
listInvJob
} from "@/api/wms/invJob.js";
import {
listInvJobDetail,
updateInvJobDetail
} from "@/api/wms/invJobDetail.js"
export default {
data() {
return {
invJobDetailList: [],
invJobDetailSelectList: [],
wmsInvDetailList: null,
invJobDetailInfo: null,
formData: {
// 详情单 id
id: null,
wmsMatInvCode: null,
wmsInvDetailDefCode: null,
materialCode: null,
materialName: null,
batchNo: null,
whCode: null,
areaCode: null,
storageLocationCode: null,
theoryNumber: null,
actualNumber: null,
},
rules: {
wmsMatInvCode: {
rules: [{
required: true,
errorMessage: '请输入盘点单!'
}]
},
batchNo: {
rules: [{
required: true,
errorMessage: '请输入批号编码!'
}]
},
actualNumber: {
rules: [{
required: true,
errorMessage: '请输入实盘数量!'
}]
}
}
}
},
methods: {
// 扫描盘点作业单编码
scanInvCode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.wmsMatInvCode = res.result;
}
});
},
// 扫描物料批号
scanBatchNo() {
if (!this.formData.wmsMatInvCode) {
this.$modal.msg("请先扫描盘点作业单编码!")
return
}
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.batchNo = res.result;
}
});
},
// 获取盘点明细
async getInvDeatil() {
if (!this.formData.wmsMatInvCode) {
this.$modal.msg("请先扫描盘点作业单编码!")
return
}
uni.showLoading({
title: '获取盘点明细...'
});
await listInvJobDetail({
wmsInvJobCode: this.formData.wmsMatInvCode,
batchNo: this.formData.batchNo
}).then(res => {
// 存储明细列表到本地
this.invJobDetailList = res.rows
// 生成 select 列表
this.invJobDetailSelectList = []
this.invJobDetailList.forEach(item => {
this.invJobDetailSelectList.push({
text: item.wmsInvJobDetailCode,
value: item.wmsInvJobDetailCode,
disabled: false
})
})
this.formData.wmsInvDetailDefCode = this.invJobDetailList[0]?.wmsInvJobDetailCode
// 默认渲染第一个明细单
this.renderDetail(this.formData.wmsInvDetailDefCode)
}).catch(() => {
this.$modal.msg("未获取到盘点作业明细信息")
}).finally(() => {
uni.hideLoading()
})
},
// 根据明细编码找到对应的物料信息
renderDetail(code) {
const i = this.invJobDetailList.findIndex(item => item.wmsInvJobDetailCode === code)
this.formData.id = this.invJobDetailList[i].id
this.formData.materialCode = this.invJobDetailList[i].materialCode
this.formData.materialName = this.invJobDetailList[i].materialName
this.formData.whCode = this.invJobDetailList[i].whCode
this.formData.areaCode = this.invJobDetailList[i].areaCode
this.formData.shelvesCode = this.invJobDetailList[i].shelvesCode
this.formData.storageLocationCode = this.invJobDetailList[i].storageLocationCode
this.formData.theoryNumber = this.invJobDetailList[i].theoryNumber
},
// 切换明细单
changeDetail(e) {
this.clearInvDeatil()
this.renderDetail(e)
},
// 重置表单
clearInvDeatil() {
Object.keys(this.formData).forEach(key => {
if (!["wmsMatInvCode", "wmsInvDetailDefCode", "batchNo"].includes(key)) {
this.formData[key] = null
}
})
this.actualNumber = 0
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定盘点该物料吗?',
success: function(res) {
if (res.confirm) {
uni.showLoading({
title: '提交盘点明细单...'
});
updateInvJobDetail(_this.formData).then(() => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("盘点成功!");
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style scoped>
.container {
padding: 15px;
}
.uni-forms-item {
margin-bottom: 16px;
}
</style>

View File

@@ -0,0 +1,250 @@
<template>
<view class="container">
<uni-forms ref="form" :modelValue="formData" labelWidth="120px" :rules="rules">
<uni-forms-item label="盘点作业单" name="wmsMatInvCode" required>
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @change="scanBarCode"
v-model="formData.wmsMatInvCode" type="text" :focus='true' />
</uni-forms-item>
<uni-forms-item label="盘点单明细编码" name="wmsInvDetailDefCode" required>
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @change="getInvDetailInfo"
v-model="formData.wmsInvDetailDefCode" type="text" />
</uni-forms-item>
<u-divider text="详细信息"></u-divider>
<uni-forms-item label="物料编码" name="materialCode">
<uni-easyinput v-model="formData.materialCode" type="text" disabled />
</uni-forms-item>
<uni-forms-item label="物料名称" name="materialName">
<uni-easyinput type="text" v-model="formData.materialName" disabled />
</uni-forms-item>
<uni-forms-item label="物料批号" name="batchNo">
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
</uni-forms-item>
<uni-forms-item label="仓库编码" name="whCode">
<uni-easyinput disabled type="text" v-model="formData.whCode" />
</uni-forms-item>
<uni-forms-item label="库区编码" name="areaCode">
<uni-easyinput disabled type="text" v-model="formData.areaCode" />
</uni-forms-item>
<uni-forms-item label="库位编码" name="storageLocationCode">
<uni-easyinput disabled type="text" v-model="formData.storageLocationCode" />
</uni-forms-item>
<uni-forms-item label="账面数量" name="theoryNumber">
<uni-easyinput disabled type="number" v-model="formData.theoryNumber" />
</uni-forms-item>
<uni-forms-item label="实盘数量" name="actualNumber">
<u-number-box inputWidth="auto" button-size="36" v-model="formData.actualNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
getInvJob
} from "@/api/wms/invJob.js";
import {
getInvJobDetail,
updateInvJobDetail
} from "@/api/wms/invJobDetail.js"
import {
listMaterial
} from "@/api/wms/request.js";
export default {
data() {
return {
wmsInvDetailList: null,
invJobDetailInfo: null,
formData: {
wmsMatInvCode: null,
wmsInvDetailDefCode: null,
materialCode: null,
materialName: null,
batchNo: null,
whCode: null,
areaCode: null,
storageLocationCode: null,
theoryNumber: null,
actualNumber: null,
},
rules: {
wmsMatInvCode: {
rules: [{
required: true,
errorMessage: '请输入盘点单!'
}]
},
wmsInvDetailDefCode: {
rules: [{
required: true,
errorMessage: '请输入盘点单明细编码!'
}]
},
actualNumber: {
rules: [{
required: true,
errorMessage: '请输入实盘数量!'
}]
}
}
}
},
methods: {
clearInvDeatil() {
this.actualNumber = 0
// 重置表单信息
Object.keys(this.formData).forEach(key => {
if (key != "wmsMatInvCode" && key != "wmsInvDetailDefCode") {
this.formData[key] = null
}
})
},
async scanBarCode() {
//重置表单信息
this.clearInvDeatil()
if (this.formData.wmsMatInvCode) {
const invId = this.formData.wmsMatInvCode.slice(4);
const res = await getInvJob(invId)
this.wmsInvDetailList = res.data.wmsInvJobDetailList
}
/*
console.log(invId);
getInvJob(invId).then(async res => {
console.log(res);
if (res.data != null) {
for (var i in res.data.wmsMatInvDetailDefList) {
if (res.data.wmsMatInvDetailDefList[i].wmsInvDetailDefCode == this
.formData.wmsInvDetailDefCode) {
console.log(res.data.wmsMatInvDetailDefList[i].actualNumber);
this.formData.materialCode = res.data.wmsMatInvDetailDefList[i]
.materialCode;
this.formData.materialName = res.data.wmsMatInvDetailDefList[i]
.materialName;
this.formData.batchNo = res.data.wmsMatInvDetailDefList[i].batchNo;
this.formData.whCode = res.data.wmsMatInvDetailDefList[i]
.whCode;
this.formData.areaCode = res.data.wmsMatInvDetailDefList[i]
.areaCode;
this.formData.storageLocationCode = res.data.wmsMatInvDetailDefList[i].storageLocationCode;
this.formData.theoryNumber = res.data.wmsMatInvDetailDefList[i]
.theoryNumber;
}
}
} else {
this.$modal.msg("未检索到该盘点信息!")
}
})
*/
},
getInvDetailInfo() {
this.clearInvDeatil()
if (this.formData.wmsMatInvCode) {
const invDetail = this.wmsInvDetailList.find(
item => item.wmsInvJobDetailCode === this.formData.wmsInvDetailDefCode
);
this.invJobDetailInfo = invDetail
this.formData.materialCode = invDetail.materialCode
this.formData.materialName = invDetail.materialName
this.formData.batchNo = invDetail.batchNo
this.formData.whCode = invDetail.whCode
this.formData.areaCode = invDetail.areaCode
this.formData.shelvesCode = invDetail.shelvesCode
this.formData.storageLocationCode = invDetail.storageLocationCode
this.formData.theoryNumber = invDetail.theoryNumber
}
},
//盘点单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.wmsMatInvCode = res.result;
_this.scanBarCode();
}
});
},
//盘点单明细编码
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.wmsInvDetailDefCode = res.result;
_this.scanBarCode();
}
});
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定盘点该物料吗?',
success: function(res) {
if (res.confirm) {
let obj = _this.formData.wmsMatInvCode.slice(4);
_this.invJobDetailInfo.actualNumber = _this.formData.actualNumber
updateInvJobDetail(_this.invJobDetailInfo).then(() => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("盘点成功!");
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
});
/*
getInvJob(obj).then(async res => {
for (var i in res.data
.wmsMatInvDetailDefList) {
if (res.data
.wmsMatInvDetailDefList[i]
.wmsInvDetailDefCode == _this
.formData
.wmsInvDetailDefCode) {
res.data
.wmsMatInvDetailDefList[i]
.actualNumber =
_this.formData.actualNumber;
_this.$modal.loading('提交中')
updateInvJobDetail(res.data).then(
async res => {
_this.$modal
.closeLoading();
_this.$modal
.msgSuccess(
"盘点成功!"
);
setTimeout(
() => {
_this
.$tab
.switchTab(
"/pages/work/index"
);
}, 500);
});
}
}
});
*/
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style scoped>
.container {
padding: 15px;
}
.uni-forms-item {
margin-bottom: 16px;
}
</style>

View File

@@ -0,0 +1,514 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="生产退料入库单" :open="true">
<uni-forms-item label="工单" :labelWidth='90' name="workOrderCode" v-if="value !== '扫物料标签'">
<uni-easyinput clearable suffixIcon="scan" @iconClick="scanBarPwo"
v-model="formData.workOrderCode" @confirm="scanBarPwoCode" type="text" />
</uni-forms-item>
<uni-forms-item label="生产退料任务单" :labelWidth='90' name="backTaskCode">
<uni-easyinput v-model="formData.backTaskCode" disabled />
</uni-forms-item>
<uni-forms-item label="生产退料收货单" :labelWidth='90' name="backReceiveCode" v-if="value !== '扫物料标签'">
<uni-combox :candidates="backReceiveCodeList" emptyTips="无" @input="scanBarReceiveCode"
v-model="formData.backReceiveCode"></uni-combox>
</uni-forms-item>
<uni-forms-item label="生产退料入库单" :labelWidth='90' name="backInCode" v-if="value !== '扫物料标签'">
<uni-combox :candidates="backInCodeList" emptyTips="无" @input="scanBarBackInCode"
v-model="formData.backInCode"></uni-combox>
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode" v-if="value !== '扫物料标签'">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarwarehouseCode"
v-model="formData.warehouseCode" />
</uni-forms-item>
<uni-forms-item label="上架员" :labelWidth='90' name="shelfPutBy" v-if="value !== '扫物料标签'">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarshelfPutBy"
v-model="formData.shelfPutBy" @confirm="isEmp" />
<uni-data-picker popup-title="请选择上架员" :localdata="dataTree" v-model="pickerData"
@change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened"
@popupclosed="onpopupclosed" style="margin-top: 5px;" :preload="true">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="入库方式" :labelWidth='90'>
<u-radio-group v-model="value" iconPlacement="left">
<u-radio label="正常" name="正常"></u-radio>
<u-radio label="扫物料标签" name="扫物料标签" style="margin-left: 10px;"></u-radio>
</u-radio-group>
</uni-forms-item>
<button size="mini" v-if="value=='扫物料标签' &&formData.wmsBackInDetailList.length == 0" type="primary"
style="text-align: center;margin-left: 30%;font-size: 18px;" @click="show=!show">添加物料标签</button>
<u-modal :show="show" title="扫描物料标签编码" showCancelButton closeOnClickOverlay
@cancel="cancelMaterialLabel" @close="cancelMaterialLabel" :showConfirmButton="false">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarMaterialLabel" v-model="materialLabel"
type="text" @confirm="confirmMaterialLabel" maxlength="-1" :focus="true" />
</u-modal>
</uni-collapse-item>
<uni-collapse-item title="生产退料入库单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item v-for="(item, index) in formData.wmsBackInDetailList" :key="index">
<view>
<uni-badge :text="index+1" class="uni-badge-left-margin" type="primary"></uni-badge>
</view>
<uni-forms-item label="物料编码" :labelWidth='90'>
<uni-easyinput type="text" disabled v-model="item.materialCode" />
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'>
<uni-easyinput type="text" disabled v-model="item.materialName" />
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'>
<uni-easyinput type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="箱号" v-if="item.materialLotNo" :labelWidth='90'>
<uni-easyinput type="text" disabled v-model="item.materialLotNo" />
</uni-forms-item>
<uni-forms-item label="类型" :labelWidth='90' name="'wmsBackInDetailList.'+ index +'.type'">
<uni-tag v-if="item.type == 1" text="合格" type="success"></uni-tag>
<uni-tag v-else-if="item.type == 2" text="不良" type="warning"></uni-tag>
<uni-tag v-else-if="item.type == 3" text="报废" type="error"></uni-tag>
<uni-tag v-else-if="item.type == null" text="无" type="primary"></uni-tag>
</uni-forms-item>
<uni-forms-item label="库位条码" :labelWidth='90'
name="'wmsBackInDetailList.'+ index +'.storageLocationBarcode'">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
@change="splitStlBarcode(index,$event)" type="text"
v-model="item.storageLocationBarcode" />
</uni-forms-item>
<uni-forms-item label="上架数量" :labelWidth='90'>
<uni-easyinput disabled type="text" v-model="item.number" v-if="value == '扫物料标签'" />
<u-number-box inputWidth="120" button-size="36" v-model="item.number" v-else
min="0"></u-number-box>
</uni-forms-item>
<!-- <uni-forms-item label="备注" :labelWidth='90' name="remark">
<uni-easyinput autoHeight type="textarea" v-model="item.remark"></uni-easyinput>
</uni-forms-item> -->
<!-- <uni-forms-item label="单位" :labelWidth='90' :disabled="true">
<uni-easyinput type="text" disabled v-model="item.unitText" />
</uni-forms-item> -->
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listIn,
getIn,
delIn,
addIn,
updateIn,
exportIn,
getListDetail,
updateStock,
getInBySrc,
getInByCode,
getTaskDetailByDetailCode,
directBackInByTaskDetail
} from "@/api/wms/pdcBack/in";
import {
listReceive,
getReceive,
delReceive,
addReceive,
updateReceive,
exportReceive,
getRcvByTask,
listReceiveDetail,
updateReceiveDetail,
listDetail
} from "@/api/wms/pdcBack/receive";
import {
listMaterial
} from "@/api/wms/request.js";
import {
getListDetailByBL,
} from "@/api/wms/purchase.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
import {
listDepartment
} from "@/api/basic/department";
import {
listUnit
} from "@/api/basic/unit";
import {
getConnectLoc
} from "@/api/wms/pdcIn.js";
import _ from 'lodash';
export default {
created() {
this.selectTypeList()
},
mounted() {
listDepartment().then((res) => {
this.dptList = res.rows
})
listEmployee().then((res) => {
this.empList = res.rows
})
listUnit().then((res) => {
this.unitList = res.rows.map(item => {
let obj = {
text: item.unitCode + ":" + item.unitName,
value: item.id
}
return obj
})
})
console.log(this.$store)
},
data() {
return {
buttonDisabled: false,
wmsLotNoList: [],
dptList: [],
empList: [],
unitList: [],
item: '',
dataTree: [],
pickerData: '',
value: '正常',
show: false,
materialLabel: null,
//是否都入库
isAllListed: false,
isRk: false,
//是否打开编辑按钮
isSplit: true,
backReceiveCodeList: [],
// backQualityCodeList: [],
checkStorageLocationBarcode: true,
backInCodeList: [],
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
formData: {
workOrderCode: '',
backReceiveCode: '',
// backQualityCode: null,
wmsBackInDetailList: [],
billType: "1",
status: "1",
id: null,
backInCode: '',
shelfPutBy: null,
backTaskCode: ''
},
backTaskDetailCode: '',
rules: {
}
}
},
methods: {
deleteDetail(index) {
this.formData.wmsBackInDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
onnodeclick(e) {
console.log(e)
this.item = e
this.onchange(this.item)
},
onpopupopened(e) {
this.dataTree = []
this.empList.filter(item => item.deptId).forEach(item => {
item.departmentTitle = this.dptList.find(item2 => item2.id == item.deptId).departmentTitle
// 检查dataTree中是否已存在相同部门
let existingDept = this.dataTree.find(dept => dept.value === item.deptId);
if (existingDept) {
// 如果已存在相同部门则将员工信息push进该部门的children数组
existingDept.children.push({
text: item.name,
value: item.empCode
});
} else {
// 如果不存在相同部门则创建一个新部门对象包括children数组并将员工信息push进去
let newDept = {
text: item.departmentTitle,
value: item.deptId,
children: [{
text: item.name,
value: item.empCode
}]
};
this.dataTree.push(newDept);
}
})
console.log(this.dataTree)
},
onpopupclosed() {
//处理不同步
// this.$nextTick(() => {
// this.pickerData = this.item.value;
// this.formData.pickerData = this.item.value;
// if (!this.item) return
// this.onchange(this.item)
// });
},
onchange(e) {
console.log(e)
this.formData.shelfPutBy = null
this.$set(this.formData, 'shelfPutBy', e.value.split('/')[0])
},
addMaterialLabel() {
this.show = true;
},
cancelMaterialLabel() {
this.materialLabel = null;
this.show = false;
},
confirmMaterialLabel(data) {
data = JSON.parse(data)
if (data) {
// this.id = data.id
getTaskDetailByDetailCode(data.backTaskDetailCode).then(res => {
console.log(res)
if (res.backTaskDetail) {
this.formData.backTaskCode = res.backTaskDetail.backTaskCode;
let obj = {
materialCode: res.backTaskDetail.materialCode,
materialName: res.backTaskDetail.materialName,
materialBatchNo: res.backTaskDetail.materialBatchNo,
materialLotNo: res.backTaskDetail.materialLotNo,
type: res.backTaskDetail.type,
storageLocationBarcode: res.backTaskDetail.storageLocationBarcode,
number: res.backTaskDetail.number
}
this.backTaskDetailCode = res.backTaskDetail.backTaskDetailCode
this.formData.wmsBackInDetailList.push(obj)
this.materialLabel = null;
this.show = false;
} else {
this.$modal.msg("没有该条物料明细!")
}
})
}
},
scanBarMaterialLabel() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.materialLabel = res.result;
// console.log(materialLabel)
_this.confirmMaterialLabel(_this.materialLabel);
}
});
},
async splitStlBarcode(i,event) {
const _this = this;
const detail = _this.formData.wmsBackInDetailList[i];
detail.whCode = null;
detail.areaCode = null;
detail.shelvesCode = null;
detail.storageLocationCode = null;
console.log(_this.$store)
let barcode = detail.storageLocationBarcode;
if (!barcode) {
return; // 如果没有条码,不做任何处理
}
let [whCode, areaCode, shelvesCode, storageLocationCode, extra] = barcode.split('-');
const data = await getConnectLoc({connectLoc:event})
if(!data.data) return this.$modal.msg("库位条码校验错误,请重新输入!")
_this.checkStorageLocationBarcode = true;
detail.whCode = whCode || null;
detail.areaCode = areaCode || null;
detail.shelvesCode = shelvesCode || null;
detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
},
scanBarstorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.formData.wmsBackInDetailList[i], "storageLocationBarcode", res
.result);
_this.splitStlBarcode(i);
}
});
},
scanBarPwo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.workOrderCode = res.result;
_this.scanBarPwoCode();
}
});
},
scanBarPwoCode() {
this.backReceiveCodeList = [];
// this.productQualityCodeList = [];
this.backInCodeList = [];
if (this.formData.workOrderCode) {
listReceive({
workOrderCode: this.formData.workOrderCode
}).then(async response => {
this.backReceiveCodeList = response.rows.map(item => {
return item.backReceiveCode
})
});
listIn({
workOrderCode: this.formData.workOrderCode
}).then(async response => {
this.backInCodeList = response.rows.map(item => {
return item.backInCode
})
});
}
},
selectTypeList() {
listReceive().then(async response => {
this.backReceiveCodeList = response.rows.map(item => {
return item.backReceiveCode
})
});
listIn().then(async response => {
this.backInCodeList = response.rows.map(item => {
return item.backInCode
})
});
},
change(e) {
console.log(e);
},
scanBarReceiveCode() {
if (this.formData.backReceiveCode) {
// this.formData.productQualityCode = '';
this.formData.backInCode = '';
console.log(this.formData, "this.formData");
this.selectTask();
} else {
this.$modal.msg("生产退料收货单!");
}
},
selectTask() {
getInBySrc(this.formData).then((res) => {
console.log(this.formData, "this.formData");
// this.form = res.wmsBackIn;
this.formData.wmsBackInDetailList = res.wmsBackIn.wmsBackInDetailList;
});
// getDetails(this.formData).then(res => {
// this.formData.wmsBackInDetailList = res.details;
// })
},
scanBarBackInCode(i) {
console.log(i)
this.formData.backReceiveCode = '';
getInByCode({
backInCode: i
}).then((response) => {
this.formData = response.wmsBackIn;
this.checkIsListed();
});
},
//上架员
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.shelfPutBy = res.result;
}
});
},
scanBarwarehouseCode() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.warehouseCode = res.result;
}
});
},
/** 提交按钮 */
submit() {
const _this = this;
_this.formData.status = 2;
//判断明细是否都入库
if (
_this.formData.wmsBackInDetailList.filter((obj) => obj.status != 1).length == 0
) {
_this.formData.status = 3;
}
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成入库吗?',
success: function(res) {
_this.$modal.loading('提交中')
console.log(_this, " _this");
// _this.formData.wmsBackInDetailList.map(item => {
// item.secondNumber = item.number;
// item.secondUnitId = item.unitId;
// return item
// })
let obj = {
backTaskDetailCode: _this.backTaskDetailCode,
whCode: _this.formData.wmsBackInDetailList[0].whCode,
areaCode: _this.formData.wmsBackInDetailList[0]
.areaCode,
shelvesCode: _this.formData.wmsBackInDetailList[0]
.shelvesCode,
storageLocationCode: _this.formData.wmsBackInDetailList[
0].storageLocationCode,
backTaskDetailCode:_this.formData .wmsBackInDetailList[0].backTaskDetailCode
}
if (!_this.checkStorageLocationBarcode) {
_this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
directBackInByTaskDetail(obj).then(response => {
_this.$modal.msgSuccess("入库成功!");
_this.$modal.closeLoading();
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
})
// }
}
});
});
},
//检查是否都入库
checkIsListed() {
let flag = true;
this.formData.wmsBackInDetailList.forEach((item) => {
if (item.status == 0 || item.status == null) flag = false;
});
this.isAllListed = flag;
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,422 @@
<template>
<view>
<uni-collapse>
<view class="cu-card article ">
<view class="cu-item shadow borderBottom">
<view class="content">
<view class="desc">
<view class="text-content" style="font-size: 15px;">
<view><strong>物料编码</strong> : {{singleInfo.materialCode}}</view>
<view><strong>物料名称</strong> : {{singleInfo.materialName}}</view>
<view><strong>物料批号</strong> : {{singleInfo.materialBatchNo}}</view>
<view><strong>物料箱号</strong> : {{singleInfo.materialLotNo}}</view>
<view><strong>上架数量</strong> : {{singleInfo.number}}</view>
</view>
</view>
</view>
</view>
</view>
<uni-row>
<uni-col :span="12">
<span style="display: block;text-align: center;">每份数量<view style="margin-left: 15%;"><u-number-box
v-model="eachNumber" integer min="0" @change="eachNumberClear" /></view></span>
</uni-col>
<uni-col :span="12">
<span style="display: block;text-align: center;">拆分数量<view style="margin-left: 15%;"><u-number-box
v-model="splitNumber" integer min="0" @change="splitNumberClear" /></view></span>
</uni-col>
</uni-row>
<uni-row style="margin-top: 5px;" :gutter="10">
<uni-col :span="12">
<u-button type="primary" icon="cut" :disabled="isSecondOpen" @click="multiSplit" :plain="true"
text="拆分"></u-button>
</uni-col>
<uni-col :span="12">
<u-button type="success" icon="close-circle" @click="singleSplit" :disabled="isSecondOpen"
:plain="true" text="不拆分"></u-button>
</uni-col>
</uni-row>
<uni-collapse-item :open="true">
<!-- <uni-swipe-action> -->
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<view :key="index" v-for="(item, index) in wmsLotNoList">
<!-- <uni-swipe-action-item :key="index" v-for="(item, index) in wmsLotNoList"
@click="(data) => clickDetail(index,data)" @change="swipChange"> -->
<view>
<uni-badge :text="index+1" class="uni-badge-left-margin" type="primary"></uni-badge>
</view>
<uni-forms-item label="物料箱号" :labelWidth='90' :name="item.lotNo">
<uni-easyinput type="text" v-model="item.lotNo" />
</uni-forms-item>
<uni-forms-item label="库位条码" :labelWidth='90' name="storageLocationBarcode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
@change="splitStlBarcode(index,$event)" type="text" v-model="item.storageLocationBarcode" />
</uni-forms-item>
<uni-forms-item label="上架数量" :labelWidth='90'>
<u-number-box inputWidth="120" button-size="36" v-model="item.number"
min="0"></u-number-box>
</uni-forms-item>
<uni-forms-item label="入库时间" :labelWidth='90' :name="item.storageInTime">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="item.storageInTime" />
</view>
</uni-forms-item>
</view>
<!-- </uni-swipe-action-item> -->
</uni-forms>
<!-- </uni-swipe-action> -->
</uni-collapse-item>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
addInDetail,
addLotInfo,
} from "@/api/wms/purchase.js";
import {
updateInDetail,
getConnectLoc
} from "@/api/wms/pdcIn.js";
export default {
onLoad: function(option) {
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.rkTime = formattedDate;
console.log(option);
this.isSecondOpen = option.isSecondOpen == 'false' ? false : true;
this.selectedRow = JSON.parse(decodeURIComponent(option.selectedRow));
this.singleInfo = JSON.parse(decodeURIComponent(option.singleInfo));
this.wmsLotNoList = JSON.parse(decodeURIComponent(option.wmsLotNoList));
this.eachNumber = option.eachNumber;
this.splitNumber = option.splitNumber;
this.index = option.index
},
data() {
return {
//入库时间
rkTime: null,
//是否已分批
isSecondOpen: false,
selectedRow: {},
singleInfo: {},
wmsLotNoList: [],
eachNumber: null,
splitNumber: null,
index: null,
checkStorageLocationBarcode: true,
// storageLocationBarcode: ''
formData: {},
rules: {
storageLocationBarcode: {
rules: [{
required: true,
errorMessage: '请输入库位条码!'
}]
}
},
}
},
methods: {
eachNumberClear() {
this.eachSecondNumber = null;
this.splitNumber = null;
},
eachSecondNumberClear() {
this.eachNumber = null;
this.splitNumber = null;
},
splitNumberClear() {
this.eachNumber = null;
this.eachSecondNumber = null;
},
//选择条件拆分批次
multiSplit() {
this.wmsLotNoList = [];
console.log(this.singleInfo)
let materialCode = this.singleInfo.materialCode;
let batchNo = this.singleInfo.materialBatchNo;
let unit = this.singleInfo.unit;
let purchaseInCode = this.singleInfo.purchaseInCode;
let type = this.singleInfo.type;
let unitId = this.singleInfo.unitId;
let secondNumber = this.singleInfo.secondNumber;
let secondUnitId = this.singleInfo.secondUnitId;
let productionVersion = this.singleInfo.productionVersion;
let materialName = this.singleInfo.materialName;
let specification = this.singleInfo.specification;
let unitName = this.singleInfo.unit;
let storageInBillCode = this.singleInfo.storageInBillCode;
let storageInBillDetailCode = this.singleInfo.storageInBillDetailCode;
let erpDocLineKey1 = this.singleInfo.erpDocLineKey1;
if (this.eachNumber != 0 && this.eachNumber != null) {
console.log(this.eachNumber)
this.splitNumber = 0;
let t;
let k;
t = parseInt(this.singleInfo.number / this.eachNumber);
k = this.singleInfo.number % this.eachNumber;
if (k != 0) {
t++;
}
for (let i = 0; i < t; i++) {
let obj = {};
obj.materialCode = materialCode;
obj.batchNo = batchNo;
obj.number = this.eachNumber;
obj.secondNumber = this.eachNumber;
obj.unit = unit;
obj.secondUnitId = secondUnitId;
obj.type = type;
obj.storageInBillDetailCode = storageInBillDetailCode;
obj.storageInBillCode = storageInBillCode;
obj.materialName = materialName;
obj.specification = specification;
obj.productionVersion = productionVersion;
obj.storageInTime = this.rkTime;
if (i == t - 1) {
if (k != 0) {
obj.number = k;
}
}
// obj.lotNo = i + 1;
this.wmsLotNoList.push(obj);
}
}
if (this.splitNumber != 0 && this.splitNumber != null) {
console.log(2)
this.eachNumber = 0;
let k;
let j;
k = parseInt(this.singleInfo.number / this.splitNumber);
j = this.singleInfo.number - (this.splitNumber - 1) * k;
for (let i = 0; i < this.splitNumber; i++) {
let obj = {};
obj.materialCode = materialCode;
obj.batchNo = batchNo;
obj.number = k;
obj.secondNumber = k;
obj.secondUnitId = secondUnitId;
obj.unit = unit;
obj.type = type;
obj.storageInBillDetailCode = storageInBillDetailCode;
obj.storageInBillCode = storageInBillCode;
obj.materialName = materialName;
obj.specification = specification;
obj.productionVersion = productionVersion;
obj.storageInTime = this.rkTime;
// obj.lotNo = i + 1;
if (i == this.splitNumber - 1) {
obj.number = j;
obj.secondNumber = j;
}
this.wmsLotNoList.push(obj);
}
}
},
//不拆分批次
singleSplit() {
this.wmsLotNoList = [];
this.splitNumber = 1;
this.eachNumber = 0;
let obj = {};
obj.materialCode = this.singleInfo.materialCode;
obj.batchNo = this.singleInfo.materialBatchNo;
obj.number = this.singleInfo.number;
obj.unit = this.singleInfo.unit;
obj.secondNumber = this.singleInfo.secondNumber;
obj.secondUnitId = this.singleInfo.secondUnitId;
obj.type = this.singleInfo.type;
obj.storageInBillDetailCode = this.singleInfo.storageInBillDetailCode;
obj.storageInBillCode = this.singleInfo.storageInBillCode;
obj.materialName = this.singleInfo.materialName;
obj.specification = this.singleInfo.specification;
obj.productionVersion = this.singleInfo.productionVersion;
obj.storageInTime = this.rkTime;
// obj.lotNo = 1;
this.wmsLotNoList.push(obj);
},
async splitStlBarcode(i,event) {
const _this = this;
const detail = _this.wmsLotNoList[i];
detail.whCode = null;
detail.areaCode = null;
detail.shelvesCode = null;
detail.storageLocationCode = null;
let barcode = detail.storageLocationBarcode;
if (!barcode) {
return; // 如果没有条码,不做任何处理
}
let [whCode, areaCode, shelvesCode, storageLocationCode, extra] = barcode.split('-');
const data = await getConnectLoc({connectLoc:event})
if(!data.data) return this.$modal.msg("库位条码校验错误,请重新输入!")
_this.checkStorageLocationBarcode = true;
detail.whCode = whCode || null;
detail.areaCode = areaCode || null;
detail.shelvesCode = shelvesCode || null;
detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
console.log(this.wmsLotNoList[i]);
},
scanBarstorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.wmsLotNoList[i], "storageLocationBarcode", res
.result);
// _this.wmsLotNoList[i].storageLocationBarcode = res.result;
_this.splitStlBarcode(i);
}
});
},
//提交分批入库详情
submit() {
//数量防错
let allNum = 0;
for (var i in this.wmsLotNoList) {
allNum += this.wmsLotNoList[i].number;
}
console.log(allNum)
if (allNum == this.singleInfo.number) {
if (this.wmsLotNoList.length > 0) {
if (this.wmsLotNoList[0].id != null) {
console.log(this.wmsLotNoList[0].id);
for (let i = 0; i < this.wmsLotNoList.length; i++) {
if (this.wmsLotNoList && this.wmsLotNoList.length > 0) {
this.selectedRow.status = "1";
} else {
this.selectedRow.status = "0";
}
}
this.$modal.msgSuccess("修改成功!");
setTimeout(() => {
uni.$emit('backWithParam', {
status: this.selectedRow.status,
index: this.index
});
this.$tab.navigateBack();
}, 500);
} else {
console.log(this.wmsLotNoList);
var flag =
this.wmsLotNoList.filter((obj) => obj.whCode == null).length == 0 ?
1 :
0;
console.log(flag);
if (flag == 0) {
console.log("入库库位必填!", flag);
this.$modal.msgError("入库库位必填!");
} else {
let obj = {};
obj = this.singleInfo;
obj.batchNo = this.singleInfo.materialBatchNo;
obj.eachNumber = this.eachNumber;
// obj.eachSecondNumber = this.eachSecondNumber;
obj.splitNumber = this.splitNumber;
if (this.wmsLotNoList && this.wmsLotNoList.length > 0) {
this.selectedRow.status = "1";
} else {
this.selectedRow.status = "0";
}
console.log(obj, this.wmsLotNoList);
if (!this.checkStorageLocationBarcode) {
this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
this.$modal.loading('提交中')
addLotInfo(obj).then(res => {
console.log(this.wmsLotNoList)
addInDetail(this.wmsLotNoList, 1).then(res => {
this.$modal.closeLoading();
this.$modal.msgSuccess("上架成功!");
uni.$emit('backWithParam', {
status: this.selectedRow.status,
index: this.index
});
this.$tab.navigateBack();
});
});
}
}
}
// let obj = {};
// obj = this.singleInfo;
// obj.batchNo = this.singleInfo.materialBatchNo;
// obj.lotNo = this.singleInfo.materialLotNo;
// obj.eachNumber = this.eachNumber;
// // obj.eachSecondNumber = this.eachSecondNumber;
// obj.splitNumber = this.splitNumber;
// addLotInfo(obj); //拆箱详情
// addInDetail(this.wmsLotNoList, 1) //对库存操作
// if (this.wmsLotNoList && this.wmsLotNoList.length > 0) {
// this.selectedRow.status = "1";
// } else {
// this.selectedRow.status = "0";
// }
// this.$modal.msgSuccess("编辑成功!");
// setTimeout(() => {
// uni.$emit('backWithParam', {
// status: this.selectedRow.status,
// index: this.index
// });
// this.$tab.navigateBack();
// }, 500);
} else {
this.$modal.msg("批号分批入库明细数量不符合!");
}
},
}
}
</script>
<style>
.cu-card.article>.cu-item .content .text-content {
height: 100% !important;
}
.cu-card.article>.cu-item {
padding-bottom: 0;
}
.cu-card>.cu-item {
margin: 0;
}
.uni-swipe {
overflow: inherit;
}
</style>

View File

@@ -0,0 +1,695 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="生产退料入库单" :open="true">
<uni-forms-item label="工单" :labelWidth='90' name="workOrderCode">
<uni-easyinput clearable suffixIcon="scan" @iconClick="scanBarPwo"
v-model="formData.workOrderCode" @confirm="scanBarPwoCode" type="text" />
</uni-forms-item>
<uni-forms-item label="生产退料收货单" :labelWidth='90' name="backReceiveCode">
<uni-combox :candidates="backReceiveCodeList" emptyTips="无" @input="scanBarReceiveCode"
v-model="formData.backReceiveCode"></uni-combox>
</uni-forms-item>
<!-- <uni-forms-item label="生产退料入库质检单" :labelWidth='90' name="backQualityCode">
<uni-combox :candidates="backQualityCodeList" emptyTips="无" @input="scanBarQualityCode"
v-model="formData.backQualityCode" />
</uni-forms-item> -->
<!-- <uni-forms-item label="生产退料收货单" :labelWidth='90' name="backReceiveCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarReceiveCode"
v-model="formData.backReceiveCode" type="text" />
</uni-forms-item> -->
<uni-forms-item label="生产退料入库单" :labelWidth='90' name="backInCode">
<uni-combox :candidates="backInCodeList" emptyTips="无" @input="scanBarBackInCode"
v-model="formData.backInCode"></uni-combox>
<!-- <uni-easyinput suffixIcon="scan" @iconClick="scanBarPInCode" @confirm="scanBarbackInCodeCode"
v-model="formData.backInCode" type="text" /> -->
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarwarehouseCode"
v-model="formData.warehouseCode" />
</uni-forms-item>
<uni-forms-item label="上架员" :labelWidth='90' name="shelfPutBy">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarshelfPutBy"
v-model="formData.shelfPutBy" @confirm="isEmp" />
<uni-data-picker popup-title="请选择上架员" :localdata="dataTree" v-model="pickerData"
@change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened"
@popupclosed="onpopupclosed" style="margin-top: 5px;" :preload="true">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="入库方式" :labelWidth='90'>
<u-radio-group v-model="value" iconPlacement="left">
<u-radio label="正常" name="正常"></u-radio>
<u-radio label="扫物料标签" name="扫物料标签" style="margin-left: 10px;"></u-radio>
</u-radio-group>
</uni-forms-item>
<button size="mini" v-if="value=='扫物料标签' &&formData.wmsBackInDetailList.length == 0" type="primary"
style="text-align: center;margin-left: 30%;font-size: 18px;" @click="show=!show">添加物料标签</button>
<u-modal :show="show" title="扫描物料标签编码" showCancelButton closeOnClickOverlay
@cancel="cancelMaterialLabel" @close="cancelMaterialLabel" :showConfirmButton="false">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarMaterialLabel" v-model="materialLabel"
type="text" @confirm="confirmMaterialLabel" maxlength="-1" :focus="true" />
</u-modal>
</uni-collapse-item>
<uni-collapse-item title="生产退料入库单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item v-for="(item, index) in formData.wmsBackInDetailList" :key="index">
<view>
<uni-badge :text="index+1" class="uni-badge-left-margin" type="primary"></uni-badge>
<button @click="open(index,item)" size="mini"
:disabled="buttonDisabled || !formData.id || !item.materialBatchNo"
type="primary">编辑</button>
</view>
<uni-forms-item label="物料编码" :labelWidth='90'>
<uni-easyinput type="text" disabled v-model="item.materialCode" />
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'>
<uni-easyinput type="text" disabled v-model="item.materialName" />
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'>
<uni-easyinput type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="箱号" v-if="item.materialLotNo" :labelWidth='90'>
<uni-easyinput type="text" disabled v-model="item.materialLotNo" />
</uni-forms-item>
<uni-forms-item label="类型" :labelWidth='90' name="'wmsBackInDetailList.'+ index +'.type'">
<uni-tag v-if="item.type == 1" text="合格" type="success"></uni-tag>
<uni-tag v-else-if="item.type == 2" text="不良" type="warning"></uni-tag>
<uni-tag v-else-if="item.type == 3" text="报废" type="error"></uni-tag>
<uni-tag v-else-if="item.type == null" text="无" type="primary"></uni-tag>
</uni-forms-item>
<uni-forms-item label="上架数量" :labelWidth='90'>
<u-number-box inputWidth="120" button-size="36" v-model="item.number"
min="0"></u-number-box>
</uni-forms-item>
<uni-forms-item label="备注" :labelWidth='90' name="remark">
<uni-easyinput autoHeight type="textarea" v-model="item.remark"></uni-easyinput>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<uni-row :gutter="10">
<uni-col :span="12">
<u-button type="success" @click="savesubmit">保存</u-button>
</uni-col>
<uni-col :span="12">
<u-button type="primary" :disabled="!isAllListed" @click="submit">提交</u-button>
</uni-col>
</uni-row>
</view>
</template>
<script>
import {
listIn,
getIn,
delIn,
addIn,
updateIn,
exportIn,
getListDetail,
updateStock,
getInBySrc,
getInByCode
} from "@/api/wms/pdcBack/in";
import {
listReceive,
getReceive,
delReceive,
addReceive,
updateReceive,
exportReceive,
getRcvByTask,
listReceiveDetail,
updateReceiveDetail,
listDetail
} from "@/api/wms/pdcBack/receive";
import {
listMaterial
} from "@/api/wms/request.js";
import {
getListDetailByBL,
} from "@/api/wms/purchase.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
import {
listDepartment
} from "@/api/basic/department";
import _ from 'lodash';
export default {
created() {
this.selectTypeList()
//监听编辑批号分批后的状态
uni.$on('backWithParam', (param) => {
if (param.status && param.index) {
this.formData.wmsBackInDetailList[Number(param.index)].status = param.status
}
this.checkIsListed();
});
},
mounted() {
listDepartment().then((res) => {
this.dptList = res.rows
})
listEmployee().then((res) => {
this.empList = res.rows
})
},
data() {
return {
buttonDisabled: false,
wmsLotNoList: [],
dptList: [],
empList: [],
item: '',
dataTree: [],
pickerData: '',
value: '正常',
show: false,
materialLabel: null,
//是否都入库
isAllListed: false,
isRk: false,
//是否打开编辑按钮
isSplit: true,
backReceiveCodeList: [],
// backQualityCodeList: [],
backInCodeList: [],
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
formData: {
workOrderCode: '',
backReceiveCode: '',
// backQualityCode: null,
wmsBackInDetailList: [],
billType: "1",
status: "1",
id: null,
backInCode: '',
shelfPutBy: null
},
rules: {
}
}
},
methods: {
deleteDetail(index) {
this.formData.wmsBackInDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
onnodeclick(e) {
console.log(e)
this.item = e
this.onchange(this.item)
},
onpopupopened(e) {
this.dataTree = []
this.empList.filter(item => item.deptId).forEach(item => {
item.departmentTitle = this.dptList.find(item2 => item2.id == item.deptId).departmentTitle
// 检查dataTree中是否已存在相同部门
let existingDept = this.dataTree.find(dept => dept.value === item.deptId);
if (existingDept) {
// 如果已存在相同部门则将员工信息push进该部门的children数组
existingDept.children.push({
text: item.name,
value: item.empCode
});
} else {
// 如果不存在相同部门则创建一个新部门对象包括children数组并将员工信息push进去
let newDept = {
text: item.departmentTitle,
value: item.deptId,
children: [{
text: item.name,
value: item.empCode
}]
};
this.dataTree.push(newDept);
}
})
console.log(this.dataTree)
},
onpopupclosed() {
//处理不同步
// this.$nextTick(() => {
// this.pickerData = this.item.value;
// this.formData.pickerData = this.item.value;
// if (!this.item) return
// this.onchange(this.item)
// });
},
onchange(e) {
console.log(e)
this.formData.shelfPutBy = null
this.$set(this.formData, 'shelfPutBy', e.value.split('/')[0])
},
addMaterialLabel() {
this.show = true;
},
cancelMaterialLabel() {
this.materialLabel = null;
this.show = false;
},
confirmMaterialLabel(data) {
data = JSON.parse(data)
if (data) {
//判断是否已收货
listReceiveDetail({
backTaskDetailCode: data.backTaskDetailCode
}).then(res => {
console.log(res)
//若已有收货单
if (res.data.length > 0) {
this.formData.backReceiveCode = res.data[0].backReceiveCode;
this.formData.deptCode = res.data[0].deptCode
this.formData.warehouseCode = res.data[0].warehouseCode
// this.formData.workOrderCode = data.pwoCode;
this.formData.backQualityCode = '';
this.formData.backInCode = '';
this.selectTask();
this.materialLabel = null;
this.show = false;
} else {
this.$modal.msg("该条物料明细还未收货!")
}
})
}
},
scanBarMaterialLabel() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.materialLabel = res.result;
// console.log(materialLabel)
_this.confirmMaterialLabel(_this.materialLabel);
}
});
},
//进入编辑页
open: _.debounce(async function(index, row) {
// 禁用按钮
this.buttonDisabled = true;
console.log(row)
//拆分下的列表
this.wmsLotNoList = [];
//选中的物料明细项
let selectedRow = row;
//是否分批
let isSecondOpen = false;
//每份数量
let eachNumber = null;
//拆分数量
let splitNumber = null;
//头部信息
let singleInfo = {};
singleInfo.materialCode = row.materialCode;
singleInfo.materialBatchNo = row.materialBatchNo;
// singleInfo.materialLotNo = row.materialLotNo;
singleInfo.number = row.number;
singleInfo.unit = row.unit;
singleInfo.secondNumber = row.number;
singleInfo.secondUnitId = row.unitId;
singleInfo.backInCode = row.backInCode;
singleInfo.materialName = row.materialName;
singleInfo.type = row.type;
singleInfo.unitName = row.unit;
singleInfo.specification = row.specification;
singleInfo.whCode = row.whCode;
singleInfo.areaCode = row.areaCode;
singleInfo.shelvesCode = row.shelvesCode;
singleInfo.storageLocationCode = row.storageLocationCode;
singleInfo.storageInBillCode = row.backInCode;
singleInfo.storageInBillDetailCode = row.backInDetailCode;
singleInfo.erpDocLineKey1 = row.erpDocLineKey1;
singleInfo.unitId = row.unitId;
this.formData.productInCode = row.productInCode;
await getListDetailByBL(singleInfo).then((response) => {
if (
response.materialDetailList &&
response.materialDetailList.length > 0
) {
console.log(1)
/** 导入拆分信息 */
if (response.materialDetailList[0].splitNumber != null) {
splitNumber = response.materialDetailList[0].splitNumber;
} else if (response.materialDetailList[0].eachNumber != null) {
eachNumber = response.materialDetailList[0].eachNumber;
} else if (response.materialDetailList[0].eachSecondNumber != null) {
eachSecondNumber =
response.materialDetailList[0].eachSecondNumber;
}
if (
response.materialStockList &&
response.materialStockList.length > 0
) {
/** 导入拆分详情 */
this.wmsLotNoList = response.materialStockList.map((item) => {
item.batchNo = item.materialBatchNo;
item.locCascade = [
item.whCode,
item.areaCode,
item.shelvesCode,
item.storageLocationCode,
];
if (item.whCode != null) {
item.connectedLocation = item.whCode;
if (item.areaCode != null) {
item.connectedLocation = item.connectedLocation + '-' +
item
.areaCode;
if (item.shelvesCode != null) {
item.connectedLocation = item.connectedLocation +
'-' +
item
.shelvesCode;
if (item.storageLocationCode != null) {
item.connectedLocation = item
.connectedLocation +
'-' +
item.storageLocationCode;
}
}
}
}
return item;
});
if (response.materialStockList.length != 0) {
isSecondOpen = true;
}
}
}
});
console.log(this.wmsLotNoList);
uni.navigateTo({
url: '/pages/wms/pdcBack/pdcBackListing?singleInfo=' + encodeURIComponent(JSON
.stringify(
singleInfo)) +
'&wmsLotNoList=' + encodeURIComponent(JSON.stringify(
this.wmsLotNoList)) +
'&selectedRow=' + encodeURIComponent(JSON.stringify(
selectedRow)) +
'&eachNumber=' + eachNumber +
'&splitNumber=' + splitNumber +
'&isSecondOpen=' + isSecondOpen +
'&index=' + index
});
// 在页面跳转后恢复按钮状态
setTimeout(() => {
this.buttonDisabled = false;
}, 500); // 延时,确保跳转完成后再启用按钮
}, 1000, {
leading: true,
trailing: false
}),
splitStlBarcode(i) {
this.formData.wmsProductInDetailList[i].whCode = null;
this.formData.wmsProductInDetailList[i].areaCode = null;
this.formData.wmsProductInDetailList[i].shelvesCode = null;
this.formData.wmsProductInDetailList[i].storageLocationCode = null;
let array = this.formData.wmsProductInDetailList[i].storageLocationBarcode.split('-');
let [whCode, areaCode, shelvesCode, storageLocationCode, extra] = array;
this.formData.wmsProductInDetailList[i].whCode = whCode || null;
this.formData.wmsProductInDetailList[i].areaCode = areaCode || null;
this.formData.wmsProductInDetailList[i].shelvesCode = shelvesCode || null;
this.formData.wmsProductInDetailList[i].storageLocationCode = extra ? `${storageLocationCode}-${extra}` :
storageLocationCode || null;
// const _this = this;
// const detail = _this.formData.wmsBackInDetailList[i];
// detail.whCode = null;
// detail.areaCode = null;
// detail.shelvesCode = null;
// detail.storageLocationCode = null;
// let barcode = detail.storageLocationBarcode;
// if (!barcode) {
// return; // 如果没有条码,不做任何处理
// }
// let [whCode, areaCode, shelvesCode, storageLocationCode, extra] = barcode.split('-');
// const checkAndSetField = (obj, field, value, msg) => {
// if (!value) {
// _this.$modal.msg(msg);
// _this.$set(obj, field, null);
// _this.$nextTick(() => {
// _this.$set(obj, "storageLocationBarcode", null);
// });
// return false;
// }
// return true;
// };
// let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
// if (!checkAndSetField(detail, 'whCode', warehouseObj, "仓库不存在!")) return;
// let areaObj = _this.$store.getters.areaOptions.find(item => item.areaCode == areaCode);
// if (!checkAndSetField(detail, 'areaCode', areaObj, "库区不存在!")) return;
// let shelvesObj = _this.$store.getters.shelvesOptions.find(item => item.storageShelvesCode == shelvesCode);
// if (!checkAndSetField(detail, 'shelvesCode', shelvesObj, "货架不存在!")) return;
// let locationObj = _this.$store.getters.locationOptions.find(item => item.storageLocationCode ==
// `${storageLocationCode}-${extra}`);
// if (!checkAndSetField(detail, 'storageLocationCode', locationObj, "库位不存在!")) return;
// // 更新formData中的对应字段
// detail.whCode = whCode || null;
// detail.areaCode = areaCode || null;
// detail.shelvesCode = shelvesCode || null;
// detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
},
scanBarstorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.formData.wmsProductInDetailList[i], "storageLocationBarcode", res
.result);
_this.splitStlBarcode(i);
}
});
},
// clearPwo() {
// if (this.formData.workOrderCode == '' || !this.formData.workOrderCode) {
// this.selectTypeList();
// }
// },
scanBarPwo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.workOrderCode = res.result;
_this.scanBarPwoCode();
}
});
},
scanBarPwoCode() {
this.backReceiveCodeList = [];
// this.productQualityCodeList = [];
this.backInCodeList = [];
if (this.formData.workOrderCode) {
listReceive({
workOrderCode: this.formData.workOrderCode
}).then(async response => {
this.backReceiveCodeList = response.rows.map(item => {
return item.backReceiveCode
})
});
listIn({
workOrderCode: this.formData.workOrderCode
}).then(async response => {
this.backInCodeList = response.rows.map(item => {
return item.backInCode
})
});
}
},
selectTypeList() {
listReceive().then(async response => {
this.backReceiveCodeList = response.rows.map(item => {
return item.backReceiveCode
})
});
listIn().then(async response => {
this.backInCodeList = response.rows.map(item => {
return item.backInCode
})
});
},
change(e) {
console.log(e);
},
scanBarReceiveCode() {
if (this.formData.backReceiveCode) {
// this.formData.productQualityCode = '';
this.formData.backInCode = '';
this.selectTask();
} else {
this.$modal.msg("生产退料收货单!");
}
},
// scanBarQualityCode() {
// if (this.formData.productQualityCode) {
// this.formData.productReceiveCode = '';
// this.formData.productInCode = '';
// this.selectTask();
// } else {
// this.$modal.msg("产品入库质检单!");
// }
// },
selectTask() {
getInBySrc(this.formData).then((res) => {
console.log(res);
// this.form = res.wmsBackIn;
this.formData.wmsBackInDetailList = res.wmsBackIn.wmsBackInDetailList;
});
// getDetails(this.formData).then(res => {
// this.formData.wmsBackInDetailList = res.details;
// })
},
scanBarBackInCode(i) {
console.log(i)
this.formData.backReceiveCode = '';
getInByCode({
backInCode: i
}).then((response) => {
this.formData = response.wmsBackIn;
this.checkIsListed();
});
},
//上架员
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.shelfPutBy = res.result;
}
});
},
scanBarwarehouseCode() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.warehouseCode = res.result;
}
});
},
savesubmit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定保存吗?',
success: function(res) {
if (res.confirm) {
if (_this.formData.backReceiveCode) {
_this.formData.wmsBackInDetailList.map(item => {
item.secondNumber = item.number;
item.secondUnitId = item.unitId;
return item
})
if (_this.formData.id != null) {
_this.$modal.loading('提交中')
updateIn(_this.formData).then((response) => {
_this.$modal.closeLoading();
_this.formData = response.data;
_this.checkIsListed();
_this.$modal.msgSuccess("修改成功!");
});
} else {
_this.$modal.loading('提交中')
addIn(_this.formData).then((response) => {
_this.$modal.closeLoading();
_this.formData = response.data;
_this.checkIsListed();
_this.$modal.msgSuccess("保存成功!");
});
}
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
/** 提交按钮 */
submit() {
const _this = this;
_this.formData.status = 2;
//判断明细是否都入库
if (
_this.formData.wmsBackInDetailList.filter((obj) => obj.status != 1).length == 0
) {
_this.formData.status = 3;
}
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成入库吗?',
success: function(res) {
_this.$modal.loading('提交中')
_this.formData.wmsBackInDetailList.map(item => {
item.secondNumber = item.number;
item.secondUnitId = item.unitId;
return item
})
updateIn(_this.formData).then(response => {
_this.$modal.msgSuccess("入库成功!");
_this.$modal.closeLoading();
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
});
// }
}
});
});
},
//检查是否都入库
checkIsListed() {
let flag = true;
this.formData.wmsBackInDetailList.forEach((item) => {
if (item.status == 0 || item.status == null) flag = false;
});
this.isAllListed = flag;
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,439 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="生产退料收货单" :open="true">
<uni-forms-item label="工单" :labelWidth='90' name="workOrderCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPwo" @change="clearPwo"
v-model="workOrderCode" @confirm="scanBarPwoCode" type="text" />
</uni-forms-item>
<uni-forms-item label="生产退料任务单" :labelWidth='90' name="backTaskCode">
<uni-combox :candidates="backTaskCodeList" emptyTips="无" @input="scanBarCode"
v-model="formData.backTaskCode"></uni-combox>
</uni-forms-item>
<uni-forms-item label="生产退料任务明细单" :labelWidth='90' name="backTaskDetailCode">
<uni-easyinput v-model="formData.backTaskDetailCode" type="text" />
</uni-forms-item>
<uni-forms-item label="生产退料收货单" :labelWidth='90' name="backReceiveCode">
<uni-easyinput v-model="formData.backReceiveCode" type="text" />
</uni-forms-item>
<uni-forms-item label="签收员" :labelWidth='90' name="drawBy">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.drawBy" type="text" />
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarwarehouseCode"
v-model="formData.warehouseCode" />
</uni-forms-item>
<uni-forms-item label="到货时间" :labelWidth='90' name="arriveTime">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.arriveTime" />
</view>
</uni-forms-item>
<uni-forms-item label="收货方式" :labelWidth='90'>
<u-radio-group v-model="value" iconPlacement="left">
<u-radio label="正常" name="正常"></u-radio>
<u-radio label="扫物料标签" name="扫物料标签" style="margin-left: 10px;"></u-radio>
</u-radio-group>
</uni-forms-item>
<button size="mini" v-if="value=='扫物料标签' && formData.wmsBackReceiveDetailList.length == 0"
type="primary" style="text-align: center;margin-left: 30%;font-size: 18px;"
@click="show=!show">添加物料标签</button>
<u-modal :show="show" title="扫描物料标签编码" showCancelButton closeOnClickOverlay
@cancel="cancelMaterialLabel" @close="cancelMaterialLabel" :showConfirmButton="false">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarMaterialLabel" v-model="materialLabel"
type="text" @confirm="confirmMaterialLabel" maxlength="-1" focus="true" />
</u-modal>
</uni-collapse-item>
<uni-collapse-item title="生产退料收货单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item v-for="(item, index) in formData.wmsBackReceiveDetailList" :key="index"
@click="(data) => clickDetail(index,data)" :right-options="rightOptions">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90'>
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'>
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'>
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90'>
<uni-easyinput disabled type="text" v-model="item.materialLotNo" />
</uni-forms-item>
<uni-forms-item label="退料原因" :labelWidth='90'>
<uni-easyinput disabled type="text" v-model="item.reason" />
</uni-forms-item>
<uni-forms-item label="应收数量" :labelWidth='90'>
<uni-easyinput disabled type="number" v-model="item.theoryNumber" />
</uni-forms-item>
<uni-forms-item label="已收数量" :labelWidth='90' v-if="item.receivedNumber"
:name="'wmsBackReceiveDetailList.'+ index +'.receivedNumber'">
<uni-easyinput disabled type="number" v-model="item.receivedNumber" />
</uni-forms-item>
<uni-forms-item label="到货数量" :labelWidth='90'>
<u-number-box inputWidth="120" button-size="36" v-model="item.arriveNumber"
:max="item.theoryNumber" min="0"></u-number-box>
</uni-forms-item>
<uni-forms-item label="实收数量" :labelWidth='90'>
<u-number-box inputWidth="120" button-size="36" v-model="item.actualNumber"
:max="item.theoryNumber" min="0"></u-number-box>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listReceive,
getReceive,
delReceive,
addReceive,
updateReceive,
exportReceive,
getRcvByTask,
listReceiveDetail,
updateReceiveDetail,
listDetail
} from "@/api/wms/pdcBack/receive";
import {
listTask,
getTask,
delTask,
addTask,
updateTask,
exportTask,
mergePrintDetailPdfs,
} from "@/api/wms/pdcBack/task";
export default {
onLoad: function() {
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.formData.arriveTime = formattedDate;
},
mounted() {},
data() {
return {
isSupplierCode: false,
isReceive: false,
backTaskCodeList: [],
value: '正常',
show: false,
materialLabel: null,
workOrderCode: null,
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
formData: {
backTaskCode: '',
backReceiveCode: null,
backTaskDetailCode: null,
wmsBackReceiveDetailList: [],
arriveTime: null,
warehouseCode: null,
//任务单状态=1=‘新建’
status: '1'
},
rules: {
// backTaskCode: {
// rules: [{
// required: true,
// errorMessage: '请输入生产退料任务单!'
// }]
// },
}
}
},
methods: {
deleteDetail(index) {
this.formData.wmsBackReceiveDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
addMaterialLabel() {
this.show = true;
},
cancelMaterialLabel() {
this.materialLabel = null;
this.show = false;
},
confirmMaterialLabel(data) {
data = JSON.parse(data)
if (data) {
//判断是否已收货
console.log(data)
listReceiveDetail({
backTaskDetailCode: data.backTaskDetailCode
}).then(res => {
console.log(res)
//若已有收货单
if (res.data.length > 0) {
let num = 0;
//统计所有实收数量
for (var i in res.data) {
num += res.data[i].actualNumber
}
//若所有收货单的实际收货数量与应收数量一致
if (num == res.data[0].theoryNumber) {
this.$modal.msg("该条物料明细已完成收货!")
} else {
// this.workOrderCode = data.pwoCode
this.formData.backTaskCode = res.data[0].backTaskCode
this.formData.backTaskDetailCode = data.backTaskDetailCode
this.formData.backReceiveCode = res.data[0].backReceiveCode
this.formData.deptCode = res.data[0].deptCode
this.formData.warehouseCode = res.data[0].warehouseCode
// this.formData.id
let obj = {
materialCode: res.data[0].materialCode,
materialName: res.data[0].materialName,
materialBatchNo: res.data[0].materialBatchNo,
theoryNumber: res.data[0].theoryNumber,
unitId: res.data[0].unitId,
receivedNumber: num,
backTaskDetailCode: data.backTaskDetailCode,
type: res.data[0].type,
id: res.data[0].id
}
this.formData.wmsBackReceiveDetailList.push(obj);
this.isReceive = true;
this.materialLabel = null;
this.show = false;
}
} else {
// this.workOrderCode = data.pwoCode
listDetail({
backTaskDetailCode: data.backTaskDetailCode
}).then((res) => {
console.log(res)
if (res.rows.length > 0) {
this.formData.backTaskDetailCode = data.backTaskDetailCode
this.formData.wmsBackReceiveDetailList = []
let obj = res.rows[0]
obj.theoryNumber = obj.number;
obj.unitId = obj.unitId;
obj.id = null
this.formData.backTaskCode = obj.backTaskCode
this.formData.deptCode = obj.deptCode
this.formData.warehouseCode = obj.warehouseCode
this.formData.wmsBackReceiveDetailList.push(obj);
this.isReceive = false;
this.materialLabel = null;
this.show = false;
} else {
this.$modal.msg("任务单里未查到该条明细!")
}
});
}
})
}
},
scanBarMaterialLabel() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.materialLabel = res.result;
// console.log(materialLabel)
_this.confirmMaterialLabel(_this.materialLabel);
}
});
},
clearPwo() {
if (this.workOrderCode == '' || !this.workOrderCode) {
this.selectTypeList();
}
},
scanBarPwo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.workOrderCode = res.result;
_this.scanBarPwoCode();
}
});
},
scanBarPwoCode() {
this.backTaskCodeList = [];
if (this.workOrderCode) {
listTask({
workOrderCode: this.workOrderCode
}).then(async response => {
this.backTaskCodeList = response.rows.map(item => {
return item.backTaskCode
});
});
}
},
selectTypeList() {
listTask().then(async res => {
this.backTaskCodeList = res.rows.map(item => {
return item.backTaskCode
});
})
},
scanBarCode() {
if (this.formData.backTaskCode) {
// let data = {
// backTaskDetailCode: this.formData.backTaskDetailCode
// }
getRcvByTask(this.formData).then(res => {
this.formData.wmsBackReceiveDetailList = res.wmsBackReceive.wmsBackReceiveDetailList;
})
} else {
this.$modal.msg("请输入生产退料任务单!")
}
},
bindDateChange(e) {
this.formData.arriveTime = e.detail.value
},
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`;
},
//仓库编码
scanBarwarehouseCode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.warehouseCode = res.result;
}
});
},
//签收员编码
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.drawBy = res.result;
// _this.scanBarCode();
}
});
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定收取该物料吗?',
success: function(res) {
if (res.confirm) {
console.log(_this.formData)
_this.formData.wmsBackReceiveDetailList.map(item => {
item.secondTheoryNumber = item.number;
item.secondUnitId = item.unitId;
item.secondArriveNumber = item.arriveNumber;
item.secondActualNumber = item.actualNumber;
item.secondActualUnitId = item.unitId;
return item
})
if (_this.isReceive == false) {
//判断实收数量是否超出应收数量
let isNumOver = false;
for (var i in _this.formData.wmsBackReceiveDetailList) {
if (_this.formData.wmsBackReceiveDetailList[i]
.actualNumber > _this.formData.wmsBackReceiveDetailList[
i].theoryNumber) {
_this.$modal.msg("实收数量超出应收数量,请检查!");
isNumOver = true;
}
}
if (isNumOver == false) {
_this.$modal.loading('提交中')
addReceive(_this.formData).then(async res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("收货成功!");
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
});
}
} else {
console.log(1)
let isNumOver = false;
for (var i in _this.formData.wmsBackReceiveDetailList) {
if (_this.formData.wmsBackReceiveDetailList[i]
.actualNumber > (_this.formData
.wmsBackReceiveDetailList[i].theoryNumber - _this
.formData.wmsBackReceiveDetailList[i].receivedNumber
)) {
_this.$modal.msg("实收数量超出应收数量,请检查!");
isNumOver = true;
}
}
if (isNumOver == false) {
console.log(_this.formData.wmsBackReceiveDetailList)
_this.formData.wmsBackReceiveDetailList[0].actualNumber +=
_this.formData.wmsBackReceiveDetailList[0]
.receivedNumber;
_this.formData.wmsBackReceiveDetailList[0].arriveNumber +=
_this.formData.wmsBackReceiveDetailList[0]
.receivedNumber;
_this.$modal.loading('提交中')
updateReceiveDetail(_this.formData.wmsBackReceiveDetailList[
0])
.then(async res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("收货成功!");
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
});
}
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,283 @@
<template>
<view>
<uni-collapse style="width: 100%;">
<uni-forms ref="form" :modelValue="getCode" class="form">
<uni-easyinput type="text" prefixIcon="scan"
class="Number"
placeholder="请扫描销售工业条码!"
placeholderStyle="color:black"
v-model="getCode.Industry"
@iconClick="iconClick('industry')"
@confirm="getIndustry"
:focus="focusFoIndustry"
clearable
/>
<uni-collapse-item :disabled="open" :open="!open" class="uniCollapse">
<form class="form" >
<uni-table border stripe emptyText="暂无更多数据" >
<!-- 表格数据行 -->
<uni-tr>
<uni-td align="center" width="30">物料编码</uni-td>
<uni-td align="center" width="70">{{form.materialCode}}</uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center" width="30">工业条码</uni-td>
<uni-td align="center" width="70">{{form.Industry}}</uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center" width="30">物料名称</uni-td>
<uni-td align="center" width="70">{{form.materialName}}</uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center" width="30">规格</uni-td>
<uni-td align="center" width="70">{{form.specification1}}</uni-td>
</uni-tr>
</uni-table>
<br />
<uni-easyinput type="text" prefixIcon="scan"
class="Number"
placeholder="请扫描组件二维码!"
placeholderStyle="color:black"
v-model="getCode.computed"
@iconClick="iconClick('subassembly')"
@confirm="getSubassembly"
:focus="focusComputed"
clearable
/>
<uni-table border stripe emptyText="暂无更多数据" >
<!-- 表头行 -->
<uni-tr>
<uni-th align="center" width="70">编码</uni-th>
<uni-th align="center" width="30">操作</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item,index) in form.list" :key="index">
<uni-td align="center">{{item.componentCode}}</uni-td>
<uni-td align="center">
<u-button @click="deleteList(item)">删除</u-button>
</uni-td>
</uni-tr>
</uni-table>
</form>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog cancelText="关闭" confirmText="同意" title="通知" :content="'是否删除编码为'+item.componentCode+'的单子'" @confirm="dialogConfirm"
@close="dialogClose"></uni-popup-dialog>
</uni-popup>
<!-- 提示信息弹窗 -->
<uni-popup ref="message" type="message">
<uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
</uni-popup>
</view>
</template>
<script>
import {
getMaterial,
} from "@/api/mes/material.js";
import {
getSubassembly,
insertSubassembly,
deletSubassembly
} from "@/api/mes/wmsPieceOutRecord.js"
export default {
data() {
return {
//工业条码自动聚焦
focusFoIndustry:true,
focusComputed:false,
//解析的码数据
getCode:{
//工业条码
Industry:null,
//组件
computed:null,
},
//控制明细区是否展开
open:true,
//获取到的数据
form:{
list:[{
name:1,
id:3
},{
name:2,
id:4
}]
},
//要删除的信息
item:{},
//提示信息
messageText:null,
msgType:'info'
}
},
methods: {
/**
* 扫码方法
* @param {Object} value {industry || number }
*/
iconClick(value){
const _this = this;
uni.scanCode({
// 是否只能从相机扫码,不允许从相册选择图片
onlyFromCamera:true,
// 扫码类型
scanType: ['barCode', 'qrCode'],
success: function(res) {
value === 'industry' ? _this.getIndustry(res.result) : value;
value === 'subassembly' ? _this.getSubassembly(res.result) : value;
}
})
},
/**
* 扫描工业条码
* @param {Object} pieceBarcode 解析到的条码数据
*/
async getIndustry(pieceBarcode){
const _self = this;
//判断工业条码里面是否有,号,逗号后面是九位数
_self.focusComputed = false;
if(pieceBarcode ==undefined || pieceBarcode == null|| pieceBarcode.length < 11) return
if(pieceBarcode.indexOf(',') === -1 ||pieceBarcode.split(',').length !=2 ||pieceBarcode.split(',')[1].length != 9){
this.updateMessage('error','该工业条码不符合规范')
return
}
try{
//获取物料信息
const {materialCode,materialName,specification1} = await fnGetMaterial(pieceBarcode);
//获取组件信息
const list = await this.getSubassemblyList(pieceBarcode)
//把所有信息存入form中
_self.form = Object.assign({},{materialCode,materialName,specification1,list,Industry:pieceBarcode})
_self.open = false
_self.focusComputed = true;
}catch(e){
//TODO handle the exception
_self.updateMessage('error','未查到相关数据')
_self.form = Object.assign({})
}
/**
* 通过id获取物料信息
* @param {Object} pieceBarcode 扫描的工业条码
*/
async function fnGetMaterial(pieceBarcode){
//从pieceBarcode截取逗号前面的数据用作id
const id = parseInt(pieceBarcode.split(',')[0]);
let data = [];
await getMaterial(id).then(function(res){
data = res.data
})
return data;
}
},
/**
* 扫描组件条码
* @param {Object} code
*/
async getSubassembly(componentCode){
const _self = this;
// _self.focusComputed = false;
//判断条码是否符合规范
if(componentCode === null || componentCode ==='' ||componentCode === undefined) return _self.focusComputed = true
//查询组件表是否有这个组件,没有则添加,有则结束
if(!await fnInsertSubassembly(this.form.Industry,componentCode)) {
_self.focusComputed = true
return _self.updateMessage('warn','该组件已被扫描')
}
//重新查询数据
const list = await _self.getSubassemblyList(_self.form.Industry)
//把所有信息存入form中
_self.form = Object.assign({},_self.form,{list});
_self.getCode.computed = null;
_self.focusComputed = true
/**
* 查询组件表是否有这个组件,没有则添加
* @param {Object} Industry
* @param {Object} componentCode
*/
async function fnInsertSubassembly(Industry,componentCode){
let data = false;
await insertSubassembly(Industry,componentCode).then(res=>{
data = true
})
return data
}
},
/**
* 通过工业条码查询组件信息
* @param {Object} pieceBarcode
*/
async getSubassemblyList(pieceBarcode){
let data = [];
await getSubassembly(pieceBarcode).then(res => {
data = res.data
})
return data
},
/**
* 删除明细
* @param {Object} 要删除明细的数据
*/
deleteList(item){
this.item = item
this.$refs.alertDialog.open()
},
/**
* 弹出框确认按钮
*/
async dialogConfirm(){
const _self = this;
await deletSubassembly(this.item.id).then(async res => {
this.$refs.alertDialog.close()
this.updateMessage('success','删除成功')
//重新查询数据
const list = await this.getSubassemblyList(_self.form.Industry)
//把所有信息存入form中
_self.form = Object.assign({},_self.form,{list})
})
},
/**
* 弹出框取消按钮
*/
dialogClose(){
this.updateMessage('info','取消删除')
},
/**控制提示框的类型和文字
* @param {Object} type {'info':消息,'success''成功‘,'error':'失败','warn':'警告'}
* @param {Object} text
*/
updateMessage(type,text){
this.messageText = text
this.msgType = type
this.$refs.message.open()
}
}
}
</script>
<style>
page{
padding-top: 10px;
background-color: #ffffff ;
}
</style>
<style scoped lang="scss">
.form {
width: 90%;
margin: 0 auto;
color: black;
font-size:40rpx;
}
.form text {
margin-left: 20%;
}
</style>

View File

@@ -0,0 +1,565 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules" label-align="right">
<uni-collapse-item title="直接入库单" :open="true">
<uni-forms-item label="工单" :labelWidth='80' name="workOrderCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanWorkOrderCode" @change="handleChangeWorkOrderCode"
v-model="workOrderCode" type="text" />
</uni-forms-item>
<uni-forms-item label="产品入库任务单" :labelWidth='80' name="productInTaskCode">
<uni-combox :candidates="productInTaskCodeList" emptyTips="无" @input="fetchTaskInfo"
v-model="formData.productInTaskCode"></uni-combox>
</uni-forms-item>
<uni-forms-item label="上架员" :labelWidth='80' name="shelfPutBy">
<uni-easyinput suffixIcon="scan" @iconClick="scanPutBy" v-model="formData.shelfPutBy" type="text" />
<uni-data-picker popup-title="选择上架员" :localdata="dataTree" v-model="pickerData" @change="onchange"
@nodeclick="onnodeclick" @popupopened="onpopupopened" @popupclosed="onpopupclosed" placeholder="选择上架员"
class="putByPicker" :preload="true">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="入库方式" :labelWidth='80'>
<uni-data-checkbox v-model="value" :localdata="pdcInTypeOptions" class="pdcInType" />
</uni-forms-item>
<span v-if="value=='扫物料标签' && formData.wmsProductInDetailList.length == 0" class="scanMatLabel">
<button size="mini" type="primary" class="scanMatLabelBtn" @click="show=!show">
添加物料标签
</button>
</span>
<u-modal :show="show" title="扫描物料标签编码" showCancelButton closeOnClickOverlay @cancel="cancelMaterialLabel"
@close="cancelMaterialLabel" :showConfirmButton="false">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarMaterialLabel" v-model="materialLabel" type="text"
@confirm="confirmMaterialLabel" maxlength="-1" focus="true" />
</u-modal>
</uni-collapse-item>
<uni-collapse-item title="直接入库单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in formData.wmsProductInDetailList" @click="(data) => clickDetail(index,data)"
@change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90' :name="'wmsProductInDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90' :name="'wmsProductInDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90' name="'wmsProductInDetailList.'+ index +'.materialBatchNo'">
<uni-easyinput type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90' name="'wmsProductInDetailList.'+ index +'.materialLotNo'">
<uni-easyinput disabled type="text" v-model="item.materialLotNo" />
</uni-forms-item>
<uni-forms-item label="类型" :labelWidth='90' name="'wmsProductInDetailList.'+ index +'.type'">
<uni-tag v-if="item.type == 1" text="合格" type="success"></uni-tag>
<uni-tag v-else-if="item.type == 2" text="不良" type="warning"></uni-tag>
<uni-tag v-else-if="item.type == 3" text="报废" type="error"></uni-tag>
</uni-forms-item>
<uni-forms-item label="推荐库位" :label-width="90" ref="myInput">
<uni-easyinput type="text" class="uni-mt-5" v-model="item.recommendLocation" disabled>
<template #right>
<uni-icons custom-prefix="iconfont" type="icon-fuzhi" size="40"
@click="clickCopy(index)"></uni-icons>
</template>
</uni-easyinput>
</uni-forms-item>
<uni-forms-item label="库位条码" :labelWidth='90'
name="'wmsProductInDetailList.'+ index +'.storageLocationBarcode'">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)" type="text"
v-model="item.storageLocationBarcode" />
</uni-forms-item>
<uni-forms-item label="上架数量" :labelWidth='90' name="'wmsProductInDetailList.'+ index +'number'">
<uni-easyinput disabled type="text" v-model="item.number" v-if="value == '扫物料标签'" />
<u-number-box inputWidth="120" button-size="36" v-model="item.number" :min="0" :max="item.notInNumber" v-else></u-number-box>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<view class="opt">
<button @click="clickCopy">一键复制</button>
<button type="primary" @click="submit">提交</button>
</view>
</view>
</template>
<script>
import {
addIn,
listTask,
getTask,
getReveive,
getDetails,
listReceiveDetail,
getDetail,
directProductInByTaskDetail,
getConnectLoc
} from "@/api/wms/pdcIn.js";
import { listDepartment } from "@/api/basic/department";
import { listEmployee } from "@/api/mes/jobIn.js";
import { listWarehouse } from "@/api/wms/warehouse";
import { listStock } from "@/api/wms/stock.js";
import { getConfigKey } from "@/api/system/config.js"
import { getMaterial_code } from "@/api/wms/purchase.js";
import { listLocation } from '@/api/basic/location';
export default {
mounted() {
// 获取任务单编码列表
listTask({
pageNum: 1,
pageSize: 25
}).then(res => {
this.productInTaskCodeList = res.rows.map(item => item.productInTaskCode);
});
// 获取部门列表
listDepartment().then((res) => {
this.dptList = res.rows
})
// 获取员工列表
listEmployee().then((res) => {
this.empList = res.rows
})
// 获取参数: 库位显示级数
getConfigKey('wms.location.size').then(res => {
this.locationSize = res.msg
})
},
data() {
return {
locationSize: null,
value: '正常',
show: false,
materialLabel: null,
workOrderCode: '',
productInTaskCodeList: [],
legalLocation: true,
dptList: [],
empList: [],
item: '',
dataTree: [],
pickerData: '',
formData: {
billType: '2',
status: '3',
productInTaskCode: '',
shelfPutBy: null,
wmsProductInDetailList: [],
},
//类型
pdcInTypeOptions: [
{ text: '正常', value: '正常' },
{ text: '扫物料标签', value: '扫物料标签' },
],
typeOptions: [{
value: 1,
label: "合格",
},
{
value: 2,
label: "不良",
},
{
value: 3,
label: "报废",
},
],
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
productInTaskCode: {
rules: [{
required: true,
errorMessage: '请输入产品入库任务单!'
}]
},
shelfPutBy: {
rules: [{
required: false,
errorMessage: '请输入上架员编码!'
}]
}
}
}
},
methods: {
// 工单改变
handleChangeWorkOrderCode() {
// 重置任务单列表
this.productInTaskCodeList = [];
// 重置任务单编码
this.formData.productInTaskCode = '';
// 重置明细
this.formData.wmsProductInDetailList = [];
// 获取任务单列表
this.fetchTaskList();
},
// 获取任务单列表
fetchTaskList() {
if (!this.workOrderCode) return;
listTask({
workOrderCode: this.workOrderCode
}).then(async res => {
this.productInTaskCodeList = res.rows.map(item => item.productInTaskCode);
}).catch(err => {
console.error(`获取工单号为${this.workOrderCode}的产品入库任务单列表失败,详情:${err}`);
});
},
// 扫描工单号
scanWorkOrderCode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.workOrderCode = res.result;
_this.handleChangeWorkOrderCode();
}
});
},
onnodeclick(e) {
this.item = e
this.onchange(this.item)
},
onpopupopened(e) {
this.dataTree = []
this.empList.filter(item => item.deptId).forEach(item => {
item.departmentTitle = this.dptList.find(item2 => item2.id == item.deptId).departmentTitle
// 检查dataTree中是否已存在相同部门
let existingDept = this.dataTree.find(dept => dept.value === item.deptId);
if (existingDept) {
// 如果已存在相同部门则将员工信息push进该部门的children数组
existingDept.children.push({
text: item.name,
value: item.empCode
});
} else {
// 如果不存在相同部门则创建一个新部门对象包括children数组并将员工信息push进去
let newDept = {
text: item.departmentTitle,
value: item.deptId,
children: [{
text: item.name,
value: item.empCode
}]
};
this.dataTree.push(newDept);
}
})
},
onchange(e) {
this.formData.shelfPutBy = null
this.$set(this.formData, 'shelfPutBy', e.value.split('/')[0])
},
cancelMaterialLabel() {
this.materialLabel = null;
this.show = false;
},
confirmMaterialLabel(data) {
data = JSON.parse(data)
if (data) {
this.id = data.id
getDetail(data.id).then(res => {
if (res.data) {
this.formData.productInTaskCode = res.data.productInTaskCode;
let obj = {
materialCode: res.data.materialCode,
materialName: res.data.materialName,
materialBatchNo: res.data.materialBatchNo,
materialLotNo: res.data.materialLotNo,
type: res.data.type,
storageLocationBarcode: res.data.storageLocationBarcode,
number: res.data.number
}
this.formData.wmsProductInDetailList.push(obj)
this.materialLabel = null;
this.show = false;
} else {
this.$modal.msg("未查询到该条物料明细!")
}
})
}
},
scanBarMaterialLabel() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.materialLabel = res.result;
// console.log(materialLabel)
_this.confirmMaterialLabel(_this.materialLabel);
}
});
},
// 验证库位合法性
async validateLocation(item) {
const code = item.storageLocationBarcode
if (!code) return false
if (['2', '4'].includes(this.locationSize)) return true
let fullLocation = null
if (this.locationSize == '0') {
fullLocation = code
} else if (this.locationSize == '5') {
// 用两级库位查完整库位
const res = await listLocation({
storageShelvesCode: code.split('-')[0],
storageLocationCode: code.split('-').slice(1).join('-')
})
fullLocation = res.rows[0]?.storageLocationBarcode || null
}
const data = await getConnectLoc({ connectLoc: fullLocation })
if (data.data) {
item.whCode = fullLocation.split('-')[0] || null
item.areaCode = fullLocation.split('-')[1] || null
item.shelvesCode = fullLocation.split('-')[2] || null
item.storageLocationCode = fullLocation.split('-').slice(3).join('-') || null
} else {
this.$modal.msg("库位条码校验错误,请重新输入!")
}
return data.data
},
// 扫描库位编码
scanBarstorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.formData.wmsProductInDetailList[i], "storageLocationBarcode", res.result);
}
});
},
selectTypeList() {
listTask({
pageNum: 1,
pageSize: 25
}).then(async res => {
for (var i in res.rows) {
this.productInTaskCodeList.push(res.rows[i].productInTaskCode);
}
});
},
// 依次获取推荐库位
async fetchLocation(taskDetail) {
const promises = taskDetail.map(async (item) => {
if (!item.materialCode) {
return {
...item,
recommend: null,
recommendLocation: null
}
}
const res = await getMaterial_code(item.materialCode);
// 提供默认值以防 res 为 null 或 undefined
const { data } = res || {};
const recommend = data || null;
const recommendLocation = data ? this.getRecommend(data) : null;
return { ...item, recommend, recommendLocation };
});
// 等待所有异步操作完成
const updatedList = await Promise.all(promises);
return updatedList;
},
async fetchTaskInfo() {
// 清空明细单列表
this.formData.wmsProductInDetailList = [];
if (!this.formData.productInTaskCode) return;
let taskId = null;
let taskDetail = [];
// 获取任务单 id
await listTask({
productInTaskCode: this.formData.productInTaskCode
}).then(res => {
taskId = res.rows[0].id
}).catch(err => {
console.error(`获取入库任务单号为${this.formData.productInTaskCode}的任务单 id 失败,详情:${err}`);
})
// 根据任务单 id 获取任务单明细
await getTask(taskId).then(res => {
taskDetail = res.data.wmsProductInTaskDetailList
}).catch(err => {
console.error(`获取入库任务单 id 为${taskId}的任务单明细失败,详情:${err}`);
})
if (taskDetail.length === 0) return
// 获取推荐库位
this.formData.wmsProductInDetailList = await this.fetchLocation(taskDetail)
console.log("明细单列表: ", this.formData.wmsProductInDetailList)
},
// 上架员
scanPutBy() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.shelfPutBy = res.result;
}
});
},
// 拆解推荐库位
getRecommend(recommend) {
const { whCode, areaCode, shelvesCode, storageLocationCode } = recommend
if (!(whCode || areaCode || shelvesCode || storageLocationCode)) return null
switch (this.locationSize) {
case '0':
return [whCode, areaCode, shelvesCode, storageLocationCode].join('-')
case '2':
return areaCode
case '4':
return storageLocationCode
case '5':
return [shelvesCode, storageLocationCode].join('-')
}
},
// 校验明细单各项库位是否为空
checkLocation() {
this.formData.wmsProductInDetailList.forEach(item => {
if (!item.storageLocationBarcode) {
this.$modal.msg("库位条码不允许为空")
return false
}
})
return true
},
// 提交
async submit() {
const _this = this;
if (!this.checkLocation()) return
_this.$modal.loading('校验库位中')
await _this.formData.wmsProductInDetailList.forEach(async item => {
// 避免明细传递失败,删除明细 id
delete item.id;
if (!item.storageLocationBarcode) {
this.$modal.msg("库位条码不允许为空");
return;
}
const res = await _this.validateLocation(item)
if (!res) {
item.storageLocationBarcode = null
this.$modal.msg("库位条码校验错误,请重新输入!")
return
}
})
_this.$modal.closeLoading()
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成直接入库吗?',
success: function(res) {
if (res.confirm) {
if (_this.value == '扫物料标签') {
let obj = {
id: _this.id,
whCode: _this.formData.wmsProductInDetailList[0].whCode,
areaCode: _this.formData.wmsProductInDetailList[0]
.areaCode,
shelvesCode: _this.formData.wmsProductInDetailList[0]
.shelvesCode,
storageLocationCode: _this.formData.wmsProductInDetailList[
0].storageLocationCode
}
_this.$modal.loading('提交中')
directProductInByTaskDetail(obj).then(async res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("入库成功!");
_this.$tab.switchTab('/pages/work/index');
});
} else {
if (_this.formData.productInTaskCode) {
_this.$modal.loading('提交中')
addIn(_this.formData).then(async res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("入库成功!");
_this.$tab.switchTab('/pages/work/index');
});
}
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
// 复制库位
clickCopy(index) {
// 创建新数组避免引用问题
const newList = this.formData.wmsProductInDetailList.map(item => ({ ...item }));
if (typeof index === 'number') {
// 复制单个项
newList[index] = {
...newList[index],
storageLocationBarcode: newList[index].recommendLocation,
whCode: newList[index].recommend.whCode,
areaCode: newList[index].recommend.areaCode,
shelvesCode: newList[index].recommend.shelvesCode,
storageLocationCode: newList[index].recommend.storageLocationCode
};
} else {
// 复制所有项
newList.forEach(item => {
item.storageLocationBarcode = item.recommendLocation;
item.whCode = item.recommend.whCode;
item.areaCode = item.recommend.areaCode;
item.shelvesCode = item.recommend.shelvesCode;
item.storageLocationCode = item.recommend.storageLocationCode;
});
}
// 创建新对象确保响应式更新
this.formData = {
...this.formData,
wmsProductInDetailList: newList
};
}
}
}
</script>
<style lang="scss" scoped>
.putByPicker {
margin-top: 5px;
}
.pdcInType {
margin-top: 6px;
}
.scanMatLabel {
display: flex;
}
.scanMatLabel .scanMatLabelBtn {
justify-content: center;
font-size: 1.1rem;
}
.opt {
// position: fixed;
// bottom: 0;
width: 100%;
padding: 2vw 0;
display: flex;
justify-content: space-evenly;
}
.opt button {
flex: 1;
margin: 0 5px;
}
</style>

View File

@@ -0,0 +1,78 @@
<template>
<view class="uni-padding-wrap uni-common-mt" >
<view class="grid-body">
<uni-grid :column="3" :showBorder="false" @change="changeGrid1">
<uni-grid-item :index="1" style="line-height: 100px;margin-top:100px;margin-left:37.5%;width: 100%;">
<view class="grid-item-box">
<uni-icons custom-prefix="iconfont" type="icon-caigoushouhuodan" size="30"></uni-icons>
<text class="text">产品收货</text>
</view>
</uni-grid-item>
<uni-grid-item :index="2" style="line-height: 100px;margin-left:37.5%;width: 100%;">
<view class="grid-item-box">
<uni-icons custom-prefix="iconfont" type="icon-zhijian" size="30"></uni-icons>
<text class="text">产品质检</text>
</view>
</uni-grid-item>
<uni-grid-item :index="3" style="line-height: 100px;margin-left:37.5%;width: 100%;">
<view class="grid-item-box">
<uni-icons custom-prefix="iconfont" type="icon-caidanlan-shengchan-shengchanruku" size="30"></uni-icons>
<text class="text">产品入库</text>
</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
</view>
</template>
<script>
export default {
onLoad: function() {
},
methods: {
changeGrid1(e) {
console.log(e.detail.index);
if (e.detail.index == 1) {
this.$tab.navigateTo('/pages/wms/pdcIn/pdcSh');
} else if (e.detail.index == 2) {
this.$tab.navigateTo('/pages/wms/pdcIn/pdcInQualityT');
} else if (e.detail.index == 3) {
this.$tab.navigateTo('/pages/wms/pdcIn/pdcRk');
}
}
}
}
</script>
<style>
uni-grid-item {
line-height: 100px;
margin: auto;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>

View File

@@ -0,0 +1,239 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="产品质检单" :open="true">
<uni-forms-item label="收货单" :labelWidth='90' name="productReveiveCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode"
v-model="formData.productReveiveCode" type="text" />
</uni-forms-item>
<uni-forms-item label="收货方式" :labelWidth='90'>
<u-radio-group v-model="value" iconPlacement="left">
<u-radio label="正常" name="正常"></u-radio>
<u-radio label="扫物料标签" name="扫物料标签" style="margin-left: 10px;"></u-radio>
</u-radio-group>
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="产品质检单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in formData.pdcInQualityDetailList"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :name="'pdcInQualityDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :name="'pdcInQualityDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
name="'pdcInQualityDetailList.'+ index +'.materialBatchNo'">
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="实收数量" :labelWidth='90'
name="'pdcInQualityDetailList.'+ index +'.actualNumber'">
<uni-easyinput disabled type="number" v-model="item.actualNumber" />
</uni-forms-item>
<uni-forms-item label="质检数量" :labelWidth='90'
name="'pdcInQualityDetailList.'+ index +'number'">
<uni-easyinput disabled type="number" v-model="item.number" />
</uni-forms-item>
<uni-forms-item label="合格数量" :labelWidth='90'
name="'pdcInQualityDetailList.'+ index +'.passNumber'">
<u-number-box inputWidth="120" button-size="36" v-model="item.passNumber"
min="0"></u-number-box>
</uni-forms-item>
<!-- <uni-forms-item label="不良数量" :labelWidth='90' name="'pdcInQualityDetailList.'+ index +'.blNum'">
<uni-easyinput type="number" v-model="item.blNum"/>
</uni-forms-item> -->
<uni-forms-item label="不良原因" :labelWidth='90'
name="'pdcInQualityDetailList.'+ index +'.failReason'">
<uni-easyinput type="textarea" v-model="item.failReason" />
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
addReveive,
listReceive,
getReceive,
listTask,
getTask,
listQuality,
getQuality,
addQuality
} from "@/api/wms/pdcIn.js";
import {
listMaterial
} from "@/api/wms/request.js";
export default {
mounted() {
this.test();
},
data() {
return {
formData: {
pdcInQualityDetailList: [],
},
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
productReveiveCode: {
rules: [{
required: true,
errorMessage: '请输入产品收货单!'
}]
},
materialCode: {
rules: [{
required: true,
errorMessage: '请输入物料编码!'
}]
},
}
}
},
methods: {
clickDetail(itemIndex, {
position,
index
}) {
// if (index == 0){
// this.deleteDetail(itemIndex);
// }
},
reset(code) {
this.formData = {
productReveiveCode: code,
pdcInQualityDetailList: [],
};
},
test() {
listQuality().then(async res => {
console.log(res);
});
// getQuality('284').then(async res => {
// console.log(res);
// });
},
scanBarCode(code) {
if (code) {
this.reset(code);
}
if (this.formData.productReveiveCode) {
let q = {
productReveiveCode: this.formData.productReveiveCode
}
listReceive(q).then(async res => {
console.log(res);
if (res.rows != null && res.rows.length > 0) {
let did = res.rows[0].id
getReceive(did).then(async res => {
for (let i in res.data.wmsProductReceiveDetailList) {
let obj = {};
obj.materialBatchNo = res.data.wmsProductReceiveDetailList[i]
.materialBatchNo;
obj.materialCode = res.data.wmsProductReceiveDetailList[i]
.materialCode;
obj.materialName = res.data.wmsProductReceiveDetailList[i]
.materialName;
obj.actualNumber = res.data.wmsProductReceiveDetailList[i]
.actualNumber;
obj.number = res.data.wmsProductReceiveDetailList[i]
.actualNumber
obj.unitId = res.data.wmsProductReceiveDetailList[i]
.unitId
this.formData.pdcInQualityDetailList.push(obj);
}
});
}
});
}
},
//采购任务单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.productReveiveCode = res.result;
_this.scanBarCode(_this.formData.productReveiveCode);
}
});
},
submit() {
const _this = this;
// this.$refs["jobInForm"].validate().then(valid => {
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成该质检吗?',
success: function(res) {
if (res.confirm) {
// let psNum = Number()
let wmsProductQualityDetailList = [];
for (let i in _this.formData.pdcInQualityDetailList) {
let obj = {};
obj.materialCode = _this.formData.pdcInQualityDetailList[i]
.materialCode;
obj.materialName = _this.formData.pdcInQualityDetailList[i]
.materialName;
obj.materialBatchNo = _this.formData.pdcInQualityDetailList[i]
.materialBatchNo;
obj.number = _this.formData.pdcInQualityDetailList[i].number;
obj.unitId = Number(_this.formData.pdcInQualityDetailList[i]
.unitId);
obj.secondNumber = _this.formData.pdcInQualityDetailList[i].number;
obj.passNumber = Number(_this.formData.pdcInQualityDetailList[i]
.passNumber);
obj.secondPassNumber = Number(_this.formData
.pdcInQualityDetailList[i]
.secondPassNumber);
obj.secondUnitId = Number(_this.formData.pdcInQualityDetailList[i]
.unitId);
obj.failReason = _this.formData.pdcInQualityDetailList[i]
.failReason;
wmsProductQualityDetailList.push(obj);
}
console.log(wmsProductQualityDetailList);
let data = {
productReceiveCode: _this.formData.productReveiveCode,
status: '1',
wmsProductQualityDetailList: wmsProductQualityDetailList
}
console.log(data);
_this.$modal.loading('提交中')
addQuality(data).then(response => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("质检成功!");
_this.$tab.switchTab('/pages/work/index');
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,373 @@
<template>
<view>
<uni-collapse>
<view class="cu-card article ">
<view class="cu-item shadow borderBottom">
<view class="content">
<view class="desc">
<view class="text-content" style="font-size: 15px;">
<view><strong>物料编码</strong> : {{singleInfo.materialCode}}</view>
<view><strong>物料名称</strong> : {{singleInfo.materialName}}</view>
<view><strong>物料批号</strong> : {{singleInfo.materialBatchNo}}</view>
<view><strong>物料箱号</strong> : {{singleInfo.materialLotNo}}</view>
<view><strong>上架数量</strong> : {{singleInfo.number}}</view>
</view>
</view>
</view>
</view>
</view>
<uni-row>
<uni-col :span="12">
<span style="display: block;text-align: center;">每份数量<view style="margin-left: 15%;"><u-number-box
v-model="eachNumber" integer min="0" @change="eachNumberClear" /></view></span>
</uni-col>
<uni-col :span="12">
<span style="display: block;text-align: center;">拆分数量<view style="margin-left: 15%;"><u-number-box
v-model="splitNumber" integer min="0" @change="splitNumberClear" /></view></span>
</uni-col>
</uni-row>
<uni-row style="margin-top: 5px;" :gutter="10">
<uni-col :span="12">
<u-button type="primary" icon="cut" :disabled="isSecondOpen" @click="multiSplit" :plain="true"
text="拆分"></u-button>
</uni-col>
<uni-col :span="12">
<u-button type="success" icon="close-circle" @click="singleSplit" :disabled="isSecondOpen"
:plain="true" text="不拆分"></u-button>
</uni-col>
</uni-row>
<uni-collapse-item :open="true">
<!-- <uni-swipe-action> -->
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<view :key="index" v-for="(item, index) in wmsLotNoList">
<!-- <uni-swipe-action-item :key="index" v-for="(item, index) in wmsLotNoList"
@click="(data) => clickDetail(index,data)" @change="swipChange"> -->
<view>
<uni-badge :text="index+1" class="uni-badge-left-margin" type="primary"></uni-badge>
</view>
<uni-forms-item label="物料箱号" :labelWidth='90' :name="item.lotNo">
<uni-easyinput type="text" v-model="item.lotNo" />
</uni-forms-item>
<uni-forms-item label="库位条码" :labelWidth='90' name="storageLocationBarcode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
@change="splitStlBarcode(index,$event)" type="text"
v-model="item.storageLocationBarcode" />
</uni-forms-item>
<uni-forms-item label="上架数量" :labelWidth='90'>
<u-number-box inputWidth="120" button-size="36" v-model="item.number"
min="0"></u-number-box>
</uni-forms-item>
<uni-forms-item label="入库时间" :labelWidth='90' :name="item.storageInTime">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="item.storageInTime" />
</view>
</uni-forms-item>
</view>
<!-- </uni-swipe-action-item> -->
</uni-forms>
<!-- </uni-swipe-action> -->
</uni-collapse-item>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
addInDetail,
addLotInfo,
} from "@/api/wms/purchase.js";
import {
updateInDetail,
getConnectLoc
} from "@/api/wms/pdcIn.js";
export default {
onLoad: function(option) {
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.rkTime = formattedDate;
console.log(option);
this.isSecondOpen = option.isSecondOpen == 'false' ? false : true;
this.selectedRow = JSON.parse(decodeURIComponent(option.selectedRow));
this.singleInfo = JSON.parse(decodeURIComponent(option.singleInfo));
this.wmsLotNoList = JSON.parse(decodeURIComponent(option.wmsLotNoList));
this.eachNumber = option.eachNumber;
this.splitNumber = option.splitNumber;
this.index = option.index
},
data() {
return {
//入库时间
rkTime: null,
//是否已分批
isSecondOpen: false,
selectedRow: {},
singleInfo: {},
wmsLotNoList: [],
eachNumber: null,
splitNumber: null,
index: null,
checkStorageLocationBarcode: true,
isSubmitted: false,
// storageLocationBarcode: ''
formData: {},
rules: {
storageLocationBarcode: {
rules: [{
required: true,
errorMessage: '请输入库位条码!'
}]
}
},
}
},
methods: {
eachNumberClear() {
this.eachSecondNumber = null;
this.splitNumber = null;
},
eachSecondNumberClear() {
this.eachNumber = null;
this.splitNumber = null;
},
splitNumberClear() {
this.eachNumber = null;
this.eachSecondNumber = null;
},
//选择条件拆分批次
multiSplit() {
this.wmsLotNoList = [];
if (this.eachNumber != 0 && this.eachNumber != null) {
console.log(this.eachNumber)
this.splitNumber = 0;
let t;
let k;
t = parseInt(this.singleInfo.number / this.eachNumber);
k = this.singleInfo.number % this.eachNumber;
let materialCode = this.singleInfo.materialCode;
let batchNo = this.singleInfo.materialBatchNo;
let unit = this.singleInfo.unit;
let productInCode = this.singleInfo.productInCode;
let unitId = this.singleInfo.unitId;
let secondUnitId = this.singleInfo.secondUnitId;
if (k != 0) {
t++;
}
for (let i = 0; i < t; i++) {
let obj = {};
obj.materialCode = materialCode;
obj.batchNo = batchNo;
obj.number = this.eachNumber;
obj.secondNumber = this.eachNumber;
obj.unitId = unitId;
obj.secondUnitId = secondUnitId;
obj.unit = unit;
obj.storageInBillCode = productInCode;
obj.storageInBillDetailCode = this.singleInfo.storageInBillDetailCode;
obj.storageInTime = this.rkTime;
if (i == t - 1) {
if (k != 0) {
obj.number = k;
}
}
// obj.lotNo = i + 1;
this.wmsLotNoList.push(obj);
}
}
if (this.splitNumber != 0 && this.splitNumber != null) {
console.log(2)
this.eachNumber = 0;
let k;
let j;
k = parseInt(this.singleInfo.number / this.splitNumber);
j = this.singleInfo.number - (this.splitNumber - 1) * k;
let materialCode = this.singleInfo.materialCode;
let batchNo = this.singleInfo.materialBatchNo;
let unit = this.singleInfo.unit;
let productInCode = this.singleInfo.productInCode;
let unitId = this.singleInfo.unitId;
let secondUnitId = this.singleInfo.secondUnitId;
for (let i = 0; i < this.splitNumber; i++) {
let obj = {};
obj.materialCode = materialCode;
obj.batchNo = batchNo;
obj.number = k;
obj.secondNumber = k;
obj.unit = unit;
obj.unitId = unitId;
obj.secondUnitId = secondUnitId;
obj.storageInBillCode = productInCode;
obj.storageInBillDetailCode = this.singleInfo.storageInBillDetailCode;
obj.storageInTime = this.rkTime;
// obj.lotNo = i + 1;
if (i == this.splitNumber - 1) {
obj.number = j;
}
this.wmsLotNoList.push(obj);
}
}
},
//不拆分批次
singleSplit() {
this.wmsLotNoList = [];
this.splitNumber = 1;
this.eachNumber = 0;
let obj = {};
obj.materialCode = this.singleInfo.materialCode;
obj.batchNo = this.singleInfo.materialBatchNo;
obj.secondNumber = this.singleInfo.secondNumber;
obj.secondUnit = this.singleInfo.secondUnit;
obj.secondUnitId = this.singleInfo.secondUnitId;
obj.storageInBillCode = this.singleInfo.productInCode;
obj.storageInBillDetailCode = this.singleInfo.storageInBillDetailCode;
obj.number = this.singleInfo.number;
obj.unit = this.singleInfo.unit;
obj.storageInTime = this.rkTime;
// obj.lotNo = 1;
this.wmsLotNoList.push(obj);
},
async splitStlBarcode(i, event) {
console.log(this.wmsLotNoList[i]);
const _this = this;
const detail = _this.wmsLotNoList[i];
detail.whCode = _this.singleInfo.whCode;
detail.areaCode = null;
detail.shelvesCode = null;
detail.storageLocationCode = null;
let barcode = detail.storageLocationBarcode;
if (!barcode) {
return; // 如果没有条码,不做任何处理
}
// 分割为三部分:库区、货架、库位(库位可能含'-'
const parts = barcode.split('-');
if (parts.length < 3) {
_this.$modal.msg("库位条码格式错误,应为:库区-货架-库位");
return;
}
// 解析三部分
const areaCode = parts[0];
const shelvesCode = parts[1];
const storageLocationCode = parts.slice(2).join('-'); // 合并剩余部分为库位
const data = await getConnectLoc({
connectLoc: event
})
if (!data.data) return this.$modal.msg("库位条码校验错误,请重新输入!")
_this.checkStorageLocationBarcode = true;
detail.areaCode = areaCode || null;
detail.shelvesCode = shelvesCode || null;
detail.storageLocationCode = storageLocationCode || null;
console.log(this.wmsLotNoList[i]);
},
scanBarstorageLocationBarcode(i) {
const _this = this;
_this.isSubmitted = false
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.wmsLotNoList[i], "storageLocationBarcode", res
.result);
// _this.wmsLotNoList[i].storageLocationBarcode = res.result;
_this.splitStlBarcode(i);
}
});
},
//提交分批入库详情
async submit() {
//数量防错
let allNum = 0;
for (var i in this.wmsLotNoList) {
allNum += this.wmsLotNoList[i].number;
}
console.log(allNum)
if (allNum == this.singleInfo.number) {
let obj = {};
obj = this.singleInfo;
obj.batchNo = this.singleInfo.materialBatchNo;
obj.lotNo = this.singleInfo.materialLotNo;
obj.eachNumber = this.eachNumber;
obj.storageInBillDetailCode = this.singleInfo.storageInBillDetailCode;
obj.storageInBillCode = this.singleInfo.storageInBillCode;
obj.type = this.singleInfo.type;
// obj.eachSecondNumber = this.eachSecondNumber;
obj.splitNumber = this.splitNumber;
if (!this.checkStorageLocationBarcode) {
this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
// 拼接仓库
if (!this.isSubmitted) {
this.isSubmitted = true
for (let i in this.wmsLotNoList) {
this.wmsLotNoList[i].storageLocationBarcode =
`${this.wmsLotNoList[i].whCode}-${this.wmsLotNoList[i].storageLocationBarcode}`
}
}
console.log(this.wmsLotNoList)
this.$modal.loading('提交中')
addLotInfo(obj).then(res => {
console.log(this.wmsLotNoList)
addInDetail(this.wmsLotNoList, 1).then(res => {
console.log(res)
if (this.wmsLotNoList && this.wmsLotNoList.length > 0) {
this.selectedRow.status = "1";
} else {
this.selectedRow.status = "0";
}
this.$modal.closeLoading();
this.$modal.msgSuccess("编辑成功!");
uni.$emit('backWithParam', {
status: this.selectedRow.status,
index: this.index
});
this.$tab.navigateBack();
});
});
} else {
this.$modal.msg("批号分批入库明细数量不符合!");
}
},
}
}
</script>
<style>
.cu-card.article>.cu-item .content .text-content {
height: 100% !important;
}
.cu-card.article>.cu-item {
padding-bottom: 0;
}
.cu-card>.cu-item {
margin: 0;
}
.uni-swipe {
overflow: inherit;
}
</style>

718
pages/wms/pdcIn/pdcRk.vue Normal file
View File

@@ -0,0 +1,718 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="产品入库单" :open="true">
<uni-forms-item label="工单" :labelWidth='90' name="workOrderCode">
<uni-easyinput clearable suffixIcon="scan" @iconClick="scanBarPwo"
v-model="formData.workOrderCode" @confirm="scanBarPwoCode" type="text" />
</uni-forms-item>
<uni-forms-item label="产品入库收货单" :labelWidth='90' name="productReceiveCode">
<uni-combox :candidates="productReceiveCodeList" emptyTips="无" @input="scanBarReceiveCode"
v-model="formData.productReceiveCode"></uni-combox>
</uni-forms-item>
<uni-forms-item label="产品入库质检单" :labelWidth='90' name="productQualityCode">
<uni-combox :candidates="productQualityCodeList" emptyTips="无" @input="scanBarQualityCode"
v-model="formData.productQualityCode" />
</uni-forms-item>
<uni-forms-item label="产品入库单" :labelWidth='90' name="productInCode">
<uni-combox-re labelKey="productInCode" valueKey="productInCode" :candidates="productInCodeList"
emptyTips="无" @input="scanBarProductInCode"
v-model="formData.productInCode"></uni-combox-re>
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarwarehouseCode"
v-model="formData.warehouseCode" />
<uni-data-select style="margin-top: 5px;" v-model="formData.warehouseCode"
:localdata="wcList"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="上架员" :labelWidth='90' name="shelfPutBy">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.shelfPutBy"
type="text" />
<uni-data-picker popup-title="请选择上架员" :localdata="dataTree" v-model="pickerData"
@change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened"
@popupclosed="onpopupclosed" style="margin-top: 5px;" :preload="true">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="入库方式" :labelWidth='90'>
<u-radio-group v-model="value" iconPlacement="left">
<u-radio label="正常" name="正常"></u-radio>
<u-radio label="扫物料标签" name="扫物料标签" style="margin-left: 10px;"></u-radio>
</u-radio-group>
</uni-forms-item>
<!-- <uni-forms-item :labelWidth='90' > -->
<button size="mini" v-if="value=='扫物料标签' && formData.wmsProductInDetailList.length == 0"
type="primary" style="text-align: center;margin-left: 30%;font-size: 18px;"
@click="show=!show">添加物料标签</button>
<!-- </uni-forms-item> -->
<u-modal :show="show" title="扫描物料标签编码" showCancelButton closeOnClickOverlay
@cancel="cancelMaterialLabel" @close="cancelMaterialLabel" :showConfirmButton="false">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarMaterialLabel" v-model="materialLabel"
type="text" @confirm="confirmMaterialLabel" maxlength="-1" focus="true" />
</u-modal>
</uni-collapse-item>
<uni-collapse-item title="产品入库单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
@click="(data) => clickDetail(index,data)"
v-for="(item, index) in formData.wmsProductInDetailList">
<view>
<uni-badge :text="index+1" class="uni-badge-left-margin" type="primary"></uni-badge>
<button @click="open(index,item)" size="mini"
:disabled="buttonDisabled ||!formData.id || !item.materialBatchNo"
type="primary">编辑</button>
</view>
<!-- <uni-badge :text="index+1" type="primary"></uni-badge> -->
<uni-forms-item label="物料编码" :name="'wmsProductInDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :name="'wmsProductInDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" name="'wmsProductInDetailList.'+ index +'.materialBatchNo'">
<uni-easyinput type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料箱号" name="'wmsProductInDetailList.'+ index +'.materialLotNo'">
<uni-easyinput disabled type="text" v-model="item.materialLotNo" />
</uni-forms-item>
<uni-forms-item label="类型" name="'wmsProductInDetailList.'+ index +'.type'">
<uni-tag v-if="item.type == 1" text="合格" type="success"></uni-tag>
<uni-tag v-else-if="item.type == 2" text="不良" type="warning"></uni-tag>
<uni-tag v-else-if="item.type == 3" text="报废" type="error"></uni-tag>
</uni-forms-item>
<!-- <uni-forms-item label="库位条码" :labelWidth='90'
name="'wmsProductInDetailList.'+ index +'.storageLocationBarcode'">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
@confirm="splitStlBarcode(index)" type="text"
v-model="item.storageLocationBarcode" />
</uni-forms-item> -->
<uni-forms-item label="上架数量" :labelWidth='90'
name="'wmsProductInDetailList.'+ index +'number'">
<u-number-box inputWidth="120" button-size="36" v-model="item.number"
min="0"></u-number-box>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<uni-row :gutter="10">
<uni-col :span="12">
<u-button type="success" @click="savesubmit">保存</u-button>
</uni-col>
<uni-col :span="12">
<u-button type="primary" :disabled="!isAllListed" @click="submit">提交</u-button>
</uni-col>
</uni-row>
<!-- <u-modal :show="show" :title="title" content='是否进行批号分包入库'></u-modal> -->
</view>
</template>
<script>
import {
listQuality,
addIn,
listTask,
getTask,
getReceive,
getDetails,
listReceive,
updateIn,
listIn,
getIn,
listReceiveDetail,
updateProductIndetail
} from "@/api/wms/pdcIn.js";
import {
getListDetailByBL
} from "@/api/wms/purchase.js"
import uniComboxRe from "../../../uni_modules/uni-combox/components/uni-combox/uni-combox-re.vue"
import {
listDepartment
} from "@/api/basic/department";
import {
listEmployee
} from "@/api/mes/jobIn.js";
import {
listWarehouse
} from "@/api/wms/warehouse";
import _ from 'lodash';
export default {
created() {
//监听编辑批号分批后的状态
uni.$on('backWithParam', (param) => {
console.log(param);
if (param.status && param.index) {
this.formData.wmsProductInDetailList[Number(param.index)].status = param.status
}
this.checkIsListed();
});
},
mounted() {
listDepartment().then((res) => {
this.dptList = res.rows
})
listEmployee().then((res) => {
this.empList = res.rows
})
listWarehouse().then((res) => {
this.wcList = res.rows.map(item => {
let obj = {
text: item.warehouseName,
value: item.warehouseCode
}
return obj
})
})
},
components: {
uniComboxRe
},
data() {
return {
buttonDisabled: false,
dptList: [],
empList: [],
wcList: [],
item: '',
dataTree: [],
pickerData: '',
value: '正常',
show: false,
materialLabel: null,
range: [],
isRk: false,
//是否打开编辑按钮
isSplit: true,
workOrderCode: '',
productReceiveCodeList: [],
productQualityCodeList: [],
productInCodeList: [],
formData: {
workOrderCode: '',
productReceiveCode: '',
productQualityCode: '',
shelfPutBy: null,
wmsProductInDetailList: [],
billType: "1",
status: "1",
id: null,
productInCode: ''
},
//是否都入库
isAllListed: false,
// storageLocationBarcode:null,
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
shelfPutBy: {
rules: [{
required: true,
errorMessage: '请输入上架员编码!'
}]
},
// workOrderCode: {
// rules: [{
// required: true,
// errorMessage: '请输入工单!'
// }]
// }
},
wmsLotNoList: []
}
},
methods: {
deleteDetail(index) {
this.formData.wmsProductInDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
onnodeclick(e) {
console.log(e)
this.item = e
this.onchange(this.item)
},
onpopupopened(e) {
this.dataTree = []
this.empList.filter(item => item.deptId).forEach(item => {
item.departmentTitle = this.dptList.find(item2 => item2.id == item.deptId).departmentTitle
// 检查dataTree中是否已存在相同部门
let existingDept = this.dataTree.find(dept => dept.value === item.deptId);
if (existingDept) {
// 如果已存在相同部门则将员工信息push进该部门的children数组
existingDept.children.push({
text: item.name,
value: item.empCode
});
} else {
// 如果不存在相同部门则创建一个新部门对象包括children数组并将员工信息push进去
let newDept = {
text: item.departmentTitle,
value: item.deptId,
children: [{
text: item.name,
value: item.empCode
}]
};
this.dataTree.push(newDept);
}
})
console.log(this.dataTree)
},
onpopupclosed() {
//处理不同步
// this.$nextTick(() => {
// this.pickerData = this.item.value;
// this.formData.pickerData = this.item.value;
// if (!this.item) return
// this.onchange(this.item)
// });
},
onchange(e) {
console.log(e)
this.formData.shelfPutBy = null
this.$set(this.formData, 'shelfPutBy', e.value.split('/')[0])
},
addMaterialLabel() {
this.show = true;
},
cancelMaterialLabel() {
this.materialLabel = null;
this.show = false;
},
confirmMaterialLabel(data) {
data = JSON.parse(data)
if (data) {
//判断是否已入库
listReceiveDetail({
productInTaskDetailId: data.id
}).then(res => {
console.log(res)
//若已有收货单
if (res.data.length > 0) {
this.formData.productReceiveCode = res.data[0].productReceiveCode;
// this.formData.workOrderCode = data.pwoCode;
this.formData.productQualityCode = '';
this.formData.productInCode = '';
this.selectTask();
this.materialLabel = null;
this.show = false;
} else {
this.$modal.msg("该条物料明细还未收货!")
}
})
}
},
scanBarMaterialLabel() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.materialLabel = res.result;
// console.log(materialLabel)
_this.confirmMaterialLabel(_this.materialLabel);
}
});
},
//进入编辑页
open: _.debounce(async function(index, row) {
console.log(row)
// 禁用按钮
this.buttonDisabled = true;
//拆分下的列表
this.wmsLotNoList = [];
//选中的物料明细项
let selectedRow = row;
//是否分批
let isSecondOpen = false;
//每份数量
let eachNumber = null;
//拆分数量
let splitNumber = null;
//头部信息
let singleInfo = {};
singleInfo.materialCode = row.materialCode;
singleInfo.materialBatchNo = row.materialBatchNo;
singleInfo.materialLotNo = row.materialLotNo;
singleInfo.number = row.number;
singleInfo.unit = row.unit;
singleInfo.unitId = row.unitId;
singleInfo.secondNumber = row.number;
singleInfo.secondUnitId = row.unitId;
singleInfo.productInCode = row.productInCode;
singleInfo.materialName = row.materialName;
singleInfo.type = row.type;
singleInfo.storageInBillDetailCode = row.productInDetailCode;
this.formData.productInCode = row.productInCode;
await getListDetailByBL({
materialCode: row.materialCode,
storageInBillDetailCode: row.productInDetailCode,
batchNo: row.materialBatchNo,
lotNo: row.materialLotNo,
}).then((response) => {
console.log(response)
if (
response.materialDetailList &&
response.materialStockList
) {
/** 导入拆分信息 */
if (response.materialDetailList.length > 0) {
if (response.materialDetailList[0].splitNumber != null) {
splitNumber = response.materialDetailList[0].splitNumber;
} else if (response.materialDetailList[0].eachNumber != null) {
eachNumber = response.materialDetailList[0].eachNumber;
} else if (response.materialDetailList[0].eachSecondNumber != null) {
eachSecondNumber =
response.materialDetailList[0].eachSecondNumber;
}
}
/** 导入拆分详情 */
if (response.materialStockList.length > 0) {
this.wmsLotNoList = response.materialStockList.map((item) => {
item.batchNo = item.materialBatchNo;
item.locCascade = [
item.whCode,
item.areaCode,
item.shelvesCode,
item.storageLocationCode,
];
if (item.whCode != null) {
item.connectedLocation = item.whCode;
if (item.areaCode != null) {
item.connectedLocation = item.connectedLocation + '-' +
item
.areaCode;
if (item.shelvesCode != null) {
item.connectedLocation = item.connectedLocation +
'-' +
item
.shelvesCode;
if (item.storageLocationCode != null) {
item.connectedLocation = item
.connectedLocation +
'-' +
item.storageLocationCode;
}
}
}
}
return item;
});
}
if (response.materialStockList.length != 0) {
isSecondOpen = true;
}
} else {
if (singleInfo.materialLotNo) {
console.log(singleInfo)
splitNumber = 1;
singleInfo.storageInBillCode = singleInfo.productInCode;
this.wmsLotNoList.push(singleInfo);
console.log(this.wmsLotNoList)
isSecondOpen = true;
}
}
});
console.log(6)
console.log(this.wmsLotNoList);
uni.navigateTo({
url: '/pages/wms/pdcIn/pdcListing?singleInfo=' + encodeURIComponent(JSON.stringify(
singleInfo)) +
'&wmsLotNoList=' + encodeURIComponent(JSON.stringify(
this.wmsLotNoList)) +
'&selectedRow=' + encodeURIComponent(JSON.stringify(
selectedRow)) +
'&eachNumber=' + eachNumber +
'&splitNumber=' + splitNumber +
'&isSecondOpen=' + isSecondOpen +
'&index=' + index
});
// 在页面跳转后恢复按钮状态
setTimeout(() => {
this.buttonDisabled = false;
}, 500); // 延时,确保跳转完成后再启用按钮
}, 1000, {
leading: true,
trailing: false
}),
splitStlBarcode(i) {
this.formData.wmsProductInDetailList[i].whCode = null;
this.formData.wmsProductInDetailList[i].areaCode = null;
this.formData.wmsProductInDetailList[i].shelvesCode = null;
this.formData.wmsProductInDetailList[i].storageLocationCode = null;
let array = this.formData.wmsProductInDetailList[i].storageLocationBarcode.split('-');
let [whCode, areaCode, shelvesCode, storageLocationCode, extra] = array;
this.formData.wmsProductInDetailList[i].whCode = whCode || null;
this.formData.wmsProductInDetailList[i].areaCode = areaCode || null;
this.formData.wmsProductInDetailList[i].shelvesCode = shelvesCode || null;
this.formData.wmsProductInDetailList[i].storageLocationCode = extra ? `${storageLocationCode}-${extra}` :
storageLocationCode || null;
// const _this = this;
// const detail = _this.formData.wmsProductInDetailList[i];
// detail.whCode = null;
// detail.areaCode = null;
// detail.shelvesCode = null;
// detail.storageLocationCode = null;
// let barcode = detail.storageLocationBarcode;
// if (!barcode) {
// return; // 如果没有条码,不做任何处理
// }
// let [whCode, areaCode, shelvesCode, storageLocationCode, extra] = barcode.split('-');
// const checkAndSetField = (obj, field, value, msg) => {
// if (!value) {
// _this.$modal.msg(msg);
// _this.$set(obj, field, null);
// _this.$nextTick(() => {
// _this.$set(obj, "storageLocationBarcode", null);
// });
// return false;
// }
// return true;
// };
// let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
// if (!checkAndSetField(detail, 'whCode', warehouseObj, "仓库不存在!")) return;
// let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode == areaCode);
// if (!checkAndSetField(detail, 'areaCode', areaObj, "库区不存在!")) return;
// let shelvesObj = _this.$store.getters.shelvesOptions.find(item => item.storageShelvesCode == shelvesCode);
// if (!checkAndSetField(detail, 'shelvesCode', shelvesObj, "货架不存在!")) return;
// let locationObj = _this.$store.getters.locationOptions.find(item => item.storageLocationCode ==
// `${storageLocationCode}-${extra}`);
// if (!checkAndSetField(detail, 'storageLocationCode', locationObj, "库位不存在!")) return;
// // 更新formData中的对应字段
// detail.whCode = whCode || null;
// detail.areaCode = areaCode || null;
// detail.shelvesCode = shelvesCode || null;
// detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
},
scanBarstorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.formData.wmsProductInDetailList[i], "storageLocationBarcode", res
.result);
_this.splitStlBarcode(i);
}
});
},
// clearPwo() {
// if (this.formData.workOrderCode == '' || !this.formData.workOrderCode) {
// this.selectTypeList();
// }
// },
scanBarPwo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.workOrderCode = res.result;
_this.scanBarPwoCode();
}
});
},
scanBarPwoCode() {
this.productReceiveCodeList = [];
this.productQualityCodeList = [];
this.productInCodeList = [];
if (this.formData.workOrderCode) {
listReceive({
workOrderCode: this.formData.workOrderCode
}).then(async response => {
for (var i = 0; i < response.rows.length; i++) {
this.productReceiveCodeList.push(response
.rows[i].productReceiveCode);
}
});
listQuality({
workOrderCode: this.formData.workOrderCode
}).then(async response => {
for (var i = 0; i < response.rows.length; i++) {
this.productQualityCodeList.push(response.rows[i].productQualityCode);
}
});
listIn({
workOrderCode: this.formData.workOrderCode
}).then(async response => {
this.productInCodeList = response.rows
// for (var i = 0; i < response.rows.length; i++) {
// this.productInCodeList.push(response.rows[i].productInCode);
// }
});
}
},
change(e) {
console.log(e);
},
// selectTypeList() {
// this.productReceiveCodeList = [];
// this.productQualityCodeList = [];
// this.productInCodeList = [];
// listReceive().then(async response => {
// for (var i = 0; i < response.rows.length; i++) {
// this.productReceiveCodeList.push(response.rows[i].productReceiveCode);
// }
// });
// listQuality().then(response => {
// for (var i = 0; i < response.rows.length; i++) {
// this.productQualityCodeList.push(response.rows[i].productQualityCode);
// }
// });
// listIn().then(response => {
// for (var i = 0; i < response.rows.length; i++) {
// this.productInCodeList.push(response.rows[i].productInCode);
// }
// });
// },
scanBarReceiveCode() {
if (this.formData.productReceiveCode) {
this.formData.productQualityCode = '';
this.formData.productInCode = '';
this.selectTask();
} else {
this.$modal.msg("产品入库收货单!");
}
},
scanBarQualityCode() {
if (this.formData.productQualityCode) {
this.formData.productReceiveCode = '';
this.formData.productInCode = '';
this.selectTask();
} else {
this.$modal.msg("产品入库质检单!");
}
},
selectTask() {
getDetails(this.formData).then(res => {
this.formData.wmsProductInDetailList = res.details;
this.formData.warehouseCode = res.inBill.warehouseCode;
})
},
scanBarProductInCode(i) {
this.formData.productReceiveCode = '';
this.formData.productQualityCode = '';
getIn(this.productInCodeList.find(item => item.productInCode == i).id).then((response) => {
this.formData = response.data;
this.checkIsListed();
});
},
//上架员
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.shelfPutBy = res.result;
}
});
},
savesubmit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定保存吗?',
success: function(res) {
if (res.confirm) {
if (_this.formData.productReceiveCode || _this.formData
.productQualityCode) {
// _this.formData.wmsProductInDetailList.map(item => {
// item.secondNumber = item.number;
// item.secondUnitId = item.unitId;
// return item
// })
if (_this.formData.id != null) {
_this.$modal.loading('提交中')
updateIn(_this.formData).then((response) => {
_this.$modal.closeLoading();
_this.formData = response.data;
console.log(_this.formData);
_this.checkIsListed();
_this.$modal.msgSuccess("修改成功!");
});
} else {
_this.$modal.loading('提交中')
addIn(_this.formData).then((response) => {
_this.$modal.closeLoading();
_this.formData = response.data;
console.log(_this.formData);
_this.checkIsListed();
_this.$modal.msgSuccess("保存成功!");
});
}
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
/** 提交按钮 */
submit() {
const _this = this;
_this.formData.status = 2;
//判断明细是否都入库
if (
_this.formData.wmsProductInDetailList.filter((obj) => obj.status != 1).length == 0
) {
_this.formData.status = 3;
}
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成入库吗?',
success: function(res) {
// _this.formData.wmsProductInDetailList.map(item => {
// item.secondNumber = item.number;
// item.secondUnitId = item.unitId;
// return item
// })
_this.$modal.loading('提交中')
updateIn(_this.formData).then(response => {
_this.$modal.msgSuccess("入库成功!");
_this.$modal.closeLoading();
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
});
// }
}
});
});
},
//检查是否都入库
checkIsListed() {
let flag = true;
this.formData.wmsProductInDetailList.forEach((item) => {
if (item.status == 0 || item.status == null) flag = false;
});
this.isAllListed = flag;
},
}
}
</script>
<style>
</style>

450
pages/wms/pdcIn/pdcSh.vue Normal file
View File

@@ -0,0 +1,450 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="产品收货单" :open="true">
<uni-forms-item label="工单" :labelWidth='90' name="workOrderCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPwo" @change="clearPwo"
v-model="workOrderCode" @confirm="scanBarPwoCode" type="text" />
</uni-forms-item>
<uni-forms-item label="产品任务单" :labelWidth='90' name="productInTaskCode">
<uni-combox :candidates="productInTaskCodeList" emptyTips="无" @input="scanBarCode"
v-model="formData.productInTaskCode"></uni-combox>
</uni-forms-item>
<uni-forms-item label="签收员" :labelWidth='90' name="drawBy">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.drawBy" type="text" />
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
<uni-easyinput v-model="formData.warehouseCode" type="text" />
</uni-forms-item>
<uni-forms-item label="到货时间" :labelWidth='90' name="arriveTime">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.arriveTime" />
</view>
</uni-forms-item>
<uni-forms-item label="收货方式" :labelWidth='90'>
<u-radio-group v-model="value" iconPlacement="left">
<u-radio label="正常" name="正常"></u-radio>
<u-radio label="扫物料标签" name="扫物料标签" style="margin-left: 10px;"></u-radio>
</u-radio-group>
</uni-forms-item>
<button size="mini" v-if="value=='扫物料标签' && formData.wmsProductReceiveDetailList.length == 0"
type="primary" style="text-align: center;margin-left: 30%;font-size: 18px;"
@click="show=!show">添加物料标签</button>
<u-modal :show="show" title="扫描物料标签编码" showCancelButton closeOnClickOverlay
@cancel="cancelMaterialLabel" @close="cancelMaterialLabel" :showConfirmButton="false">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarMaterialLabel" v-model="materialLabel"
type="text" @confirm="confirmMaterialLabel" maxlength="-1" focus="true" />
</u-modal>
</uni-collapse-item>
<uni-collapse-item title="产品收货单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :key="index"
v-for="(item, index) in formData.wmsProductReceiveDetailList"
@click="(data) => clickDetail(index,data)" :right-options="rightOptions">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'wmsProductReceiveDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'wmsProductReceiveDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
:name="'wmsProductReceiveDetailList.'+ index +'.materialBatchNo'">
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90'
:name="'wmsProductReceiveDetailList.'+ index +'.materialLotNo'">
<uni-easyinput disabled type="number" v-model="item.materialLotNo" />
</uni-forms-item>
<uni-forms-item label="类型" :labelWidth='90'
name="'wmsProductReceiveDetailList.'+ index +'.type'">
<uni-tag v-if="item.type == 1" text="合格" type="success"></uni-tag>
<uni-tag v-else-if="item.type == 2" text="不良" type="warning"></uni-tag>
<uni-tag v-else-if="item.type == 3" text="报废" type="error"></uni-tag>
</uni-forms-item>
<uni-forms-item label="应收数量" :labelWidth='90'
:name="'wmsProductReceiveDetailList.'+ index +'.theoryNumber'">
<uni-easyinput disabled type="number" v-model="item.theoryNumber" />
</uni-forms-item>
<uni-forms-item label="已收数量" :labelWidth='90' v-if="item.receivedNumber"
:name="'wmsProductReceiveDetailList.'+ index +'.receivedNumber'">
<uni-easyinput disabled type="number" v-model="item.receivedNumber" />
</uni-forms-item>
<uni-forms-item label="到货数量" :labelWidth='90'
:name="'wmsProductReceiveDetailList.'+ index +'.arriveNumber'">
<u-number-box inputWidth="120" button-size="36" v-model="item.arriveNumber"
min="0"></u-number-box>
</uni-forms-item>
<uni-forms-item label="实收数量" :labelWidth='90'
:name="'wmsProductReceiveDetailList.'+ index +'.actualNumber'">
<u-number-box inputWidth="120" button-size="36" v-model="item.actualNumber"
min="0"></u-number-box>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
addReceive,
listReceive,
getReceive,
listTask,
getTask,
getReceiveDetails,
listReceiveDetail,
updateReceiveDetail,
} from "@/api/wms/pdcIn.js";
import {
listMaterial
} from "@/api/wms/request.js";
export default {
onLoad: function() {
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.formData.arriveTime = formattedDate;
},
mounted() {
//判断是否已收货
listReceiveDetail({
productInTaskDetailId: 846
}).then(res => {
console.log(res)
})
},
data() {
return {
isReceive: false,
value: '正常',
show: false,
materialLabel: null,
workOrderCode: null,
productInTaskCodeList: [],
formData: {
productInTaskCode: '',
drawBy: null,
warehouseCode: null,
wmsProductReceiveDetailList: [],
arriveTime: null,
},
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
productInTaskCode: {
rules: [{
required: true,
errorMessage: '请输入产品任务单!'
}]
},
actualNumber: {
rules: [{
required: true,
errorMessage: '请输入实收数量!'
}]
},
}
}
},
computed: {
startDate() {
return this.getDate('start');
},
endDate() {
return this.getDate('end');
}
},
methods: {
deleteDetail(index) {
this.formData.wmsProductReceiveDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
addMaterialLabel() {
this.show = true;
},
cancelMaterialLabel() {
this.materialLabel = null;
this.show = false;
},
confirmMaterialLabel(data) {
data = JSON.parse(data)
if (data) {
//判断是否已收货
listReceiveDetail({
productInTaskDetailId: data.id
}).then(res => {
console.log(res)
//若已有收货单
if (res.data.length > 0) {
let num = 0;
//统计所有实收数量
for (var i in res.data) {
num += res.data[i].actualNumber
}
//若所有收货单的实际收货数量与应收数量一致
if (num == res.data[0].theoryNumber) {
this.$modal.msg("该条物料明细已完成收货!")
} else {
// this.workOrderCode = data.pwoCode
this.formData.productInTaskCode = data.productInTaskCode
// this.formData.id
let obj = {
materialCode: res.data[0].materialCode,
materialName: res.data[0].materialName,
materialBatchNo: res.data[0].materialBatchNo,
theoryNumber: res.data[0].theoryNumber,
receivedNumber: num,
productInTaskDetailId: data.id,
type: res.data[0].type,
id: res.data[0].id
}
this.formData.wmsProductReceiveDetailList.push(obj);
this.isReceive = true;
this.materialLabel = null;
this.show = false;
}
} else {
// this.workOrderCode = data.pwoCode
getReceiveDetails({
productInTaskCode: data.productInTaskCode
}).then((res) => {
if (res.details.length > 0) {
this.formData = res.rcv;
this.formData.productInTaskCode = data.productInTaskCode
this.formData.wmsProductReceiveDetailList = []
this.formData.wmsProductReceiveDetailList.push(res.details
.find(item =>
item.productInTaskDetailId == data.id));
this.isReceive = false;
this.materialLabel = null;
this.show = false;
} else {
this.$modal.msg("任务单里未查到该条明细!")
}
});
// let obj = {
// materialCode: data.materialCode,
// materialName: data.materialName,
// materialBatchNo: data.materialBatchNo,
// theoryNumber: data.number,
// productInTaskDetailId: data.id,
// type: data.type
// }
// this.formData.wmsProductReceiveDetailList.push(obj);
}
})
}
},
scanBarMaterialLabel() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.materialLabel = res.result;
// console.log(materialLabel)
_this.confirmMaterialLabel(_this.materialLabel);
}
});
},
clearPwo() {
if (this.workOrderCode == '' || !this.workOrderCode) {
this.selectTypeList();
}
},
scanBarPwo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.workOrderCode = res.result;
_this.scanBarPwoCode();
}
});
},
scanBarPwoCode() {
this.productInTaskCodeList = [];
if (this.workOrderCode) {
listTask({
workOrderCode: this.workOrderCode
}).then(async response => {
for (var i = 0; i < response.rows.length; i++) {
this.productInTaskCodeList.push(response.rows[i].productInTaskCode);
}
});
}
},
selectTypeList() {
listTask().then(async res => {
// console.log(res);
for (var i in res.rows) {
this.productInTaskCodeList.push(res.rows[i].productInTaskCode);
}
// console.log(this.drawTaskCodeList)
});
},
bindDateChange(e) {
this.formData.arriveTime = e.detail.value
},
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`;
},
scanBarCode() {
if (this.formData.productInTaskCode) {
let data = {
productInTaskCode: this.formData.productInTaskCode
}
getReceiveDetails(this.formData).then(res => {
this.formData.wmsProductReceiveDetailList = res.details;
})
} else {
this.$modal.msg("请输入产品任务单!")
}
},
//产品任务单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.productInTaskCode = res.result;
_this.scanBarCode();
}
});
},
//签收员编码
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.drawBy = res.result;
// _this.scanBarCode();
}
});
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定收取该物料吗?',
success: function(res) {
if (res.confirm) {
_this.formData.wmsProductReceiveDetailList.map(item => {
item.secondTheoryNumber = item.number;
item.secondUnitId = item.unitId;
item.secondArriveNumber = item.arriveNumber;
item.secondActualNumber = item.actualNumber;
item.secondActualUnitId = item.unitId;
return item
})
if (_this.isReceive == false) {
//判断实收数量是否超出应收数量
let isNumOver = false;
for (var i in _this.formData.wmsProductReceiveDetailList) {
if (_this.formData.wmsProductReceiveDetailList[i]
.actualNumber > _this.formData.wmsProductReceiveDetailList[
i].theoryNumber) {
_this.$modal.msg("实收数量超出应收数量,请检查!");
isNumOver = true;
}
}
if (isNumOver == false) {
_this.$modal.loading('提交中')
addReceive(_this.formData).then(async res => {
_this.$modal.msgSuccess("收货成功!");
_this.$modal.closeLoading();
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
});
}
} else {
let isNumOver = false;
for (var i in _this.formData.wmsProductReceiveDetailList) {
if (_this.formData.wmsProductReceiveDetailList[i]
.actualNumber > (_this.formData
.wmsProductReceiveDetailList[i].theoryNumber - _this
.formData.wmsProductReceiveDetailList[i].receivedNumber
)) {
_this.$modal.msg("实收数量超出应收数量,请检查!");
isNumOver = true;
}
}
if (isNumOver == false) {
console.log(_this.formData.wmsProductReceiveDetailList)
_this.formData.wmsProductReceiveDetailList[0].actualNumber +=
_this.formData.wmsProductReceiveDetailList[0]
.receivedNumber;
_this.formData.wmsProductReceiveDetailList[0].arriveNumber +=
_this.formData.wmsProductReceiveDetailList[0]
.receivedNumber;
_this.$modal.loading('提交中')
updateReceiveDetail(_this.formData.wmsProductReceiveDetailList[
0])
.then(async res => {
_this.$modal.msgSuccess("收货成功!");
_this.$modal.closeLoading();
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
});
}
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,217 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<!-- <uni-forms-item label="生产领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-combox :candidates="drawTaskCodeList" emptyTips="无" @input="scanBarCode" v-model="formData.drawTaskCode"></uni-combox>
</uni-forms-item> -->
<uni-forms-item label="生产领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-easyinput ref="myInput" suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode"
v-model="formData.drawTaskCode" type="text" />
</uni-forms-item>
<!-- <uni-section title="确认生产领料出库单明细单" type="line" padding style="">
<uni-data-picker :localdata="dataTree" v-model="formData.drawOutDetailCode"
@change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened" @popupclosed="onpopupclosed">
</uni-data-picker>
</uni-section> -->
<uni-forms-item label="生产领料出库单" :labelWidth='90' name="drawOutCode">
<uni-combox :candidates="drawOutCodeList" emptyTips="无" @input="scanBarCodeOut"
v-model="formData.drawOutCode"></uni-combox>
</uni-forms-item>
<uni-forms-item label="生产领料出库单明细编码" :labelWidth='90' name="drawOutDetailCode" style="">
<view style="overflow: visible;z-index: 200;">
<uni-combox :candidates="drawOutDetailCodeList" style="z-index: 200px;" emptyTips="无"
@input="selectDetail" v-model="formData.drawOutDetailCode"></uni-combox>
</view>
<!-- <scroll-view style="overflow: visible;z-index: 200px;"> -->
<!-- <uni-combox :candidates="drawOutDetailCodeList" :z-index="100" emptyTips="无" @input="selectDetail" v-model="formData.drawOutDetailCode"></uni-combox> -->
<!-- </scroll-view> -->
</uni-forms-item>
<uni-forms-item>
</uni-forms-item>
</uni-forms>
<!-- <uni-collapse-item title="领料确认数量单明细" :open="true" > -->
<uni-collapse-item title="出库确认数量单明细" :open="true">
<uni-swipe-action :open="true">
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in formData.details" @click="(data) => clickDetail(index,data)"
@change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90' :name="'details.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90' :name="'details.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90' :name="'details.'+ index +'.materialBatchNo'">
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90' :name="'details.'+ index +'.materialLotNo'">
<uni-easyinput disabled type="number" v-model="item.materialLotNo" />
</uni-forms-item>
<uni-forms-item label="数量" :labelWidth='90' :name="'details.'+ index +'number'">
<uni-easyinput disabled type="number" v-model="item.pickNumber" />
</uni-forms-item>
<u-button type="primary" @click="submit(index)">数量正确</u-button>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-collapse>
</view>
</template>
<script>
import {
listOut,
getOut,
listPick,
addOut,
listTask,
getDetails,
getListDetail,
updatePick
} from "@/api/wms/pdcMaterial.js";
export default {
mounted() {
let myInput = this.$refs.myInput;
let inputWidth = myInput.$el.offsetWidth; // 获取元素宽度
console.log(inputWidth); // 输出宽度
},
data() {
return {
formData: {
drawTaskCode: null,
drawOutCode: '',
drawOutDetailCode: '',
details: [],
},
drawOutCode: null,
drawOutDetailCodeList: [],
drawOutCodeList: [],
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
drawTaskCode: {
rules: [{
required: true,
errorMessage: '请输入领料任务单!'
}]
}
}
}
},
methods: {
collapseChange(isOpen) {
if (isOpen) {
this.showCombox = true;
} else {
this.showCombox = false;
this.$refs.combox.close(); // 使combox组件关闭
}
},
selectDetail() {
if (this.formData.drawOutDetailCode) {
this.formData.details = []
let obj = this.detailsList.find(item => item.drawOutDetailCode == this.formData.drawOutDetailCode)
obj.drawTaskCode = this.formData.drawTaskCode;
getListDetail(obj).then(response => {
this.formData.details = response.drawPickDetailList.map(obj => {
obj.storageLocationCode = null;
if (obj.pickArea) {
obj.storageLocationCode = obj.pickArea;
}
return obj;
});
})
}
},
scanBarCodeOut() {
this.detailsList = [];
this.drawOutDetailCodeList = [];
if (this.formData.drawOutCode) {
listOut({
drawOutCode: this.formData.drawOutCode
}).then(async res => {
getOut(res.rows[0].id).then(async response => {
if (response.data.wmsDrawOutDetailList.length > 0) {
this.detailsList = response.data.wmsDrawOutDetailList;
for (var i in response.data.wmsDrawOutDetailList) {
this.drawOutDetailCodeList.push(response.data
.wmsDrawOutDetailList[i].drawOutDetailCode);
}
}
})
});
}
// this.$nextTick(() => {
// this.$refs.collapse.resize();
// });
},
scanBarCode() {
this.drawOutCodeList = [];
if (this.formData.drawTaskCode) {
let data = {
drawTaskCode: this.formData.drawTaskCode
}
listOut(data).then(async res => {
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
this.drawOutCodeList.push(res.rows[i].drawOutCode);
}
}
});
} else {
this.$modal.msg("请输入生产领料任务单!")
}
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.drawTaskCode = res.result;
_this.scanBarCode();
}
});
},
submit(index) {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定数量正确吗?',
success: function(res) {
if (res.confirm) {
if (_this.formData.details[index].checkStatus == '2') {
_this.$modal.msg("该条明细数量已检验!")
} else {
_this.formData.details[index].drawOutCode = _this.formData
.drawOutCode;
_this.formData.details[index].checkStatus = "2";
updatePick(_this.formData.details[index]).then(response => {
_this.$modal.msgSuccess("检验完成!");
});
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,538 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="直接出库单" :open="true">
<uni-forms-item label="工单" :labelWidth='90' name="workOrderCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPwo" @change="clearPwo"
v-model="workOrderCode" @confirm="scanBarPwoCode" type="text" />
</uni-forms-item>
<!-- <view class="example-body"> -->
<uni-forms-item label="生产领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-combox :candidates="drawTaskCodeList" emptyTips="无" @input="scanBarCode"
v-model="formData.drawTaskCode"></uni-combox>
</uni-forms-item>
<!-- </view> -->
<!-- <uni-forms-item label="生产领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode" v-model="formData.drawTaskCode" type="text" />
</uni-forms-item> -->
<uni-forms-item label="领料员" :labelWidth='90' name="drawBy">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.drawBy" type="text" />
<uni-data-picker popup-title="请选择领料员" :localdata="dataTree" v-model="pickerData1"
@change="onchange1" @nodeclick="onnodeclick1" @popupopened="onpopupopened"
@popupclosed="onpopupclosed" style="margin-top: 5px;" :preload="true">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="出库员" :labelWidth='90' name="warehouseOutBy">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar2" v-model="formData.warehouseOutBy"
type="text" />
<uni-data-picker popup-title="请选择出库员" :localdata="dataTree" v-model="pickerData2"
@change="onchange2" @nodeclick="onnodeclick2" @popupopened="onpopupopened"
@popupclosed="onpopupclosed" style="margin-top: 5px;" :preload="true">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
<uni-easyinput v-model="formData.warehouseCode" type="text" />
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="直接出库单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in formData.wmsDrawOutDetailList"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="领料出库单明细编码" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.drawOutDetailCode'">
<uni-easyinput type="text" disabled v-model="item.drawOutDetailCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialBatchNo'">
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialLotNo'">
<uni-easyinput disabled type="number" v-model="item.materialLotNo" />
</uni-forms-item>
<uni-forms-item label="库位条码" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.storageLocationBarcode'">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
@change="(data) => splitStlBarcode(index,data)" type="text"
v-model="item.storageLocationBarcode" />
</uni-forms-item>
<uni-forms-item label="出库数量" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'secondNumber'">
<u-number-box inputWidth="120" button-size="36" v-model="item.secondNumber"
min="0"></u-number-box>
</uni-forms-item>
<uni-forms-item label="单位" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'unitText'">
<uni-easyinput type="text" disabled v-model="item.unitText" />
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listTask,
listPick,
addOut,
getDetails,
getDrawOutDirectlyByTaskCode
} from "@/api/wms/pdcMaterial.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
import {
listUnit,
convertBySecondUnitOrNum,
} from "@/api/basic/unit";
import {
listDepartment
} from "@/api/basic/department";
export default {
mounted() {
// this.test();
listUnit().then((res) => {
this.unitList = res.rows.map(item => {
let obj = {
text: item.unitCode + ":" + item.unitName,
value: item.id
}
return obj
})
})
this.selectTypeList();
listEmployee().then((res) => {
this.empList = res.rows
})
listDepartment().then((res) => {
this.dptList = res.rows
})
},
data() {
return {
dptList: [],
unitList: [],
empList: [],
item: '',
dataTree: [],
pickerData1: '',
pickerData2: '',
workOrderCode: '',
drawTaskCodeList: [],
checkStorageLocationBarcode: true,
formData: {
drawTaskCode: '',
billType: '2',
status: '1',
wmsDrawOutDetailList: [],
drawBy: null,
warehouseCode: null,
warehouseOutBy: null
},
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
drawTaskCode: {
rules: [{
required: true,
errorMessage: '请输入生产领料任务单!'
}]
},
drawBy: {
rules: [{
required: false,
errorMessage: '请输入领料员编码!'
}]
},
warehouseOutBy: {
rules: [{
required: false,
errorMessage: '请输入出库员编码!'
}]
},
// warehouseCode:{
// rules:[
// {required:true,errorMessage:'请输入仓库编码!'}
// ]
// },
}
}
},
methods: {
onnodeclick1(e) {
console.log(e)
this.item = e
this.onchange1(this.item)
},
onnodeclick2(e) {
console.log(e)
this.item = e
this.onchange2(this.item)
},
onpopupopened(e) {
this.dataTree = []
this.empList.filter(item => item.deptId).forEach(item => {
item.departmentTitle = this.dptList.find(item2 => item2.id == item.deptId).departmentTitle
// 检查dataTree中是否已存在相同部门
let existingDept = this.dataTree.find(dept => dept.value === item.deptId);
if (existingDept) {
// 如果已存在相同部门则将员工信息push进该部门的children数组
existingDept.children.push({
text: item.name,
value: item.empCode
});
} else {
// 如果不存在相同部门则创建一个新部门对象包括children数组并将员工信息push进去
let newDept = {
text: item.departmentTitle,
value: item.deptId,
children: [{
text: item.name,
// value: item.empCode + '/'
value: item.empCode
}]
};
this.dataTree.push(newDept);
}
})
console.log(this.dataTree)
},
onpopupclosed() {
//处理不同步
// this.$nextTick(() => {
// this.pickerData = this.item.value;
// this.formData.pickerData = this.item.value;
// if (!this.item) return
// this.onchange(this.item)
// });
},
onchange2(e) {
console.log(e)
this.formData.warehouseOutBy = null
this.$set(this.formData, 'warehouseOutBy', e.value.split('/')[0])
// if (e.value.includes('/')) {
// this.$set(this.formData, 'warehouseOutBy', e.value.split('/')[0])
// }
},
onchange1(e) {
console.log(e)
this.formData.drawBy = null
this.$set(this.formData, 'drawBy', e.value.split('/')[0])
// if (e.value.includes('/')) {
// this.$set(this.formData, 'drawBy', e.value.split('/')[0])
// }
},
clickDetail(e, index) {
console.log('返回:', e);
this.formData.wmsDrawOutDetailList.splice(e, 1);
},
splitStlBarcode(i) {
// this.formData.wmsDrawOutDetailList[i].whCode = null;
// this.formData.wmsDrawOutDetailList[i].storageAreaCode = null;
// this.formData.wmsDrawOutDetailList[i].shelvesCode = null;
// this.formData.wmsDrawOutDetailList[i].storageLocationCode = null;
// let array = this.formData.wmsDrawOutDetailList[i].storageLocationBarcode.split('-');
// let [whCode, storageAreaCode, shelvesCode, storageLocationCode, extra] = array;
// this.formData.wmsDrawOutDetailList[i].whCode = whCode || null;
// this.formData.wmsDrawOutDetailList[i].storageAreaCode = storageAreaCode || null;
// this.formData.wmsDrawOutDetailList[i].shelvesCode = shelvesCode || null;
// this.formData.wmsDrawOutDetailList[i].storageLocationCode = extra ? `${storageLocationCode}-${extra}` :
// storageLocationCode || null;
const _this = this;
const detail = _this.formData.wmsDrawOutDetailList[i];
detail.whCode = null;
detail.storageAreaCode = null;
detail.shelvesCode = null;
detail.storageLocationCode = null;
let barcode = detail.storageLocationBarcode;
if (!barcode) {
return; // 如果没有条码,不做任何处理
}
let [whCode, storageAreaCode, shelvesCode, storageLocationCode, extra] = barcode.split('-');
// const checkAndSetField = (obj, field, value, msg) => {
// if (!value) {
// _this.$modal.msg(msg);
// _this.$set(obj, field, null);
// _this.$nextTick(() => {
// _this.$set(obj, "storageLocationBarcode", null);
// });
// obj.storageLocationBarcode = null
// return false;
// }
// return true;
// };
if (whCode) {
let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
if (!warehouseObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
}
if (storageAreaCode) {
let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode ==
storageAreaCode);
if (!areaObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("库区不存在!");
return;
}
if (shelvesCode) {
let shelvesObj = _this.$store.getters.shelvesOptions.find(item => item.storageShelvesCode ==
shelvesCode);
if (!shelvesObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
};
if (storageLocationCode) {
let locationObj = _this.$store.getters.locationOptions.find(item => item
.storageLocationCode == (extra ?
(storageLocationCode + '-' + extra) : storageLocationCode));
if (!locationObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("库位不存在!");
return;
};
}
}
}
}
_this.checkStorageLocationBarcode = true;
detail.whCode = whCode || null;
detail.storageAreaCode = storageAreaCode || null;
detail.shelvesCode = shelvesCode || null;
detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
},
scanBarstorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.formData.wmsDrawOutDetailList[i], "storageLocationBarcode",
res
.result);
_this.splitStlBarcode(i);
}
});
},
clearPwo() {
if (this.workOrderCode == '' || !this.workOrderCode) {
this.selectTypeList();
}
},
scanBarPwo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.workOrderCode = res.result;
_this.scanBarPwoCode();
}
});
},
scanBarPwoCode() {
this.drawTaskCodeList = [];
if (this.workOrderCode) {
listTask({
workOrderCode: this.workOrderCode
}).then(async response => {
for (var i = 0; i < response.rows.length; i++) {
this.drawTaskCodeList.push(response.rows[i].drawTaskCode);
}
});
}
},
selectTypeList() {
listTask().then(async res => {
for (var i in res.rows) {
this.drawTaskCodeList.push(res.rows[i].drawTaskCode);
}
});
},
test() {
},
scanBarCode() {
if (this.formData.drawTaskCode) {
let data = {
drawTaskCode: this.formData.drawTaskCode
}
//换成直接出库调用的明细接口
getDrawOutDirectlyByTaskCode(this.formData).then((res) => {
console.log(res);
this.formData = res.wmsDrawOut;
this.formData.wmsDrawOutDetailList = res.wmsDrawOut.wmsDrawOutDetailList.map(
item => {
let unitobj = this.unitList.find(i => i.value == item.secondUnitId)
if (unitobj) {
item.unitText = unitobj.text
}
item.storageLocationBarcode = item.whCode ? (item.storageAreaCode ? (
item.shelvesCode ? (item.storageLocationCode ? (item
.whCode + '-' + item.storageAreaCode + '-' + item
.shelvesCode +
'-' + item.storageLocationCode) : (item.whCode +
'-' + item.storageAreaCode + '-' + item
.shelvesCode
)) : (item.whCode + '-' + item.storageAreaCode)) : item
.whCode) : ''
return item
})
});
} else {
this.$modal.msg("请输入生产领料任务单!")
}
},
//生产领料任务单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.drawTaskCode = res.result;
_this.scanBarCode(_this.formData.drawTaskCode);
}
});
},
//领料员
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.drawBy = res.result;
console.log(res.result);
}
});
},
//出库员
scanBar2() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.warehouseOutBy = res.result;
}
});
},
//仓库编码
scanBar3() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.warehouseCode = res.result;
}
});
},
/**第二数量(数量改变)
* 要求基本单位和数量不为空
* */
async secondNumberChange(item) {
if (item.secondNumber == null || item.secondNumber == "") {
// this.$emit("update:number", 0);
item.number=0
}
if (item.unitId == null || item.unitId == "") {
// this.$emit("update:number", this.secondNumber);
item.number=item.secondNumber
} else if (
item.secondNumber &&
item.materialCode &&
item.materialCode != "" &&
item.unitId &&
item.secondUnitId
) {
console.log('secondNumber',item.secondNumber)
let params = {
materialCode: item.materialCode,
number: null,
unitId: item.unitId,
secondUnitId: item.secondUnitId,
secondNumber: item.secondNumber,
};
await convertBySecondUnitOrNum(params).then((response) => {
console.log('第一数量',response.data.number)
// this.$emit("update:number", response.data.number);
item.number=response.data.number;
});
} else { //其它所有异常情况,都将第二数量同步传给第一数量
// this.$emit("update:number", this.inputNumber);
item.number=item.secondNumber;
}
return item
},
submit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成直接出库吗?',
success: async function(res) {
if (res.confirm) {
// _this.formData.wmsDrawOutDetailList.map(item => {
// item.number = item.secondNumber;
// item.unitId = item.secondUnitId;
// return item
// })
await Promise.all(_this.formData.wmsDrawOutDetailList.map(async item => {
return await _this.secondNumberChange(item)
}))
if (!_this.checkStorageLocationBarcode) {
_this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
_this.$modal.loading('提交中')
console.log(_this.formData);
addOut(_this.formData).then(res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("直接出库成功!");
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,293 @@
<style lang="scss">
.text {
font-size: 12px;
color: #666;
margin-top: 5px;
}
.uni-px-5 {
padding-left: 10px;
padding-right: 10px;
}
.uni-pb-5 {
padding-bottom: 10px;
}
.container {
overflow: hidden;
}
.custom-cover {
flex: 1;
flex-direction: row;
position: relative;
}
.cover-content {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 40px;
background-color: rgba($color: #000000, $alpha: 0.4);
display: flex;
flex-direction: row;
align-items: center;
padding-left: 15px;
font-size: 14px;
color: #fff;
}
.card-actions {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
}
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
}
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
}
.cover-image {
flex: 1;
height: 150px;
}
.no-border {
border-width: 0;
}
</style>
<template>
<view>
<uni-collapse>
<!-- <uni-collapse-item title="筛选单据"> -->
<!-- <view class="content"> -->
<uni-forms>
<!-- <uni-forms-item label="生产领料任务单编码" label-align="center" :label-width="100">
<uni-combox :candidates="taskListQuery" placeholder="请选择生产领料任务单编码"
v-model="queryParams.drawTaskCode"></uni-combox>
</uni-forms-item> -->
<uni-forms-item label="生产工单号">
<uni-combox :candidates="workOrderCodeArr" placeholder="请选择生产工单号"
v-model="queryParams.workOrderCode"></uni-combox>
</uni-forms-item>
<!-- <uni-forms-item label="来源单据">
<uni-combox :candidates="srcDocCodeArr" placeholder="请输入来源单据"
v-model="queryParams.srcDocCode"></uni-combox>
</uni-forms-item> -->
<uni-forms-item label="仓库">
<uni-data-select v-model="queryParams.warehouseCode"
:localdata="warehouseOptions"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="状态">
<uni-data-select v-model="queryParams.status" :localdata="statusOptions"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="领料类型">
<uni-data-select v-model="queryParams.drawType" :localdata="drawTypeArr"></uni-data-select>
</uni-forms-item>
<button type="primary" @click="querySub">查询</button>
<uni-collapse-item title="领料任务单" :open="isBool">
<uni-card :is-shadow="false" is-full v-for="(item,index) in getListArr" :key="index">
<uni-row class="demo-uni-row">
<uni-col :span="24">
<view>
<uni-forms-item label="领料单号" :labelWidth='90'>
<uni-easyinput :value="item.drawTaskCode" type="text" :disabled="true" />
</uni-forms-item>
<uni-forms-item label="来源单号" :labelWidth='90'>
<uni-easyinput :value="item.srcDocCode" type="text" :disabled="true" />
</uni-forms-item>
<uni-forms-item label="工单单号" :labelWidth='90'>
<uni-easyinput :value="item.workOrderCode" type="text" :disabled="true" />
</uni-forms-item>
<uni-forms-item label="状态" :labelWidth='90'>
<uni-easyinput
:value="statusOptions.find(items=>items.value == item.status).text"
type="text" :disabled="true" />
</uni-forms-item>
<uni-forms-item label="仓库" :labelWidth='90'>
<uni-easyinput
:value="isNaN(warehouseOptions.find(items=>items.value == item.warehouseCode))?'':warehouseOptions.find(items=>items.value == item.warehouseCode).text"
type="text" :disabled="true" />
</uni-forms-item>
</view>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="10">
<button type="primary" @click="lokDetails(item,index)">查看明细</button>
</uni-col>
<uni-col :span="11" style="margin: 0 .5rem;">
<button type="primary" @click="productionListFuc(item,index)">生成拣货单</button>
</uni-col>
</uni-row>
</uni-card>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
</view>
</template>
<script>
import {
listTask,
listWarehouse, //仓库
schedulePick,
} from "@/api/wms/materRequisitiontask";
import {
getTask,
listPick
} from "@/api/wms/pdcMaterial"
export default {
created() {
this.getDicts("wms_bill_status").then(response => { // 单据状态
this.statusOptions = response.data.map(item => {
return {
text: item.dictLabel,
value: item.dictValue
}
})
});
this.getDicts("wms_draw_type").then(response => { // 单据状态
console.log(response, "response");
this.drawTypeArr = response.data.map(item => {
return {
text: item.dictLabel,
value: item.dictValue
}
})
});
listTask().then(response => {
response.rows.forEach(item => {
this.taskListQuery.push(item.drawTaskCode);
this.workOrderCodeArr.push(item.workOrderCode);
this.srcDocCodeArr.push(item.srcDocCode);
});
console.log(this.taskListQuery[0]);
});
// listEmployee().then(response => {
// this.listEmpoyeeOptions = response.rows;
// });
listWarehouse().then(response => { //仓库数据
this.warehouseOptions = response.rows.map(item => {
return {
text: item.warehouseCode + ':' + item.warehouseName,
value: item.warehouseCode
}
})
this.listWarehouseOptions = response.rows;
});
},
data() {
return {
taskListQuery: [],
getListArr: [],
workOrderCodeArr: [],
srcDocCodeArr: [],
warehouseOptions: [],
listWarehouseOptions: [],
statusOptions: [],
drawTypeArr: [],
isBool: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 50,
orderByColumn: "id",
isAsc: "desc",
// drawTaskCode: null,
workOrderCode: null,
status: null,
estimateDrawTime: null,
drawBy: null,
warehouseCode: null,
transportBy: null,
enclosure: null
},
}
},
methods: {
productionListFuc(item, index) {
const _this = this
listPick({
drawTaskCode: item.drawTaskCode,
}).then(res => {
if (res.total > 0) {
_this.$model.msgError("已生成拣货单")
} else {
getTask(item.id).then(res => {
console.log(res.data, "res");
res.data.wmsDrawTaskDetailList.forEach(item => {
item.secondPlanPickNumber = item.number
item.planPickNumber = item.number
})
schedulePick(res.data).then(res => {
_this.$modal.msgSuccess(res.mag)
})
})
}
})
},
getList() {
listTask(this.queryParams).then(response => {
console.log(response, "poe");
this.getListArr = response.rows
this.isBool = true;
})
},
lokDetails(item, index) { //查看明细跳转
this.$tab.navigateTo("/pages/wms/pdcMaterial/materRequisitiontask/materRequisitiontaskDetails?data=" +
encodeURIComponent(JSON.stringify(item)));
},
querySub() {
this.getList();
this.queryParams = {
drawTaskCode: null,
workOrderCode: null,
status: null,
estimateDrawTime: null,
drawBy: null,
warehouseCode: null,
transportBy: null,
enclosure: null
}
}
}
}
</script>

View File

@@ -0,0 +1,261 @@
<template>
<view>
<uni-forms>
<uni-collapse>
<uni-row>
<uni-col :span="12">物料编码:{{checkedMaterialDetailList[0].materialCode}}</uni-col>
<uni-col :span="12">待分配:{{options.number}},已分配:{{planNumer}}</uni-col>
</uni-row>
<uni-row>
<uni-col :span="24">物料名称:{{checkedMaterialDetailList[0].materialName}}</uni-col>
</uni-row>
<uni-collapse-item title="选择物料">
<uni-table ref="table" border type="selection" emptyText="暂无更多数据"
@selection-change="selectionChange">
<uni-tr>
<uni-th width="40" align="center">库位</uni-th>
<!-- <uni-th width="40" align="center">数量</uni-th> -->
<uni-th width="60" align="center">可用数量</uni-th>
<uni-th width="60" align="center">库存总量</uni-th>
<uni-th width="120" align="center">计划拣货数量</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in checkedMaterialDetailList" :key="index">
<uni-td>{{ item.whCode }}</uni-td>
<uni-td align="center">{{ item.number }}</uni-td>
<uni-td>
{{ item.number }}
</uni-td>
<uni-td align="center">
<input type="number" v-model="item.planNum" placeholder="请输入计划拣货数量" />
</uni-td>
</uni-tr>
</uni-table>
</uni-collapse-item>
</uni-collapse>
<button @click="submit" type="primary" style="position: fixed;bottom: 0;width: 100vw;">确定</button>
</uni-forms>
</view>
</template>
<script>
import {
selectExactStockList,
getConfigKey,
addU9StockRecord,
updateTask
} from "@/api/wms/materRequisitiontask";
import {
convertBySecondUnitOrNum
} from "@/api/basic/unit"
export default {
data() {
return {
options: {},
checkedMaterialDetailList: [],
wmsDrawTaskDetailList: [],
planNumer: 0,
countNum: 0,
checkedMaterialDetailListArr: [],
getListArr: {},
}
},
onLoad(options) {
this.options = JSON.parse(options.data)
this.getListArr = JSON.parse(options.getListArr)
this.wmsDrawTaskDetailList = JSON.parse(options.wmsDrawTaskDetailList)
console.log(this.wmsDrawTaskDetailList, options, "this.wmsDrawTaskDetailList");
selectExactStockList({
materialCode: JSON.parse(options.data).materialCode,
businessType: 'PRODUCE_DRAW'
}).then(res => {
if (res.total) {
this.checkedMaterialDetailList = res.rows
}
})
convertBySecondUnitOrNum({
materialCode: this.wmsDrawTaskDetailList[JSON.parse(options.index)].materialCode,
unitId: this.wmsDrawTaskDetailList[JSON.parse(options.index)].unitId,
secondUnitId: this.wmsDrawTaskDetailList[JSON.parse(options.index)].secondUnitId,
secondNumber: this.wmsDrawTaskDetailList[JSON.parse(options.index)].secondNumber,
}).then(res => {
console.log("convertBySecondUnitOrNum", res.data);
})
},
methods: {
selectionChange(item, indexs) {
this.checkedMaterialDetailListArr = [];
let count = 0
count = item.length;
this.countNum = count
let planNumers = 0
item.detail.index.map(item => {
planNumers += Number(this.checkedMaterialDetailList[item].planNum) ?? 0;
// console.log(this.checkedMaterialDetailList[item],"this.checkedMaterialDetailList[item]",item);
this.checkedMaterialDetailListArr.push(this.checkedMaterialDetailList[item])
})
console.log(this.checkedMaterialDetailListArr, "this.checkedMaterialDetailListArr");
this.planNumer = planNumers
},
/**第二数量(数量改变)
* 要求基本单位和数量不为空
*
* */
async secondNumberChange(materialCode, number, unitId, seconNumber, secondUnitId) {
console.log(materialCode, number, unitId, seconNumber, secondUnitId);
// 设置父组件的第一数量
if (seconNumber == null || seconNumber === "") {
number = 0;
} else if (unitId == null || unitId === "") {
number = seconNumber;
} else if (materialCode && materialCode !== "" && unitId && secondUnitId) {
let params = {
materialCode: materialCode,
number: null,
unitId: unitId,
secondUnitId: secondUnitId,
secondNumber: seconNumber,
};
const response = await convertBySecondUnitOrNum(params);
console.log("res", params, "params", response);
number = response.data.number;
} else {
// 其它所有异常情况,都将第二数量同步传给第一数量
number = seconNumber;
}
return number; // 返回修改后的 number 值
},
async submit() {
let row = this.options; //明细主表信息
if (this.planNumer > this.options.number) {
return this.$modal.msgError("分配数量不能大于待分配数量");
}
if (this.countNum == 0) {
return this.$modal.msgError("请先选择要调拨的物料详细数据")
}
/**删除用来选择的物料,即无批号箱号信息的记录 */
for (let i = 0; i < this.wmsDrawTaskDetailList.length; i++) {
if (row.id == this.wmsDrawTaskDetailList[i].id) {
this.wmsDrawTaskDetailList.splice(i, 1);
break;
}
};
/**插入选中的物料 */
let count = 0;
for (let i = 0; i < this.checkedMaterialDetailListArr.length; i++) { //库存物料
// let obj = { ...this.row };
let obj = {};
Object.assign(obj, row)
obj.id = null;
obj.originWmsMaterialStockId = row.wmsMaterialStockId == null ? this.checkedMaterialDetailListArr[
i]
.id :
row.wmsMaterialStockId;
obj.wmsMaterialStockId = this.checkedMaterialDetailListArr[i].id;
obj.materialCode = this.checkedMaterialDetailListArr[i].materialCode;
obj.materialName = this.checkedMaterialDetailListArr[i].materialName;
obj.materialBatchNo = this.checkedMaterialDetailListArr[i].batchNo;
obj.materialLotNo = this.checkedMaterialDetailListArr[i].lotNo;
obj.originAreaCode = this.checkedMaterialDetailListArr[i].areaCode;
obj.originShelvesCode = this.checkedMaterialDetailListArr[i].shelvesCode;
obj.originLocationCode = this.checkedMaterialDetailListArr[i].storageLocationCode;
obj.number = isNaN(this.checkedMaterialDetailListArr[i].planNum) ? 0 : Number(this
.checkedMaterialDetailListArr[i].planNum);
//将一单一数传入二单二数中,根据库存的第一单位,第二单位,第一数量获取第二数量
if (obj.unitId != obj.secondUnitId) {
obj.secondNumber = await this.secondNumberChange(obj.materialCode, obj.secondNumber, obj
.secondUnitId, obj.number, obj.unitId);
} else {
obj.secondNumber = obj.number;
}
obj.productionVersion = this.checkedMaterialDetailListArr[i].productionVersion;
// obj.schemeNumber = this.row[i].schemeNumber;
obj.targetAreaCode = "";
obj.targetShelves = "";
obj.targetLocation = "";
obj.availableNumber = this.checkedMaterialDetailListArr[i].number - this
.checkedMaterialDetailListArr[i]
.lockNumber;
obj.schemeNumber = "";
obj.actualNumber = "";
obj.numUnitId = "";
obj.delStatus = "";
count += Number(obj.number) ?? 0;
console.log("count", count, obj.number)
//u9库存信息插入
getConfigKey("wms.u9.whMode").then(response => {
if (response.msg == 'true') {
let u9Obj = {};
u9Obj.materialCode = this.checkedMaterialDetailListArr[i].materialCode;
u9Obj.materialName = this.checkedMaterialDetailListArr[i].materialName;
u9Obj.batchNo = this.checkedMaterialDetailListArr[i].batchNo;
u9Obj.lotNo = this.checkedMaterialDetailListArr[i].lotNo;
u9Obj.whCode = this.checkedMaterialDetailListArr[i].whCode;
u9Obj.areaCode = this.checkedMaterialDetailListArr[i].areaCode;
u9Obj.shelvesCode = this.checkedMaterialDetailListArr[i].shelvesCode;
u9Obj.storageLocationCode = this.checkedMaterialDetailListArr[i]
.storageLocationCode;
u9Obj.number = this.checkedMaterialDetailListArr[i].number;
u9Obj.seibanNo = this.checkedMaterialDetailListArr[i].seibanNo;
u9Obj.resvStQty = this.checkedMaterialDetailListArr[i].resvStQty;
u9Obj.lockNumber = this.checkedMaterialDetailListArr[i].planNum;
addU9StockRecord(u9Obj).then(res => {
this.$modal.msgSuccess("库存选择成功");
console.log(res, "666");
obj.u9WmsMaterialStockId = res.obj.id;
});
}
})
this.wmsDrawTaskDetailList.push(obj);
}
if (count < row.number) {
// let obj = this.row;
let obj = {};
Object.assign(obj, row)
obj.number = row.number - count;
console.log(obj.materialCode, obj.secondNumber, obj
.secondUnitId, obj.number, obj.unitId, "obj.materialCode,");
//将一单一数传入二单二数中,根据库存的第一单位,第二单位,第一数量获取第二数量
if (obj.unitId != obj.secondUnitId) {
obj.secondNumber = await this.secondNumberChange(obj.materialCode, obj.secondNumber, obj
.secondUnitId, obj.number, obj.unitId);
console.log("sec2", obj.secondNumber);
} else {
obj.secondNumber = obj.number;
}
// obj.secondNumber = obj.number;
console.log(obj)
this.wmsDrawTaskDetailList.push(obj);
}
console.log(this.$tab, "this.$tab", this.wmsDrawTaskDetailList);
// uni.setStorageSync('inVentData', JSON.stringify(this.wmsDrawTaskDetailList));
// this.$tab.navigateBack({
// delta: 1 // 返回上一级页面
// });
this.getListArr.wmsDrawTaskDetailList = this.wmsDrawTaskDetailList
updateTask(this.getListArr).then(res => {
this.$modal.msgSuccess("修改成功")
})
},
},
}
</script>
<style>
</style>

View File

@@ -0,0 +1,153 @@
<template>
<view class="materRe">
<uni-forms>
<uni-collapse>
<uni-forms-item :labelWidth="90" label="领料单号">
<uni-easyinput :value="options.drawTaskCode" disabled />
</uni-forms-item>
<button type="primary" @click="allocateStockBtn">一键分配库存</button>
<uni-collapse-item :open="true" title="明细信息">
<uni-card v-for="(item,index) in getTaskData.wmsDrawTaskDetailList" :key="index">
<uni-row>
<uni-col :span="12" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
物料编码:{{item.materialCode}}
</uni-forms-item>
</uni-col>
<uni-col :span="12" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
数量:{{item.number}}
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="12" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
物料名称:{{item.materialName}}
</uni-col>
<uni-col :span="12" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
单位:{{item.unitId}}
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="12" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
物料规格:{{item.specification}}
</uni-col>
<uni-col :span="12" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
可用数量:{{item.availableNumber}}
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="24" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis; ">
物料批号:{{item.materialBatchNo}}
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="24">
<button type="primary"
:disabled="item.pickedNumber > 0 ? true : false || item.outedNumber > 0 ? true : false"
@click="InventoryBtn(item,index)">选择物料库存</button>
</uni-col>
</uni-row>
</uni-card>
</uni-collapse-item>
</uni-collapse>
<button @click="goBack" type="primary" style="position: fixed;bottom: 0;width: 100vw;">确定</button>
</uni-forms>
</view>
</template>
<script>
import {
getTask
} from "@/api/wms/pdcMaterial"
import {
allocateStock, //分配库存
} from "@/api/wms/materRequisitiontask";
export default {
onLoad(options) {
this.options = JSON.parse(options.data)
console.log(this.options, "optj");
getTask(JSON.parse(options.data).id).then(res => {
console.log(res, "res");
this.getTaskData = res.data;
this.getTaskData.wmsDrawTaskDetailList.forEach(item => {
item.secondNumber =
item.secondNumber == null ? item.number : item.secondNumber;
});
})
},
// onShow() {
// console.log(this.getTaskData.wmsDrawTaskDetailList, "this.getTaskData.wmsDrawTaskDetailList");
// if (this.getTaskData.wmsDrawTaskDetailList) {
// this.getTaskData.wmsDrawTaskDetailList.forEach(item => {
// convertBySecondUnitOrNum({
// materialCode: item.materialCode,
// unitId: item.unitId,
// secondUnitId: item.secondUnitId,
// secondNumber: item.secondNumber,
// }).then(res => {
// console.log("单位1", res);
// })
// })
// }
// },
mounted() {
},
data() {
return {
options: {},
getTaskData: {},
}
},
methods: {
InventoryBtn(item, index) {
console.log(item, index);
this.$tab.navigateTo("/pages/wms/pdcMaterial/materRequisitiontask/InventoryDetails?data=" +
encodeURIComponent(JSON.stringify(item)) + '&wmsDrawTaskDetailList=' + encodeURIComponent(JSON
.stringify(this.getTaskData.wmsDrawTaskDetailList)) + '&index=' + encodeURIComponent(JSON
.stringify(index))+"&getListArr="+encodeURIComponent(JSON
.stringify(this.options)));
},
allocateStockBtn() {
console.log(this.options, "this");
allocateStock([this.options.id]).then(res => {
console.log(res)
})
},
goBack() {
this.$tab.navigateBack({
delta: 1 // 返回的页面数量1 表示返回上一级页面
});
}
},
}
</script>
<style lang="scss">
.materRe {
background-color: #FFFFFF;
}
</style>

View File

@@ -0,0 +1,577 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="领料出库单" :open="true">
<!-- <view class="example-body"> -->
<uni-forms-item label="工单" :labelWidth='90' name="workOrderCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPwo" @change="clearPwo"
v-model="workOrderCode" @confirm="scanBarPwoCode" type="text" />
</uni-forms-item>
<uni-forms-item label="生产领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-combox :candidates="drawTaskCodeList" emptyTips="无" @input="scanBarCode"
v-model="formData.drawTaskCode"></uni-combox>
</uni-forms-item>
<!-- </view> -->
<!-- <uni-forms-item label="生产领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode" v-model="formData.drawTaskCode" type="text" />
</uni-forms-item> -->
<uni-forms-item label="领料员" :labelWidth='90' name="drawBy">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.drawBy" type="text" />
<uni-data-picker popup-title="请选择领料员" :localdata="dataTree" v-model="pickerData1"
@change="onchange1" @nodeclick="onnodeclick1" @popupopened="onpopupopened"
@popupclosed="onpopupclosed" style="margin-top: 5px;" :preload="true">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="出库员" :labelWidth='90' name="warehouseOutBy">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar2" v-model="formData.warehouseOutBy"
type="text" />
<uni-data-picker popup-title="请选择出库员" :localdata="dataTree" v-model="pickerData2"
@change="onchange2" @nodeclick="onnodeclick2" @popupopened="onpopupopened"
@popupclosed="onpopupclosed" style="margin-top: 5px;" :preload="true">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
<uni-easyinput v-model="formData.warehouseCode" type="text" />
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="领料出库单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in formData.wmsDrawOutDetailList"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<u-button type="primary" @click="open(index,item)">拆分</u-button>
<uni-forms-item label="领料出库单明细编码" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.drawOutDetailCode'">
<uni-easyinput type="text" disabled v-model="item.drawOutDetailCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialBatchNo'">
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'.materialLotNo'">
<uni-easyinput disabled type="number" v-model="item.materialLotNo" />
</uni-forms-item>
<uni-forms-item label="库位条码" :labelWidth='90'
name="'wmsProductInDetailList.'+ index +'.storageLocationBarcode'">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
@change="splitStlBarcode(index)" type="text"
v-model="item.storageLocationBarcode" />
</uni-forms-item>
<uni-forms-item label="出库数量" :labelWidth='90'
:name="'wmsDrawOutDetailList.'+ index +'number'">
<u-number-box inputWidth="120" button-size="36" v-model="item.number"
min="0"></u-number-box>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit" :disabled="isDone">提交</u-button>
<view>
<!-- 提示窗示例 -->
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog type="success" cancelText="取消" confirmText="确定" title="数量检验" content="是否检验数量"
@confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
</uni-popup>
</view>
</view>
</template>
<script>
import {
listPick,
addOut,
listTask,
getDetails,
updateOut,
getOut
} from "@/api/wms/pdcMaterial.js";
import _ from 'lodash';
import {
listQuality,
getQuality,
addIn,
listReceive,
getReceive,
getListDetail,
updateIn,
listIn,
getIn,
getQualityDetail,
getReceiveDetail,
getDetailListsBySRM,
getListDetailByBL,
listSupplier
} from "@/api/wms/purchase.js";
import {
listOut,
addSplitOutInfo,
} from "@/api/wms/invQuick.js"
import {
listEmployee
} from "@/api/mes/jobIn.js";
import {
listDepartment
} from "@/api/basic/department";
import {
getConfigKey
} from "@/api/system/config.js";
import {
listSolvedOut
} from "@/api/wms/materRequisitiontask"
export default {
mounted() {
this.selectTypeList();
listDepartment().then((res) => {
this.dptList = res.rows
})
listEmployee().then((res) => {
this.empList = res.rows
})
//U9库存模式
getConfigKey("wms.u9.whMode").then((response) => {
this.wmsu9whMode = response.msg;
});
},
data() {
return {
isDone: false,
dptList: [],
wmsLotNoList: [],
empList: [],
item: '',
dataTree: [],
pickerData1: '',
pickerData2: '',
workOrderCode: '',
wmsu9whMode: false,
drawTaskCodeList: [],
checkStorageLocationBarcode: true,
formData: {
drawTaskCode: '',
warehouseCode: null,
drawBy: null,
warehouseOutBy: null,
wmsDrawOutDetailList: [],
billType: '1'
},
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
drawTaskCode: {
rules: [{
required: true,
errorMessage: '请输入领料任务单!'
}]
},
materialCode: {
rules: [{
required: true,
errorMessage: '请输入物料编码!'
}]
},
number: {
rules: [{
required: true,
errorMessage: '请输入出库数量!'
}]
},
drawBy: {
rules: [{
required: true,
errorMessage: '请输入领料员!'
}]
},
warehouseOutBy: {
rules: [{
required: true,
errorMessage: '请输入出库员!'
}]
},
}
}
},
methods: {
open(index, item) {
console.log(item, index);
if (!this.pickerData2) {
this.$modal.msg("请输入出库员!");
return
}
if (!this.pickerData1) {
this.$modal.msg("请输入领料员!");
return
}
listOut({
pageNum: 1,
pageSize: 50,
orderByColumn: 'id',
isAsc: "desc",
'drawTaskCode': this.formData.drawTaskCode
}).then(async res => { //判断单子有没有在主表
console.log(res, "主表单子");
if (!res.total) { //有就直接进入拆分页面,没有新建
getDetails({
billType: "1",
drawTaskCode: this.formData.drawTaskCode,
status: "0"
}).then(res => {
if (res) { //如果查的到数据,开始新建
res.wmsDrawOut.billType = this.formData.billType;
res.wmsDrawOut.drawBy = this.pickerData1;
res.wmsDrawOut.drawTaskCode = this.formData.drawTaskCode
res.wmsDrawOut.drawType = "0";
res.wmsDrawOut.status = "0";
res.wmsDrawOut.warehouseOutBy = this.pickerData2;
addOut(res.wmsDrawOut).then(addOutList => {
console.log(addOutList, "adda")
})
}
})
}
this.$tab.navigateTo(
'/pages/wms/pdcMaterial/splitItem?drawTaskCode=' +
encodeURIComponent(JSON.stringify(this.formData.drawTaskCode)) + '&item=' +
encodeURIComponent(JSON
.stringify(item)))
})
},
onnodeclick1(e) {
this.item = e
this.onchange1(this.item)
},
onnodeclick2(e) {
this.item = e
this.onchange2(this.item)
},
onpopupopened(e) {
this.dataTree = []
this.empList.filter(item => item.deptId).forEach(item => {
item.departmentTitle = this.dptList.find(item2 => item2.id == item.deptId).departmentTitle
// 检查dataTree中是否已存在相同部门
let existingDept = this.dataTree.find(dept => dept.value === item.deptId);
if (existingDept) {
// 如果已存在相同部门则将员工信息push进该部门的children数组
existingDept.children.push({
text: item.name,
value: item.empCode
});
} else {
// 如果不存在相同部门则创建一个新部门对象包括children数组并将员工信息push进去
let newDept = {
text: item.departmentTitle,
value: item.deptId,
children: [{
text: item.name,
// value: item.empCode + '/'
value: item.empCode
}]
};
this.dataTree.push(newDept);
}
})
},
onpopupclosed() {
//处理不同步
// this.$nextTick(() => {
// this.pickerData = this.item.value;
// this.formData.pickerData = this.item.value;
// if (!this.item) return
// this.onchange(this.item)
// });
},
onchange2(e) {
this.formData.warehouseOutBy = null
this.$set(this.formData, 'warehouseOutBy', e.value.split('/')[0])
// if (e.value.includes('/')) {
// this.$set(this.formData, 'warehouseOutBy', e.value.split('/')[0])
// }
},
onchange1(e) {
this.formData.drawBy = null
this.$set(this.formData, 'drawBy', e.value.split('/')[0])
// if (e.value.includes('/')) {
// this.$set(this.formData, 'drawBy', e.value.split('/')[0])
// }
},
splitStlBarcode(i) {
const _this = this;
const detail = _this.formData.wmsDrawOutDetailList[i];
detail.whCode = null;
detail.storageAreaCode = null;
detail.shelvesCode = null;
detail.storageLocationCode = null;
let barcode = detail.storageLocationBarcode;
if (!barcode) {
return; // 如果没有条码,不做任何处理
}
let [whCode, storageAreaCode, shelvesCode, storageLocationCode, extra] = barcode.split('-');
if (whCode) {
let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
if (!warehouseObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
}
if (storageAreaCode) {
let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode ==
storageAreaCode);
if (!areaObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("库区不存在!");
return;
}
if (shelvesCode) {
let shelvesObj = _this.$store.getters.shelvesOptions.find(item => item.storageShelvesCode ==
shelvesCode);
if (!shelvesObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
};
if (storageLocationCode) {
let locationObj = _this.$store.getters.locationOptions.find(item => item
.storageLocationCode == (extra ?
(storageLocationCode + '-' + extra) : storageLocationCode));
if (!locationObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("库位不存在!");
return;
};
}
}
}
}
_this.checkStorageLocationBarcode = true;
detail.whCode = whCode || null;
detail.storageAreaCode = storageAreaCode || null;
detail.shelvesCode = shelvesCode || null;
detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
},
scanBarstorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.formData.wmsDrawOutDetailList[i], "storageLocationBarcode", res
.result);
// _this.formData.wmsDrawOutDetailList[i].storageLocationBarcode = res.result;
_this.splitStlBarcode(i);
}
});
},
swipChange(e, index) {
},
clickDetail(e, index) {
this.formData.wmsDrawOutDetailList.splice(e, 1);
// console.log('当前索引:', index);
},
clearPwo() {
if (this.workOrderCode == '' || !this.workOrderCode) {
this.selectTypeList();
}
},
scanBarPwo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.workOrderCode = res.result;
_this.scanBarPwoCode();
}
});
},
scanBarPwoCode() {
this.drawTaskCodeList = [];
if (this.workOrderCode) {
listTask({
workOrderCode: this.workOrderCode
}).then(async response => {
for (var i = 0; i < response.rows.length; i++) {
this.drawTaskCodeList.push(response.rows[i].drawTaskCode);
}
});
}
},
selectTypeList() {
listTask().then(async res => {
this.drawTaskCodeList = res.rows.map(item => {
return item.drawTaskCode
});
});
},
scanBarCode() {
if (this.formData.drawTaskCode) {
let data = {
drawTaskCode: this.formData.drawTaskCode
}
getDetails(data).then(async res => {
console.log(res);
if (res.details.length > 0) {
this.formData.wmsDrawOutDetailList = res.details.map(item => {
item.storageLocationBarcode = item.whCode ? (item.storageAreaCode ? (
item.shelvesCode ? (item.storageLocationCode ? (item
.whCode + '-' + item.storageAreaCode + '-' + item
.shelvesCode +
'-' + item.storageLocationCode) : (item.whCode +
'-' + item.storageAreaCode + '-' + item
.shelvesCode
)) : (item.whCode + '-' + item.storageAreaCode)) : item
.whCode) : ''
return item
});
}
});
} else {
this.$modal.msg("请输入生产领料任务单!")
}
},
//领料员
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.drawBy = res.result;
// _this.scanBarCode(_this.formData.drawBy);
console.log(res.result);
}
});
},
//出库员
scanBar2() {
const _this = this;
uni.scanCode({
scanType: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.warehouseOutBy = res.result;
// _this.scanBarCode(_this.formData.warehouseOutBy);
}
});
},
//仓库编码
scanBar3() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.warehouseCode = res.result;
}
});
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定出库该物料吗?',
success: function(res) {
if (res.confirm) {
console.log(_this.formData)
if (!_this.checkStorageLocationBarcode) {
_this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
_this.$modal.loading('提交中')
listOut({
pageNum: 1,
pageSize: 50,
orderByColumn: 'id',
isAsc: "desc",
'drawTaskCode': _this.formData.drawTaskCode
}).then(res => {
if (res.total > 0) {
this.isDone = false;
getOut(res.rows[0].id).then(res => {
res.data.wmsDrawOutDetailList.forEach((
item, index) => {
item.index = index + 1;
})
updateOut(res.data).then(async res => {
_this.$modal.msgSuccess(
"出库成功!");
_this.$modal
.closeLoading();
// _this.$refs.alertDialog.open()
// setTimeout(() => {
// _this.$tab
// .switchTab(
// "/pages/work/index"
// );
// }, 500);
});
})
} else {
this.isDone = true;
}
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
// dialogConfirm() {
// uni.redirectTo({
// url: '/pages/target/?param1=xxx&param2=yyy'
// });
// this.$tab.navigateTo('/pages/wms/pdcMaterial/confirmNum');
// },
// dialogClose() {
// this.$tab.switchTab('/pages/work/index');
// },
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,66 @@
<template>
<view class="uni-padding-wrap uni-common-mt" >
<view class="grid-body">
<uni-grid :column="2" :showBorder="false" @change="changeGrid1">
<uni-grid-item :index="1" style="line-height: 100px;margin-top:100px;margin-left:37.5%;width: 100%;">
<view class="grid-item-box">
<uni-icons custom-prefix="iconfont" type="icon-lingliaodan" size="30"></uni-icons>
<text class="text">领料拣货</text>
</view>
</uni-grid-item>
<uni-grid-item :index="2" style="line-height: 100px;margin-left:37.5%;width: 100%;">
<view class="grid-item-box">
<uni-icons custom-prefix="iconfont" type="icon-navicon-ckd" size="30"></uni-icons>
<text class="text">领料出库</text>
</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
</view>
</template>
<script>
export default {
onLoad: function() {
},
methods: {
changeGrid1(e) {
console.log(e.detail.index);
if (e.detail.index == 1) {
this.$tab.navigateTo('/pages/wms/pdcMaterial/pdcPick');
} else if (e.detail.index == 2) {
this.$tab.navigateTo('/pages/wms/pdcMaterial/pdcCk');
}
}
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>

View File

@@ -0,0 +1,723 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="工单" :labelWidth='90' name="workOrderCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPwo" v-model="formData.workOrderCode"
@confirm="scanBarPwoCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="领料任务单" :labelWidth='90' name="drawTaskCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.drawTaskCode"
@confirm="scanBarCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="拣货单" :labelWidth='90' name="pickCode">
<uni-easyinput suffixIcon="scan" @confirm="scanBarCode" @iconClick="scanBar4"
v-model="formData.pickCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="物料编码" :labelWidth='90' name="materialCode">
<uni-easyinput disabled v-model="formData.materialCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="物料名称" :labelWidth='90' name="materialName">
<uni-easyinput type="text" v-model="formData.materialName" disabled />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="物料批号" :labelWidth='90' name="materialBatchNo">
<uni-easyinput disabled type="text" v-model="formData.materialBatchNo" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="库位编码" :labelWidth='90' name="storageLocationCode">
<uni-easyinput disabled type="text" v-model="formData.storageLocationCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="原有数量" :labelWidth='90' name="originNumber">
<uni-easyinput disabled type="number" v-model="formData.originNumber" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="拣货数量" :labelWidth='90' name="pickNumber">
<uni-easyinput disabled type="number" v-model="formData.pickNumber" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="现有数量" :labelWidth='90' name="xyNum">
<uni-easyinput disabled type="number" v-model="xyNum" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="拣货区" :labelWidth='90' :name="pickerData" :rules="[{'required': true,
errorMessage: '请输入拣货区!'}]">
<uni-data-picker popup-title="请选择所在货区" :localdata="dataTree" v-model="pickerData"
@change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened"
@popupclosed="onpopupclosed">
</uni-data-picker>
<!-- <uni-easyinput type="text" v-model="formData.pickArea" /> -->
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="拣货时间" :labelWidth='90' name="pickTime">
<!-- <view class="uni-list-cell-db"> -->
<!-- <u-datetime-picker ref="datetimePicker" @cancel="close" @confirm="confirm" :show="show"
v-model="value1" @change="bindDateChange" mode="datetime">
<view class="uni-input" v-model="formData.pickTime">{{formData.pickTime}}</view>
</u-datetime-picker> -->
<!-- <picker style="padding-top: 10px;" mode="time" :value="formData.pickTime" :start="startDate"
:end="endDate" @change="bindDateChange">
<view class="uni-input" v-model="formData.pickTime">{{formData.pickTime}}</view>
</picker> -->
<!-- <uni-datetime-picker></uni-datetime-picker> -->
<!-- <u-datetime-picker :show="show" v-model="value1" @change="bindDateChange"
mode="datetime"></u-datetime-picker>
<view class="uni-input" @click="show=true" v-model="formData.pickTime">
{{formData.pickTime}}
</view> -->
<!-- </view> -->
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.pickTime" />
</view>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
addPick,
getTask,
updatePick,
listPick
} from "@/api/wms/pdcMaterial.js";
import {
listMaterial
} from "@/api/wms/request.js";
import {
listArea
} from "@/api/wms/area.js";
import {
listLocation
} from "@/api/wms/location.js";
import {
listShelves
} from "@/api/wms/shelves.js";
import {
listWarehouse
} from "@/api/wms/warehouse.js";
export default {
onLoad: function(option) {
// this.test();
// this.getPickArea();
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.updateTime
this.formData.pickTime = formattedDate;
},
data() {
return {
show: false,
item: '',
dataTree: [],
pickerData: '',
value1: Number(new Date()),
xyNum: null,
formData: {
pickTime: null,
workOrderCode: null,
drawTaskCode: null,
materialCode: null,
materialName: null,
materialBatchNo: null,
whCode: null,
areaCode: null,
shelvesCode: null,
storageLocationCode: null,
originNumber: null,
pickNumber: null,
pickTime: null,
pickCode: null,
pickArea: null,
},
rules: {
drawTaskCode: {
rules: [{
required: true,
errorMessage: '请输入领料任务单!'
}]
},
pickCode: {
rules: [{
required: true,
errorMessage: '请输入拣货单!'
}]
},
}
}
},
computed: {
// startDate() {
// return this.getDate('start');
// },
// endDate() {
// return this.getDate('end');
// }
},
// onReady() {
// // 微信小程序需要用此写法
// this.$refs.datetimePicker.setFormatter(this.formatter)
// },
methods: {
getPickArea() {
let data = new Array();
listWarehouse().then((response) => {
let obj = response.rows.map(({
warehouseName,
warehouseCode,
id
}) => ({
warehouseName,
warehouseCode,
id
}));
for (var i = 0; i < obj.length; i++) {
this.dataTree.push({
text: obj[i].warehouseName,
value: obj[i].warehouseCode + '/' + obj[i].warehouseName + '/' + obj[i]
.id,
});
}
listArea().then((response) => {
let aobj = response.rows.map(
({
storageAreaName,
storageAreaCode,
id,
warehouseCode
}) => ({
storageAreaName,
storageAreaCode,
id,
warehouseCode
})
);
for (var i = 0; i < aobj.length; i++) {
const atemp = this.dataTree.find(
(item) => item.value.split('/')[0] == aobj[i].warehouseCode
);
if (atemp) {
if (!atemp.children) {
atemp.children = [];
}
atemp.children.push({
text: aobj[i].storageAreaName,
// value: aobj[i].storageAreaCode,
value: aobj[i].storageAreaCode + '/' + aobj[i]
.storageAreaName + '/' + aobj[i].id + '/' +
aobj[i]
.warehouseCode,
});
}
}
listShelves().then((response) => {
let sobj = response.rows.map(
({
storageShelvesCode,
storageShelvesName,
id,
storageAreaCode,
warehouseCode
}) => ({
storageShelvesCode,
storageShelvesName,
id,
storageAreaCode,
warehouseCode
})
);
const stemp = this.dataTree.filter((item) => item
.children);
for (var i = 0; i < sobj.length; i++) {
for (var j = 0; j < stemp.length; j++) {
const temp = stemp[j].children.find(
(item) => item.value.split('/')[0] ==
sobj[i]
.storageAreaCode
);
if (temp) {
if (!temp.children) {
temp.children = [];
}
temp.children.push({
text: sobj[i]
.storageShelvesName,
// value: sobj[i].storageShelvesCode,
value: sobj[i]
.storageShelvesCode +
'/' +
sobj[
i].storageShelvesName +
'/' +
sobj[
i]
.id + '/' + sobj[i]
.storageAreaCode +
'/' +
sobj[i].warehouseCode,
});
}
}
}
listLocation().then((response) => {
let lobj = response.rows.map(({
storageLocationCode,
storageLocationName,
id,
storageShelvesCode,
storageAreaCode,
warehouseCode
}) => ({
storageLocationCode,
storageLocationName,
id,
storageShelvesCode,
storageAreaCode,
warehouseCode
}));
const lItem = this.dataTree.filter(
(parentItem) =>
parentItem.children &&
parentItem.children.find((
childItem) =>
childItem
.children)
);
for (var i = 0; i < lobj.length; i++) {
for (var j = 0; j < lItem
.length; j++) {
for (var k = 0; k < lItem[j]
.children
.length; k++) {
if (lItem[j].children[k]
.children) {
const temp = lItem[j]
.children[k]
.children
.find(
(item) => item
.value.split(
'/')[
0] == lobj[
i]
.storageShelvesCode
);
if (temp) {
if (!temp
.children) {
temp
.children = [];
}
temp.children
.push({
text: lobj[
i
]
.storageLocationName,
// value: lobj[i]
// .storageLocationCode,
value: lobj[
i
]
.storageLocationCode +
'/' +
lobj[
i
]
.storageLocationName +
'/' +
lobj[
i
]
.id +
'/' +
lobj[
i
]
.storageShelvesCode +
'/' +
lobj[
i
]
.storageAreaCode +
'/' +
lobj[
i
]
.warehouseCode,
});
}
}
}
}
}
// if (this.formData.status == '2') {
// }
this.dataTree = JSON.parse(JSON
.stringify(this
.dataTree))
//状态为拣货完成时,默认为原来的仓库,否则默认拣货仓
if (this.formData.status != '2') {
//默认进入拣货仓
// if (!this.formData.whCode) {
if (this.dataTree.find(item => item
.text ==
'拣货仓')) {
let data = this.dataTree.find(
item => item
.text == '拣货仓')
this.item = data
this.pickerData = this.item.value;
if (!this.item) return
this.onchange(this.item)
this.onpopupclosed();
}
// }
} else {
this.getDataPicker(this.formData
.whCode, this
.formData
.areaCode, this.formData
.shelvesCode, this.formData
.storageLocationCode
)
}
});
});
});
});
},
onnodeclick(e) {
this.item = e
},
onpopupopened(e) {
console.log('popupopened');
},
onpopupclosed(e) {
//处理不同步
this.$nextTick(() => {
this.pickerData = this.item.value;
if (!this.item) return
this.onchange(this.item)
});
},
onpopupclosed2(e) {
this.pickerData = this.item.value;
if (!this.item) return
this.onchange(this.item)
},
onchange(e) {
let array = e.value.split('/');
switch (array.length) {
case 3:
this.formData.storageLocationCode = null;
this.formData.shelvesCode = null;
this.formData.areaCode = null;
this.formData.whCode = array[0];
break;
case 4:
this.formData.storageLocationCode = null;
this.formData.shelvesCode = null;
this.formData.areaCode = array[0];
this.formData.whCode = array[3];
break;
case 5:
this.formData.storageLocationCode = null;
this.formData.shelvesCode = array[0];
this.formData.areaCode = array[3];
this.formData.whCode = array[4];
break;
case 6:
this.formData.storageLocationCode = array[0];
this.formData.shelvesCode = array[3];
this.formData.areaCode = array[4];
this.formData.whCode = array[5];
break;
default:
break;
}
},
//如果已填写拣货仓,则回显到级联选择器上
getDataPicker(wh, area, shelve, stoLot) {
if (wh) {
if (area) {
if (shelve) {
if (stoLot) {
let data = this.dataTree.find(item => item.value.split('/')[0] == wh)
if (data) {
let areadata = data.children.find(item => item.value.split('/')[0] == area)
if (areadata) {
let shelvedata = areadata.children.find(item => item.value.split('/')[0] ==
shelve)
if (shelvedata) {
let stoLotdata = shelvedata.children.find(item => item.value.split('/')[
0] == stoLot)
if (stoLotdata) {
this.item = stoLotdata;
this.onpopupclosed2();
}
}
}
}
} else {
//只有仓库,库区和货架
let data = this.dataTree.find(item => item.value.split('/')[0] == wh)
if (data) {
let areadata = data.children.find(item => item.value.split('/')[0] == area)
if (areadata) {
let shelvedata = areadata.children.find(item => item.value.split('/')[
0] ==
shelve)
if (shelvedata) {
this.item = shelvedata;
this.onpopupclosed2();
}
}
}
}
} else {
//只有仓库和库区
let data = this.dataTree.find(item => item.value.split('/')[0] == wh)
if (data) {
let areadata = data.children.find(item => item.value.split('/')[0] == area)
if (areadata) {
this.item = areadata;
this.onpopupclosed2()
}
}
}
} else {
//只有仓库
let data = this.dataTree.find(item => item.value.split('/')[0] == wh)
if (data) {
this.item = data;
this.onpopupclosed2()
}
}
}
},
formatter(type, value) {
if (type === 'year') {
return `${value}`
}
if (type === 'month') {
return `${value}`
}
if (type === 'day') {
return `${value}`
}
if (type === 'hour') {
return `${value}`
}
if (type === 'minute') {
return `${value}`
}
if (type === 'second') {
return `${value}`
}
return value
},
bindDateChange(e) {
console.log(e)
this.formData.pickTime = e.detail.value
},
close() {
this.show = false;
},
confirm(e) {
this.show = false;
const date = new Date(e.value);
console.log(date.toLocaleString()); // 使用 toLocaleString() 方法将时间戳转换为可读的日期和时间格式
},
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`;
},
scanBarCode() {
// if (this.formData.pickCode) {
let obj = {
drawTaskCode: this.formData.drawTaskCode,
pickCode: this.formData.pickCode
}
console.log(obj);
this.$modal.loading('提交中')
listPick(
obj
).then(async res => {
this.$modal.closeLoading();
console.log(res);
if (res.rows.length != 0) {
// arry = res.rows[0];
// console.log(arry);
this.formData = res.rows[0];
// this.formData.wlBatchNum = res.rows[0].materialBatchNo,
// this.formData.wlName = res.rows[0].materialName,
// this.formData.wlCode = res.rows[0].materialCode,
// this.formData.ckCode = res.rows[0].storageLocationCode,
// this.formData.yyNum = res.rows[0].originNumber,
// this.formData.jhNum = res.rows[0].pickNumber,
this.xyNum = this.formData.originNumber - this.formData.pickNumber
this.formData.pickTime = this.getDate();
await this.getPickArea();
console.log(this.formData.pickTime)
} else {
this.$modal.msgError("未检索到该拣货信息!");
}
});
// } else if (!this.formData.drawTaskCode || this.formData.drawTaskCode == "" || this.formData.drawTaskCode ==
// null) {
// this.$modal.msg("请输入领料任务单!");
// } else if (!this.formData.pickCode || this.formData.pickCode == "" || this.formData.pickCode == null) {
// this.$modal.msg("请输入拣货单!");
// }
},
// scanBarCode1(){
// if(!this.formData.pickCode || this.formData.pickCode == "" || this.formData.pickCode == null){
// this.$modal.msgError("请输入拣货单!");
// }
// },
scanBarPwo() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.workOrderCode = res.result;
_this.scanBarPwoCode();
}
});
},
scanBarPwoCode() {
if (this.formData.workOrderCode) {
listPick({
workOrderCode: this.formData.workOrderCode
}).then(response => {
console.log(response);
if (response.rows.length > 1) {
this.$modal.msg("该工单检索到的拣货单超过1条请去电脑端操作");
} else if (response.rows.length == 0) {
this.$modal.msg("该工单未检索到拣货单!");
} else if (response.rows.length == 1) {
console.log("success");
this.formData = response.rows[0];
this.xyNum = this.formData.originNumber - this.formData.pickNumber;
this.formData.pickTime = this.getDate();
this.getPickArea();
console.log(this.formData.pickTime)
}
});
}
},
//领料任务单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.drawTaskCode = res.result;
_this.scanBarCode();
}
});
},
//拣货单
scanBar4() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pickCode = res.result;
_this.scanBarCode();
}
});
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定拣货该物料吗?',
success: function(res) {
if (res.confirm) {
_this.formData.status = '2';
console.log(_this.formData);
_this.$modal.loading('提交中')
updatePick(_this.formData).then(async res => {
_this.formData.inStatus = '2'
updatePick(_this.formData).then(
async res => {
_this.$modal.msgSuccess(
"拣货完成!");
setTimeout(() => {
_this.$modal
.closeLoading();
_this.$tab
.switchTab(
"/pages/work/index"
);
}, 500);
});
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,269 @@
<template>
<view>
<uni-forms style="background-color: white;" ref="form">
<uni-row>
<uni-col :span="24">
<selectLay :options="warehouseOptions" :value="whCode" placeholder="请选择设备厂家"
@selectitem="warehouseOptionsFuc"></selectLay>
</uni-col>
<uni-col :span="24">
<selectLay :options="statusArr" :value="status" placeholder="请选择拣货单状态" @selectitem="statusArrFuc">
</selectLay>
</uni-col>
<uni-col :span="24">
<selectLay :options="listEmployeeArr" :value="pickBy" placeholder="请选择拣货员"
@selectitem="listEmployeeArrFuc">
</selectLay>
</uni-col>
<button style="margin: 0 auto; width: 100vw;" type="primary" size="medium" @click="queryBtn">查询</button>
</uni-row>
<uni-collapse>
<uni-collapse-item title="拣货单明细" open>
<selectLay style="position: fixed;top: 50%;left: 0;" v-show="isBol" :options="listEmployeeArr"
:value="pickBy" placeholder="请选择拣货员" @selectitem="listEmployeePickFuc">
</selectLay>
<uni-card @click="jumpTo(item)" class="box-card" v-for="(item,col) in listPickArr">
<uni-row>
<uni-col :span="14">物料单号:{{item.drawTaskCode}}</uni-col>
<uni-col :span="10">数量:{{item.pickNumber}}</uni-col>
<uni-col :span="14">来源单号:{{item.workOrderCode}}</uni-col>
<uni-col :span="10">库位:{{item.storageLocationCode}}</uni-col>
<uni-col :span="14">单位:{{item.unit}}</uni-col>
<uni-col
:span="10">状态:{{statusArr.find(items=>item.status == items.value).label||""}}</uni-col>
<uni-col :span="24">拣货员:{{listEmployeeArrSelFuc(item.actualPickBy)}}</uni-col>
</uni-row>
<uni-row>
<uni-col :span="8" size="mini">
<button size="mini" type="primary" @click.stop="handleCancelPick(item)">撤销拣货</button>
</uni-col>
<uni-col :span="8" size="mini">
<button size="mini" type="primary" @click.stop="handleChangePerson(item)">更换人员</button>
</uni-col>
<uni-col :span="8" size="mini">
<button size="mini" type="primary" @click.stop="handlePickOut(item)">拣货出库</button>
</uni-col>
</uni-row>
</uni-card>
</uni-collapse-item>
</uni-collapse>
<uni-forms-item label="" name="">
</uni-forms-item>
</uni-forms>
</view>
</template>
<script>
import selectLay from "@/components/select-lay/select-lay.vue"
import {
listEmployee
} from "@/api/tpm/checkTaskItem"
import {
listWarehouse
} from "@/api/wms/warehouse.js"
import {
listOut,
addSplitOutInfo,
} from "@/api/wms/invQuick.js"
import {
listPick,
revokeDrawPick,
getDetails,
addOut,
} from "@/api/wms/pdcMaterial"
import {
updatePick,
} from "@/api/wms/materRequisitiontask"
export default {
created() {
listWarehouse().then(response => { //仓库数据
this.warehouseOptions = response.rows.map(item => {
return {
label: item.warehouseName,
value: item.warehouseCode
}
})
});
listEmployee().then(res => {
this.listEmployeeArr = res.rows.map(item => {
return {
label: item.name,
value: item.empCode
}
});
})
},
components: {
selectLay,
},
data() {
return {
isBol: false,
whCode: '',
status: '',
pickBy: '',
dataList:{},
warehouseOptions: [], //仓库
listEmployeeArr: [],
listPickArr: [],
pickQuery: "",
statusArr: [{
"label": "等待拣货",
"value": 1
},
{
"label": "拣货完成",
"value": 2
}
]
}
},
methods: {
handlePickOut(item){//拣货出库
item.status = '2'
updatePick(item).then(res=>{
this.$modal.msgSuccess(res.msg)
})
},
handleCancelPick(item) {
// 撤销拣货
revokeDrawPick(item.id).then(res => {
this.$modal.msgSuccess(res.msg)
})
},
getCurrentTime() {
const now = new Date(); // 获取当前时间
// 获取各个部分
const year = now.getFullYear(); // 年
const month = String(now.getMonth() + 1).padStart(2, '0'); // 月(注意要加 1因为月份从 0 开始)
const day = String(now.getDate()).padStart(2, '0'); // 日
const hours = String(now.getHours()).padStart(2, '0'); // 时
const minutes = String(now.getMinutes()).padStart(2, '0'); // 分
const seconds = String(now.getSeconds()).padStart(2, '0'); // 秒
// 拼接成目标格式
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
getCurrentDate() {
const now = new Date(); // 获取当前日期
// 获取各个部分
const year = now.getFullYear(); // 年
const month = String(now.getMonth() + 1).padStart(2, '0'); // 月(注意要加 1因为月份从 0 开始)
const day = String(now.getDate()).padStart(2, '0'); // 日
// 拼接成目标格式
return `${year}-${month}-${day}`;
},
queryBtn() {
listPick({
whCode: this.whCode,
status: this.status,
pickBy: this.pickBy
}).then(res => {
this.listPickArr = res.rows;
})
this.whCode = "";
this.status = "";
this.pickBy = "";
},
warehouseOptionsFuc(index, item) {
this.whCode = item.value;
},
statusArrFuc(index, item) {
this.status = item.value;
},
listEmployeeArrFuc(index, item) {
this.pickBy = item.value;
},
listEmployeeArrSelFuc(item) {
if (item) {
return this.listEmployeeArr.find(items => items.value == item).label;
} else {
return ""
}
},
jumpTo(item) {
console.log(item, "items");
// listOut({
// pageNum: 1,
// pageSize: 50,
// orderByColumn: 'id',
// isAsc: "desc",
// 'drawTaskCode': item.drawTaskCode
// }).then(async res => { //判断单子有没有在主表
// console.log(res, "主表单子");
// if (!res.total) { //有就直接进入拆分页面,没有新建
// getDetails({
// billType: "1",
// drawTaskCode: item.drawTaskCode,
// status: "0"
// }).then(res => {
// if (res) { //如果查的到数据,开始新建
// res.wmsDrawOut.billType ='1';
// res.wmsDrawOut.drawBy = item.drawBy;
// res.wmsDrawOut.drawTaskCode = item.drawTaskCode
// res.wmsDrawOut.drawType = "0";
// res.wmsDrawOut.status = "0";
// res.wmsDrawOut.warehouseOutBy = item.drawBy
// addOut(res.wmsDrawOut).then(addOutList => {
// console.log(addOutList, "adda")
// this.dataList = addOutList.data
// })
// }
// })
// }else{
// this.dataList = res.data
// }
this.$tab.navigateTo("/pages/wms/pdcMaterial/pickingoutModel/pickingoutDetails?item=" +
encodeURIComponent(JSON.stringify(item)));
// })
},
listEmployeePickFuc(index, item) {
console.log(item, "item人员");
this.pickQuery.actualPickBy = item.value;
this.pickQuery.updateBy = item.label;
this.pickQuery.updateTime = this.getCurrentTime();
this.pickQuery.pickTime = this.getCurrentDate();
updatePick(this.pickQuery).then(res => {
console.log(res, "修改成功");
}).finally(r => {
this.pickQuery = "";
this.isBol = false;
})
// this.isBol = false;
},
handleChangePerson(item) {
console.log(item, "2121");
this.pickQuery = item;
this.isBol = true;
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,203 @@
<template >
<view >
<uni-forms style="background-color: white;">
<uni-collapse>
<uni-collapse-item title="领料拣货出库信息" :open="true">
<uni-row>
<uni-card>
<uni-col :span="14">物料编码:{{singleInfo.materialCode}}</uni-col>
<uni-col :span="10">数量:{{singleInfo.pickNumber}}</uni-col>
<uni-col :span="14">单位:{{singleInfo.unit}}</uni-col>
<uni-col :span="10">物料名称:{{singleInfo.materialName}}</uni-col>
<uni-col :span="14">物料规格:{{singleInfo.specification}}</uni-col>
<uni-col :span="10">库位:{{singleInfo.whCode}}</uni-col>
<uni-col :span="14">批号:{{singleInfo.materialBatchNo}}</uni-col>
<uni-col :span="10">拣货员:{{singleInfo.pickBy}}</uni-col>
<uni-col :span="24">确认库位<uni-easyinput type="text" /></uni-col>
<uni-col :span="24">确认出库数量<uni-easyinput type="text"
v-model="singleInfo.pickNumber" /></uni-col>
</uni-card>
</uni-row>
</uni-collapse-item>
<selectLay v-show="isDone" style="position: fixed;top: 45%;left: 0;" :options="empList" :placeholder="placeholder" @selectitem="equipmentbrandFuc"></selectLay>
<uni-collapse-item :open="true" title="领料出库明细">
<uni-col :span="12"><button type="primary" size="default" @click="empListBtn(1)">领料员</button></uni-col>
<uni-col :span="12"><button type="primary" size="default" @click="empListBtn(2)">出库员</button></uni-col>
<uni-card @click="open(index,item)" v-for="(item,index) in wmsLotNoList.wmsDrawOutDetailList">
<uni-col :span="24">领料出库单明细编码:{{item.drawOutDetailCode}}</uni-col>
<uni-col :span="24">物料编码:{{item.materialCode}}</uni-col>
<uni-col :span="24">物料名称:{{item.materialName}}</uni-col>
<uni-col :span="24">物料批号:{{item.materialBatchNo}}</uni-col>
<uni-col :span="24">物料箱号:{{item.materialLotNo}}</uni-col>
<uni-col :span="12">库位条码:{{item.whCode}}</uni-col>
<uni-col :span="12">出库数量:{{item.number}}</uni-col>
</uni-card>
</uni-collapse-item>
</uni-collapse>
</uni-forms>
</view>
</template>
<script>
import {
addInDetail,
addLotInfo,
uploadU9
} from "@/api/wms/purchase.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
import {
addSplitOutInfo
} from "@/api/wms/invQuick"
import {
listOutSplitHistory
} from "@/api/wms/stock.js"
import {
listOut,
} from "@/api/wms/invQuick.js"
import {
updateInDetail
} from "@/api/wms/pdcIn.js";
import {
getTask,
getDetails,
addOut,
} from '@/api/wms/pdcMaterial.js'
import selectLay from "@/components/select-lay/select-lay.vue"
export default {
onLoad: function(option) {
console.log((JSON.parse(option.item)), 'iophd');
if (JSON.parse(option.item)) {
this.singleInfo = JSON.parse(option.item)
}
getDetails({drawTaskCode:this.singleInfo.drawTaskCode}).then(res=>{
this.wmsLotNoList = res.wmsDrawOut
console.log(res,"查看明细");
})
},
components:{
selectLay,
},
created() {
listEmployee().then(res=>{//员工
this.empList = res.rows.map(item=>{
return {
value:item.id,
label:item.name
}
})
})
},
data() {
return {
drawBy:"",
warehouseOutBy:"",
listData: {},
empList:[],
disBol: false,
placeholder:"",
//入库时间
//是否已分批
isSecondOpen: false,
selectedRow: {},
singleInfo: {},
dataList:{},
wmsLotNoList: [],
isDone:false,
eachNumber: null,
splitNumber: null,
drawOutCode: '',
index: null,
checkStorageLocationBarcode: true,
// storageLocationBarcode: ''
formData: {},
rules: {
storageLocationBarcode: [{
required: true,
errorMessage: '请输入库位条码!'
}]
},
}
},
methods: {
empListBtn(e){
this.isDone = true;
if(e === 1){
this.placeholder = "请选择领料员"
}else{
this.placeholder = "请选择出库员"
}
},
equipmentbrandFuc(e){
console.log(e,"e");
if(this.placeholder == "请选择领料员"){
this.drawBy = e
}else{
this.drawBy = e
}
this.placeholder = "";
this.isDone = false;
},
open(index, item) {
console.log(item, index);
listOut({
pageNum: 1,
pageSize: 50,
orderByColumn: 'id',
isAsc: "desc",
'drawTaskCode': this.singleInfo.drawTaskCode
}).then(async res => { //判断单子有没有在主表
console.log(res, "主表单子");
if (!res.total) { //有就直接进入拆分页面,没有新建
getDetails({
billType: "1",
drawTaskCode:this.singleInfo.drawTaskCode,
status: "0"
}).then(res => {
if (res) { //如果查的到数据,开始新建
res.wmsDrawOut.billType = '1';
res.wmsDrawOut.drawBy = this.drawBy;
res.wmsDrawOut.drawTaskCode = this.singleInfo.drawTaskCode
res.wmsDrawOut.drawType = "0";
res.wmsDrawOut.status = "0";
res.wmsDrawOut.warehouseOutBy = this.warehouseOutBy;
addOut(res.wmsDrawOut).then(addOutList => {
console.log(addOutList, "adda")
})
}
})
}
this.$tab.navigateTo(
'/pages/wms/pdcMaterial/splitItem?drawTaskCode=' +
encodeURIComponent(JSON.stringify(this.singleInfo.drawTaskCode)) + '&item=' +
encodeURIComponent(JSON
.stringify(item)))
})
},
},
}
</script>
<style>
</style>

View File

@@ -0,0 +1,338 @@
<template>
<view>
<uni-collapse>
<view class="cu-card article ">
<view class="cu-item shadow borderBottom">
<view class="content">
<view class="desc">
<view class="text-content" style="font-size: 15px;">
<view><strong>物料编码</strong> : {{singleInfo.materialCode}}</view>
<view><strong>物料名称</strong> : {{singleInfo.materialName}}</view>
<view><strong>物料批号</strong> : {{singleInfo.materialBatchNo}}</view>
<view><strong>上架数量</strong> : {{singleInfo.secondNumber}}</view>
</view>
</view>
</view>
</view>
</view>
<uni-row>
<uni-col :span="12">
<span style="display: block;text-align: center;">每份数量<view style="margin-left: 15%;"><u-number-box
v-model="eachNumber" integer min="0" @change="eachNumberClear" /></view></span>
</uni-col>
<uni-col :span="12">
<span style="display: block;text-align: center;">拆分数量<view style="margin-left: 15%;"><u-number-box
v-model="splitNumber" integer min="0" @change="splitNumberClear" /></view></span>
</uni-col>
</uni-row>
<uni-row style="margin-top: 5px;" :gutter="10">
<uni-col :span="12">
<u-button type="primary" icon="cut" :disabled="isSecondOpen" @click="multiSplit" :plain="true"
text="拆分"></u-button>
</uni-col>
<uni-col :span="12">
<u-button type="success" icon="close-circle" @click="singleSplit" :disabled="isSecondOpen"
:plain="true" text="不拆分"></u-button>
</uni-col>
</uni-row>
<uni-collapse-item :open="true">
<uni-forms ref="form" :modelValue="formData">
<view :key="index" v-for="(item, index) in wmsLotNoList">
<view>
<uni-badge :text="index+1" class="uni-badge-left-margin" type="primary"></uni-badge>
</view>
<uni-forms-item label="物料批号" :labelWidth='90' :name="item.materialBatchNo">
<uni-easyinput type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料编码" :labelWidth='90' :name="item.materialCode">
<uni-easyinput type="text" v-model="item.materialCode" />
</uni-forms-item>
<uni-forms-item label="拼接库位" :labelWidth='90' :name="item.whCode">
<uni-easyinput type="text" v-model="item.whCode" />
</uni-forms-item>
<uni-forms-item label="出库明细单编码" :labelWidth='90' :name="item.outBillDetailCode">
<uni-easyinput type="text" v-model="item.outBillDetailCode" />
</uni-forms-item>
<uni-forms-item label="数量" :labelWidth='90' :name="item.number">
<uni-easyinput type="text" v-model="item.number" />
</uni-forms-item>
</view>
</uni-forms>
</uni-collapse-item>
</uni-collapse>
<u-button type="primary" @click="submit" :disabled="disBol">提交</u-button>
</view>
</template>
<script>
import {
addInDetail,
addLotInfo,
uploadU9
} from "@/api/wms/purchase.js";
// import SecondNumberChangeToConvert from "@/components/SecondNumberChangeToConvert/index.vue";
import {
addSplitOutInfo
} from "@/api/wms/invQuick"
import {
listOutSplitHistory
} from "@/api/wms/stock.js"
import {
listOut,
} from "@/api/wms/invQuick.js"
import {
updateInDetail
} from "@/api/wms/pdcIn.js";
import {
getTask
} from '@/api/wms/pdcMaterial.js'
export default {
onLoad: function(option) {
console.log((JSON.parse(option.item)), 'iophd');
if (JSON.parse(option.item)) {
this.singleInfo = JSON.parse(option.item)
}
if (JSON.parse(option.drawTaskCode)) {
this.drawOutCode = JSON.parse(option.drawTaskCode)
}
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.rkTime = formattedDate;
listOutSplitHistory({
outBillDetailCode: this.singleInfo.drawOutDetailCode
}).then(res => { //查询有没有拆分记录
if (res.total) {
this.wmsLotNoList = res.rows
this.disBol = true
} else {
this.disBol = false
}
})
},
data() {
return {
disBol: false,
//入库时间
rkTime: null,
//是否已分批
isSecondOpen: false,
selectedRow: {},
singleInfo: {},
wmsLotNoList: [],
eachNumber: null,
splitNumber: null,
drawOutCode: '',
index: null,
checkStorageLocationBarcode: true,
// storageLocationBarcode: ''
formData: {},
rules: {
storageLocationBarcode: [{
required: true,
errorMessage: '请输入库位条码!'
}]
},
}
},
components: {
// SecondNumberChangeToConvert
},
methods: {
eachNumberClear() {
this.eachSecondNumber = null;
this.splitNumber = null;
},
eachSecondNumberClear() {
this.eachNumber = null;
this.splitNumber = null;
},
//不拆分批次
singleSplit() {
this.wmsLotNoList = [];
this.splitNumber = 1;
this.eachNumber = 0;
let obj = {};
obj.materialCode = this.singleInfo.materialCode;
obj.materialBatchNo = this.singleInfo.materialBatchNo;
obj.number = this.singleInfo.number;
obj.unit = this.singleInfo.unit;
obj.index = 1;
obj.outBillCode = this.singleInfo.drawOutCode;
obj.outBillDetailCode = this.singleInfo.drawOutDetailCode;
obj.unitName = this.singleInfo.unitName;
obj.materialName = this.singleInfo.materialName;
obj.specification = this.singleInfo.specification;
obj.u9StorageCode = this.singleInfo.u9StorageCode;
obj.connectedLocation = this.singleInfo.connectedLocation;
obj.whCode = this.singleInfo.whCode;
obj.u9IssueApplyDocLineId = this.singleInfo.u9IssueApplyDocLineId;
this.wmsLotNoList.push(obj);
},
//选择条件拆分批次
multiSplit() {
this.wmsLotNoList = [];
let materialCode = this.singleInfo.materialCode;
let materialBatchNo = this.singleInfo.materialBatchNo;
let unit = this.singleInfo.unit;
let outBillCode = this.singleInfo.drawOutCode;
let outBillDetailCode = this.singleInfo.drawOutDetailCode;
let materialName = this.singleInfo.materialName;
let specification = this.singleInfo.specification;
let unitName = this.singleInfo.unitName;
let u9StorageCode = this.singleInfo.u9StorageCode;
let connectedLocation = this.singleInfo.connectedLocation;
let whCode = this.singleInfo.whCode;
let u9IssueApplyDocLineId = this.singleInfo.u9IssueApplyDocLineId;
if (this.eachNumber != null) {
let t;
let k;
t = parseInt(this.singleInfo.number / this.eachNumber);
k = this.singleInfo.number % this.eachNumber;
if (k != 0) {
t++;
}
for (let i = 0; i < t; i++) {
let obj = {};
obj.materialCode = materialCode;
obj.materialBatchNo = materialBatchNo;
obj.number = this.eachNumber;
obj.unit = unit;
obj.outBillCode = outBillCode;
obj.outBillDetailCode = outBillDetailCode;
obj.materialName = materialName;
obj.specification = specification;
obj.unitName = unitName;
obj.index = i
obj.connectedLocation = connectedLocation;
obj.u9StorageCode = u9StorageCode;
obj.whCode = whCode;
obj.u9IssueApplyDocLineId = u9IssueApplyDocLineId;
if (i == t - 1) {
if (k != 0) {
obj.number = Number(k);
}
}
// obj.materialLotNo = i + 1;
console.log(obj);
this.wmsLotNoList.push(obj);
console.log(obj.number, k, "num");
}
console.log(this.wmsLotNoList, "this.wmsLotNoListthis.wmsLotNoList");
} else if (this.splitNumber != null) {
let k;
let j;
k = parseInt(this.singleInfo.number / this.splitNumber);
j = this.singleInfo.number - (this.splitNumber - 1) * k;
for (let i = 0; i < this.splitNumber; i++) {
let obj = {};
obj.materialCode = materialCode;
obj.materialBatchNo = materialBatchNo;
obj.number = k;
obj.unit = unit;
obj.index = i;
obj.outBillCode = outBillCode;
obj.outBillDetailCode = outBillDetailCode;
obj.materialName = materialName;
obj.unitName = unitName;
obj.specification = specification;
obj.connectedLocation = connectedLocation;
obj.u9StorageCode = u9StorageCode;
obj.whCode = whCode;
obj.storageLocationCode = storageLocationCode;
obj.u9IssueApplyDocLineId = u9IssueApplyDocLineId;
// obj.materialLotNo = i + 1;
if (i == this.splitNumber - 1) {
obj.number = Number(j);
}
console.log(obj.number, Number(j), "num");
this.wmsLotNoList.push(obj);
}
console.log(this.wmsLotNoList, "this.wmsLotNoListthis.wmsLotNoList");
} else if (this.eachSecondNumber != null) {
let t;
let k;
t = parseInt(this.singleInfo.secondNumber / this.eachSecondNumber);
k = this.singleInfo.secondNumber % this.eachSecondNumber;
if (k != 0) {
t++;
}
for (let i = 0; i < t; i++) {
let obj = {};
obj.index = i;
obj.materialCode = materialCode;
obj.materialBatchNo = materialBatchNo;
obj.secondNumber = this.eachSecondNumber;
obj.secondUnit = secondUnit;
obj.outBillCode = outBillCode;
obj.outBillCode = outBillDetailCode;
obj.materialName = materialName;
obj.unitName = unitName;
obj.specification = specification;
obj.connectedLocation = connectedLocation;
obj.u9StorageCode = u9StorageCode;
obj.whCode = whCode;
obj.storageLocationCode = storageLocationCode;
obj.u9IssueApplyDocLineId = u9IssueApplyDocLineId;
if (i == t - 1) {
if (k != 0) {
obj.secondNumber = k;
}
}
// obj.materialLotNo = i + 1;
console.log(obj);
this.wmsLotNoList.push(obj);
console.log(this.wmsLotNoList, " this.wmsLotNoList");
}
}
},
async submit() {
addSplitOutInfo(this.wmsLotNoList).then(res => {
console.log(res, "拆分记录");
this.$modal.msgSuccess(res.msg);
})
// })
}
},
}
</script>
<style>
.cu-card.article>.cu-item .content .text-content {
height: 100% !important;
}
.cu-card.article>.cu-item {
padding-bottom: 0;
}
.cu-card>.cu-item {
margin: 0;
}
.uni-swipe {
overflow: inherit;
}
</style>

View File

@@ -0,0 +1,350 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData">
<!-- <uni-collapse-item title="明细标签入库" :open="true"> -->
<uni-forms-item label="扫描标签" :labelWidth='90' name="purchaseLabelCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @blur="getlabelCode" placeholder='请扫描标签'
v-model="purchaseLabelCode" type="text" :focus='true'/>
</uni-forms-item>
<!-- 标签明细 -->
<uni-collapse-item :open="true">
<uni-card :is-shadow="false" is-full v-for="(item,index) in formData.wmsCommonInDetailLabelList"
:key="index" v-if="total>0">
<div><strong>标签码</strong>:{{item.labelCode}}</div>
<div><strong>供应商</strong>:{{item.supplierName}}</div>
<div><strong>物料编码</strong>:{{item.materialCode}}</div>
<div><strong>物料名称</strong>:{{item.materialName}}</div>
<div><strong>规格</strong>:{{item.specification}}</div>
<div><strong>批号</strong>:{{item.materialBatchNo}}</div>
<div><strong>数量</strong>:{{item.number}}</div>
<!-- <div><strong>状态</strong>:{{returnStatus(item.status)}}</div> -->
<div><strong>状态</strong>:{{dtlStatusFormat(item.status)}}</div>
</uni-card>
</uni-collapse-item>
<uni-forms-item label="上架扫码" :labelWidth='90' name="location" style="margin-top:10px">
<uni-easyinput suffixIcon="scan" @iconClick="scanLocation" @blur="getWarehouse"
placeholder='请扫描库位标签' v-model="locationCode" type="text" />
</uni-forms-item>
<uni-collapse-item :open="true">
<uni-card :is-shadow="false" is-full v-if='warehouseName'>
<div><strong>仓库</strong>:{{warehouseName}}</div>
<div><strong>库位</strong>:{{showLocationCode}}</div>
</uni-card>
</uni-collapse-item>
<u-button type="primary" @click="submitIn">确认入库</u-button>
</uni-forms>
</uni-collapse>
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="确认是否入库" @confirm="dialogConfirm">
<div>
<div><strong>物料编码</strong>:{{alert.materialCode}}</div>
<div><strong>数量</strong>:{{alert.number}}</div>
<div><strong>库位</strong>:{{alert.showLocationCode}}</div>
</div>
</uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
import {
listQuality,
getQuality,
addIn,
listReceive,
getReceive,
getListDetail,
updateIn,
listIn,
getIn,
getQualityDetail,
getReceiveDetail,
getDetailListsBySRM,
getListDetailByBL,
listSupplier,
listPurchaseInDetailLabel,
listWarehouse,
labelInStock,
} from "@/api/wms/purchase.js";
import {
getConfigKey,
} from "@/api/wms/materRequisitiontask";
export default {
onLoad: function() {},
created() {
//获取当前客户
getConfigKey('wms.warehouse.mode').then(res =>{
this.getConfigKey.setkey(res.msg)
})
},
mounted() {
},
data() {
return {
// 遮罩层
loading: true,
// 总条数
total: 0,
//标识码
purchaseLabelCode: null,
//库位码
locationCode: null,
//仓库码
showLocationCode: null,
//仓库名
warehouseName: null,
formData: {
areaCode: null,
shelvesCode: null,
storageLocationCode: null,
whCode: null,
// 采购入库明细标签表格数据
wmsCommonInDetailLabelList: [],
},
//标签码查询参数
queryParams: {
pageNum: 1,
pageSize: 50,
labelCode: null,
},
//仓库查询参数
queryParamsCK: {
pageNum: 1,
pageSize: 50,
orderByColumn: "id",
isAsc: "desc",
warehouseCode: null,
},
getConfigKey:new classLocationCode(),
alert:{
materialCode :null,
number : null,
showLocationCode: null
}
}
},
methods: {
//明细状态
dtlStatusFormat(status) {
if (status == 1) {
return "入库完成";
} else if (status == 0) {
return "等待入库";
} else if (status == 2) {
return "入库中";
} else {
return "等待入库";
}
},
//扫描标签码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.purchaseLabelCode = res.result;
_this.getlabelCode();
}
});
},
getlabelCode() {
this.queryParams.labelCode = this.purchaseLabelCode;
this.getList()
},
//查询标签列表
getList() {
this.loading = true;
//解析扫的条码信息,以,为间隔转换成数组,并取第二个数据为真实需要的信息
this.purchaseLabelCode = this.queryParams.labelCode = this.queryParams.labelCode.split(',')[1]
listPurchaseInDetailLabel(this.queryParams).then(res => {
this.formData.wmsCommonInDetailLabelList = [res.rows[0]];
this.total = res.total;
this.loading = false;
if (this.total == 0) {
// console.log("二维码有错");
this.$modal.msgError("标签二维码错误");
this.purchaseLabelCode = null
}
});
},
//扫描库位码
scanLocation() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.locationCode = res.result;
_this.getWarehouse();
}
});
},
//仓库码
async getWarehouse() {
if (this.locationCode == null || this.locationCode == '') {
this.$modal.msgError("库位码为空");
} else {
this.showLocationCode = this.locationCode
let parts = this.locationCode.split('-');
if (parts.length <1 || parts.length > 4) {
this.$modal.msgError("库位码格式有误");
this.locationCode = null
return
}
parts = this.getConfigKey.getValue(this.locationCode).split('-');
// this.formData.whCode = parts[0] || null;
this.formData.whCode = await getParts(parts) || null;
this.formData.areaCode = parts[1] || null;
this.formData.shelvesCode = parts[2] || null;
this.formData.storageLocationCode = parts.slice(3).join('-') || null;
this.queryParamsCK.warehouseCode = parts[0]
this.getlistWarehouse()
}
/**
* 根据扫的二维码的长度判断其第一位应该是什么值
* @name PZQ
* @param {Object} parts 二维码转换的数组
*/
function getParts(parts){
if(parts.length == 4 ){
return parts[0] || null;
}else {
return '0' + parts[0].charAt(0) || null;
}
}
},
//查仓库名
getlistWarehouse() {
// this.formData.location
this.loading = true;
listWarehouse(this.queryParamsCK).then(res => {
this.warehouseName = res.rows[0].warehouseName
this.loading = false;
});
},
//重置
reset() {
// 总条数
this.total = 0,
//标识码
this.purchaseLabelCode = null,
//库位码
this.locationCode = null,
//仓库码
this.showLocationCode = null,
//仓库名
this.warehouseName = null,
this.formData = {
areaCode: null,
shelvesCode: null,
storageLocationCode: null,
whCode: null,
// 采购入库明细标签表格数据
wmsCommonInDetailLabelList: [],
}
//标签码查询参数
this.queryParams = {
pageNum: 1,
pageSize: 50,
labelCode: null,
}
//仓库查询参数
this.queryParamsCK = {
pageNum: 1,
pageSize: 50,
orderByColumn: "id",
isAsc: "desc",
warehouseCode: null,
}
},
//确认入库
submitIn() {
if(this.formData.wmsCommonInDetailLabelList == null || this.formData.whCode == []){
this.$modal.msgError("请扫描标识码");
return;
}
if(this.formData.whCode == null || this.formData.whCode == ''){
this.$modal.msgError("请扫描库位码");
return;
}
console.log(this.formData)
const {wmsCommonInDetailLabelList} = this.formData
const {materialCode,number } = wmsCommonInDetailLabelList[0]
// showLocationCode
// else
//弹框二次确认
this.alert = {
materialCode,
number,
showLocationCode:this.showLocationCode
}
this.$refs.alertDialog.open()
return
// uni.showModal({
// title: '提示',
// content: `确定要入库数量为${number}物料编码为${materialCode}到${this.showLocationCode}吗?`,
// success: res => {
// if (res.confirm) {
// labelInStock(this.formData).then(response => {
// this.$modal.msgSuccess("入库成功");
// this.reset()
// });
// } else if (res.cancel) {
// // console.log('用户点击取消');
// uni.showToast({
// title: '取消入库',
// icon: 'none', //如果要纯文本不要icon将值设为'none'
// duration: 2000 //持续时间为 2秒
// })
// }
// }
// });
},
dialogConfirm(){
labelInStock(this.formData).then(response => {
this.$modal.msgSuccess("入库成功");
this.reset()
});
this.$refs.alertDialog.close()
}
}
}
class classLocationCode{
#key = null
setkey(key){
this.key = key
}
/**
* 给外部调用的方法
* @param {Object} value
*/
getValue(value){
const obj = {
"1":this.#getLocationCode,
}
if(this.key in obj){
return obj[this.key](value)
}
return value
}
/**
* 判断上架扫码是否拼接
* @param {Object} value
*/
#getLocationCode(value){
const number = value[0]
return '0' + number + '-' + value
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,78 @@
<template>
<view class="uni-padding-wrap uni-common-mt" >
<view class="grid-body">
<uni-grid :column="3" :showBorder="false" @change="changeGrid1">
<uni-grid-item :index="1" style="line-height: 100px;margin-top:100px;margin-left:37.5%;width: 100%;">
<view class="grid-item-box">
<uni-icons custom-prefix="iconfont" type="icon-caigoushouhuodan" size="30"></uni-icons>
<text class="text">采购收货单</text>
</view>
</uni-grid-item>
<uni-grid-item :index="2" style="line-height: 100px;margin-left:37.5%;width: 100%;">
<view class="grid-item-box">
<uni-icons custom-prefix="iconfont" type="icon-zhijian" size="30"></uni-icons>
<text class="text">采购质检</text>
</view>
</uni-grid-item>
<uni-grid-item :index="3" style="line-height: 100px;margin-left:37.5%;width: 100%;">
<view class="grid-item-box">
<uni-icons custom-prefix="iconfont" type="icon-navicon-cgrkd" size="30"></uni-icons>
<text class="text">采购入库单</text>
</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
</view>
</template>
<script>
export default {
onLoad: function() {
},
methods: {
changeGrid1(e) {
console.log(e.detail.index);
if (e.detail.index == 1) {
this.$tab.navigateTo('/pages/wms/purchase/purchaseSh');
} else if (e.detail.index == 2) {
this.$tab.navigateTo('/pages/wms/purchase/purchaseQualityT');
} else if (e.detail.index == 3) {
this.$tab.navigateTo('/pages/wms/purchase/purchaseRk');
}
}
}
}
</script>
<style>
uni-grid-item {
line-height: 100px;
margin: auto;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>

View File

@@ -0,0 +1,673 @@
<template>
<view>
<uni-collapse>
<view class="cu-card article ">
<view class="cu-item shadow borderBottom">
<view class="content">
<view class="desc">
<view class="text-content" style="font-size: 15px;">
<view><strong>物料编码</strong> : {{singleInfo.materialCode}}</view>
<view><strong>物料名称</strong> : {{singleInfo.materialName}}</view>
<view><strong>物料批号</strong> : {{singleInfo.materialBatchNo}}</view>
<view><strong>上架数量</strong> : {{singleInfo.secondNumber}}</view>
</view>
</view>
</view>
</view>
</view>
<uni-row>
<uni-col :span="12">
<span style="display: block;text-align: center;">每份数量<view style="margin-left: 15%;"><u-number-box
v-model="eachNumber" integer min="0" @change="eachNumberClear" /></view></span>
</uni-col>
<uni-col :span="12">
<span style="display: block;text-align: center;">拆分数量<view style="margin-left: 15%;"><u-number-box
v-model="splitNumber" integer min="0" @change="splitNumberClear" /></view></span>
</uni-col>
</uni-row>
<uni-row style="margin-top: 5px;" :gutter="10">
<uni-col :span="12">
<u-button type="primary" icon="cut" :disabled="isSecondOpen" @click="multiSplit" :plain="true"
text="拆分"></u-button>
</uni-col>
<uni-col :span="12">
<u-button type="success" icon="close-circle" @click="singleSplit" :disabled="isSecondOpen"
:plain="true" text="不拆分"></u-button>
</uni-col>
</uni-row>
<uni-collapse-item :open="true">
<uni-forms ref="form" :modelValue="formData">
<view :key="index" v-for="(item, index) in wmsLotNoList">
<view>
<uni-badge :text="index+1" class="uni-badge-left-margin" type="primary"></uni-badge>
</view>
<uni-forms-item label="物料箱号" :labelWidth='90' :name="item.lotNo">
<uni-easyinput type="text" v-model="item.lotNo" />
</uni-forms-item>
<uni-forms-item label="推荐库位" :label-width="90" ref="myInput">
<uni-easyinput disabled type="text" v-model="item.recommend"
style="width: 70%;float: left;" />
<u-button
style="background-color: beige;width: 30%;float: left;font-size: 100%;height: 100%;"
@click="clickCopy(index)">复制库位</u-button>
</uni-forms-item>
<uni-forms-item label="库位条码" :labelWidth='90'
:name="'wmsLotNoList.'+ index +'.storageLocationBarcode'">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
@change="splitStlBarcode(index,$event)" type="text"
v-model="item.storageLocationBarcode" />
</uni-forms-item>
<uni-forms-item label="上架数量" :labelWidth='90'>
<second-number-change-to-convert :materialCode="item.materialCode"
:secondNumber.sync="item.secondNumber" :secondUnitId="item.secondUnitId"
:number.sync="item.number" :unitId="item.unitId"></second-number-change-to-convert>
<!-- <u-number-box inputWidth="120" button-size="36" v-model="item.secondNumber"
min="0"></u-number-box> -->
</uni-forms-item>
<uni-forms-item label="入库时间" :labelWidth='90' :name="item.storageInTime">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="item.storageInTime" />
</view>
</uni-forms-item>
</view>
</uni-forms>
</uni-collapse-item>
</uni-collapse>
<u-button type="warning" @click="clickCopy">一键复制</u-button>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
addInDetail,
addLotInfo,
uploadU9
} from "@/api/wms/purchase.js";
import SecondNumberChangeToConvert from "@/components/SecondNumberChangeToConvert/index.vue";
import {
updateInDetail,
getConnectLoc
} from "@/api/wms/pdcIn.js";
import {
listStock
} from "@/api/wms/stock.js"
// import { set } from "lodash";
export default {
onLoad: async function(option) {
console.log(option);
console.log(option.selectedRow);
console.log(option.singleInfo);
console.log(option.wmsLotNoList);
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.rkTime = formattedDate;
this.isSecondOpen = option.isSecondOpen == 'false' ? false : true;
this.selectedRow = JSON.parse(decodeURIComponent(option.selectedRow));
this.singleInfo = JSON.parse(decodeURIComponent(option.singleInfo));
this.wmsLotNoList = JSON.parse(decodeURIComponent(option.wmsLotNoList));
this.wmsLotNoList.map(item => {
item.storageInTime = formattedDate;
item.storageLocationBarcode = item.whCode ? (item.areaCode ? (
item.shelvesCode ? (item.storageLocationCode ? (item
.whCode + '-' + item.areaCode + '-' + item
.shelvesCode +
'-' + item.storageLocationCode) : (item.whCode +
'-' + item.areaCode + '-' + item
.shelvesCode
)) : (item.whCode + '-' + item.areaCode)) : item
.whCode) : ''
return item
})
console.log(this.wmsLotNoList);
this.recommend = await fnListStock(this.singleInfo)
this.eachNumber = option.eachNumber;
this.splitNumber = option.splitNumber;
this.index = option.index
/**
* 通过明细编码去获取库位
* @param {Object} list 明细信息
*/
async function fnListStock(list) {
const set = new Set()
await listStock({
materialCode: list.materialCode
}).then(res => {
const rows = res.rows;
for (let i in rows) {
if (rows[i].whCode != null && rows[i].areaCode != null && rows[i]
.storageLocationCode && rows[i].shelvesCode) {
set.add(rows[i].whCode + '-' + rows[i].areaCode + '-' + rows[i].shelvesCode +
'-' + rows[i].storageLocationCode)
}
}
})
return [...set].toString()
}
},
data() {
return {
recommend: null,
number: 1111,
//入库时间
rkTime: null,
//是否已分批
isSecondOpen: false,
selectedRow: {},
singleInfo: {},
wmsLotNoList: [],
eachNumber: null,
splitNumber: null,
index: null,
checkStorageLocationBarcode: true,
// storageLocationBarcode: ''
formData: {},
isSubmitted: false,
rules: {
// storageLocationBarcode: {
// rules: [{
// required: true,
// errorMessage: '请输入库位条码!'
// }]
// }
storageLocationBarcode: [{
required: true,
errorMessage: '请输入库位条码!'
}]
},
}
},
components: {
SecondNumberChangeToConvert
},
methods: {
eachNumberClear() {
this.eachSecondNumber = null;
this.splitNumber = null;
},
eachSecondNumberClear() {
this.eachNumber = null;
this.splitNumber = null;
},
splitNumberClear() {
this.eachNumber = null;
this.eachSecondNumber = null;
},
//选择条件拆分批次
multiSplit() {
this.wmsLotNoList = [];
let materialCode = this.singleInfo.materialCode;
let batchNo = this.singleInfo.materialBatchNo;
let unit = this.singleInfo.unit;
let unitId = this.singleInfo.unitId;
let secondUnitId = this.singleInfo.secondUnitId;
let purchaseInCode = this.singleInfo.purchaseInCode;
let materialName = this.singleInfo.materialName;
let specification = this.singleInfo.specification;
let unitName = this.singleInfo.unitName;
let u9StorageCode = this.singleInfo.u9StorageCode;
let storageInBillDetailCode = this.singleInfo.storageInBillDetailCode;
let u9LineId = this.singleInfo.u9LineId;
let connectedLocation = "";
let storageInTime = this.rkTime;
if (this.singleInfo.whCode != null) {
connectedLocation = this.singleInfo.whCode;
if (this.singleInfo.areaCode != null) {
connectedLocation = connectedLocation + '-' + this.singleInfo.areaCode;
if (this.singleInfo.shelvesCode != null) {
connectedLocation = connectedLocation + '-' + this.singleInfo.shelvesCode;
if (this.singleInfo.storageLocationCode != null) {
connectedLocation = connectedLocation + '-' + this.singleInfo.storageLocationCode;
}
}
}
}
let locCascade = [
this.singleInfo.whCode,
this.singleInfo.areaCode,
this.singleInfo.shelvesCode,
this.singleInfo.storageLocationCode,
];
if (this.eachNumber != null) {
let t;
let k;
t = parseInt(this.singleInfo.number / this.eachNumber);
k = this.singleInfo.number % this.eachNumber;
let rate;
let secondK;
let secondT;
rate = this.singleInfo.number / this.singleInfo.secondNumber;
secondT = parseInt(this.singleInfo.secondNumber / this.eachNumber);
secondK = this.singleInfo.secondNumber % this.eachNumber;
// if (k != 0) { t++; }
if (secondK != 0) {
secondT++;
}
for (let i = 0; i < secondT; i++) {
let obj = {};
obj.recommend = this.recommend;
obj.materialCode = materialCode;
obj.batchNo = batchNo;
obj.number = this.eachNumber * rate;
obj.secondNumber = this.eachNumber;
obj.unit = unit;
obj.unitId = unitId;
obj.secondUnitId = secondUnitId;
obj.storageInBillCode = purchaseInCode;
obj.materialName = materialName;
obj.specification = specification;
obj.unitName = unitName;
obj.locCascade = locCascade;
obj.connectedLocation = connectedLocation;
obj.u9StorageCode = u9StorageCode;
obj.storageInBillDetailCode = storageInBillDetailCode;
obj.u9LineId = u9LineId;
obj.storageInTime = storageInTime;
// this.selectLoc(locCascade, obj);
if (i == secondT - 1) {
if (secondK != 0) {
obj.number = secondK * rate;
obj.secondNumber = secondK;
}
}
// obj.lotNo = i + 1;
this.wmsLotNoList.push(obj);
}
} else if (this.splitNumber != null) {
let k;
let j;
const data = this.singleInfo[0] === undefined ? this.singleInfo : this.singleInfo[0]
k = parseInt(data.number / this.splitNumber);
j = data.number - (this.splitNumber - 1) * k;
let secondK;
let secondJ;
secondK = parseInt(data.secondNumber / this.splitNumber);
secondJ = data.secondNumber - (this.splitNumber - 1) * secondK;
for (let i = 0; i < this.splitNumber; i++) {
let obj = {};
obj.recommend = this.recommend;
obj.materialCode = materialCode;
obj.batchNo = batchNo;
obj.number = k;
obj.unit = unit;
obj.secondNumber = secondK;
obj.unitId = unitId;
obj.secondUnitId = secondUnitId;
obj.storageInBillCode = purchaseInCode;
obj.materialName = materialName;
obj.unitName = unitName;
obj.specification = specification;
obj.locCascade = locCascade;
// this.selectLoc(locCascade, obj);
obj.connectedLocation = connectedLocation;
obj.u9StorageCode = u9StorageCode;
obj.storageInBillDetailCode = storageInBillDetailCode;
obj.u9LineId = u9LineId;
obj.storageInTime = storageInTime;
// obj.lotNo = i + 1;
if (i == this.splitNumber - 1) {
obj.number = j;
obj.secondNumber = secondJ;
}
this.wmsLotNoList.push(obj);
}
} else if (this.eachSecondNumber != 0) {
let t;
let k;
t = parseInt(this.singleInfo.secondNumber / this.eachSecondNumber);
k = this.singleInfo.secondNumber % this.eachSecondNumber;
if (k != 0) {
t++;
}
for (let i = 0; i < t; i++) {
let obj = {};
obj.recommend = this.recommend;
obj.materialCode = materialCode;
obj.batchNo = batchNo;
obj.secondNumber = this.eachSecondNumber;
obj.secondUnit = secondUnit;
obj.storageInBillCode = purchaseInCode;
obj.materialName = materialName;
obj.unitName = unitName;
obj.secondNumber = this.eachSecondNumber;
obj.unitId = unitId;
obj.secondUnitId = secondUnitId;
obj.specification = specification;
obj.locCascade = locCascade;
obj.connectedLocation = connectedLocation;
obj.u9StorageCode = u9StorageCode;
obj.storageInBillDetailCode = storageInBillDetailCode;
obj.u9LineId = u9LineId;
obj.storageInTime = storageInTime;
// this.selectLoc(locCascade, obj);
if (i == t - 1) {
if (k != 0) {
obj.secondNumber = k;
}
}
// obj.lotNo = i + 1;
this.wmsLotNoList.push(obj);
}
}
},
/**
* 复制
*/
clickCopy(index) {
const data = this.wmsLotNoList
if (index != undefined) {
data[index].storageLocationBarcode = data[index].recommend
} else {
for (let i in data) {
data[i].storageLocationBarcode = data[i].recommend
}
}
this.wmsLotNoList = Object.assign({});
this.wmsLotNoList = data
},
//不拆分批次
async singleSplit() {
const set = new Set()
await listStock({
materialCode: this.singleInfo.materialCode
}).then(res => {
const rows = res.rows;
for (let i in rows) {
if (rows[i].whCode != null && rows[i].areaCode != null && rows[i]
.storageLocationCode && rows[i].shelvesCode) {
set.add(rows[i].whCode + '-' + rows[i].areaCode + '-' + rows[i]
.storageLocationCode + '-' + rows[i].shelvesCode)
}
}
})
const array = [...set].toString()
this.wmsLotNoList = [];
this.splitNumber = 1;
let obj = {};
obj.areaCode = array;
obj.recommend = this.recommend;
obj.materialCode = this.singleInfo.materialCode;
obj.batchNo = this.singleInfo.materialBatchNo;
obj.secondNumber = this.singleInfo.secondNumber;
obj.secondUnit = this.singleInfo.secondUnit;
obj.storageInBillCode = this.singleInfo.purchaseInCode;
obj.number = this.singleInfo.number;
obj.unitId = this.singleInfo.unitId;
obj.secondUnitId = this.singleInfo.secondUnitId;
obj.unit = this.singleInfo.unit;
obj.unitName = this.singleInfo.unitName;
obj.materialName = this.singleInfo.materialName;
obj.specification = this.singleInfo.specification;
obj.u9StorageCode = this.singleInfo.u9StorageCode;
obj.storageInBillDetailCode = this.singleInfo.storageInBillDetailCode;
obj.u9LineId = this.singleInfo.u9LineId;
obj.storageInTime = this.rkTime;
if (this.singleInfo.whCode != null) {
obj.connectedLocation = this.singleInfo.whCode;
if (this.singleInfo.areaCode != null) {
obj.connectedLocation = obj.connectedLocation + '-' + this.singleInfo.areaCode;
if (this.singleInfo.shelvesCode != null) {
obj.connectedLocation = obj.connectedLocation + '-' + this.singleInfo.shelvesCode;
if (this.singleInfo.storageLocationCode != null) {
obj.connectedLocation = obj.connectedLocation + '-' + this.singleInfo
.storageLocationCode;
}
}
}
}
obj.locCascade = [
this.singleInfo.whCode,
this.singleInfo.areaCode,
this.singleInfo.shelvesCode,
this.singleInfo.storageLocationCode,
];
// this.selectLoc(obj.locCascade, obj);
// obj.lotNo = 1;
this.wmsLotNoList.push(obj);
},
async splitStlBarcode(i, event) {
console.log(i)
const _this = this;
const detail = _this.wmsLotNoList[i];
console.log(detail.whCode)
detail.whCode = _this.singleInfo.whCode
detail.areaCode = null;
detail.shelvesCode = null;
detail.storageLocationCode = null;
let barcode = detail.storageLocationBarcode;
if (!barcode) {
return; // 如果没有条码,不做任何处理
}
// 分割为三部分:库区、货架、库位(库位可能含'-'
const parts = barcode.split('-');
if (parts.length < 3) {
_this.$modal.msg("库位条码格式错误,应为:库区-货架-库位");
return;
}
// 解析三部分
const areaCode = parts[0];
const shelvesCode = parts[1];
const storageLocationCode = parts.slice(2).join('-'); // 合并剩余部分为库位
const data = await getConnectLoc({
connectLoc: event
})
if (!data.data) return this.$modal.msg("库位条码校验错误,请重新输入!")
_this.checkStorageLocationBarcode = true;
detail.areaCode = areaCode || null;
detail.shelvesCode = shelvesCode || null;
detail.storageLocationCode = storageLocationCode || null;
},
scanBarstorageLocationBarcode(i) {
const _this = this;
_this.isSubmitted = false
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.wmsLotNoList[i], "storageLocationBarcode", res
.result);
_this.splitStlBarcode(i);
}
});
},
//提交分批入库详情
async submit() {
// const valid = await this.$refs.form.validate();
// if (valid) {
// this.$refs.form.validate().then(res => {
let isStorageLocationBarcode = true;
for (var i in this.wmsLotNoList) {
if (this.wmsLotNoList[i].storageLocationBarcode == null || this.wmsLotNoList[i]
.storageLocationBarcode == '') isStorageLocationBarcode = false
}
if (isStorageLocationBarcode) {
//数量防错
let allNum = 0;
for (var i in this.wmsLotNoList) {
allNum += this.wmsLotNoList[i].number;
}
if (this.wmsLotNoList.length > 0) {
if (this.wmsLotNoList[0].id != null) {
for (let i = 0; i < this.wmsLotNoList.length; i++) {
// if (this.wmsu9whMode == "true") {
// console.log(this.wmsu9whMode);
// updateU9Stock(this.wmsLotNoList[i]);
// } else {
// updateStock(this.wmsLotNoList[i]);
// }
if (this.wmsLotNoList && this.wmsLotNoList.length >
0) {
this.selectedRow.status = "1";
} else {
this.selectedRow.status = "0";
}
}
this.$modal.msgSuccess("编辑成功!");
setTimeout(() => {
uni.$emit('backWithParam', {
status: this.selectedRow.status,
index: this.index
});
this.$tab.navigateBack();
}, 500);
} else {
let obj = {};
obj = this.singleInfo;
obj.batchNo = this.singleInfo.materialBatchNo;
obj.eachNumber = this.eachNumber;
obj.splitNumber = this.splitNumber;
if (this.wmsLotNoList && this.wmsLotNoList.length >
0) {
this.selectedRow.status = "1";
} else {
this.selectedRow.status = "0";
}
if (!this.checkStorageLocationBarcode) {
this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
console.log(this.wmsLotNoList)
// 拼接仓库
if (!this.isSubmitted) {
this.isSubmitted = true
for (let i in this.wmsLotNoList) {
this.wmsLotNoList[i].storageLocationBarcode =
`${this.wmsLotNoList[i].whCode}-${this.wmsLotNoList[i].storageLocationBarcode}`
}
}
console.log(this.wmsLotNoList)
this.$modal.loading('提交中')
addLotInfo(obj).then(res => {
addInDetail(this.wmsLotNoList, 1).then(res => {
uploadU9(this.wmsLotNoList)
this.$modal.closeLoading();
this.$modal.msgSuccess("编辑成功!");
// setTimeout(() => {
uni.$emit(
'backWithParam', {
status: this
.selectedRow
.status,
index: this
.index
});
this.$tab.navigateBack();
// }, 500);
})
});
}
}
// if (allNum == this.singleInfo.number) {
// if (this.wmsLotNoList.length > 0) {
// if (this.wmsLotNoList[0].id != null) {
// console.log(this.wmsLotNoList[0].id);
// for (let i = 0; i < this.wmsLotNoList.length; i++) {
// // if (this.wmsu9whMode == "true") {
// // console.log(this.wmsu9whMode);
// // updateU9Stock(this.wmsLotNoList[i]);
// // } else {
// // updateStock(this.wmsLotNoList[i]);
// // }
// if (this.wmsLotNoList && this.wmsLotNoList.length >
// 0) {
// this.selectedRow.status = "1";
// } else {
// this.selectedRow.status = "0";
// }
// }
// this.$modal.msgSuccess("编辑成功!");
// setTimeout(() => {
// uni.$emit('backWithParam', {
// status: this.selectedRow.status,
// index: this.index
// });
// this.$tab.navigateBack();
// }, 500);
// } else {
// let obj = {};
// obj = this.singleInfo;
// obj.batchNo = this.singleInfo.materialBatchNo;
// obj.eachNumber = this.eachNumber;
// obj.splitNumber = this.splitNumber;
// if (this.wmsLotNoList && this.wmsLotNoList.length >
// 0) {
// this.selectedRow.status = "1";
// } else {
// this.selectedRow.status = "0";
// }
// if (!this.checkStorageLocationBarcode) {
// this.$modal.msg("库位条码校验错误,请重新输入!")
// return;
// }
// this.$modal.loading('提交中')
// addLotInfo(obj).then(res => {
// addInDetail(this.wmsLotNoList, 1).then(res => {
// uploadU9(this.wmsLotNoList)
// this.$modal.closeLoading();
// this.$modal.msgSuccess("编辑成功!");
// // setTimeout(() => {
// uni.$emit(
// 'backWithParam', {
// status: this
// .selectedRow
// .status,
// index: this
// .index
// });
// this.$tab.navigateBack();
// // }, 500);
// })
// });
// }
// }
// } else {
// this.$modal.msg("批号分批入库明细数量不符合!");
// }
} else {
this.$modal.msg("库位条码必填!");
}
// })
}
},
}
</script>
<style>
.cu-card.article>.cu-item .content .text-content {
height: 100% !important;
}
.cu-card.article>.cu-item {
padding-bottom: 0;
}
.cu-card>.cu-item {
margin: 0;
}
.uni-swipe {
overflow: inherit;
}
</style>

View File

@@ -0,0 +1,655 @@
<template>
<view>
<uni-collapse>
<view class="cu-card article ">
<view class="cu-item shadow borderBottom">
<view class="content">
<view class="desc">
<view class="text-content" style="font-size: 15px;">
<view><strong>物料编码</strong> : {{singleInfo.materialCode}}</view>
<view><strong>物料名称</strong> : {{singleInfo.materialName}}</view>
<view><strong>物料批号</strong> : {{singleInfo.materialBatchNo}}</view>
<view><strong>上架数量</strong> : {{singleInfo.secondNumber}}</view>
</view>
</view>
</view>
</view>
</view>
<uni-row>
<uni-col :span="12">
<span style="display: block;text-align: center;">每份数量<view style="margin-left: 15%;"><u-number-box
v-model="eachNumber" integer min="0" @change="eachNumberClear" /></view></span>
</uni-col>
<uni-col :span="12">
<span style="display: block;text-align: center;">拆分数量<view style="margin-left: 15%;"><u-number-box
v-model="splitNumber" integer min="0" @change="splitNumberClear" /></view></span>
</uni-col>
</uni-row>
<uni-row style="margin-top: 5px;" :gutter="10">
<uni-col :span="12">
<u-button type="primary" icon="cut" :disabled="isSecondOpen" @click="multiSplit" :plain="true"
text="拆分"></u-button>
</uni-col>
<uni-col :span="12">
<u-button type="success" icon="close-circle" @click="singleSplit" :disabled="isSecondOpen"
:plain="true" text="不拆分"></u-button>
</uni-col>
</uni-row>
<uni-collapse-item :open="true">
<uni-forms ref="form" :modelValue="formData">
<view :key="index" v-for="(item, index) in wmsLotNoList">
<view>
<uni-badge :text="index+1" class="uni-badge-left-margin" type="primary"></uni-badge>
</view>
<uni-forms-item label="物料箱号" :labelWidth='90' :name="item.lotNo">
<uni-easyinput type="text" v-model="item.lotNo" />
</uni-forms-item>
<uni-forms-item label="推荐库位" :label-width="90" ref="myInput">
<uni-easyinput disabled type="text" v-model="item.recommend"
style="width: 70%;float: left;" />
<u-button
style="background-color: beige;width: 30%;float: left;font-size: 100%;height: 100%;"
@click="clickCopy(index)">复制库位</u-button>
</uni-forms-item>
<uni-forms-item label="库位条码" :labelWidth='90'
:name="'wmsLotNoList.'+ index +'.storageLocationBarcode'">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
@change="splitStlBarcode(index,$event)" type="text"
v-model="item.storageLocationBarcode" />
</uni-forms-item>
<uni-forms-item label="上架数量" :labelWidth='90'>
<second-number-change-to-convert :materialCode="item.materialCode"
:secondNumber.sync="item.secondNumber" :secondUnitId="item.secondUnitId"
:number.sync="item.number" :unitId="item.unitId"></second-number-change-to-convert>
<!-- <u-number-box inputWidth="120" button-size="36" v-model="item.secondNumber"
min="0"></u-number-box> -->
</uni-forms-item>
<uni-forms-item label="入库时间" :labelWidth='90' :name="item.storageInTime">
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="item.storageInTime" />
</view>
</uni-forms-item>
</view>
</uni-forms>
</uni-collapse-item>
</uni-collapse>
<u-button type="warning" @click="clickCopy">一键复制</u-button>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
addInDetail,
addLotInfo,
uploadU9
} from "@/api/wms/purchase.js";
import SecondNumberChangeToConvert from "@/components/SecondNumberChangeToConvert/index.vue";
import {
updateInDetail,
getConnectLoc
} from "@/api/wms/pdcIn.js";
import {
listStock
} from "@/api/wms/stock.js"
// import { set } from "lodash";
export default {
onLoad: async function(option) {
console.log(option);
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.endTime
this.rkTime = formattedDate;
this.isSecondOpen = option.isSecondOpen == 'false' ? false : true;
this.selectedRow = JSON.parse(decodeURIComponent(option.selectedRow));
this.singleInfo = JSON.parse(decodeURIComponent(option.singleInfo));
this.wmsLotNoList = JSON.parse(decodeURIComponent(option.wmsLotNoList));
this.wmsLotNoList.map(item => {
item.storageInTime = formattedDate;
item.storageLocationBarcode = item.whCode ? (item.areaCode ? (
item.shelvesCode ? (item.storageLocationCode ? (item
.whCode + '-' + item.areaCode + '-' + item
.shelvesCode +
'-' + item.storageLocationCode) : (item.whCode +
'-' + item.areaCode + '-' + item
.shelvesCode
)) : (item.whCode + '-' + item.areaCode)) : item
.whCode) : ''
return item
})
console.log(this.wmsLotNoList);
this.recommend = await fnListStock(this.singleInfo)
this.eachNumber = option.eachNumber;
this.splitNumber = option.splitNumber;
this.index = option.index
/**
* 通过明细编码去获取库位
* @param {Object} list 明细信息
*/
async function fnListStock(list) {
const set = new Set()
await listStock({
materialCode: list.materialCode
}).then(res => {
const rows = res.rows;
for (let i in rows) {
if (rows[i].whCode != null && rows[i].areaCode != null && rows[i]
.storageLocationCode && rows[i].shelvesCode) {
set.add(rows[i].whCode + '-' + rows[i].areaCode + '-' + rows[i].shelvesCode +
'-' + rows[i].storageLocationCode)
}
}
})
return [...set].toString()
}
},
data() {
return {
recommend: null,
number: 1111,
//入库时间
rkTime: null,
//是否已分批
isSecondOpen: false,
selectedRow: {},
singleInfo: {},
wmsLotNoList: [],
eachNumber: null,
splitNumber: null,
index: null,
checkStorageLocationBarcode: true,
// storageLocationBarcode: ''
formData: {},
rules: {
// storageLocationBarcode: {
// rules: [{
// required: true,
// errorMessage: '请输入库位条码!'
// }]
// }
storageLocationBarcode: [{
required: true,
errorMessage: '请输入库位条码!'
}]
},
}
},
components: {
SecondNumberChangeToConvert
},
methods: {
eachNumberClear() {
this.eachSecondNumber = null;
this.splitNumber = null;
},
eachSecondNumberClear() {
this.eachNumber = null;
this.splitNumber = null;
},
splitNumberClear() {
this.eachNumber = null;
this.eachSecondNumber = null;
},
//选择条件拆分批次
multiSplit() {
this.wmsLotNoList = [];
let materialCode = this.singleInfo.materialCode;
let batchNo = this.singleInfo.materialBatchNo;
let unit = this.singleInfo.unit;
let unitId = this.singleInfo.unitId;
let secondUnitId = this.singleInfo.secondUnitId;
let purchaseInCode = this.singleInfo.purchaseInCode;
let materialName = this.singleInfo.materialName;
let specification = this.singleInfo.specification;
let unitName = this.singleInfo.unitName;
let u9StorageCode = this.singleInfo.u9StorageCode;
let storageInBillDetailCode = this.singleInfo.storageInBillDetailCode;
let u9LineId = this.singleInfo.u9LineId;
let connectedLocation = "";
let storageInTime = this.rkTime;
if (this.singleInfo.whCode != null) {
connectedLocation = this.singleInfo.whCode;
if (this.singleInfo.areaCode != null) {
connectedLocation = connectedLocation + '-' + this.singleInfo.areaCode;
if (this.singleInfo.shelvesCode != null) {
connectedLocation = connectedLocation + '-' + this.singleInfo.shelvesCode;
if (this.singleInfo.storageLocationCode != null) {
connectedLocation = connectedLocation + '-' + this.singleInfo.storageLocationCode;
}
}
}
}
let locCascade = [
this.singleInfo.whCode,
this.singleInfo.areaCode,
this.singleInfo.shelvesCode,
this.singleInfo.storageLocationCode,
];
if (this.eachNumber != null) {
let t;
let k;
t = parseInt(this.singleInfo.number / this.eachNumber);
k = this.singleInfo.number % this.eachNumber;
let rate;
let secondK;
let secondT;
rate = this.singleInfo.number / this.singleInfo.secondNumber;
secondT = parseInt(this.singleInfo.secondNumber / this.eachNumber);
secondK = this.singleInfo.secondNumber % this.eachNumber;
// if (k != 0) { t++; }
if (secondK != 0) {
secondT++;
}
for (let i = 0; i < secondT; i++) {
console.log(i)
let obj = {};
obj.recommend = this.recommend;
obj.materialCode = materialCode;
obj.batchNo = batchNo;
obj.number = this.eachNumber * rate;
obj.secondNumber = this.eachNumber;
obj.unit = unit;
obj.unitId = unitId;
obj.secondUnitId = secondUnitId;
obj.storageInBillCode = purchaseInCode;
obj.materialName = materialName;
obj.specification = specification;
obj.unitName = unitName;
obj.locCascade = locCascade;
obj.connectedLocation = connectedLocation;
obj.u9StorageCode = u9StorageCode;
obj.storageInBillDetailCode = storageInBillDetailCode;
obj.u9LineId = u9LineId;
obj.storageInTime = storageInTime;
// this.selectLoc(locCascade, obj);
if (i == secondT - 1) {
if (secondK != 0) {
obj.number = secondK * rate;
obj.secondNumber = secondK;
}
}
// obj.lotNo = i + 1;
console.log(obj);
this.wmsLotNoList.push(obj);
}
} else if (this.splitNumber != null) {
let k;
let j;
const data = this.singleInfo[0] === undefined ? this.singleInfo : this.singleInfo[0]
k = parseInt(data.number / this.splitNumber);
j = data.number - (this.splitNumber - 1) * k;
let secondK;
let secondJ;
secondK = parseInt(data.secondNumber / this.splitNumber);
secondJ = data.secondNumber - (this.splitNumber - 1) * secondK;
for (let i = 0; i < this.splitNumber; i++) {
let obj = {};
obj.recommend = this.recommend;
obj.materialCode = materialCode;
obj.batchNo = batchNo;
obj.number = k;
obj.unit = unit;
obj.secondNumber = secondK;
obj.unitId = unitId;
obj.secondUnitId = secondUnitId;
obj.storageInBillCode = purchaseInCode;
obj.materialName = materialName;
obj.unitName = unitName;
obj.specification = specification;
obj.locCascade = locCascade;
// this.selectLoc(locCascade, obj);
obj.connectedLocation = connectedLocation;
obj.u9StorageCode = u9StorageCode;
obj.storageInBillDetailCode = storageInBillDetailCode;
obj.u9LineId = u9LineId;
obj.storageInTime = storageInTime;
// obj.lotNo = i + 1;
if (i == this.splitNumber - 1) {
obj.number = j;
obj.secondNumber = secondJ;
}
this.wmsLotNoList.push(obj);
}
} else if (this.eachSecondNumber != 0) {
let t;
let k;
t = parseInt(this.singleInfo.secondNumber / this.eachSecondNumber);
k = this.singleInfo.secondNumber % this.eachSecondNumber;
if (k != 0) {
t++;
}
for (let i = 0; i < t; i++) {
let obj = {};
obj.recommend = this.recommend;
obj.materialCode = materialCode;
obj.batchNo = batchNo;
obj.secondNumber = this.eachSecondNumber;
obj.secondUnit = secondUnit;
obj.storageInBillCode = purchaseInCode;
obj.materialName = materialName;
obj.unitName = unitName;
obj.secondNumber = this.eachSecondNumber;
obj.unitId = unitId;
obj.secondUnitId = secondUnitId;
obj.specification = specification;
obj.locCascade = locCascade;
obj.connectedLocation = connectedLocation;
obj.u9StorageCode = u9StorageCode;
obj.storageInBillDetailCode = storageInBillDetailCode;
obj.u9LineId = u9LineId;
obj.storageInTime = storageInTime;
// this.selectLoc(locCascade, obj);
if (i == t - 1) {
if (k != 0) {
obj.secondNumber = k;
}
}
// obj.lotNo = i + 1;
console.log(obj);
this.wmsLotNoList.push(obj);
}
}
},
/**
* 复制
*/
clickCopy(index) {
const data = this.wmsLotNoList
if (index != undefined) {
data[index].storageLocationBarcode = data[index].recommend
} else {
for (let i in data) {
data[i].storageLocationBarcode = data[i].recommend
}
}
this.wmsLotNoList = Object.assign({});
this.wmsLotNoList = data
},
//不拆分批次
async singleSplit() {
const set = new Set()
await listStock({
materialCode: this.singleInfo.materialCode
}).then(res => {
const rows = res.rows;
for (let i in rows) {
if (rows[i].whCode != null && rows[i].areaCode != null && rows[i]
.storageLocationCode && rows[i].shelvesCode) {
set.add(rows[i].whCode + '-' + rows[i].areaCode + '-' + rows[i]
.storageLocationCode + '-' + rows[i].shelvesCode)
}
}
})
const array = [...set].toString()
this.wmsLotNoList = [];
this.splitNumber = 1;
let obj = {};
obj.areaCode = array;
obj.recommend = this.recommend;
obj.materialCode = this.singleInfo.materialCode;
obj.batchNo = this.singleInfo.materialBatchNo;
obj.secondNumber = this.singleInfo.secondNumber;
obj.secondUnit = this.singleInfo.secondUnit;
obj.storageInBillCode = this.singleInfo.purchaseInCode;
obj.number = this.singleInfo.number;
obj.unitId = this.singleInfo.unitId;
obj.secondUnitId = this.singleInfo.secondUnitId;
obj.unit = this.singleInfo.unit;
obj.unitName = this.singleInfo.unitName;
obj.materialName = this.singleInfo.materialName;
obj.specification = this.singleInfo.specification;
obj.u9StorageCode = this.singleInfo.u9StorageCode;
obj.storageInBillDetailCode = this.singleInfo.storageInBillDetailCode;
obj.u9LineId = this.singleInfo.u9LineId;
obj.storageInTime = this.rkTime;
if (this.singleInfo.whCode != null) {
obj.connectedLocation = this.singleInfo.whCode;
if (this.singleInfo.areaCode != null) {
obj.connectedLocation = obj.connectedLocation + '-' + this.singleInfo.areaCode;
if (this.singleInfo.shelvesCode != null) {
obj.connectedLocation = obj.connectedLocation + '-' + this.singleInfo.shelvesCode;
if (this.singleInfo.storageLocationCode != null) {
obj.connectedLocation = obj.connectedLocation + '-' + this.singleInfo
.storageLocationCode;
}
}
}
}
obj.locCascade = [
this.singleInfo.whCode,
this.singleInfo.areaCode,
this.singleInfo.shelvesCode,
this.singleInfo.storageLocationCode,
];
// this.selectLoc(obj.locCascade, obj);
// obj.lotNo = 1;
this.wmsLotNoList.push(obj);
console.log(this.wmsLotNoList);
},
async splitStlBarcode(i, event) {
const _this = this;
const detail = _this.wmsLotNoList[i];
detail.whCode = null;
detail.areaCode = null;
detail.shelvesCode = null;
detail.storageLocationCode = null;
let barcode = detail.storageLocationBarcode;
if (!barcode) {
return; // 如果没有条码,不做任何处理
}
let [whCode, areaCode, shelvesCode, storageLocationCode, extra] = barcode.split('-');
const data = await getConnectLoc({
connectLoc: event
})
if (!data.data) return this.$modal.msg("库位条码校验错误,请重新输入!")
_this.checkStorageLocationBarcode = true;
detail.whCode = whCode || null;
detail.areaCode = areaCode || null;
detail.shelvesCode = shelvesCode || null;
detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
console.log(this.wmsLotNoList[i]);
},
scanBarstorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.wmsLotNoList[i], "storageLocationBarcode", res
.result);
_this.splitStlBarcode(i);
}
});
},
//提交分批入库详情
async submit() {
// const valid = await this.$refs.form.validate();
// if (valid) {
// this.$refs.form.validate().then(res => {
let isStorageLocationBarcode = true;
for (var i in this.wmsLotNoList) {
if (this.wmsLotNoList[i].storageLocationBarcode == null || this.wmsLotNoList[i]
.storageLocationBarcode == '') isStorageLocationBarcode = false
}
if (isStorageLocationBarcode) {
//数量防错
let allNum = 0;
for (var i in this.wmsLotNoList) {
allNum += this.wmsLotNoList[i].number;
}
console.log(allNum, this.singleInfo.number)
if (this.wmsLotNoList.length > 0) {
if (this.wmsLotNoList[0].id != null) {
console.log(this.wmsLotNoList[0].id);
for (let i = 0; i < this.wmsLotNoList.length; i++) {
// if (this.wmsu9whMode == "true") {
// console.log(this.wmsu9whMode);
// updateU9Stock(this.wmsLotNoList[i]);
// } else {
// updateStock(this.wmsLotNoList[i]);
// }
if (this.wmsLotNoList && this.wmsLotNoList.length >
0) {
this.selectedRow.status = "1";
} else {
this.selectedRow.status = "0";
}
}
this.$modal.msgSuccess("编辑成功!");
setTimeout(() => {
uni.$emit('backWithParam', {
status: this.selectedRow.status,
index: this.index
});
this.$tab.navigateBack();
}, 500);
} else {
let obj = {};
obj = this.singleInfo;
obj.batchNo = this.singleInfo.materialBatchNo;
obj.eachNumber = this.eachNumber;
obj.splitNumber = this.splitNumber;
if (this.wmsLotNoList && this.wmsLotNoList.length >
0) {
this.selectedRow.status = "1";
} else {
this.selectedRow.status = "0";
}
if (!this.checkStorageLocationBarcode) {
this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
this.$modal.loading('提交中')
addLotInfo(obj).then(res => {
addInDetail(this.wmsLotNoList, 1).then(res => {
uploadU9(this.wmsLotNoList)
this.$modal.closeLoading();
this.$modal.msgSuccess("编辑成功!");
// setTimeout(() => {
uni.$emit(
'backWithParam', {
status: this
.selectedRow
.status,
index: this
.index
});
this.$tab.navigateBack();
// }, 500);
})
});
}
}
// if (allNum == this.singleInfo.number) {
// if (this.wmsLotNoList.length > 0) {
// if (this.wmsLotNoList[0].id != null) {
// console.log(this.wmsLotNoList[0].id);
// for (let i = 0; i < this.wmsLotNoList.length; i++) {
// // if (this.wmsu9whMode == "true") {
// // console.log(this.wmsu9whMode);
// // updateU9Stock(this.wmsLotNoList[i]);
// // } else {
// // updateStock(this.wmsLotNoList[i]);
// // }
// if (this.wmsLotNoList && this.wmsLotNoList.length >
// 0) {
// this.selectedRow.status = "1";
// } else {
// this.selectedRow.status = "0";
// }
// }
// this.$modal.msgSuccess("编辑成功!");
// setTimeout(() => {
// uni.$emit('backWithParam', {
// status: this.selectedRow.status,
// index: this.index
// });
// this.$tab.navigateBack();
// }, 500);
// } else {
// let obj = {};
// obj = this.singleInfo;
// obj.batchNo = this.singleInfo.materialBatchNo;
// obj.eachNumber = this.eachNumber;
// obj.splitNumber = this.splitNumber;
// if (this.wmsLotNoList && this.wmsLotNoList.length >
// 0) {
// this.selectedRow.status = "1";
// } else {
// this.selectedRow.status = "0";
// }
// if (!this.checkStorageLocationBarcode) {
// this.$modal.msg("库位条码校验错误,请重新输入!")
// return;
// }
// this.$modal.loading('提交中')
// addLotInfo(obj).then(res => {
// addInDetail(this.wmsLotNoList, 1).then(res => {
// uploadU9(this.wmsLotNoList)
// this.$modal.closeLoading();
// this.$modal.msgSuccess("编辑成功!");
// // setTimeout(() => {
// uni.$emit(
// 'backWithParam', {
// status: this
// .selectedRow
// .status,
// index: this
// .index
// });
// this.$tab.navigateBack();
// // }, 500);
// })
// });
// }
// }
// } else {
// this.$modal.msg("批号分批入库明细数量不符合!");
// }
} else {
this.$modal.msg("库位条码必填!");
}
// })
}
},
}
</script>
<style>
.cu-card.article>.cu-item .content .text-content {
height: 100% !important;
}
.cu-card.article>.cu-item {
padding-bottom: 0;
}
.cu-card>.cu-item {
margin: 0;
}
.uni-swipe {
overflow: inherit;
}
</style>

View File

@@ -0,0 +1,625 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<!-- <uni-collapse-item title="采购质检单" :open="true"> -->
<uni-forms-item label="收货单" :labelWidth='90' name="purchaseReceiveCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode"
v-model="formData.purchaseReceiveCode" type="text" />
</uni-forms-item>
<uni-forms-item label="质检单" :labelWidth='90' name="purchaseQualityCode"
v-show="formData.purchaseQualityCode">
<uni-easyinput v-model="formData.purchaseQualityCode" type="text" disabled />
</uni-forms-item>
<uni-forms-item label="附件" :labelWidth='90' name="enclosure">
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
:maxCount="10" :previewFullImage="true"></u-upload>
</uni-forms-item>
<uni-forms-item label="质检方式" :labelWidth='90'>
<u-radio-group v-model="value" iconPlacement="left">
<u-radio label="正常" name="正常"></u-radio>
<u-radio label="扫物料标签" name="扫物料标签" style="margin-left: 10px;"></u-radio>
</u-radio-group>
</uni-forms-item>
<button size="mini" v-if="value=='扫物料标签' &&formData.wmsPurchaseQualityDetailList.length == 0"
type="primary" style="text-align: center;margin-left: 30%;font-size: 18px;"
@click="show=!show">添加物料标签</button>
<u-modal :show="show" title="扫描物料标签编码" showCancelButton closeOnClickOverlay
@cancel="cancelMaterialLabel" @close="cancelMaterialLabel" :showConfirmButton="false">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarMaterialLabel" v-model="materialLabel"
type="text" @confirm="confirmMaterialLabel" maxlength="-1" :focus="true" />
</u-modal>
<!-- </uni-collapse-item> -->
<uni-collapse-item title="采购质检单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in formData.wmsPurchaseQualityDetailList"
@click="(data) => clickDetail(index,data)">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'wmsPurchaseQualityDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'wmsPurchaseQualityDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
name="'wmsPurchaseQualityDetailList.'+ index +'.materialBatchNo'">
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="实收数量" :labelWidth='90'
name="'wmsPurchaseQualityDetailList.'+ index +'.secondActualNumber'">
<uni-easyinput disabled type="number" v-model="item.secondActualNumber" />
</uni-forms-item>
<uni-forms-item label="质检数量" :labelWidth='90'
name="'wmsPurchaseQualityDetailList.'+ index +'secondNumber'">
<second-number-change-to-convert :materialCode="item.materialCode"
:secondNumber.sync="item.secondNumber" :secondUnitId="item.secondUnitId"
:number.sync="item.number" :unitId="item.unitId"
@input="(data) => inputNUmber(index,data)"
></second-number-change-to-convert>
<!-- <u-number-box inputWidth="120" button-size="36" v-model="item.number" min="0"
@change="getBackNumber(index)"></u-number-box> -->
<!-- <uni-easyinput type="number" v-model="item.number"
@change="(data) => getBackNumber(index,data)" /> -->
</uni-forms-item>
<uni-forms-item label="合格数量" :labelWidth='90'
name="'wmsPurchaseQualityDetailList'+ index +'.secondPassNumber'">
<second-number-change-to-convert-new :materialCode="item.materialCode"
:key="item.passNumber"
:secondNumber.sync="item.secondPassNumber" :secondUnitId="item.secondUnitId"
:number.sync="item.passNumber"
:unitId="item.unitId"
@change="(data) => getCompare(item,data)"></second-number-change-to-convert-new>
<!-- <u-number-box inputWidth="120" button-size="36" v-model="item.passNumber" min="0"
@change="getBackNumber(index)"></u-number-box> -->
</uni-forms-item>
<uni-forms-item label="应入数量" :labelWidth='90'
name="'wmsPurchaseQualityDetailList.'+ index +'.secondInNumber'">
<!-- 之前代码 -->
<!-- <second-number-change-to-convert :materialCode="item.materialCode"
:secondNumber.sync="item.secondInNumber" :secondUnitId="item.secondUnitId"
:number.sync="item.inNumber" :unitId="item.unitId"
@change="(data) => getBackNumber('secondInNumber',item,data)"></second-number-change-to-convert> -->
<uni-easyinput type="number" v-model="item.secondInNumber" @input="(data) => getBackNumber('secondInNumber',item,data)"/>
<!-- <u-number-box inputWidth="120" button-size="36" v-model="item.secondInNumber" min="0"
@change="(data) => getBackNumber(index,data)"
:max="item.actualNumber"></u-number-box> -->
<!-- <uni-row style="margin-top: 10px;">
<uni-col :span="12">
<button size="mini" type="primary" style="font-size: 16px;"
@click="item.inNumber = item.actualNumber">全部入库</button>
</uni-col>
<uni-col :span="12">
<button size="mini" type="primary" style="font-size: 16px;"
@click="item.inNumber = 0">全部退回</button>
</uni-col>
</uni-row> -->
</uni-forms-item>
<uni-forms-item label="退回数量" :labelWidth='90'
name="'wmsPurchaseQualityDetailList.'+ index +'.backNumber'">
<uni-easyinput type="number" v-model="item.backNumber" @input="(data) => getBackNumber('backNumber',item,data)"/>
</uni-forms-item>
<uni-forms-item label="不良原因" :labelWidth='90'
name="'wmsPurchaseQualityDetailList.'+ index +'.failReason'">
<uni-easyinput type="textarea" v-model="item.failReason" />
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
uploadImage,
getStandardList,
addQualityHistoryList,
listQualityHistory,
updateQualityHistory
} from "@/api/qc/qc.js";
import {
addReceive,
listReceive,
listQuality,
getReceive,
addQuality,
updateQuality,
getReceiveDetail,
getQualityDetail,
getQualityReceiveDetail,
getDetailListsBySRM
} from "@/api/wms/purchase.js";
import {
listMaterial
} from "@/api/wms/request.js";
import {
getConfigKey,
} from "@/api/wms/materRequisitiontask";
import SecondNumberChangeToConvert from "@/components/SecondNumberChangeToConvert/index.vue";
import SecondNumberChangeToConvertNew from "@/components/SecondNumberChangeToConvert/index-.vue";
import {
toast,
} from '@/utils/common'
export default {
mounted() {
getConfigKey('wms.app').then(res => {
if(getKey('purchaseQualityT',res.msg) === 'Y'){
this.value='扫物料标签'
}
/**
* 获取wms.app的值
* @param {Object} name 要获取的字段
* @param {Object} json 要转换的数据默认res.msg
*/
function getKey(name,json){
return JSON.parse(json)[name]
}
});
},
data() {
return {
isSupplierCode: false,
isQualited: false,
value: '正常',
show: false,
materialLabel: null,
fileList1: [],
formData: {
purchaseReceiveCode: null,
purchaseQualityCode: null,
enclosure: null,
wmsPurchaseQualityDetailList: []
},
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
passNumber: {
rules: [{
required: true,
errorMessage: '请输入质检数量!'
}]
},
purchaseReceiveCode: {
rules: [{
required: true,
errorMessage: '请输入采购收货单!'
}]
},
},
listStyles: {
// 是否显示边框
border: true,
// 是否显示分隔线
dividline: true,
// 线条样式
borderStyle: {
width: 1,
color: 'blue',
style: 'dashed',
radius: 2
}
},
}
},
components: {
SecondNumberChangeToConvert,
SecondNumberChangeToConvertNew,
},
methods: {
// getCompare1(e){
// console.log('质检数量改变');
// // console.log('111');
// },
getCompare(item,data){
if(data>item.secondNumber){
uni.showToast({
title: '合格数量不能大于质检数量',
icon: 'none',
duration: 2000
})
// this.$set(item, "secondPassNumber", item.secondNumber)
// this.$forceUpdate()
item.secondPassNumber=item.secondNumber
// console.log("1414",item.secondPassNumber);
}
},
//获取退回数量
getBackNumber(name,item,e) {
//输入的应收数量
if(name === 'secondInNumber'){
if (e > item.secondActualNumber) {
toast("应入数量不能大于实收数量");
return false
}
item.backNumber = item.secondActualNumber - e
}
if(name === 'backNumber'){
if (e > item.secondActualNumber) {
toast("退回数量不能大于实收数量");
return false
}
item.secondInNumber = item.secondActualNumber - e
}
this.formData = Object.assign({},this.formData)
},
// getBackNumber(index, data) {
// if (data) {
// this.formData.wmsPurchaseQualityDetailList[index].backNumber = this.formData
// .wmsPurchaseQualityDetailList[
// index]
// .actualNumber - data.value
// } else {
// this.formData.wmsPurchaseQualityDetailList[index].backNumber = this.formData
// .wmsPurchaseQualityDetailList[
// index]
// .actualNumber - this.formData
// .wmsPurchaseQualityDetailList[
// index]
// .inNumber
// }
// },
deleteDetail(index) {
this.formData.wmsPurchaseQualityDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
addMaterialLabel() {
this.show = true;
},
cancelMaterialLabel() {
this.materialLabel = null;
this.show = false;
},
confirmMaterialLabel(data) {
//判断是否供应商扫码
if (data.includes('@')) {
this.isSupplierCode = true;
let array = data.split('@');
let new_supplierCode = array[0];
let new_u9SourceBillCode = array[3].split('|')[0];
let new_erpDocCode1 = array[4].split('|')[0];
let new_erpDocLineKey1 = array[4].split('|')[1];
getDetailListsBySRM({
u9SourceBillCode: new_u9SourceBillCode,
erpDocCode1: new_erpDocCode1,
erpDocLineKey1: new_erpDocLineKey1
}).then(res => {
//判断有没有质检(先查质检-再查收货)
if (res.qualityList.length == 0) {
//没有质检
//判断有没有收货
// if (res.receiveDetailList.length == 0) {
// this.$modal.msg("该条物料还未收货!")
// } else {
// //判断有没有完成收货
// if (res.receiveDetailList[0].theoryNumber == res.receiveDetailList[0]
// .actualNumber) {
// getQualityReceiveDetail({
// purchaseReceiveCode: res.receiveDetailList[0].purchaseReceiveCode,
// status: '1'
// }).then((res) => {
// console.log(res);
// this.formData = res.qualityBill;
// this.formData.purchaseQualityDetailList = res.qualityBill
// .wmsPurchaseQualityDetailList;
// });
// } else {
this.$modal.msg("该条物料还未完成收货!")
// }
// }
} else {
this.isQualited = true;
//判断检验有无完成
if (res.qualityList[0].status == 3) {
this.$modal.msg("该条物料已完成检验!")
} else {
this.formData = res.qualityList[0];
this.formData.wmsPurchaseQualityDetailList = res.qualityList[0]
.purchaseQualityDetailList
}
}
})
this.materialLabel = null;
this.show = false;
} else {
data = JSON.parse(data)
if (data) {
getQualityDetail({
purchaseReceiveDetailId: data.id
}).then(res => {
//判断有没有质检
if (res.data.length > 0) {
this.formData.purchaseReceiveCode = res.data[0].purchaseReceiveCode;
this.formData.purchaseQualityCode = res.data[0].purchaseQualityCode;
this.formData.supplierCode = res.data[0].supplierCode;
this.formData.supplierName = res.data[0].supplierName;
//代入主表id
this.formData.id = res.data[0].purchaseQualityId;
const data = res.data[0];
data.inNumber = data.secondInNumber;
data.backNumber = 0
this.formData.wmsPurchaseQualityDetailList.push(data);
this.materialLabel = null;
this.show = false;
// this.$modal.msg("该条物料已质检!");
} else {
getReceiveDetail(data.id).then(res => {
//判断有没有收货
if (res.data.actualNumber != null) {
let obj = {
materialCode: res.data.materialCode,
materialName: res.data.materialName,
materialBatchNo: res.data.materialBatchNo,
actualNumber: res.data.actualNumber,
number: res.data.number,
purchaseReceiveDetailId: data.id,
passNumber: 0,
unitId: res.data.unitId,
inNumber: res.data.secondInNumber,
secondNumber: res.data.secondActualNumber,
secondUnitId: res.data.secondActualUnitId,
secondInNumber: res.data.secondInNumber,
}
this.formData.supplierCode = res.data.supplierCode;
this.formData.supplierName = res.data.supplierName;
this.formData.purchaseReceiveCode = res.data.purchaseReceiveCode;
this.formData.wmsPurchaseQualityDetailList.push(obj);
this.materialLabel = null;
this.show = false;
} else {
this.$modal.msg("该条物料还没有收货,无法质检!");
}
})
}
})
};
}
},
scanBarMaterialLabel() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.materialLabel = res.result;
// console.log(materialLabel)
_this.confirmMaterialLabel(_this.materialLabel);
}
});
},
// 删除图片
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
},
// 新增图片
async afterRead(event) {
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
status: 'uploading',
message: '上传中'
})
})
for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i].url)
let item = this[`fileList${event.name}`][fileListLen]
// console.log(item)
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
url: result
}))
fileListLen++
}
},
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
let a = uploadImage({
filePath: url
}).then(response => {
uni.showToast({
title: "上传成功",
icon: 'success'
});
this.formData.enclosure = response.fileName
resolve(response.url)
});
})
},
reset(code) {
this.formData = {
purchaseReceiveCode: code,
wmsPurchaseQualityDetailList: [],
};
},
scanBarCode(code) {
// if (code){
// this.reset(code);
// }
if (code) {
let q = {
purchaseReceiveCode: code
}
listReceive(q).then(async res => {
if (res.rows != null && res.rows.length > 0) {
let did = res.rows[0].id
getReceive(did).then(async res => {
for (let i in res.data
.wmsPurchaseReceiveDetailList) {
let obj = {};
obj.materialBatchNo = res.data
.wmsPurchaseReceiveDetailList[i]
.materialBatchNo;
obj.materialCode = res.data
.wmsPurchaseReceiveDetailList[i]
.materialCode;
obj.materialName = res.data
.wmsPurchaseReceiveDetailList[i]
.materialName;
obj.actualNumber = res.data
.wmsPurchaseReceiveDetailList[i]
.actualNumber;
obj.number = res.data
.wmsPurchaseReceiveDetailList[i]
.actualNumber;
obj.secondActualNumber = res.data
.wmsPurchaseReceiveDetailList[i]
.secondActualNumber;
this.formData.wmsPurchaseQualityDetailList.push(
obj);
}
});
} else {
this.$modal.msg("未检索到收货明细!");
}
});
}
},
//采购任务单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.purchaseReceiveCode = res.result;
_this.scanBarCode(_this.formData.purchaseReceiveCode);
}
});
},
submit() {
const _this = this;
if(!getNumber(_this.formData.wmsPurchaseQualityDetailList,'secondActualNumber','secondInNumber','backNumber','materialCode')) return
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成该质检吗?',
success: function(res) {
if (res.confirm) {
if (_this.formData.id != null) {
_this.$modal.loading('提交中')
for(let i in _this.formData.wmsPurchaseQualityDetailList){
_this.formData.wmsPurchaseQualityDetailList[i].inNumber = _this.formData.wmsPurchaseQualityDetailList[i].secondInNumber
}
updateQuality(_this.formData).then(res => {
_this.$modal.msgSuccess("质检成功!");
setTimeout(() => {
_this.$modal.closeLoading();
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
})
} else {
let wmsPurchaseQualityDetailList = [];
for (let i in _this.formData
.wmsPurchaseQualityDetailList) {
let obj = {};
obj.materialCode = _this.formData
.wmsPurchaseQualityDetailList[i]
.materialCode;
obj.materialName = _this.formData
.wmsPurchaseQualityDetailList[i]
.materialName;
obj.materialBatchNo = _this.formData
.wmsPurchaseQualityDetailList[i]
.materialBatchNo;
obj.number = _this.formData
.wmsPurchaseQualityDetailList[i].number;
obj.passNumber = Number(_this.formData
.wmsPurchaseQualityDetailList[i]
.passNumber);
obj.failReason = _this.formData
.wmsPurchaseQualityDetailList[i]
.failReason;
wmsPurchaseQualityDetailList.push(obj);
}
let enclosure = null;
if (_this.fileList1.length > 0) {
enclosure = _this.fileList1.map(obj => obj.url)
.join(', ');
}
for(let i in _this.formData.wmsPurchaseQualityDetailList){
_this.formData.wmsPurchaseQualityDetailList[i].inNumber = _this.formData.wmsPurchaseQualityDetailList[i].secondInNumber
}
let data = {
purchaseReceiveCode: _this.formData
.purchaseReceiveCode,
status: '1',
wmsPurchaseQualityDetailList: _this.formData
.wmsPurchaseQualityDetailList,
enclosure: enclosure
}
_this.$modal.loading('提交中')
addQuality(data).then(response => {
_this.$modal.msgSuccess("质检成功!");
setTimeout(() => {
_this.$modal.closeLoading();
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
});
}
} else if (res.cancel) {
}
}
});
});
/**
* 判断应入和退回和是否等于实收
* @param {Object} list 要比较的数据
* @param {Object} key1 secondActualNumber
* @param {Object} key2 secondInNumber
* @param {Object} key3 backNumber
* @param {Object} key4 materialCode
*/
function getNumber(list,key1,key2,key3,key4){
for(let i in list){
if(list[i][key1] != parseInt(list[i][key2]) +parseInt(list[i][key3])){
_this.$modal.msg("物料编码为 " + list[i][key4] + "的单子应入和退回不等于实收");
return false
}
}
return true
}
},
/**
* 修改质检数量,合格数量跟随改变
* @param {Object} index 当前修改数据的下标
* @param {Object} data 当前修改的数据
*/
inputNUmber(index,data){
const arr = this.formData.wmsPurchaseQualityDetailList
arr[index].passNumber =arr[index].secondPassNumber = parseInt(data)
}
}
}
</script>
<style>
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,546 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<!-- <uni-collapse-item title="采购收货单" :open="true"> -->
<uni-forms-item v-if="value=='正常' && !formData.u9SourceBillCode" label="采购任务单" :labelWidth='90'
name="purchaseTaskCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarTaskCode"
v-model="formData.purchaseTaskCode" type="text" />
</uni-forms-item>
<uni-forms-item v-if="value=='扫物料标签'" label="采购收货单" :labelWidth='90' name="purchaseReceiveCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarTaskCode"
v-model="formData.purchaseReceiveCode" type="text" />
</uni-forms-item>
<uni-forms-item v-if="!formData.u9SourceBillCode" label="采购订单号" :labelWidth='90' name="purchaseCode">
<uni-combox :candidates="purchaseCodeList" emptyTips="无" @input="scanBarPurchaseCode"
v-model="formData.purchaseCode"></uni-combox>
</uni-forms-item>
<uni-forms-item v-if="formData.supplierCode" label="供应商代码" :labelWidth='90' name="supplierCode">
<uni-easyinput v-model="formData.supplierCode" type="text" disabled />
</uni-forms-item>
<uni-forms-item v-if="formData.u9SourceBillCode" label="采购订单号" :labelWidth='90' name="u9SourceBillCode">
<uni-easyinput v-model="formData.u9SourceBillCode" type="text" disabled />
</uni-forms-item>
<uni-forms-item v-if="formData.remark" label="备注" :labelWidth='90' name="remark">
<uni-easyinput v-model="formData.remark" type="text" disabled />
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarscanBarwarehouseCode"
v-model="formData.warehouseCode" />
<uni-data-select v-model="formData.warehouseCode" :localdata="wcList"
style="margin-top: 10px;"></uni-data-select>
</uni-forms-item>
<!-- <uni-forms-item label="收货方式" :labelWidth='90' name="receiveWay"> -->
<u-radio-group v-model="value" iconPlacement="left" style="font-size: 14px;margin-bottom: 20px;">收货方式
<u-radio label="正常" name="正常" style="margin-left: 40px;"></u-radio>
<u-radio label="扫物料标签" name="扫物料标签" style="margin-left: 10px;"></u-radio>
</u-radio-group>
<!-- </uni-forms-item> -->
<button size="mini" v-if="value=='扫物料标签'" type="primary"
style="text-align: center;margin-left: 30%;font-size: 18px;margin-top: 15px;"
@click="show=!show">添加物料标签</button>
<u-modal :show="show" title="扫描物料标签编码" showCancelButton closeOnClickOverlay
@cancel="cancelMaterialLabel" @close="cancelMaterialLabel" :showConfirmButton="false">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarMaterialLabel" v-model="materialLabel"
type="text" @confirm="confirmMaterialLabel" maxlength="-1" :focus="true" />
</u-modal>
<!-- </uni-collapse-item> -->
<!-- <uni-collapse-item title="采购收货单单明细" :open="true"> -->
<!-- <uni-swipe-action> -->
<view v-for="(item, index) in formData.wmsPurchaseReceiveDetailList" :key="index"
@click="(data) => clickDetail(index,data)" :right-options="rightOptions">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90'>
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'>
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'>
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="箱号" :labelWidth='90' v-if="item.remark">
<uni-easyinput disabled type="text" v-model="item.remark" />
</uni-forms-item>
<uni-forms-item label="应收数量" :labelWidth='90'>
<uni-easyinput disabled type="number" v-model="item.theoryNumber" />
</uni-forms-item>
<uni-forms-item label="已收数量" :labelWidth='90'>
<uni-easyinput disabled type="number" v-model="item.rcvNum" />
</uni-forms-item>
<uni-forms-item label="入库数量" :labelWidth='90'>
<uni-easyinput disabled type="number" v-model="item.quaInNum" />
</uni-forms-item>
<uni-forms-item label="退回数量" :labelWidth='90'>
<uni-easyinput disabled type="number" v-model="item.backNum" />
</uni-forms-item>
<uni-forms-item label="到货数量" :labelWidth='90'>
<uni-easyinput type="number" v-model="item.arriveNumber" />
<!-- <u-number-box inputWidth="120" button-size="36" v-model="item.arriveNumber"
:max="item.theoryNumber" min="0"></u-number-box> -->
</uni-forms-item>
<uni-forms-item label="实收数量" :labelWidth='90'>
<uni-row>
<uni-col :span="12">
<second-number-change-to-convert :materialCode="item.materialCode"
:secondNumber.sync="item.secondActualNumber" :secondUnitId="item.secondActualUnitId"
:number.sync="item.actualNumber"
:unitId="item.unitId"></second-number-change-to-convert>
</uni-col>
<uni-col :span="12">
<select-unit-convertible v-model="item.secondActualUnitId"
:materialCode="item.materialCode" :secondNumber.sync="item.secondActualNumber"
:number="item.actualNumber" :unitId="item.unitId"></select-unit-convertible>
</uni-col>
</uni-row>
</uni-forms-item>
</view>
<!-- </uni-swipe-action-item> -->
<!-- </uni-swipe-action> -->
<!-- </uni-collapse-item> -->
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</uni-collapse>
</view>
</template>
<script>
import {
addReceive,
getTask,
listTask,
getDetail,
updateReceive,
updateReceiveDetail,
getDetailByPoCode,
getReceiveDetailJoin,
getDetailListsBySRM,
listSupplier
} from "@/api/wms/purchase.js";
import {
getConfigKey,
} from "@/api/wms/materRequisitiontask";
import {
values
} from "lodash";
import {
listWarehouse
} from "@/api/wms/warehouse";
import selectUnitConvertible from "@/components/selectUnitConvertible/index.vue";
import SecondNumberChangeToConvert from "@/components/SecondNumberChangeToConvert/index.vue";
export default {
mounted() {
getConfigKey('wms.app').then(res => {
if(getKey('purchaseSh',res.msg) === 'Y'){
this.value='扫物料标签'
}
/**
* 获取wms.app的值
* @param {Object} name 要获取的字段
* @param {Object} json 要转换的数据默认res.msg
*/
function getKey(name,json){
return JSON.parse(json)[name]
}
});
listTask().then((response) => {
for (var i = 0; i < response.rows.length; i++) {
this.purchaseCodeList.push(response.rows[i].purchaseCode);
}
});
listWarehouse().then((res) => {
this.wcList = res.rows.map(item => {
let obj = {
text: item.warehouseName,
value: item.warehouseCode
}
return obj
})
})
},
components: {
selectUnitConvertible,
SecondNumberChangeToConvert
},
data() {
return {
wcList: [],
isSupplierCode: false,
isReceived: false,
purchaseCodeList: [],
value: '正常',
show: false,
materialLabel: null,
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
formData: {
purchaseTaskCode: null,
purchaseReceiveCode: null,
wmsPurchaseReceiveDetailList: [],
warehouseCode: null,
//任务单状态=1=‘新建’
status: '1'
},
rules: {
// purchaseTaskCode: {
// rules: [{
// required: true,
// errorMessage: '请输入采购任务单!'
// }]
// },
warehouseCode: {
rules: [{
required: false,
errorMessage: '请输入仓库编码!'
}]
},
}
}
},
methods: {
scanBarPurchaseCode() {
if (this.formData.purchaseCode) {
getDetailByPoCode(this.formData.purchaseCode).then(res => {
console.log(res)
let purchaseCode = this.formData.purchaseCode
this.formData = res.receiveBill
this.formData.purchaseCode = purchaseCode
})
} else {
this.$modal.msg("请输入采购订单号!");
}
},
deleteDetail(index) {
this.formData.wmsPurchaseReceiveDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
addMaterialLabel() {
this.show = true;
},
cancelMaterialLabel() {
this.materialLabel = null;
this.show = false;
},
confirmMaterialLabel(data) {
//判断是否供应商扫码
if (data.includes('@')) {
this.isSupplierCode = true;
let array = data.split('@');
let new_supplierCode = array[0];
let new_u9SourceBillCode = array[3].split('|')[0];
let new_erpDocCode1 = array[4].split('|')[0];
let new_erpDocLineKey1 = array[4].split('|')[1];
let lotNo = array[4].split('|')[2];
let supplierCode = null;
console.log(new_erpDocLineKey1, lotNo);
getDetailListsBySRM({
u9SourceBillCode: new_u9SourceBillCode,
erpDocCode1: new_erpDocCode1,
erpDocLineKey1: new_erpDocLineKey1
}).then(res => {
console.log(res)
//查供应商编码
listSupplier({
remark: new_supplierCode
}).then(res => {
if (res.rows.length > 0) {
supplierCode = res.rows[0].supplierCode
}
})
//判断有没有进行收货
//未收货
if (res.receiveDetailList.length == 0) {
//判断是总码还是外箱,外箱码是多加一个箱数量
if (array.length < 7) {
//总码
let obj = {
materialCode: array[1],
materialBatchNo: array[2],
theoryNumber: Number(array[5]),
arriveNumber: Number(array[5]),
actualNumber: Number(array[5]),
//ASN行号
erpDocLineKey1: new_erpDocLineKey1,
}
//供应商代码
this.formData.supplierCode = supplierCode;
//采购订单号
this.formData.u9SourceBillCode = new_u9SourceBillCode;
//ASN单号
this.formData.erpDocCode1 = new_erpDocCode1;
this.formData.wmsPurchaseReceiveDetailList.push(obj);
} else {
//外箱,会出现多次扫码的情况
//判断当前单据下是否已扫描添加过明细
if (this.formData.wmsPurchaseReceiveDetailList.length > 0) {
//有明细
//判断是否为同一个主表下的同一物料
if (this.formData.u9SourceBillCode == new_u9SourceBillCode && this.formData
.erpDocCode1 == new_erpDocCode1 && this.formData
.wmsPurchaseReceiveDetailList[0].erpDocLineKey1 == new_erpDocLineKey1) {
//判断箱号有无重复
if (this.formData.wmsPurchaseReceiveDetailList.find(item => item.remark
.includes(lotNo))) {
this.$modal.msg("该条物料已添加!")
} else {
this.formData.wmsPurchaseReceiveDetailList[0].remark = this.formData
.wmsPurchaseReceiveDetailList[0].remark + ',' + lotNo
this.formData.wmsPurchaseReceiveDetailList[0].arriveNumber += Number(
array[
5]);
this.formData.wmsPurchaseReceiveDetailList[0].actualNumber += Number(
array[
5]);
}
} else {
this.$modal.msg("该条物料与现有明细不在同一ASN行号下")
}
} else {
//没明细
let obj = {
materialCode: array[1],
materialBatchNo: array[2],
theoryNumber: Number(array[6]),
arriveNumber: Number(array[5]),
actualNumber: Number(array[5]),
//ASN行号
erpDocLineKey1: array[4].split('|')[1],
remark: lotNo
}
//供应商代码
this.formData.supplierCode = supplierCode;
//采购订单号
this.formData.u9SourceBillCode = new_u9SourceBillCode;
//ASN单号
this.formData.erpDocCode1 = new_erpDocCode1;
this.formData.wmsPurchaseReceiveDetailList.push(obj);
}
}
} else {
//已收货存在收货明细
this.isReceived = true;
//判断收货有无完成
if (res.receiveDetailList[0].actualNumber == res.receiveDetailList[0]
.theoryNumber) {
this.$modal.msg("该条物料已完成收货!")
} else {
//判断当前表单是否已有明细
if (this.formData.wmsPurchaseReceiveDetailList.length > 0) {
//判断是否为同一个主表下的同一物料
if (this.formData.u9SourceBillCode == new_u9SourceBillCode && this.formData
.erpDocCode1 == new_erpDocCode1 && this.formData
.wmsPurchaseReceiveDetailList[0].erpDocLineKey1 == new_erpDocLineKey1) {
//判断箱号有无重复
if (this.formData.wmsPurchaseReceiveDetailList.find(item => item.remark
.includes(lotNo))) {
this.$modal.msg("该条物料已添加!")
} else {
this.formData.wmsPurchaseReceiveDetailList[0].remark = this.formData
.wmsPurchaseReceiveDetailList[0].remark + ',' + lotNo
this.formData.wmsPurchaseReceiveDetailList[0].arriveNumber += Number(
array[
5]);
this.formData.wmsPurchaseReceiveDetailList[0].actualNumber += Number(
array[
5]);
}
} else {
this.$modal.msg("该条物料与现有明细不在同一ASN单号下")
}
} else {
//判断箱号有无重复
if (res.receiveDetailList.find(item => item.remark
.includes(lotNo))) {
this.$modal.msg("该条物料已添加!")
} else {
//供应商代码
this.formData.supplierCode = supplierCode;
//采购订单号
this.formData.u9SourceBillCode = new_u9SourceBillCode;
//ASN单号
this.formData.erpDocCode1 = new_erpDocCode1;
res.receiveDetailList[0].remark = res.receiveDetailList[0].remark + ',' +
lotNo
res.receiveDetailList[0].arriveNumber += Number(array[5]);
res.receiveDetailList[0].actualNumber += Number(array[5]);
this.formData.wmsPurchaseReceiveDetailList = res.receiveDetailList;
}
}
}
}
})
this.materialLabel = null;
this.show = false;
} else {
data = JSON.parse(data)
if (data) {
//判断后续输入的物料明细是否与第一条绑定的收货单一致
if (this.formData.purchaseReceiveCode) {
//添加过物料标签,加入判断
getReceiveDetailJoin(data.id).then(res => {
if (res.data) {
if (res.data.purchaseReceiveCode !== this.formData
.purchaseReceiveCode) {
this.$modal.msg("与上一条输入的物料标签编码的收货单不一致!")
} else {
//若与上一条输入的物料标签编码的收货单一致则进行物料id判断
let a = this.formData.wmsPurchaseReceiveDetailList.find(item => item.id ==
data
.id)
//id添加过
if (typeof(this.formData.wmsPurchaseReceiveDetailList.find(item => item
.id ==
data
.id)) ===
'object') {
this.$modal.msg("该条物料标签已添加!")
} else {
this.formData.wmsPurchaseReceiveDetailList.push(res.data);
this.materialLabel = null;
this.show = false;
}
}
} else {
this.$modal.msg("未查询到该明细!")
}
})
} else {
//没有添加过物料标签,则跳过判断直接添加
getReceiveDetailJoin(data.id).then(res => {
if (res.data) {
this.formData.purchaseReceiveCode = res.data.purchaseReceiveCode
this.formData.wmsPurchaseReceiveDetailList.push(res.data);
this.materialLabel = null;
this.show = false;
} else {
this.$modal.msg("未查询到该明细!")
}
})
}
}
}
},
scanBarMaterialLabel() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.materialLabel = res.result;
// console.log(materialLabel)
_this.confirmMaterialLabel(_this.materialLabel);
}
});
},
//采购任务单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.purchaseTaskCode = res.result;
_this.scanBarTaskCode(res.result);
}
});
},
scanBarTaskCode(code) {
// let obj = {
// purchaseTaskCode: this.formData.purchaseTaskCode,
// };
// listReceive(obj).then((response) => {
// this.taskReceiveList = response.rows;
// });
getDetail(this.formData).then((res) => {
// console.log(res);
this.formData = res.receiveBill;
// this.formData.wmsPurchaseReceiveDetailList = res.receiveBill.wmsPurchaseReceiveDetailList;
});
// getDetail(this.formData).then((res) => {
// this.formData.wmsPurchaseReceiveDetailList = res.details;
// });
},
//仓库编码
scanBarscanBarwarehouseCode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.warehouseCode = res.result;
}
});
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定收取该物料吗?',
success: function(res) {
if (res.confirm) {
if (_this.value == '正常' || _this.value == '扫物料标签' && _this
.isSupplierCode && !_this.isReceived) {
console.log(_this.formData)
_this.$modal.loading('提交中')
addReceive(_this.formData).then(async res => {
_this.$modal.msgSuccess("收货成功!");
setTimeout(() => {
_this.$modal.closeLoading();
_this.$tab.switchTab(
"/pages/work/index"
);
}, 500);
});
} else if (_this.value == '扫物料标签' || _this.value ==
'扫物料标签' &&
_this
.isSupplierCode && _this.isReceived) {
console.log(2)
_this.$modal.loading('提交中')
updateReceiveDetail(_this.formData
.wmsPurchaseReceiveDetailList)
.then(async res => {
_this.$modal.msgSuccess("收货成功!");
setTimeout(() => {
_this.$modal.msgSuccess("收货成功!");
_this.$tab.switchTab(
"/pages/work/index"
);
}, 500);
});
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
},
watch:{
value(newVal){
if(newVal === '扫物料标签'){
this.rules.warehouseCode.rules[0].required =false
}else{
this.rules.warehouseCode.rules[0].required =true
}
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,397 @@
<template>
<view id="view">
<div class="header">
<table>
<tr>
<td>物料代码:</td>
<td>
<uni-easyinput placeholder="请输入内容" :focus="PTfocus" v-model="PTCode" primaryColor="red" @confirm="getCode"
prefixIcon="scan" @iconClick="scanClick('primary')" />
</td>
</tr>
</table>
</div>
<div class="body">
<table>
<tr>
<td>收货单号:</td>
<td>{{form.purchaseReceiveCode}}</td>
</tr>
<tr>
<td>&numsp;&numsp;:</td>
<td>{{form.supplierCode}}{{form.supplierName}}</td>
</tr>
<tr>
<td>物料编码:</td>
<td>{{form.materialCode}}</td>
</tr>
<tr>
<td>物料名称:</td>
<td>{{form.materialName}}</td>
</tr>
<tr>
<td>规格型号:</td>
<td>{{form.specification}}</td>
</tr>
<tr>
<td>推荐库位:</td>
<td>
<uni-easyinput :key="keyBol" class="uni-mt-5" v-model="form.recommend" disabled>
<template #right>
<uni-icons custom-prefix="iconfont" type="icon-fuzhi" size="40" @click="iconClick"></uni-icons>
</template>
</uni-easyinput>
</td>
</tr>
<tr>
<td>上架数量:</td>
<td>
<u-number-box inputWidth="120" button-size="36" v-model="form.number" min="0"
:max="form.secondInNumber"></u-number-box>
</td>
</tr>
<tr>
<td>&emsp;&emsp;:</td>
<td>
<uni-easyinput :key="keyBol" type="text" prefixIcon="scan" placeholder="扫描"
v-model="form.storageLocationBarcode" @iconClick="scanClick('storageLocationBarcode')" />
</td>
</tr>
</table>
</div>
<div class="footer">
<button type="primary" @click="submit">
<span>提交</span>
</button>
</div>
<uni-popup ref="message" type="message">
<uni-popup-message :type="message.msgType" :message="message.messageText" :duration="2000"></uni-popup-message>
</uni-popup>
<uni-popup ref="popup" type="center" background-color="#fff" :is-mask-click="false">
<!-- 加载动画 -->
<loding-vue />
</uni-popup>
</view>
</template>
<script>
import {
getReceiveDetailJoin,
addPurchase,
getMaterial_code
} from "@/api/wms/purchase.js";
import {
getConfigKey,
getUser
} from "@/api/system/config.js"
import lodingVue from "@/utils/loding/loding.vue";
export default {
components: {
lodingVue
},
data() {
return {
form: {},
message: {
msgType: 'warn',
messageText: '请先查询设备信息'
},
locationSize: 0,
map: null,
PTfocus: true, //物料编码输入框的是否焦点标记
PTCode: null, //物料编码框的已输入内容
keyBol: true,
user: {},
}
},
async mounted() {
const _this = this;
_this.locationSize = await _this.fnApi('getConfigKey', 'wms.location.size', 'msg')
_this.user = (await _this.fnApi('getUser', { pageNum: 1, pageSize: 1, userName: _this.$store.state.user.name },
'rows'))[0]
},
methods: {
/**
* 所有扫描点击事件
* @param {Object} key
*/
scanClick(key) {
const _this = this;
const obj = {
primary: 'getCode',
storageLocationBarcode: 'iconClick'
}
uni.scanCode({
// 是否只能从相机扫码,不允许从相册选择图片
onlyFromCamera: true,
// 扫码类型
scanType: ['barCode', 'qrCode'],
success: function(res) {
const value = res.result
_this[obj[key]](value)
}
})
},
/**
* 图标点击事件
*/
iconClick(value) {
const _self = this;
// const arr =
_self.form = Object.assign({}, _self.form, {
storageLocationBarcode: value || _self.form.recommend
})
},
/**
* 扫描收货单明细标签
* @param {Object} value id
*/
async getCode(value) {
const _self = this;
_self.PTfocus = false;
const obj = JSON.parse(value);
try {
const data = (await _self.fnApi('getReceiveDetailJoin', obj.id || value))
const res = await _self.fnApi('getMaterial_code', data.materialCode, 'data')
let code = null;
if (res && res.whCode) {
code = getCode(_self.locationSize, res).value
}
data.number = data.allowedNumber || data.number
data.recommend = code
_self.form = data
} catch (e) {
//TODO handle the exception
_self.messageType({
msgType: 'error',
messageText: '未查到信息'
})
}
/**
* 根据参数显示库位格式
* @param {Object} num
* @param {Object} i
*/
function getCode(num, i) {
const code = i.whCode + '-' + i.areaCode + '-' + i.shelvesCode + '-' + i.storageLocationCode;
let value = null;
switch (num) {
case '0':
value = code
break;
case '2':
value = i.areaCode
break;
case '4':
value = i.storageLocationCode
break;
case '5':
value = i.shelvesCode + '-' + i.storageLocationCode
break;
}
return { value }
}
},
/**
* 提交事件
*/
async submit() {
const _self = this
const form = Object.assign({}, _self.form);
if (!form.number) {
_self.messageType({
msgType: 'warn',
messageText: '上架数量不能为0'
})
return
}
if (!this.isEmpty(form.storageLocationBarcode)) {
_self.messageType({
msgType: 'warn',
messageText: '库位未填写'
})
return
}
form.purchaseReceiveDetailId = form.id
form.id = null
form.secondNumber = form.number;
const { purchaseReceiveCode, supplierCode } = _self.form
const obj = {
purchaseReceiveCode,
supplierCode,
userId: _self.user.userId,
wmsPurchaseInDetailList: [form]
}
const data = await _self.fnApi('addPurchase', obj, 'code')
if (data === 200) {
_self.messageType({
msgType: 'success',
messageText: '操作成功'
})
/* Begins 20250503-0001
新增:“提交成功”后输入焦点自动回到顶部输入框,并清空物料输入框、推荐库位、库位内容
修改关闭提交后2秒延时退出页面功能。
For Customer:浙江日井泵业股份有限公司
*/
_self.PTfocus = true
_self.PTCode = null
_self.form = {}
_self.keyBol = !_self.keyBol;
/* Ends 20250503-0001
setTimeout(()=>{
uni.switchTab({
url:'/pages/work/index'
})
},2000)
*/
} else {
/*
TODO: If Error happens, Should notify the user what happened and how to deal with it.
*/
_self.messageType({
msgType: 'error',
messageText: '操作失败'
})
}
},
/**
* 接口访问方法
* @param {String} api 接口名称
* @param {Object} value 带入参数
* @param {String} accept 接受的数据有些的data有些的data看具体数据 默认data
*/
async fnApi(api, value, accept = 'data') {
const _self = this;
const objApi = {
getReceiveDetailJoin,
addPurchase,
getConfigKey,
getMaterial_code,
getUser
}
try {
//打开蒙层
_self.$refs.popup.open()
//查询接口
const data = (await objApi[api](value))[accept]
return data
} catch (e) {
_self.messageType({
msgType: 'error',
messageText: '接口请求出错'
})
} finally {
//关闭蒙层
_self.$refs.popup.close()
}
},
/**
* 提示信息
* @param {Object|undefined} value
* {msgType,messageText} 参数里面需要包含这两个键
*/
messageType(obj) {
const _self = this;
let message = {}
if (obj === undefined) {
message = {
msgType: 'error',
messageText: '请填写设备代码'
}
} else {
message = {
msgType: obj.msgType,
messageText: obj.messageText
}
}
_self.message = Object.assign({}, message)
return _self.$refs.message.open()
},
isEmpty(value) {
if (value === undefined || value === null || value === '') return false
return true
}
}
}
</script>
<style>
page {
background-color: #ffffff;
display: flex;
justify-content: center;
font-size: 5vw;
color: #484744;
}
</style>
<style lang="scss" scoped>
#view {
width: 97vw;
height: calc(100vh - 44px);
display: flex;
justify-content: center;
flex-wrap: wrap;
&>* {
width: 100%;
background-color: #ffffff;
}
.header,
.footer {
height: 8%;
}
.footer {
margin-top: auto;
&>* {
margin-top: 3%;
}
.icon-saomiao {
margin-right: 2%;
}
}
.body {
height: calc(100% - 2 * 8% - 4%);
table>tr {
border-bottom: 1px dashed #969696;
height: 15vw;
&>td:last-child {
display: flex;
justify-content: flex-end
}
}
}
table {
width: 100%;
tr {
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
td {
display: flex;
align-items: center;
justify-content: center;
text-overflow: ellipsis;
}
&>td:first-child {
width: 30%;
}
&>td:last-child {
width: 70%;
}
}
}
}
</style>

168
pages/wms/pwoIn/pwoRk.vue Normal file
View File

@@ -0,0 +1,168 @@
<template>
<view>
<uni-collapse>
<uni-forms :modelValue="jobInForm" ref="jobInForm" :rules="rules">
<uni-collapse-item title="产品入库单" :open="true">
<uni-forms-item label="工单" :labelWidth='90' name="pwoCode">
<uni-easyinput type="text" disabled v-model="jobInForm.pwoCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="产品收货单" :labelWidth='90' name="pwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" @confirm="scanJobCode"
v-model="jobInForm.pwoJobCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="上架员" :labelWidth='90' name="equipmentCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" type="text" v-model="equipmentCode">
</uni-easyinput>
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="产品入库单单明细" :open="true">
<!-- <u-button type="primary" @click="addDetail">新增</u-button>
<u-button type="primary" @click="submit">确认</u-button> -->
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in jobInForm.mesPwoJobCvDetailList"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialBatch'">
<uni-easyinput type="text" disabled v-model="item.materialBatch"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.whCodeDest'">
<uni-easyinput type="text" disabled v-model="item.whCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="上架数量" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.locCodeDest'">
<uni-easyinput type="text" disabled v-model="item.locCodeDest"></uni-easyinput>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="jobInSubmit">提交</u-button>
</view>
</template>
<script>
import {
handleConvert,
getEquipment,
addConversion,
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn.js";
import {
updatePwoJob,
listEquipment,
getPwoJob,
listPwoJob
} from "@/api/mes/jobReport.js"
export default {
data() {
return {
jobInForm: {
mesPwoJobCvDetailList: [],
},
equipmentCode: null,
flag: true,
show: false,
operateBy: null,
operateByCode: null,
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
materialCode: [{
required: true,
errorMessage: '请输入物料编码!'
}],
materialName: [{
required: false,
errorMessage: '请输入物料名称!'
}],
number: [{
required: true,
errorMessage: '请输入转移数量!'
}],
equipmentCode: [{
required: true,
errorMessage: '请输入设备编码!'
}]
}
}
},
mounted() {},
methods: {
scanJobCode(code) {
},
jobInSubmit() {
this.jobInForm.operateBy = this.operateBy
console.log(this.jobInForm);
this.$refs["jobInForm"].validate().then(valid => {
//作业转入
this.jobInForm.operateBy = this.operateBy
console.log(this.jobInForm);
addConversion(this.jobInForm).then(response => {
this.$modal.msgSuccess("转入成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
});
});
},
//作业编码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.jobInForm.pwoJobCode = res.result;
_this.scanJobCode(_this.jobInForm.pwoJobCode);
}
});
},
//设备编码
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.equipmentCode = res.result;
}
});
},
//操作人编码
scanBar2() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.operateByCode = res.result;
_this.scanBarOperateBy();
}
});
},
}
}
</script>
<style>
</style>

177
pages/wms/pwoIn/pwoSh.vue Normal file
View File

@@ -0,0 +1,177 @@
<template>
<view>
<uni-collapse>
<uni-forms :modelValue="jobInForm" ref="jobInForm" :rules="rules">
<uni-collapse-item title="生产任务单" :open="true">
<uni-forms-item label="工单" :labelWidth='90' name="pwoCode">
<uni-easyinput type="text" disabled v-model="jobInForm.pwoCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="生产入库任务单" :labelWidth='90' name="pwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" @confirm="scanJobCode"
v-model="jobInForm.pwoJobCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="equipmentCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" type="text" v-model="equipmentCode">
</uni-easyinput>
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="生产任务单单明细" :open="true">
<!-- <u-button type="primary" @click="addDetail">新增</u-button>
<u-button type="primary" @click="submit">确认</u-button> -->
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in jobInForm.mesPwoJobCvDetailList"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialBatch'">
<uni-easyinput type="text" disabled v-model="item.materialBatch"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.whCodeDest'">
<uni-easyinput type="text" disabled v-model="item.whCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="应收数量" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.locCodeDest'">
<uni-easyinput type="text" disabled v-model="item.locCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="到货数量" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.locCodeDest'">
<uni-easyinput type="text" disabled v-model="item.locCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="实收数量" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.locCodeDest'">
<uni-easyinput type="text" disabled v-model="item.locCodeDest"></uni-easyinput>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="jobInSubmit">提交</u-button>
</view>
</template>
<script>
import {
handleConvert,
getEquipment,
addConversion,
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn.js";
import {
updatePwoJob,
listEquipment,
getPwoJob,
listPwoJob
} from "@/api/mes/jobReport.js"
export default {
data() {
return {
jobInForm: {
mesPwoJobCvDetailList: [],
},
equipmentCode: null,
flag: true,
show: false,
operateBy: null,
operateByCode: null,
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
materialCode: [{
required: true,
errorMessage: '请输入物料编码!'
}],
materialName: [{
required: false,
errorMessage: '请输入物料名称!'
}],
number: [{
required: true,
errorMessage: '请输入转移数量!'
}],
equipmentCode: [{
required: true,
errorMessage: '请输入设备编码!'
}]
}
}
},
mounted() {},
methods: {
scanJobCode(code) {
},
jobInSubmit() {
this.jobInForm.operateBy = this.operateBy
console.log(this.jobInForm);
this.$refs["jobInForm"].validate().then(valid => {
//作业转入
this.jobInForm.operateBy = this.operateBy
console.log(this.jobInForm);
addConversion(this.jobInForm).then(response => {
this.$modal.msgSuccess("转入成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
});
});
},
//作业编码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.jobInForm.pwoJobCode = res.result;
_this.scanJobCode(_this.jobInForm.pwoJobCode);
}
});
},
//设备编码
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.equipmentCode = res.result;
}
});
},
//操作人编码
scanBar2() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.operateByCode = res.result;
_this.scanBarOperateBy();
}
});
},
}
}
</script>
<style>
</style>

327
pages/wms/pwoIn/pwoTask.vue Normal file
View File

@@ -0,0 +1,327 @@
<template>
<view>
<uni-collapse>
<uni-forms :modelValue="jobInForm" ref="jobInForm" :rules="rules">
<uni-collapse-item title="生产任务单" :open="true">
<uni-forms-item label="工单" :labelWidth='90' name="pwoCode">
<uni-easyinput type="text" disabled v-model="jobInForm.pwoCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="生产入库任务单" :labelWidth='90' name="pwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" @confirm="scanJobCode"
v-model="jobInForm.pwoJobCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="equipmentCode">
<uni-easyinput suffixIcon="scan" :disabled=flag ref="equipmentCode" @iconClick="scanBar1"
type="text" v-model="equipmentCode">
</uni-easyinput>
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="生产任务单单明细" :open="true">
<!-- <u-button type="primary" @click="addDetail">新增</u-button>
<u-button type="primary" @click="submit">确认</u-button> -->
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in jobInForm.mesPwoJobCvDetailList"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialBatch'">
<uni-easyinput type="text" disabled v-model="item.materialBatch"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.whCodeDest'">
<uni-easyinput type="text" disabled v-model="item.whCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="数量" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.locCodeDest'">
<uni-easyinput type="text" disabled v-model="item.locCodeDest"></uni-easyinput>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="jobInSubmit">提交</u-button>
</view>
</template>
<script>
import {
handleConvert,
getEquipment,
addConversion,
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn.js";
import {
updatePwoJob,
listEquipment,
getPwoJob,
listPwoJob
} from "@/api/mes/jobReport.js"
export default {
data() {
return {
jobInForm: {
mesPwoJobCvDetailList: [],
},
equipmentCode: null,
flag: true,
show: false,
operateBy: null,
operateByCode: null,
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
materialCode: [{
required: true,
errorMessage: '请输入物料编码!'
}],
materialName: [{
required: false,
errorMessage: '请输入物料名称!'
}],
number: [{
required: true,
errorMessage: '请输入转移数量!'
}],
equipmentCode: [{
required: true,
errorMessage: '请输入设备编码!'
}]
}
}
},
mounted() {},
methods: {
addDetail() {
this.jobInForm.mesPwoJobCvDetailList.push({});
},
deleteDetail(index) {
console.log(index);
console.log(this.mesPwoJobCvDetailList);
this.jobInForm.mesPwoJobCvDetailList.splice(index, 1);
console.log(this.mesPwoJobCvDetailList);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
reset(code) {
this.jobInForm = {
pwoJobCode: code,
mesPwoJobCvDetailList: [],
};
this.equipmentCode = null;
this.operateBy = null;
this.operateByCode = null;
},
eqpBind() {
let id = Number(this.jobInForm.pwoJobCode.substring(4));
console.log(id);
//判断是否有该设备
if (this.equipmentCode != "" && this.equipmentCode) {
let query = {
equipmentCode: this.equipmentCode
}
listEquipment(query).then(async res => {
if (res.rows.length != 0) {
//绑定设备
let data = {
id: this.jobInForm.pwoJobCode.slice(4),
eqpId: res.rows[0].id
}
// await getEquipment(response.jobInfo.eqpId).then(response => {
// this.equipmentCode = response.data.equipmentCode; //赋值设备编码
// console.log(response);
// })
updatePwoJob(data).then(res => {
this.$modal.msgSuccess("绑定成功!");
this.show = false;
this.flag = true;
this.scanJobCode(this.jobInForm.pwoJobCode);
})
} else {
this.$modal.msg("未查询到该设备编码!");
}
});
// listEmpEqpHistory(query).then(async res=>{
// if(res.rows.length!=0){
// this.operateBy = res.rows[res.rows.length-1].empName;
// this.operateByCode = res.rows[res.rows.length-1].empCode;
// }
// });
// handleConvert(id).then(async response => {
// console.log(response);
// this.jobInForm.pwoJobId = response.jobInfo.id;
// this.jobInForm.powJobCode = response.jobInfo.code;
// this.jobInForm.pwoId = response.jobInfo.pwoId;
// this.jobInForm.pwoCode = response.jobInfo.pwoCode;
// this.jobInForm.type = 2;
// console.log(this.jobInForm);
// if (response.materials != null && response.materials.length > 0){
// for (let i in response.materials){
// let obj = {};
// obj.materialCode = response.materials[i].cPtNo;
// obj.materialName = response.materials[i].cTitle;
// obj.whCodeDest = "op-" + response.jobInfo.opCode;
// obj.locCodeDest = this.equipmentCode + "-01";
// this.jobInForm.mesPwoJobCvDetailList.push(obj);
// }
// }else{
// this.$modal.msg("未查询到可转入的原材料!");
// }
// });
} else {
this.$modal.msg("请输入设备编码!");
}
},
scanJobCode(code) {
if (code) {
this.reset(code);
let id = Number(code.substring(4));
// getPwoJob(id).then(async res =>{
// console.log(res);
// })
let obj = {
code: code
}
listPwoJob(obj).then(async res => {
console.log(res);
if (res.rows.length != 0) {
if (!res.rows[0].eqpId) { //未绑定设备,设备编码框可用,绑定按钮显示
console.log('no');
this.$modal.msg("该作业未绑定设备,请绑定设备!");
this.flag = false;
this.show = true;
} else { //已绑定设备,
handleConvert(id).then(async response => {
await getEquipment(response.jobInfo.eqpId).then(response => {
this.equipmentCode = response.data
.equipmentCode; //赋值设备编码
console.log(response);
});
let query = {
equipmentCode: this.equipmentCode
}
listEmpEqpHistory(query).then(async res => {
if (res.rows.length != 0) {
this.operateBy = res.rows[res.rows.length -
1].empName;
this.operateByCode = res.rows[res.rows
.length - 1].empCode;
}
});
console.log(response);
this.jobInForm.pwoJobId = response.jobInfo.id;
this.jobInForm.powJobCode = response.jobInfo.code;
this.jobInForm.pwoId = response.jobInfo.pwoId;
this.jobInForm.pwoCode = response.jobInfo.pwoCode;
this.jobInForm.type = 2;
if (response.materials != null && response.materials.length >
0) {
for (let i in response.materials) {
let obj = {};
obj.materialCode = response.materials[i].cPtNo;
obj.materialName = response.materials[i].cTitle;
obj.materialBatch = response.materials[i].batchNo;
obj.whCodeDest = "op-" + response.jobInfo.opCode;
obj.availableNum = response.materials[i].availableNum;
obj.locCodeDest = this.equipmentCode + "-01";
this.jobInForm.mesPwoJobCvDetailList.push(obj);
}
} else {
this.$modal.msg("未查询到可转入的原材料!");
}
});
}
}
});
}
},
scanBarOperateBy() {
let obj = {
empCode: this.operateByCode
}
listEmployee(obj).then(async res => {
if (res.rows.length != 0) {
this.operateBy = res.rows[0].name;
} else {
this.$modal.msg("未查询到该人员信息!");
}
});
},
jobInSubmit() {
this.jobInForm.operateBy = this.operateBy
console.log(this.jobInForm);
this.$refs["jobInForm"].validate().then(valid => {
//作业转入
this.jobInForm.operateBy = this.operateBy
console.log(this.jobInForm);
addConversion(this.jobInForm).then(response => {
this.$modal.msgSuccess("转入成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
});
});
},
//作业编码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.jobInForm.pwoJobCode = res.result;
_this.scanJobCode(_this.jobInForm.pwoJobCode);
}
});
},
//设备编码
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.equipmentCode = res.result;
}
});
},
//操作人编码
scanBar2() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.operateByCode = res.result;
_this.scanBarOperateBy();
}
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,178 @@
<template>
<view>
<uni-collapse>
<uni-forms :modelValue="jobInForm" ref="jobInForm" :rules="rules">
<uni-collapse-item title="领料出库单" :open="true">
<uni-forms-item label="工单" :labelWidth='90' name="pwoCode">
<uni-easyinput type="text" disabled v-model="jobInForm.pwoCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="生产领料任务单" :labelWidth='90' name="pwoJobCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" type="text" @confirm="scanJobCode"
v-model="jobInForm.pwoJobCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="领料员" :labelWidth='90' name="equipmentCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" type="text" v-model="equipmentCode">
</uni-easyinput>
</uni-forms-item>
<uni-forms-item label="出库员" :labelWidth='90' name="equipmentCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" type="text" v-model="equipmentCode">
</uni-easyinput>
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="领料出库单单明细" :open="true">
<!-- <u-button type="primary" @click="addDetail">新增</u-button>
<u-button type="primary" @click="submit">确认</u-button> -->
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions" :key="index"
v-for="(item, index) in jobInForm.mesPwoJobCvDetailList"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.materialBatch'">
<uni-easyinput type="text" disabled v-model="item.materialBatch"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.whCodeDest'">
<uni-easyinput type="text" disabled v-model="item.whCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="库区编码" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.locCodeDest'">
<uni-easyinput type="text" disabled v-model="item.locCodeDest"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="出库数量" :labelWidth='90'
:name="'mesPwoJobCvDetailList.'+ index +'.locCodeDest'">
<uni-easyinput type="text" disabled v-model="item.locCodeDest"></uni-easyinput>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="jobInSubmit">提交</u-button>
</view>
</template>
<script>
import {
handleConvert,
getEquipment,
addConversion,
listEmpEqpHistory,
listEmployee,
listConversion
} from "@/api/mes/jobIn.js";
import {
updatePwoJob,
listEquipment,
getPwoJob,
listPwoJob
} from "@/api/mes/jobReport.js"
export default {
data() {
return {
jobInForm: {
mesPwoJobCvDetailList: [],
},
equipmentCode: null,
flag: true,
show: false,
operateBy: null,
operateByCode: null,
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
materialCode: [{
required: true,
errorMessage: '请输入物料编码!'
}],
materialName: [{
required: false,
errorMessage: '请输入物料名称!'
}],
number: [{
required: true,
errorMessage: '请输入转移数量!'
}],
equipmentCode: [{
required: true,
errorMessage: '请输入设备编码!'
}]
}
}
},
mounted() {},
methods: {
scanJobCode(code) {
},
jobInSubmit() {
this.jobInForm.operateBy = this.operateBy
console.log(this.jobInForm);
this.$refs["jobInForm"].validate().then(valid => {
//作业转入
this.jobInForm.operateBy = this.operateBy
console.log(this.jobInForm);
addConversion(this.jobInForm).then(response => {
this.$modal.msgSuccess("转入成功!");
setTimeout(() => {
this.$tab.switchTab("/pages/work/index");
}, 500);
});
});
},
//作业编码
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.jobInForm.pwoJobCode = res.result;
_this.scanJobCode(_this.jobInForm.pwoJobCode);
}
});
},
//设备编码
scanBar1() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.equipmentCode = res.result;
}
});
},
//操作人编码
scanBar2() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.operateByCode = res.result;
_this.scanBarOperateBy();
}
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,249 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="领料任务单" :labelWidth='90' name="llrwdCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.llrwdCode" @confirm="scanBarCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="拣货单" :labelWidth='90' name="pickCode">
<uni-easyinput suffixIcon="scan" @confirm="scanBarCode" @iconClick="scanBar4" v-model="formData.pickCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="物料编码" :labelWidth='90' name="wlCode">
<uni-easyinput disabled v-model="formData.wlCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="物料名称" :labelWidth='90' name="wlName">
<uni-easyinput type="text" v-model="formData.wlName" disabled/>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="物料批号" :labelWidth='90' name="wlBatchNum">
<uni-easyinput disabled type="text" v-model="formData.wlBatchNum"/>
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="仓库编码" :labelWidth='90' name="ckCode">
<uni-easyinput disabled type="text" v-model="formData.ckCode"/>
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="原有数量" :labelWidth='90' name="yyNum">
<uni-easyinput disabled type="number" v-model="formData.yyNum"/>
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="拣货数量" :labelWidth='90' name="jhNum">
<uni-easyinput disabled type="number" v-model="formData.jhNum"/>
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="现有数量" :labelWidth='90' name="xyNum">
<uni-easyinput disabled type="number" v-model="formData.xyNum"/>
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="拣货区" :labelWidth='90' name="pickArea">
<uni-easyinput type="text" v-model="formData.pickArea"/>
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="拣货时间" :labelWidth='90' name="jhDate">
<view class="uni-list-cell-db">
<picker style="padding-top: 10px;" mode="date" :value="formData.jhDate" :start="startDate" :end="endDate" @change="bindDateChange">
<view class="uni-input" v-model="formData.jhDate">{{formData.jhDate}}</view>
</picker>
</view>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
var arry;
import {addPick,getTask,updatePick,listPick} from "@/api/wms/pdcMaterial.js";
import {listMaterial} from "@/api/wms/request.js";
export default{
mounted() {
this.test();
},
data(){
const currentDate = this.getDate({
format: true
})
return{
formData: {
llrwdCode : null,
wlCode : null,
wlName : null,
wlBatchNum : null,
ckCode : null,
yyNum : null,
jhNum : null,
xyNum : null,
jhDate : currentDate,
pickCode : null,
pickArea : null
},
rules:{
llrwdCode:{
rules:[
{required:true,errorMessage:'请输入领料任务单!'}
]
},
pickCode:{
rules:[
{required:true,errorMessage:'请输入拣货单!'}
]
},
pickArea:{
rules:[
{required:true,errorMessage:'请输入拣货区!'}
]
},
jhNum:{
rules:[
{required:true,errorMessage:'请输入拣货数量!'}
]
},
}
}
},
computed: {
startDate() {
return this.getDate('start');
},
endDate() {
return this.getDate('end');
}
},
methods:{
test(){
// 查询生产领料单详细
getTask('00000550').then(async res => {
console.log(res);
});
let q = {
drawTaskDetailCode : 'DRA200009495'
}
listPick(q).then(async res => {
console.log(res);
});
},
bindDateChange(e){
this.formData.jhDate = e.detail.value
},
getDate(type){
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`;
},
scanBarCode(){
if (this.formData.pickCode && this.formData.llrwdCode) {
let obj = {
drawTaskCode : this.formData.llrwdCode,
pickCode : this.formData.pickCode
}
console.log(obj);
listPick(obj).then(async res => {
console.log(res);
if(res.rows.length!=0){
arry = res.rows[0];
console.log(arry);
this.formData.wlBatchNum = res.rows[0].materialBatchNo,
this.formData.wlName = res.rows[0].materialName,
this.formData.wlCode = res.rows[0].materialCode,
this.formData.ckCode = res.rows[0].storageLocationCode,
this.formData.yyNum = res.rows[0].originNumber,
this.formData.jhNum = res.rows[0].pickNumber,
this.formData.xyNum = res.rows[0].originNumber-res.rows[0].pickNumber
}else{
this.$modal.msgError("未检索到该拣货信息!");
}
});
}else if(!this.formData.llrwdCode || this.formData.llrwdCode == "" || this.formData.llrwdCode == null){
this.$modal.msg("请输入领料任务单!");
}else if(!this.formData.pickCode || this.formData.pickCode == "" || this.formData.pickCode == null){
this.$modal.msg("请输入拣货单!");
}
},
// scanBarCode1(){
// if(!this.formData.pickCode || this.formData.pickCode == "" || this.formData.pickCode == null){
// this.$modal.msgError("请输入拣货单!");
// }
// },
//领料任务单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode','qrCode'],
success: function (res) {
_this.formData.llrwdCode = res.result;
_this.scanBarCode();
}
});
},
//拣货单
scanBar4() {
const _this = this;
uni.scanCode({
scanType: ['barCode','qrCode'],
success: function (res) {
_this.formData.pickCode = res.result;
_this.scanBarCode(_this.formData.pickCode);
}
});
},
submit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定拣货该物料吗?',
success: function (res) {
if (res.confirm) {
arry.status = '2';
arry.inStatus = '2';
arry.pickArea = _this.formData.pickArea;
console.log(arry);
updatePick(arry).then(async res => {
_this.$modal.msgSuccess("拣货成功!");
setTimeout(()=>{
_this.$tab.switchTab("/pages/work/index");
}, 500);
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,150 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="wmsSaleBackIn" >
<uni-forms-item label="销售退货任务单" :labelWidth='110' name="productInTaskCode">
<uni-combox :candidates="productInTaskCodeList" emptyTips="无" @input="scanBarCode"
v-model="wmsSaleBackIn.saleBackTaskCode"></uni-combox>
</uni-forms-item>
<uni-collapse-item title="直接入库单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :key="index"
v-for="(item, index) in wmsSaleBackIn.wmsSaleBackInDetailList"
@click="(data) => clickDetail(index,data)" @change="swipChange">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :labelWidth='90'
:name="'wmsSaleBackInDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90'
:name="'wmsSaleBackInDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
name="'wmsSaleBackInDetailList.'+ index +'.materialBatchNo'">
<uni-easyinput type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="库位条码" :labelWidth='90'
name="'wmsSaleBackInDetailList.'+ index +'.storageLocationBarcode'">
<uni-easyinput suffixIcon="scan" type="text"
v-model="item.storageLocationBarcode" @iconClick="iconClick(index)"/>
</uni-forms-item>
<uni-forms-item label="上架数量" :labelWidth='90'
name="'wmsSaleBackInDetailList.'+ index +'number'">
<u-number-box inputWidth="120" button-size="36" v-model="item.number" min="0"></u-number-box>
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listWarehouse,
backListTask,
addIn,
getInByTask
} from "@/api/wms/warehouse";
import {
toast,
} from '@/utils/common'
export default {
mounted() {
this.selectTypeList();
listWarehouse().then(res => {
console.log(res, "vuex数据");
})
},
data() {
return {
productInTaskCodeList:[],
wmsSaleBackIn:{}
}
},
methods: {
/**
* 获取销售退货任务单下拉数据
*/
selectTypeList() {
backListTask({
pageNum: 1,
pageSize: 25
}).then(async res => {
for (var i in res.rows) {
this.productInTaskCodeList.push(res.rows[i].saleBackTaskCode);
}
});
},
/**
* 获取相关信息
* @param {Object} value 销售退货任务单数据
*/
scanBarCode(value){
getInByTask({saleBackTaskCode:value}).then(res => {
this.wmsSaleBackIn = res.wmsSaleBackIn
this.wmsSaleBackIn.status = 3
})
},
/**
* 提交
*/
submit(){
//判断是否输入工业条码
if(!getStorageLocationBarcode(this.wmsSaleBackIn.wmsSaleBackInDetailList,'storageLocationBarcode')) return
addIn(this.wmsSaleBackIn).then(res =>{
toast('入库成功');
setTimeout(()=>{
uni.switchTab({
url:'/pages/work/index'
})
},2000)
})
/**
* 判断库位条码是否为nll'',undefined
* @param {Object} list 要遍历的数据
* @param {String} key 要判断的值
*/
function getStorageLocationBarcode(list,key){
for(let i in list){
if(list[i][key] === null || list[i][key] ==='' || list[i][key] === undefined){
toast('请填写库位条码')
return false
}
}
return true
}
},
/**
* 扫码方法
* @param {Object} value {industry || number }
*/
iconClick(index){
const _this = this;
uni.scanCode({
// 是否只能从相机扫码,不允许从相册选择图片
onlyFromCamera:true,
// 扫码类型
scanType: ['barCode', 'qrCode'],
success: function(res) {
// _this.wmsSaleBackIn.wmsSaleBackInDetailList[index].storageLocationBarcode = res;
_this.$set(_this.wmsSaleBackIn.wmsSaleBackInDetailList[index],'storageLocationBarcode',res.result)
}
})
},
}
}
</script>
<style>
page{
background-color: #ffffff;
padding-top: 2vh;
}
</style>

View File

@@ -0,0 +1,259 @@
<template>
<view class="container">
<uni-easyinput class="scanInput" placeholder="请扫描销售单号" v-model="saleCode"
@confirm="fetchDetail" @blur="isFocusSaleCode = false" :focus="isFocusSaleCode" />
<uni-table border stripe emptyText="暂无更多数据" class="saleInfo">
<uni-tr v-for="(field, index) in saleInfoFields" :key="index">
<uni-td align="center" width="120">{{ field.label }}</uni-td>
<uni-td align="center">{{ getNestedValue(saleInfo, field.key) }}</uni-td>
</uni-tr>
</uni-table>
<uni-easyinput class="scanInput" v-if="!allowSubmission" placeholder="请扫描箱码" v-model="boxCode"
@confirm="submitBox" @blur="isFocusBoxCode = false" :focus="isFocusBoxCode" />
<uni-table border stripe emptyText="暂无更多数据" class="boxInfo">
<uni-tr>
<uni-th align="center" width="30">物料名称</uni-th>
<uni-th align="center" width="30">规格</uni-th>
<uni-th align="center" width="20">发货数</uni-th>
<uni-th align="center" width="20">校验数</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in saleInfo.wmsSaleOutTaskDetailList" :key="index">
<uni-td align="center">{{ item.materialName }}</uni-td>
<uni-td align="center">{{ item.specification }}</uni-td>
<uni-td align="center">{{ item.number }}</uni-td>
<uni-td align="center">{{ item.validationNumber }}</uni-td>
</uni-tr>
</uni-table>
<u-button class="submitBtn" type="primary" @click="submit" :disabled="!allowSubmission">提交</u-button>
<u-modal :show="showModal" :title="title" :content='content' @confirm="handleConfirm" />
</view>
</template>
<script>
import { addOut } from '@/api/wms/sale.js';
import { listTask, getTask, fetchTask } from '@/api/wms/sale.js';
import { autioError, autioSuccess } from '@/utils/audio';
import { addWmsBoxOutRecord } from '@/api/mes/wmsPieceOutRecord.js';
export default {
computed: {
allowSubmission() {
const { scanNumber, allNumber } = this.saleInfo;
return scanNumber && allNumber && scanNumber === allNumber;
}
},
data() {
return {
// 销售单号
saleCode: null,
// 销售单 id
saleId: null,
// 箱码
boxCode: null,
// 是否处于可扫码状态
scannable: true,
// 聚焦销售单号输入框
isFocusSaleCode: true,
// 聚焦箱码输入框
isFocusBoxCode: false,
saleInfoFields: [
{ label: '销售单号', key: 'saleOutTaskCode' },
{ label: '客户', key: 'customerName' },
{ label: '下级客户', key: 'dynamicField1.nextLevelCus' },
{ label: '扫描数量', key: 'scanNumber' },
{ label: '订单总数', key: 'allNumber' },
],
// 扫描销售单号获取的数据
saleInfo: {
// 销售单号
saleOutTaskCode: null,
// 扫描数量
scanNumber: 0,
// 订单总数
allNumber: 0,
// 动态字段
dynamicField1: {
// 下级客户
nextLevelCus: null
},
//获取的物料详情
wmsSaleOutTaskDetailList: []
},
title: '',
content: '',
modelType: '',
showModal: false
};
},
methods: {
showConfirm(title, content, type) {
this.title = title;
this.content = content;
this.modalType = type;
this.showModal = true;
},
handleConfirm() {
const type = this.modalType;
this.showModal = false;
this.title = this.content = this.modalType = '';
if (type === 'saleCode') this.focusSaleCode();
else if (type === 'boxCode') this.focusBox();
},
getNestedValue(obj, path) {
return path.split('.').reduce((o, k) => o?.[k], obj) ?? '';
},
focusBox() {
this.$nextTick(() => {
this.isFocusBoxCode = true;
});
},
focusSaleCode() {
this.$nextTick(() => {
this.isFocusSaleCode = true;
});
},
// 提交整箱
async submitBox() {
if (!this.saleCode) {
this.$modal.alert('请先扫描销售单号');
autioError();
return;
}
this.$modal.loading('校验中...');
try {
await addWmsBoxOutRecord({
// 箱码
boxCode: this.boxCode,
// 销售订单号
saleOrderCode: this.saleCode,
// 客户编码
customerCode: this.saleInfo.customerCode
});
autioSuccess();
this.$modal.msgSuccess('提交成功');
this.fetchDetail();
this.boxCode = '';
} catch (err) {
this.$modal.alert(err.msg || err.message || '提交失败');
autioError();
} finally {
this.$modal.closeLoading();
this.focusBox();
}
},
// 通过销售单号获取任务单明细
async fetchDetail() {
//当输入值明显不合法时不执行后续操作
if (!this.saleCode) return;
if (this.saleCode.length < 9) {
this.showConfirm(`销售单号错误: ${this.saleCode}\n请扫描正确的销售单号`, 'saleCode');
this.saleCode = '';
return autioError();
}
try {
this.$modal.loading('获取明细中...');
// 从任务单信息中获取任务单 id
const res = await listTask({ saleOutTaskCode: this.saleCode });
this.saleId = res.rows[0]?.id || null;
if (!this.saleId) {
this.$modal.closeLoading();
this.showConfirm('获取明细失败', `请检查销售单号 ${this.saleCode}`, 'saleCode');
return;
}
// 用任务单 id 获取明细详情
const res_task = await getTask(this.saleId);
const data = res_task.data;
data.dynamicField1 = data.dynamicField1
? JSON.parse(data.dynamicField1)
: { nextLevelCus: null };
delete data.id;
this.saleInfo = data;
this.focusBox();
} catch (err) {
autioError();
this.showConfirm('获取明细失败', err.message || err, 'saleCode');
} finally {
this.$modal.closeLoading();
}
},
// 提交
async submit() {
this.$modal.loading('提交中...');
try {
const { data } = await fetchTask(this.saleId);
const detail = {
...data,
dynamicField1: JSON.stringify(this.saleInfo.dynamicField1),
wmsSaleOutDetailList: data.wmsSaleOutTaskDetailList.map(item => {
const { id, ...rest } = item;
return rest;
}),
billType: 2
};
await addOut(detail);
this.$modal.msgSuccess('出库成功');
autioSuccess();
} catch (err) {
this.$modal.alert(err.msg || '提交失败');
autioError();
} finally {
this.$modal.closeLoading();
}
}
}
};
</script>
<style scoped lang="scss">
.container {
background-color: #ffffff;
// #ifdef H5
height: calc(100vh - 44px);
// #endif
// #ifdef APP-PLUS
height: 100vh;
// #endif
padding: 10px;
display: flex;
flex-direction: column;
overflow: hidden;
}
.scanInput,
.saleInfo,
.boxInfo,
.submitBtn {
margin: 0.5vh 0;
}
.boxInfo {
flex: 10;
}
.uni-table-th,
.uni-table-td {
padding: 4px;
}
.uni-table-th {
position: sticky;
top: 0;
z-index: 2;
background-color: #ffffff;
}
.submitBtn {
width: 100%;
}
::v-deep .u-popup {
flex: unset;
}
</style>

343
pages/wms/sale/codeCk.vue Normal file
View File

@@ -0,0 +1,343 @@
<template>
<view class="container">
<uni-easyinput class="scanInput" placeholder="请扫描销售单号" v-model="saleCode"
@confirm="fetchDetail" @blur="isFocusSaleCode = false" :focus="isFocusSaleCode" clearable />
<t-sale-info :saleInfo="saleInfo" />
<uni-easyinput class="scanInput" placeholder="请扫描工业条码" v-if="!isFinish" :key="inputKey"
v-model="pieceBarcode" @confirm="submitPiece" @blur="isFocusPieceBarcode = false" :focus="isFocusPieceBarcode" clearable />
<uni-table border stripe emptyText="暂无更多数据" class="pieceInfo">
<uni-tr>
<uni-th align="center" width="30">物料名称</uni-th>
<uni-th align="center" width="30">规格</uni-th>
<uni-th align="center" width="20">发货数</uni-th>
<uni-th align="center" width="20">校验数</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in saleInfo.wmsSaleOutTaskDetailList" :key="index">
<uni-td align="center">{{ item.materialName }}</uni-td>
<uni-td align="center">{{ item.specification }}</uni-td>
<uni-td align="center">{{ item.number }}</uni-td>
<uni-td align="center">{{ item.validationNumber }}</uni-td>
</uni-tr>
</uni-table>
<view class="actions">
<u-button class="reload-btn" icon="reload" @click="fetchDetail"></u-button>
<uni-badge size="small" :text="errorLogs.length" absolute="rightTop" type="error">
<u-button class="logs-btn" @click="showErrorLogs">异常记录</u-button>
</uni-badge>
<u-button class="submit-btn" type="primary" @click="submit" :disabled="!isFinish">提交</u-button>
</view>
<uni-popup ref="popup" type="bottom" border-radius="10px 10px 0 0" background-color="#fff">
<scroll-view scroll-y class="err-logs-container" v-if="errorLogs.length">
<uni-section :title="'共有' + errorLogs.length + '条错误记录'" type="line" />
<uni-card v-for="(err, index) in errorLogs" :key="err.pieceBarcode">
<template #title>
<view class="err-logs-card__title">
<text style="flex: 1">{{ err.pieceBarcode }}</text>
<u-button size="mini" text="X" style="flex: 0" @click="removeErrPiece(err.pieceBarcode)"></u-button>
</view>
</template>
{{ err.msg }}
<template #actions>
<view class="actions-container" @click="reSubmitPiece(err.pieceBarcode)">
<text>重新提交</text>
</view>
</template>
</uni-card>
</scroll-view>
<u-empty mode="list" v-else />
</uni-popup>
<u-modal :show="showModal" :title="title" :content="content" @confirm="handleConfirm" />
</view>
</template>
<script>
import { addOut } from '@/api/wms/sale.js';
import {
listTask,
getTask,
fetchTask
} from '@/api/wms/sale.js';
import { autioError, autioSuccess } from '@/utils/audio';
import { addWmsPieceOutRecord } from '@/api/mes/wmsPieceOutRecord.js';
import { nextTick } from "vue";
export default {
data() {
return {
inputKey: 0,
isFinish: false,
isFocusSaleCode: true,
isFocusPieceBarcode: false,
// 销售单号
saleCode: null,
// 销售单 id
saleId: null,
// 工业条码
pieceBarcode: '',
// 扫描销售单号获取的数据
saleInfo: {
// 销售单号
saleOutTaskCode: '',
// 扫描数量
scanNumber: '',
// 订单总数
allNumber: '',
// 动态字段
dynamicField1: {
// 下级客户
nextLevelCus: ''
},
//获取的物料详情
wmsSaleOutTaskDetailList: []
},
showModal: false,
modalType: '',
title: '',
content: '',
errorLogs: []
};
},
methods: {
focusSaleCode() {
this.$nextTick(() => {
this.isFocusSaleCode = true;
});
},
focusPieceBarcode() {
this.inputKey++;
this.$nextTick(() => {
this.isFocusPieceBarcode = true;
});
},
showErrorLogs() {
this.$refs.popup.open('bottom');
},
showConfirm(title, content, type) {
this.title = title;
this.content = content;
this.modalType = type;
this.showModal = true;
},
handleConfirm() {
autioError();
const type = this.modalType;
this.showModal = false;
this.title = this.content = this.modalType = '';
if (type === 'saleCode') this.focusSaleCode();
else if (type === 'pieceBarCode') this.focusPieceBarcode();
},
// 校验工业条码规范性
validatePieceBarcode() {
//判断工业条码里面是否有逗号,逗号后面大于九位
if (!this.pieceBarcode) return false;
const [prefix, suffix] = this.pieceBarcode.replace('', ',').split(',');
return !!(prefix && suffix?.length >= 9);
},
// 提交工业条码
submitPiece() {
if (!this.pieceBarcode) return;
if (!this.saleCode) return this.showConfirm('错误', '请先输入销售单号', 'saleCode');
if (!this.validatePieceBarcode()) return this.showConfirm('错误', '请输入正确的工业条码', 'pieceBarCode');
const pieceBarcode = this.pieceBarcode;
autioSuccess();
this.$modal.msgSuccess('提交成功');
addWmsPieceOutRecord({
// 销售订单号
saleOrderCode: this.saleCode,
// 工业条码
pieceBarcode,
// 客户编码
customerCode: this.saleInfo.customerCode,
delStatus: '0'
}).catch(err => {
this.addError(pieceBarcode, err.msg);
});
this.isFocusPieceBarcode = false;
this.pieceBarcode = '';
this.focusPieceBarcode();
},
async reSubmitPiece(pieceBarcode) {
this.$modal.loading('重新提交中');
await addWmsPieceOutRecord({
// 销售订单号
saleOrderCode: this.saleCode,
// 工业条码
pieceBarcode,
// 客户编码
customerCode: this.saleInfo.customerCode,
delStatus: '0'
}).then(() => {
this.$modal.msgSuccess('提交成功');
this.removeErrPiece(pieceBarcode);
}).catch(err => {
autioError();
this.addError(pieceBarcode, err.msg);
this.showConfirm('重新提交失败', err.msg, 'pieceBarCode');
});
this.$modal.closeLoading();
},
addError(pieceBarcode, msg) {
const idx = this.errorLogs.findIndex(i => i.pieceBarcode === pieceBarcode);
if (idx !== -1) {
// 已存在 → 更新
this.errorLogs[idx].msg = msg;
// 为确保视图立即刷新Vue2 对数组项更新可能不追踪)
this.errorLogs.splice(idx, 1, this.errorLogs[idx]);
} else {
// 不存在 → 添加新记录
this.errorLogs.push({ pieceBarcode, msg });
}
},
removeErrPiece(pieceBarcode) {
this.errorLogs = this.errorLogs.filter(i => i.pieceBarcode !== pieceBarcode);
},
// 通过销售单号获取任务单明细
async fetchDetail() {
//当输入值明显不合法时不执行后续操作
if (!this.saleCode) return;
if (this.saleCode.length < 9) {
this.showConfirm('错误', `销售单号 ${this.saleCode} 错误,请扫描正确的销售单号`, 'saleCode');
this.saleCode = '';
return autioError();
}
this.$modal.loading('获取明细中...');
try {
// 从任务单信息中获取任务单 id
const res = await listTask({ saleOutTaskCode: this.saleCode });
this.saleId = res.rows[0]?.id || null;
if (!this.saleId) {
this.$modal.closeLoading();
this.showConfirm('获取明细失败', `请检查销售单号 ${this.saleCode}`, 'saleCode');
return;
}
// 用任务单 id 获取明细详情
const res_task = await getTask(this.saleId);
const data = res_task.data;
data.dynamicField1 = data.dynamicField1
? JSON.parse(data.dynamicField1)
: { nextLevelCus: null };
delete data.id;
this.saleInfo = data;
this.isFinish = !!(data.scanNumber && data.allNumber && data.scanNumber >= data.allNumber);
this.focusPieceBarcode();
} catch (err) {
autioError();
this.showConfirm('获取明细失败', err.message || err, 'saleCode');
}
this.$modal.closeLoading();
},
// 提交
async submit() {
try {
this.$modal.loading('提交中...');
const { data } = await fetchTask(this.saleId);
const detail = {
...data,
wmsSaleOutTaskDetailList: data.wmsSaleOutTaskDetailList.map(i => {
const { id, ...rest } = i;
return rest;
}),
dynamicField1: JSON.stringify(this.saleInfo.dynamicField1),
wmsSaleOutDetailList: data.wmsSaleOutTaskDetailList,
billType: 2
};
delete detail.id;
await addOut(detail);
autioSuccess();
this.$modal.msgSuccess('出库成功');
} catch (err) {
autioError();
this.$modal.alert(err.msg || err.message || err);
} finally {
this.$modal.closeLoading();
}
}
}
};
</script>
<style scoped lang="scss">
.container {
background-color: #ffffff;
// #ifdef H5
height: calc(100vh - 44px);
// #endif
// #ifdef APP-PLUS
height: 100vh;
// #endif
padding: 10px;
display: flex;
flex-direction: column;
overflow: hidden;
}
.scanInput,
.saleInfo,
.pieceInfo, {
flex: 0 0 auto;
margin: 0.5vh 0;
}
.pieceInfo {
flex: 1;
}
.uni-table-th,
.uni-table-td {
padding: 4px;
}
.uni-table-th {
position: sticky;
top: 0;
z-index: 2;
background-color: #ffffff;
}
::v-deep .u-popup {
flex: unset;
}
.actions {
width: 100%;
display: flex;
gap: 10px;
.reload-btn {
width: 46px;
}
.submit-btn {
flex: 1;
}
}
::v-deep .uni-badge {
z-index: 99;
}
::v-deep .err-logs-container {
.uni-scroll-view {
max-height: 40vh;
}
.err-logs-card__title {
display: flex;
align-items: center;
padding: 10px 5px;
}
}
.uni-popup__wrapper {
z-index: 999 !important;
}
.actions-container {
display: flex;
align-items: center;
justify-content: center;
padding: 12px 0;
border-top: 1px #EBEEF5 solid;
}
</style>

View File

@@ -0,0 +1,281 @@
<template>
<view class="container">
<uni-easyinput class="scanInput" placeholder="请扫描销售单号" v-model="saleCode"
@confirm="fetchDetail" @blur="isFocusSaleCode = false" :focus="isFocusSaleCode" clearable />
<uni-table border stripe emptyText="暂无更多数据" class="saleInfo">
<uni-tr v-for="(field, index) in saleInfoFields" :key="index">
<uni-td align="center" width="120">{{ field.label }}</uni-td>
<uni-td align="center">{{ getNestedValue(saleInfo, field.key) }}</uni-td>
</uni-tr>
</uni-table>
<uni-easyinput class="scanInput" placeholder="请扫描工业条码" v-if="!allowSubmission"
v-model="pieceBarcode" @confirm="submitPiece" @blur="isFocusPieceBarcode = false" :focus="isFocusPieceBarcode" clearable />
<uni-table border stripe emptyText="暂无更多数据" class="boxInfo">
<uni-tr>
<uni-th align="center" width="30">物料名称</uni-th>
<uni-th align="center" width="30">规格</uni-th>
<uni-th align="center" width="20">发货数</uni-th>
<uni-th align="center" width="20">校验数</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in saleInfo.wmsSaleOutTaskDetailList" :key="index">
<uni-td align="center">{{ item.materialName }}</uni-td>
<uni-td align="center">{{ item.specification }}</uni-td>
<uni-td align="center">{{ item.number }}</uni-td>
<uni-td align="center">{{ item.validationNumber }}</uni-td>
</uni-tr>
</uni-table>
<u-button class="submitBtn" type="primary" @click="submit" :disabled="!allowSubmission">提交</u-button>
<u-modal :show="showModal" :title="title" :content="content" @confirm="handleConfirm" />
</view>
</template>
<script>
import { addOut } from '@/api/wms/sale.js';
import {
listTask,
getTask,
fetchTask
} from '@/api/wms/sale.js';
import { autioError, autioSuccess } from '@/utils/audio';
import { addWmsPieceOutRecord } from '@/api/mes/wmsPieceOutRecord.js';
export default {
computed: {
allowSubmission() {
const { scanNumber, allNumber } = this.saleInfo;
return scanNumber && allNumber && scanNumber === allNumber;
}
},
data() {
return {
isFocusSaleCode: true,
isFocusPieceBarcode: false,
// 销售单号
saleCode: null,
// 销售单 id
saleId: null,
// 箱码
pieceBarcode: null,
saleInfoFields: [
{ label: '销售单号', key: 'saleOutTaskCode' },
{ label: '客户', key: 'customerName' },
{ label: '下级客户', key: 'dynamicField1.nextLevelCus' },
{ label: '扫描数量', key: 'scanNumber' },
{ label: '订单总数', key: 'allNumber' },
],
// 扫描销售单号获取的数据
saleInfo: {
// 销售单号
saleOutTaskCode: null,
// 扫描数量
scanNumber: 0,
// 订单总数
allNumber: 0,
// 动态字段
dynamicField1: {
// 下级客户
nextLevelCus: null
},
//获取的物料详情
wmsSaleOutTaskDetailList: []
},
showModal: false,
modalType: '',
title: '',
content: ''
};
},
methods: {
getNestedValue(obj, path) {
return path.split('.').reduce((o, k) => o?.[k], obj) ?? '';
},
focusSaleCode() {
this.$nextTick(() => {
this.isFocusSaleCode = true;
});
},
focusPieceBarcode() {
this.$nextTick(() => {
this.isFocusPieceBarcode = true;
});
},
showConfirm(title, content, type) {
this.title = title;
this.content = content;
this.modalType = type;
this.showModal = true;
},
handleConfirm() {
const type = this.modalType;
this.showModal = false;
this.title = this.content = this.modalType = '';
if (type === 'saleCode') this.focusSaleCode();
else if (type === 'pieceBarCode') this.focusPieceBarcode();
},
// 校验工业条码规范性
validatePieceBarcode() {
//判断工业条码里面是否有逗号,逗号后面大于九位
if (!this.pieceBarcode) return false;
const [prefix, suffix] = this.pieceBarcode.replace('', ',').split(',');
return !!(prefix && suffix?.length >= 9);
},
// 提交工业条码
async submitPiece() {
if (!this.pieceBarcode) return;
if (!this.saleCode) return this.showConfirm('错误', '请先输入销售单号', 'saleCode');
if (!this.validatePieceBarcode()) return this.showConfirm('错误', '请输入正确的工业条码', 'pieceBarCode');
try {
await addWmsPieceOutRecord({
// 销售订单号
saleOrderCode: this.saleCode,
// 工业条码
pieceBarcode: this.pieceBarcode,
// 客户编码
customerCode: this.saleInfo.customerCode,
delStatus: '0'
});
autioSuccess();
this.updateValidateNum(this.pieceBarcode);
this.$modal.msgSuccess('提交成功');
this.focusPieceBarcode();
} catch (err) {
autioError();
this.showConfirm('提交失败', err.msg || err.message || String(err), 'pieceBarCode');
} finally {
this.pieceBarcode = '';
}
},
// 增加物料校验数(数量可能与后端对不齐)
updateValidateNum(pieceBarcode) {
// 获取物料 id 或商品码
const [code] = pieceBarcode.replace('', ',').split(',');
const mat = this.saleInfo.wmsSaleOutTaskDetailList.find(
i => i.materialId == code || i.commodityCode == code
);
if (!mat) return console.warn('未找到对应物料');
if (typeof mat.validationNumber === 'number') {
this.$set(mat, 'validationNumber', mat.validationNumber + 1);
this.$set(this.saleInfo, 'scanNumber', this.saleInfo.scanNumber + 1);
}
},
// 通过销售单号获取任务单明细
async fetchDetail() {
//当输入值明显不合法时不执行后续操作
if (!this.saleCode) return;
if (this.saleCode.length < 9) {
this.showConfirm('错误', `销售单号 ${this.saleCode} 错误,请扫描正确的销售单号`, 'saleCode');
this.saleCode = '';
return autioError();
}
try {
this.$modal.loading('获取明细中...');
// 从任务单信息中获取任务单 id
const res = await listTask({ saleOutTaskCode: this.saleCode });
this.saleId = res.rows[0]?.id || null;
if (!this.saleId) {
this.$modal.closeLoading();
this.showConfirm('获取明细失败', `请检查销售单号 ${this.saleCode}`, 'saleCode');
return;
}
// 用任务单 id 获取明细详情
const res_task = await getTask(this.saleId);
const data = res_task.data;
data.dynamicField1 = data.dynamicField1
? JSON.parse(data.dynamicField1)
: { nextLevelCus: null };
delete data.id;
this.saleInfo = data;
this.focusPieceBarcode();
} catch (err) {
autioError();
this.showConfirm('获取明细失败', err.message || err, 'saleCode');
} finally {
this.$modal.closeLoading();
}
},
// 提交
async submit() {
try {
this.$modal.loading('提交中...');
const { data } = await fetchTask(this.saleId);
const detail = {
...data,
wmsSaleOutTaskDetailList: data.wmsSaleOutTaskDetailList.map(i => {
const { id, ...rest } = i;
return rest;
}),
dynamicField1: JSON.stringify(this.saleInfo.dynamicField1),
wmsSaleOutDetailList: data.wmsSaleOutTaskDetailList,
billType: 2
};
delete detail.id;
await addOut(detail);
autioSuccess();
this.$modal.msgSuccess('出库成功');
} catch (err) {
autioError();
this.$modal.alert(err.msg || err.message || err);
} finally {
this.$modal.closeLoading();
}
}
}
};
</script>
<style scoped lang="scss">
.container {
background-color: #ffffff;
// #ifdef H5
height: calc(100vh - 44px);
// #endif
// #ifdef APP-PLUS
height: 100vh;
// #endif
padding: 10px;
display: flex;
flex-direction: column;
overflow: hidden;
}
.scanInput,
.saleInfo,
.boxInfo,
.submitBtn {
flex: 0 0 auto;
margin: 0.5vh 0;
}
.boxInfo {
flex: 1;
}
.uni-table-th,
.uni-table-td {
padding: 4px;
}
.uni-table-th {
position: sticky;
top: 0;
z-index: 2;
background-color: #ffffff;
}
.submitBtn {
width: 100%;
}
::v-deep .u-popup {
flex: unset;
}
</style>

476
pages/wms/sale/directCk.vue Normal file
View File

@@ -0,0 +1,476 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="销售出库单" :open="true">
<uni-forms-item label="销售出库任务单" :labelWidth='90' name="saleOutTaskCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarTaskCode"
v-model="formData.saleOutTaskCode" />
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarCk"
v-model="formData.warehouseCode" />
</uni-forms-item>
<uni-forms-item label="客户编码" :labelWidth='90' name="customerCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarKh"
v-model="formData.customerCode" />
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="销售出库单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions"
v-for="(item, index) in formData.wmsSaleOutDetailList"
@click="(data) => clickDetail(index,data)" :key="index">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :name="'wmsSaleOutDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :name="'wmsSaleOutDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
name="'wmsSaleOutDetailList.'+ index +'.materialBatchNo'">
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90'
name="'wmsSaleOutDetailList.'+ index +'.materialLotNo'">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarXh"
v-model="item.materialLotNo" />
</uni-forms-item>
<!-- <uni-forms-item label="库位条码" :labelWidth='90'
name="'wmsSaleOutDetailList.'+ index +'.storageLocationBarcode'">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarKq"
v-model="item.storageLocationBarcode" />
</uni-forms-item> -->
<uni-forms-item label="库位条码" :labelWidth='90'
name="'wmsSaleOutDetailList.'+ index +'.storageLocationBarcode'">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
@change="splitStlBarcode(index)" type="text" v-model="item.storageLocationBarcode"
ref="sbcode" />
</uni-forms-item>
<uni-forms-item label="出库数量" :labelWidth='90'
name="'wmsSaleOutDetailList.'+ index +'number'">
<u-number-box inputWidth="120" button-size="36" v-model="item.number"
min="0"></u-number-box>
</uni-forms-item>
<uni-forms-item label="单位" :labelWidth='90'
:name="'wmsSaleOutDetailList.'+ index +'unitText'">
<uni-easyinput type="text" disabled v-model="item.unitText" />
</uni-forms-item>
<uni-forms-item label="是否录入防串货" :labelWidth='120'>
<uni-data-checkbox v-model="radio" :localdata="chIn"></uni-data-checkbox>
</uni-forms-item>
<view v-show="radio==1">
<uni-forms-item label="防串货编码" :labelWidth='90' name="code">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarCode" type="text"
v-model="code" />
</uni-forms-item>
<uni-forms-item label="编码类型" :labelWidth='120'>
<uni-data-checkbox v-model="radio1" :localdata="type"></uni-data-checkbox>
</uni-forms-item>
<view style="text-align: center;">
<button type="warning" size="mini" @click="codeIn(index)">录入</button>
</view>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
getTask,
listPick,
addOut,
listTask,
getOutBillBySourceCode,
getSaleOutDirectlyByTaskCode
} from "@/api/wms/sale.js";
import {
listMaterial
} from "@/api/wms/request.js";
import {
listCustomer,
addAntiChannelRecord,
searchByCode
} from "@/api/srm/antiCrossCargo.js";
import {
conforms
} from "lodash";
import {
listUnit
} from "@/api/basic/unit";
export default {
mounted() {
listUnit().then((res) => {
this.unitList = res.rows.map(item => {
let obj = {
text: item.unitCode + ":" + item.unitName,
value: item.id
}
return obj
})
})
},
data() {
return {
unitList: [],
code: null,
radio: 0,
radio1: 1,
chIn: [{
text: '是',
value: 1
},
{
text: '否',
value: 0
}
],
type: [{
text: '批号',
value: 1
},
{
text: '箱号',
value: 2
},
{
text: '件号',
value: 3
},
],
checkStorageLocationBarcode: true,
formData: {
saleOutTaskCode: null,
warehouseCode: null,
customerCode: null,
wmsSaleOutDetailList: [],
billType: '2'
},
formIn: {
},
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
saleOutTaskCode: {
rules: [{
required: true,
errorMessage: '请输入销售出库任务单!'
}]
},
}
}
},
methods: {
deleteDetail(index) {
this.formData.wmsSaleOutDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
test() {},
splitStlBarcode(i) {
const _this = this;
const detail = _this.formData.wmsSaleOutDetailList[i];
detail.whCode = null;
detail.storageAreaCode = null;
detail.storageShelvesCode = null;
detail.storageLocationCode = null;
let barcode = detail.storageLocationBarcode;
if (!barcode) {
return; // 如果没有条码,不做任何处理
}
let [whCode, storageAreaCode, storageShelvesCode, storageLocationCode, extra] = barcode.split('-');
if (whCode) {
let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
if (!warehouseObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
}
if (storageAreaCode) {
let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode ==
storageAreaCode);
if (!areaObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("库区不存在!");
return;
}
if (storageShelvesCode) {
let shelvesObj = _this.$store.getters.shelvesOptions.find(item => item.storageShelvesCode ==
storageShelvesCode);
if (!shelvesObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
};
if (storageLocationCode) {
let locationObj = _this.$store.getters.locationOptions.find(item => item
.storageLocationCode == (extra ?
(storageLocationCode + '-' + extra) : storageLocationCode));
if (!locationObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("库位不存在!");
return;
};
}
}
}
}
_this.checkStorageLocationBarcode = true;
detail.whCode = whCode || null;
detail.storageAreaCode = storageAreaCode || null;
detail.storageShelvesCode = storageShelvesCode || null;
detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
},
scanBarstorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
console.log(res.result)
// _this.formData.wmsSaleOutDetailList[i].storageLocationBarcode = res.result;
_this.$refs.sbcode.onClear();
_this.$set(_this.formData.wmsSaleOutDetailList[i], 'storageLocationBarcode', res
.result);
_this.formData.wmsSaleOutDetailList[i] = Object.assign({}, _this.formData
.wmsSaleOutDetailList[i])
_this.splitStlBarcode(i);
}
});
},
scanBarTaskCode() {
var id = null;
if (this.formData.saleOutTaskCode && this.formData.saleOutTaskCode != "") {
getSaleOutDirectlyByTaskCode({
saleOutTaskCode: this.formData.saleOutTaskCode
}).then(async res => {
if (res.wmsSaleOut) {
console.log(res)
this.formData = res.wmsSaleOut;
this.formData.billType = '2';
if (res.wmsSaleOut.wmsSaleOutDetailList.length > 0) {
this.formData.wmsSaleOutDetailList = res.wmsSaleOut.wmsSaleOutDetailList.map(
item => {
item.storageLocationBarcode = item.whCode ? (item.storageAreaCode ?
(
item.shelvesCode ? (item.storageLocationCode ? (item
.whCode + '-' + item.storageAreaCode + '-' +
item
.shelvesCode +
'-' + item.storageLocationCode) : (item
.whCode +
'-' + item.storageAreaCode + '-' + item
.shelvesCode
)) : (item.whCode + '-' + item.storageAreaCode)) : item
.whCode) : ''
let unitobj = this.unitList.find(i => i.value == item.secondUnitId)
if (unitobj) {
item.unitText = unitobj.text
}
return item
});
}
} else {
this.$modal.msg("未检索到相关物料明细!");
}
});
} else {
this.$modal.msg("请输入销售出库任务单!");
}
},
//领料任务单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.saleOutTaskCode = res.result;
_this.scanBarTaskCode();
}
});
},
//仓库编码
scanBarCk() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.warehouseCode = res.result;
}
});
},
//仓库编码
scanBarKh() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.customerCode = res.result;
}
});
},
//库区编码
scanBarKq() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.storageLocationBarcode = res.result;
}
});
},
//箱号编码
scanBarXh() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.materialLotNo = res.result;
}
});
},
//箱号编码
scanBarCode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.code = res.result;
}
});
},
//防串货录入
codeIn(i) {
if (this.code && this.radio1) {
this.search(this.code, this.radio1, i)
}
},
search(c, t, i) {
searchByCode(c, t).then(async res => {
if (res.data) {
console.log(res);
if (res.data.batchNo == this.formData.wmsSaleOutDetailList[i].materialBatchNo &&
res.data.materialCode == this.formData.wmsSaleOutDetailList[i].materialCode) {
this.scanBarCode1();
let data = {
customerId: this.formIn.customerId,
allowDealPlace: this.formIn.country,
pieceNo: res.data.pieceNo,
pieceSignId: res.data.pieceSignId,
materialCode: res.data.materialCode,
materialName: res.data.materialName,
batchNo: res.data.batchNo,
lotNo: res.data.lotNo
}
console.log(data);
addAntiChannelRecord(data).then(async res => {
this.$modal.msgSuccess("防串货录入成功!");
});
} else {
this.$modal.msg("物料信息不匹配!")
}
} else {
this.$modal.msg("未检索到相应的物料信息!")
}
});
},
//根据客户编码获取客户信息
scanBarCode1() {
if (this.formData.customerCode && this.formData.customerCode != "") {
let obj = {
customerCode: this.formData.customerCode
}
listCustomer(obj).then(async res => {
if (res.rows.length != 0) {
this.formIn.allowDealPlace = res.rows[0].country,
this.formIn.customerId = res.rows[0].id
} else {
this.$modal.msg("未检索到该客户!");
}
});
} else {
this.$modal.msg("请输入客户编码!")
}
},
submit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定出库该物料吗?',
success: function(res) {
if (res.confirm) {
// let data = {
// saleOutTaskCode: _this.formData.saleOutTaskCode,
// warehouseCode: _this.formData.warehouseCode,
// customerCode: _this.formData.customerCode,
// wmsSaleOutDetailList: _this.formData.wmsSaleOutDetailList
// }
_this.formData.wmsSaleOutDetailList.map(item => {
item.secondNumber = item.number;
item.secondUnitId = item.unitId;
return item
})
console.log(_this.formData)
if (!_this.checkStorageLocationBarcode) {
_this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
_this.$modal.loading('提交中')
addOut(_this.formData).then(async res => {
_this.$modal.msgSuccess("出库成功!");
_this.$modal.closeLoading();
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
.divider {
display: flex;
align-items: center;
justify-content: center;
margin-top: 10px;
margin-bottom: 10px;
height: 1px;
background-color: #F1F1F1;
}
.divider span {
padding: 5px;
}
</style>

456
pages/wms/sale/saleCk.vue Normal file
View File

@@ -0,0 +1,456 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="销售出库单" :open="true">
<uni-forms-item label="销售出库任务单" :labelWidth='90' name="saleOutTaskCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarTaskCode"
v-model="formData.saleOutTaskCode" />
</uni-forms-item>
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarCk"
v-model="formData.warehouseCode" />
</uni-forms-item>
<uni-forms-item label="客户编码" :labelWidth='90' name="customerCode">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarKh"
v-model="formData.customerCode" />
</uni-forms-item>
</uni-collapse-item>
<uni-collapse-item title="销售出库单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item :rightOptions="rightOptions"
v-for="(item, index) in formData.wmsSaleOutDetailList"
@click="(data) => clickDetail(index,data)" :key="index">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="物料编码" :name="'wmsSaleOutDetailList.'+ index +'.materialCode'">
<uni-easyinput type="text" disabled v-model="item.materialCode"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料名称" :name="'wmsSaleOutDetailList.'+ index +'.materialName'">
<uni-easyinput type="text" disabled v-model="item.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="物料批号" :labelWidth='90'
name="'wmsSaleOutDetailList.'+ index +'.materialBatchNo'">
<uni-easyinput disabled type="text" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="物料箱号" :labelWidth='90'
name="'wmsSaleOutDetailList.'+ index +'.materialLotNo'">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarXh"
v-model="item.materialLotNo" />
</uni-forms-item>
<!-- <uni-forms-item label="库位条码" :labelWidth='90'
name="'wmsSaleOutDetailList.'+ index +'.storageLocationBarcode'">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarKq"
v-model="item.storageLocationBarcode" />
</uni-forms-item> -->
<uni-forms-item label="库位条码" :labelWidth='90'
name="'wmsSaleOutDetailList.'+ index +'.storageLocationBarcode'">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode(index)"
@change="splitStlBarcode(index)" type="text" v-model="item.storageLocationBarcode"
ref="sbcode" />
</uni-forms-item>
<uni-forms-item label="出库数量" :labelWidth='90'
name="'wmsSaleOutDetailList.'+ index +'number'">
<u-number-box inputWidth="120" button-size="36" v-model="item.number"
min="0"></u-number-box>
</uni-forms-item>
<uni-forms-item label="是否录入防串货" :labelWidth='120'>
<uni-data-checkbox v-model="radio" :localdata="chIn"></uni-data-checkbox>
</uni-forms-item>
<view v-show="radio==1">
<uni-forms-item label="防串货编码" :labelWidth='90' name="code">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarCode" type="text"
v-model="code" />
</uni-forms-item>
<uni-forms-item label="编码类型" :labelWidth='120'>
<uni-data-checkbox v-model="radio1" :localdata="type"></uni-data-checkbox>
</uni-forms-item>
<view style="text-align: center;">
<button type="warning" size="mini" @click="codeIn(index)">录入</button>
</view>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
getTask,
listPick,
addOut,
listTask,
getOutBillBySourceCode
} from "@/api/wms/sale.js";
import {
listMaterial
} from "@/api/wms/request.js";
import {
listCustomer,
addAntiChannelRecord,
searchByCode
} from "@/api/srm/antiCrossCargo.js";
import {
conforms
} from "lodash";
export default {
mounted() {
},
data() {
return {
code: null,
radio: 0,
radio1: 1,
chIn: [{
text: '是',
value: 1
},
{
text: '否',
value: 0
}
],
type: [{
text: '批号',
value: 1
},
{
text: '箱号',
value: 2
},
{
text: '件号',
value: 3
},
],
checkStorageLocationBarcode: true,
formData: {
saleOutTaskCode: null,
warehouseCode: null,
customerCode: null,
wmsSaleOutDetailList: [],
billType: '1'
},
formIn: {
},
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
saleOutTaskCode: {
rules: [{
required: true,
errorMessage: '请输入销售出库任务单!'
}]
},
}
}
},
methods: {
deleteDetail(index) {
this.formData.wmsSaleOutDetailList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
test() {},
splitStlBarcode(i) {
const _this = this;
const detail = _this.formData.wmsSaleOutDetailList[i];
detail.whCode = null;
detail.storageAreaCode = null;
detail.storageShelvesCode = null;
detail.storageLocationCode = null;
let barcode = detail.storageLocationBarcode;
if (!barcode) {
return; // 如果没有条码,不做任何处理
}
let [whCode, storageAreaCode, storageShelvesCode, storageLocationCode, extra] = barcode.split('-');
if (whCode) {
let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
if (!warehouseObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
}
if (storageAreaCode) {
let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode ==
storageAreaCode);
if (!areaObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("库区不存在!");
return;
}
if (storageShelvesCode) {
let shelvesObj = _this.$store.getters.shelvesOptions.find(item => item.storageShelvesCode ==
storageShelvesCode);
if (!shelvesObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
};
if (storageLocationCode) {
let locationObj = _this.$store.getters.locationOptions.find(item => item
.storageLocationCode == (extra ?
(storageLocationCode + '-' + extra) : storageLocationCode));
if (!locationObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("库位不存在!");
return;
};
}
}
}
}
_this.checkStorageLocationBarcode = true;
detail.whCode = whCode || null;
detail.storageAreaCode = storageAreaCode || null;
detail.storageShelvesCode = storageShelvesCode || null;
detail.storageLocationCode = extra ? `${storageLocationCode}-${extra}` : storageLocationCode || null;
},
scanBarstorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
console.log(res.result)
// _this.formData.wmsSaleOutDetailList[i].storageLocationBarcode = res.result;
_this.$refs.sbcode.onClear();
_this.$set(_this.formData.wmsSaleOutDetailList[i], 'storageLocationBarcode', res
.result);
_this.formData.wmsSaleOutDetailList[i] = Object.assign({}, _this.formData
.wmsSaleOutDetailList[i])
_this.splitStlBarcode(i);
}
});
},
scanBarTaskCode() {
var id = null;
if (this.formData.saleOutTaskCode && this.formData.saleOutTaskCode != "") {
getOutBillBySourceCode({
saleOutTaskCode: this.formData.saleOutTaskCode
}).then(async res => {
if (res.wmsSaleOut) {
console.log(res)
this.formData = res.wmsSaleOut;
this.formData.billType = '1';
if (res.wmsSaleOut.wmsSaleOutDetailList.length > 0) {
this.formData.wmsSaleOutDetailList = res.wmsSaleOut.wmsSaleOutDetailList.map(
item => {
item.storageLocationBarcode = item.whCode ? (item.storageAreaCode ?
(
item.shelvesCode ? (item.storageLocationCode ? (item
.whCode + '-' + item.storageAreaCode + '-' +
item
.shelvesCode +
'-' + item.storageLocationCode) : (item
.whCode +
'-' + item.storageAreaCode + '-' + item
.shelvesCode
)) : (item.whCode + '-' + item.storageAreaCode)) : item
.whCode) : ''
return item
});
}
} else {
this.$modal.msg("未检索到相关物料明细!");
}
});
} else {
this.$modal.msg("请输入销售出库任务单!");
}
},
//领料任务单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.saleOutTaskCode = res.result;
_this.scanBarTaskCode();
}
});
},
//仓库编码
scanBarCk() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.warehouseCode = res.result;
}
});
},
//仓库编码
scanBarKh() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.customerCode = res.result;
}
});
},
//库区编码
scanBarKq() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.storageLocationBarcode = res.result;
}
});
},
//箱号编码
scanBarXh() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.materialLotNo = res.result;
}
});
},
//箱号编码
scanBarCode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.code = res.result;
}
});
},
//防串货录入
codeIn(i) {
if (this.code && this.radio1) {
this.search(this.code, this.radio1, i)
}
},
search(c, t, i) {
searchByCode(c, t).then(async res => {
if (res.data) {
console.log(res);
if (res.data.batchNo == this.formData.wmsSaleOutDetailList[i].materialBatchNo &&
res.data.materialCode == this.formData.wmsSaleOutDetailList[i].materialCode) {
this.scanBarCode1();
let data = {
customerId: this.formIn.customerId,
allowDealPlace: this.formIn.country,
pieceNo: res.data.pieceNo,
pieceSignId: res.data.pieceSignId,
materialCode: res.data.materialCode,
materialName: res.data.materialName,
batchNo: res.data.batchNo,
lotNo: res.data.lotNo
}
console.log(data);
addAntiChannelRecord(data).then(async res => {
this.$modal.msgSuccess("防串货录入成功!");
});
} else {
this.$modal.msg("物料信息不匹配!")
}
} else {
this.$modal.msg("未检索到相应的物料信息!")
}
});
},
//根据客户编码获取客户信息
scanBarCode1() {
if (this.formData.customerCode && this.formData.customerCode != "") {
let obj = {
customerCode: this.formData.customerCode
}
listCustomer(obj).then(async res => {
if (res.rows.length != 0) {
this.formIn.allowDealPlace = res.rows[0].country,
this.formIn.customerId = res.rows[0].id
} else {
this.$modal.msg("未检索到该客户!");
}
});
} else {
this.$modal.msg("请输入客户编码!")
}
},
submit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定出库该物料吗?',
success: function(res) {
if (res.confirm) {
// let data = {
// saleOutTaskCode: _this.formData.saleOutTaskCode,
// warehouseCode: _this.formData.warehouseCode,
// customerCode: _this.formData.customerCode,
// wmsSaleOutDetailList: _this.formData.wmsSaleOutDetailList
// }
_this.formData.wmsSaleOutDetailList.map(item => {
item.secondNumber = item.number;
item.secondUnitId = item.unitId;
return item
})
console.log(_this.formData)
if (!_this.checkStorageLocationBarcode) {
_this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
_this.$modal.loading('提交中')
addOut(_this.formData).then(async res => {
_this.$modal.msgSuccess("出库成功!");
_this.$modal.closeLoading();
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
.divider {
display: flex;
align-items: center;
justify-content: center;
margin-top: 10px;
margin-bottom: 10px;
height: 1px;
background-color: #F1F1F1;
}
.divider span {
padding: 5px;
}
</style>

580
pages/wms/sale/salePick.vue Normal file
View File

@@ -0,0 +1,580 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="销售出库任务单" :labelWidth='90' name="saleOutTaskCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.saleOutTaskCode"
@confirm="scanBarCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="销售拣货单" :labelWidth='90' name="pickCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar4" @confirm="scanBarCode"
v-model="formData.pickCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="物料编码" :labelWidth='90' name="materialCode">
<uni-easyinput disabled v-model="formData.materialCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="物料名称" :labelWidth='90' name="materialName">
<uni-easyinput type="text" v-model="formData.materialName" disabled />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="物料批号" :labelWidth='90' name="materialBatchNo">
<uni-easyinput disabled type="text" v-model="formData.materialBatchNo" />
</uni-forms-item>
</uni-col>
<!-- <uni-col :span="24">
<uni-forms-item label="仓库编码" :labelWidth='90' name="storageLocationCode">
<uni-easyinput disabled type="text" v-model="formData.storageLocationCode" />
</uni-forms-item>
</uni-col> -->
<uni-col :span="12">
<uni-forms-item label="原有数量" :labelWidth='90' name="originNumber">
<uni-easyinput disabled type="number" v-model="formData.originNumber" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="拣货数量" :labelWidth='90' name="pickNumber">
<uni-easyinput disabled type="number" v-model="formData.pickNumber" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="现有数量" :labelWidth='90' name="xyNum">
<uni-easyinput disabled type="number" v-model="formData.xyNum" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="拣货区" :labelWidth='90' :name="pickerData" :rules="[{'required': true,
errorMessage: '请输入拣货区!'}]">
<uni-data-picker popup-title="请选择所在货区" :localdata="dataTree" v-model="pickerData"
@change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened"
@popupclosed="onpopupclosed">
</uni-data-picker>
<!-- <uni-easyinput type="text" v-model="formData.pickArea" /> -->
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="拣货时间" :labelWidth='90' name="updateTime">
<!-- <view class="uni-list-cell-db">
<picker style="padding-top: 10px;" mode="date" :value="formData.jhDate" :start="startDate" :end="endDate" @change="bindDateChange">
<view class="uni-input" v-model="formData.jhDate">{{formData.jhDate}}</view>
</picker>
</view> -->
<view class="example-body">
<uni-datetime-picker type="datetime" v-model="formData.updateTime" />
</view>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
var arry;
import {
addPick,
getTask,
listTask,
updatePick,
listPick
} from "@/api/wms/sale.js";
import {
listArea
} from "@/api/wms/area.js";
import {
listLocation
} from "@/api/wms/location.js";
import {
listShelves
} from "@/api/wms/shelves.js";
import {
listWarehouse
} from "@/api/wms/warehouse.js";
import {
listMaterial
} from "@/api/wms/request.js";
export default {
onLoad: function(option) {
// 获取当前时间
var currentDate = new Date();
// 格式化为字符串YYYY-MM-DD HH:mm:ss
var year = currentDate.getFullYear();
var month = ("0" + (currentDate.getMonth() + 1)).slice(-2);
var day = ("0" + currentDate.getDate()).slice(-2);
var hours = ("0" + currentDate.getHours()).slice(-2);
var minutes = ("0" + currentDate.getMinutes()).slice(-2);
var seconds = ("0" + currentDate.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
// 将当前时间赋值给 formData.updateTime
this.formData.updateTime = formattedDate;
},
data() {
return {
dataTree2: [],
item: '',
dataTree: [],
pickerData: '',
formData: {
saleOutTaskCode: null,
updateTime: null,
pickCode: null,
materialCode: null,
materialName: null,
materialBatchNo: null,
originNumber: null,
pickNumber: null,
// pickerData: '',
//计算现有数量
xyNum: null,
whCode: null,
areaCode: null,
shelvesCode: null,
storageLocationCode: null,
// status: '2',
},
rules: {
saleOutTaskCode: {
rules: [{
required: true,
errorMessage: '请输入销售出库任务单!'
}]
},
pickCode: {
rules: [{
required: true,
errorMessage: '请输入销售拣货单!'
}]
},
}
}
},
computed: {
// startDate() {
// return this.getDate('start');
// },
// endDate() {
// return this.getDate('end');
// }
},
methods: {
getPickArea() {
let data = new Array();
listWarehouse().then((response) => {
let obj = response.rows.map(({
warehouseName,
warehouseCode,
id
}) => ({
warehouseName,
warehouseCode,
id
}));
for (var i = 0; i < obj.length; i++) {
this.dataTree.push({
text: obj[i].warehouseName,
value: obj[i].warehouseCode + '/' + obj[i].warehouseName + '/' + obj[i].id,
});
}
listArea().then((response) => {
let aobj = response.rows.map(
({
storageAreaName,
storageAreaCode,
id,
warehouseCode
}) => ({
storageAreaName,
storageAreaCode,
id,
warehouseCode
})
);
for (var i = 0; i < aobj.length; i++) {
const atemp = this.dataTree.find(
(item) => item.value.split('/')[0] == aobj[i].warehouseCode
);
if (atemp) {
if (!atemp.children) {
atemp.children = [];
}
atemp.children.push({
text: aobj[i].storageAreaName,
// value: aobj[i].storageAreaCode,
value: aobj[i].storageAreaCode + '/' + aobj[i]
.storageAreaName + '/' + aobj[i].id + '/' + aobj[i]
.warehouseCode,
});
}
}
listShelves().then((response) => {
let sobj = response.rows.map(
({
storageShelvesCode,
storageShelvesName,
id,
storageAreaCode,
warehouseCode
}) => ({
storageShelvesCode,
storageShelvesName,
id,
storageAreaCode,
warehouseCode
})
);
const stemp = this.dataTree.filter((item) => item.children);
for (var i = 0; i < sobj.length; i++) {
for (var j = 0; j < stemp.length; j++) {
const temp = stemp[j].children.find(
(item) => item.value.split('/')[0] == sobj[i]
.storageAreaCode
);
if (temp) {
if (!temp.children) {
temp.children = [];
}
temp.children.push({
text: sobj[i].storageShelvesName,
// value: sobj[i].storageShelvesCode,
value: sobj[i].storageShelvesCode + '/' +
sobj[
i].storageShelvesName + '/' + sobj[
i]
.id + '/' + sobj[i].storageAreaCode +
'/' +
sobj[i].warehouseCode,
});
}
}
}
listLocation().then((response) => {
let lobj = response.rows.map(({
storageLocationCode,
storageLocationName,
id,
storageShelvesCode,
storageAreaCode,
warehouseCode
}) => ({
storageLocationCode,
storageLocationName,
id,
storageShelvesCode,
storageAreaCode,
warehouseCode
}));
const lItem = this.dataTree.filter(
(parentItem) =>
parentItem.children &&
parentItem.children.find((childItem) =>
childItem
.children)
);
for (var i = 0; i < lobj.length; i++) {
for (var j = 0; j < lItem.length; j++) {
for (var k = 0; k < lItem[j].children
.length; k++) {
if (lItem[j].children[k].children) {
const temp = lItem[j].children[k]
.children
.find(
(item) => item.value.split(
'/')[
0] == lobj[i]
.storageShelvesCode
);
if (temp) {
if (!temp.children) {
temp.children = [];
}
temp.children.push({
text: lobj[i]
.storageLocationName,
// value: lobj[i]
// .storageLocationCode,
value: lobj[i]
.storageLocationCode +
'/' + lobj[i]
.storageLocationName +
'/' + lobj[i].id +
'/' + lobj[i]
.storageShelvesCode +
'/' + lobj[i]
.storageAreaCode +
'/' + lobj[i]
.warehouseCode,
});
}
}
}
}
}
this.dataTree = JSON.parse(JSON.stringify(this
.dataTree))
//状态为拣货完成时,默认为原来的仓库,否则默认拣货仓
if (this.formData.status != '2') {
//默认进入拣货仓
// if (!this.formData.whCode) {
if (this.dataTree.find(item => item.text ==
'拣货仓')) {
let data = this.dataTree.find(item => item
.text == '拣货仓')
this.item = data
this.pickerData = this.item.value;
if (!this.item) return
this.onchange(this.item)
this.onpopupclosed();
}
// }
} else {
this.getDataPicker(this.formData.whCode, this
.formData
.areaCode, this.formData
.shelvesCode, this.formData
.storageLocationCode
)
}
});
});
});
});
},
getAreaCode() {
console.log(this.dataTree);
},
test() {},
onnodeclick(e) {
console.log(e);
this.item = e
},
onpopupopened(e) {
console.log('popupopened');
},
onpopupclosed() {
//处理不同步
this.$nextTick(() => {
this.pickerData = this.item.value;
// this.formData.pickerData = this.item.value;
if (!this.item) return
this.onchange(this.item)
});
},
onpopupclosed2() {
this.pickerData = this.item.value;
if (!this.item) return
this.onchange(this.item)
},
onchange(e) {
console.log(e)
let array = e.value.split('/');
switch (array.length) {
case 3:
this.formData.storageLocationCode = null;
this.formData.shelvesCode = null;
this.formData.areaCode = null;
this.formData.whCode = array[0];
break;
case 4:
this.formData.storageLocationCode = null;
this.formData.shelvesCode = null;
this.formData.areaCode = array[0];
this.formData.whCode = array[3];
break;
case 5:
this.formData.storageLocationCode = null;
this.formData.shelvesCode = array[0];
this.formData.areaCode = array[3];
this.formData.whCode = array[4];
break;
case 6:
this.formData.storageLocationCode = array[0];
this.formData.shelvesCode = array[3];
this.formData.areaCode = array[4];
this.formData.whCode = array[5];
break;
default:
break;
}
console.log('onchange:', e, this.formData);
},
//如果已填写拣货仓,则回显到级联选择器上
getDataPicker(wh, area, shelve, stoLot) {
if (wh) {
if (area) {
if (shelve) {
if (stoLot) {
let data = this.dataTree.find(item => item.value.split('/')[0] == wh)
if (data) {
let areadata = data.children.find(item => item.value.split('/')[0] == area)
if (areadata) {
let shelvedata = areadata.children.find(item => item.value.split('/')[0] ==
shelve)
if (shelvedata) {
let stoLotdata = shelvedata.children.find(item => item.value.split('/')[
0] == stoLot)
if (stoLotdata) {
this.item = stoLotdata;
this.onpopupclosed2();
}
}
}
}
} else {
//只有仓库,库区和货架
let data = this.dataTree.find(item => item.value.split('/')[0] == wh)
if (data) {
let areadata = data.children.find(item => item.value.split('/')[0] == area)
if (areadata) {
let shelvedata = areadata.children.find(item => item.value.split('/')[
0] ==
shelve)
if (shelvedata) {
this.item = shelvedata;
this.onpopupclosed2();
}
}
}
}
} else {
//只有仓库和库区
let data = this.dataTree.find(item => item.value.split('/')[0] == wh)
if (data) {
let areadata = data.children.find(item => item.value.split('/')[0] == area)
if (areadata) {
this.item = areadata;
this.onpopupclosed2();
}
}
}
} else {
//只有仓库
let data = this.dataTree.find(item => item.value.split('/')[0] == wh)
if (data) {
this.item = data;
this.onpopupclosed2();
}
}
}
},
bindDateChange(e) {
this.formData.updateTime = e.detail.value
},
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`;
},
scanBarCode() {
// if (this.formData.pickCode && this.formData.pickCode != "") {
let obj = {
saleOutTaskCode: this.formData.saleOutTaskCode,
pickCode: this.formData.pickCode
}
listPick(
obj
).then(async res => {
if (res.rows.length != 0) {
this.formData = res.rows[0];
this.formData.xyNum = res.rows[0].originNumber - res.rows[0]
.pickNumber;
await this.getPickArea();
} else {
this.$modal.msg("未检索到拣货信息!");
}
});
// } else {
// this.$modal.msg("请输入拣货单!");
// }
},
//任务单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.rwdCode = res.result;
_this.scanBarCode();
}
});
},
//拣货单
scanBar4() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.pickCode = res.result;
_this.scanBarCode();
}
});
},
submit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定拣货吗?',
success: function(res) {
if (res.confirm) {
console.log(_this.formData)
_this.formData.status = '2'
_this.$modal.loading('提交中')
updatePick(_this.formData).then(async res => {
_this.formData.inStatus = '2'
updatePick(_this.formData).then(
async res => {
_this.$modal.msgSuccess(
"拣货完成!");
_this.$modal.closeLoading();
setTimeout(() => {
_this.$tab
.switchTab(
"/pages/work/index"
);
}, 500);
});
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}).catch(err => {
console.log('err', err, this.pickerData);
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,365 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-collapse-item title="快速盘点单" :open="true">
<uni-forms-item label="物料编码" :labelWidth='90' name="materialCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.materialCode"
@confirm="scanBarMaterialCode" type="text" v-if="key=='1'" />
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.materialCode"
@confirm="scanBarMaterialCodePre" type="text" v-if="key=='2'" />
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90' name="materialName">
<uni-easyinput v-model="formData.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="批号" :labelWidth='90' name="batchNo" v-if="key=='1'">
<uni-easyinput v-model="formData.batchNo" type="text" />
</uni-forms-item>
<uni-forms-item label="库位条码" :labelWidth='90' name="storageLocationBarcode" v-if="key=='1'">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode"
@confirm="splitStlBarcode" type="text" v-model="formData.storageLocationBarcode" />
</uni-forms-item>
<button @click="key=='1'?queryStockInfo():queryStockTotalInfo()" type="primary"
style="text-align: center;font-size: 18px;width: 50%;">查询</button>
</uni-collapse-item>
<uni-collapse-item title="快速盘点单明细" :open="true">
<uni-swipe-action>
<uni-swipe-action-item v-for="(item, index) in quickInvStockList" :key="index"
:rightOptions="rightOptions" @click="(data) => clickDetail(index,data)">
<uni-badge :text="index+1" type="primary"></uni-badge>
<uni-forms-item label="批号" :labelWidth='90' v-if="key=='2'" style="margin-bottom: 0;">
{{item.batchNo}}
</uni-forms-item>
<uni-forms-item label="新批号" :labelWidth='90' style="margin-bottom: 0;">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode" type="text"
v-model="item.newBatchNo" />
</uni-forms-item>
<uni-forms-item label="部门编码" :labelWidth='90' style="margin-bottom: 0;">
{{item.deptCode}}
</uni-forms-item>
<uni-forms-item label="物料规格" :labelWidth='90' style="margin-bottom: 0;">
{{item.specification}}
</uni-forms-item>
<uni-forms-item label="物料类型" :labelWidth='90' style="margin-bottom: 0;">
<uni-tag :text="item.typeText" type="primary"></uni-tag>
</uni-forms-item>
<uni-forms-item label="理论数量" :labelWidth='90' style="margin-bottom: 0;">
{{item.theoryNumber}}
</uni-forms-item>
<uni-forms-item label="锁定数量" :labelWidth='90' style="margin-bottom: 0;">
{{item.lockNumber}}
</uni-forms-item>
<uni-forms-item label="实际数量" :labelWidth='90' style="margin-bottom: 0;">
<uni-easyinput type="text" v-model="item.actualNumber" />
</uni-forms-item>
<uni-forms-item label="四级库位" :labelWidth='90' v-if="key=='2'" style="margin-bottom: 0;">
{{item.connectLocation}}
</uni-forms-item>
<uni-forms-item label="新库位条码" :labelWidth='90' name="newstorageLocationBarcode"
style="margin-bottom: 0;">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarnewstorageLocationBarcode(index)"
@change="newsplitStlBarcode(index)" type="text"
v-model="item.newstorageLocationBarcode" />
</uni-forms-item>
<uni-forms-item label="单位" :labelWidth='90' style="margin-bottom: 0;">
{{item.unitId}}
</uni-forms-item>
<uni-forms-item label="备注" :labelWidth='90' style="margin-bottom: 0;">
<uni-easyinput type="text" v-model="item.remark" />
</uni-forms-item>
</uni-swipe-action-item>
</uni-swipe-action>
<button @click="handleAddPreInvStock" size="mini" type="primary" plain="true"
style="text-align: center;font-size: 18px;width: 50%;margin-bottom: 10px;display: block;margin-top: 10px;"
v-if="key=='2'">添加</button>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listInvQuick,
advListInvQuick,
getInvQuick,
delInvQuick,
addInvQuick,
updateInvQuick,
listQuickInvStockInfo,
invQuickUpdateStock,
preInvUpdateStock,
listPreInvStockInfo
} from "@/api/wms/invQuick";
import {
listMaterial
} from "@/api/mes/material.js";
import {
getDicts
} from "@/api/system/dict/dictData.js";
export default {
onLoad: function(option) {
getDicts("material_stock_type").then(res => {
this.typeOptions = res.data.map(dict => {
return {
text: dict.dictLabel,
value: dict.dictValue,
diasble: false
}
});
})
//赋值盘点类型
this.key = option.key
},
mounted() {},
data() {
return {
//盘点类型
key: null,
typeOptions: [],
formData: {
storageLocationBarcode: null,
materialCode: null,
materialName: null,
batchNo: null,
},
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
quickInvStockList: [],
rules: {
materialCode: {
rules: [{
required: true,
errorMessage: '请输入物料编码!'
}]
},
materialName: {
rules: [{
required: true,
errorMessage: '请输入物料名称!'
}]
},
}
}
},
methods: {
deleteDetail(index) {
this.quickInvStockList.splice(index, 1);
},
clickDetail(itemIndex, {
position,
index
}) {
if (index == 0) {
this.deleteDetail(itemIndex);
}
},
newsplitStlBarcode(i) {
this.quickInvStockList[i].whCode = null;
this.quickInvStockList[i].areaCode = null;
this.quickInvStockList[i].shelvesCode = null;
this.quickInvStockList[i].storageLocationCode = null;
let array = this.quickInvStockList[i].newstorageLocationBarcode.split('-');
console.log(array);
this.quickInvStockList[i].newWhCode = array.length > 0 ? array[0] : null;
this.quickInvStockList[i].newAreaCode = array.length > 1 ? array[1] : null;
this.quickInvStockList[i].newShelvesCode = array.length > 2 ? array[2] : null;
this.quickInvStockList[i].newStorageLocationCode = array.length > 3 ? array[3] : null;
if (array.length > 4) this.quickInvStockList[i].newStorageLocationCode = array[3] + '-' + array[4];
},
scanBarnewstorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.quickInvStockList[i], "newstorageLocationBarcode", res
.result);
// _this.wmsLotNoList[i].storageLocationBarcode = res.result;
_this.newsplitStlBarcode(i);
}
});
},
splitStlBarcode(e) {
this.formData.whCode = null;
this.formData.areaCode = null;
this.formData.shelvesCode = null;
this.formData.storageLocationCode = null;
let array = e.split('-');
switch (array.length) {
case 1:
this.formData.whCode = array[0];
this.queryStockInfo();
break;
case 2:
this.formData.whCode = array[0];
this.formData.areaCode = array[1];
this.queryStockInfo();
break;
case 3:
this.formData.whCode = array[0];
this.formData.areaCode = array[1];
this.formData.shelvesCode = array[2];
this.queryStockInfo();
break;
case 4:
this.formData.whCode = array[0];
this.formData.areaCode = array[1];
this.formData.shelvesCode = array[2];
this.formData.storageLocationCode = array[3];
this.queryStockInfo();
break;
case 5:
this.formData.whCode = array[0];
this.formData.areaCode = array[1];
this.formData.shelvesCode = array[2];
this.formData.storageLocationCode = array[3] + '-' + array[4];
this.queryStockInfo();
break;
}
},
scanBarstorageLocationBarcode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.formData, "storageLocationBarcode", res
.result);
_this.splitStlBarcode(res.result);
}
});
},
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.formData, "materialCode", res
.result);
_this.scanBarMaterialCode(res.result);
}
});
},
scanBarMaterialCode(code) {
listMaterial({
materialCode: code
}).then(res => {
console.log(res)
if (res.total > 0) {
console.log(res)
this.formData.materialName = res.rows[0].materialName
}
})
},
scanBarMaterialCodePre(code) {
console.log(1)
listMaterial({
materialCode: code
}).then(res => {
console.log(res)
if (res.total > 0) {
console.log(res)
this.formData.materialName = res.rows[0].materialName
this.queryStockTotalInfo();
} else {
this.formData.materialCode = null;
this.$modal.msg("未查询到该物料,请重新输入!");
}
})
},
queryStockInfo() {
listQuickInvStockInfo(this.formData).then(response => {
this.quickInvStockList = response.data.map(item => {
if (item.type) item.typeText = this.typeOptions.find(tp => tp.value == item.type)
.text
return item
});
console.log(response.data, this.quickInvStockList);
})
},
queryStockTotalInfo() {
listPreInvStockInfo(this.formData).then(response => {
this.quickInvStockList = response.data.map(item => {
if (item.type) item.typeText = this.typeOptions.find(tp => tp.value == item.type)
.text
return item
});
})
},
handleAddPreInvStock() {
let obj = {}
if (this.quickInvStockList.length > 0) {
obj = {
...this.quickInvStockList[0]
};
} else {
obj = this.formData;
}
/**新增库存的标志*/
obj.newStock = 1;
//目前仅支持合格品
obj.type = 1;
obj.batchNo = null;
obj.newBatchNo = null;
obj.theoryNumber = 0;
obj.lockNumber = 0;
obj.actualNumber = 0;
obj.whCode = null;
obj.areaCode = null;
obj.shelvesCode = null;
obj.storageLocationCode = null;
obj.connectLocation = null;
obj.newWhCode = null;
obj.newAreaCode = null;
obj.newShelvesCode = null;
obj.newStorageLocationCode = null;
obj.remark = null;
this.quickInvStockList.push(obj);
},
submit() {
const _this = this;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定盘点该物料吗?',
success: function(res) {
if (res.confirm) {
const quickInvStockList = _this.quickInvStockList;
// console.log(quickInvStockList)
if (_this.key == '1') {
invQuickUpdateStock(quickInvStockList).then(() => {
_this.$modal.msgSuccess("盘点成功!");
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
}).catch(() => {});
} else if (_this.key == '2') {
preInvUpdateStock(quickInvStockList).then(() => {
_this.$modal.msgSuccess("盘点成功!");
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
}).catch(() => {});
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,553 @@
<template>
<view class="container">
<uni-forms :modelValue="formData" :label-width="60" label-align="right" class="form">
<uni-forms-item label="发起人">
<uni-easyinput v-model="formData.transferBy" placeholder="请输入发起人" />
</uni-forms-item>
<uni-forms-item label="运输员">
<uni-easyinput v-model="formData.transportBy" placeholder="请输入运输员" />
</uni-forms-item>
<uni-forms-item label="原库位">
<uni-easyinput v-model="formData.currentLocationCode" placeholder="请输入原库位条码" suffixIcon="scan"
@iconClick="scanCurrentLocationCode" @change="fetchLocationDetail" />
</uni-forms-item>
</uni-forms>
<uni-section class="section" title="库位库存明细" type="line">
<template #right>
<span v-if="materialList.length > 0">
库位
<strong style="margin: 0 2px">{{ materialList[0].storageLocationCode }}</strong>
,
<strong style="margin: 0 2px">{{ materialList.length }}</strong>
<!-- <checkbox @click="handleSelectAll" /> -->
</span>
</template>
<scroll-view scroll-y>
<checkbox-group @change="handleSelectRows">
<uni-card v-for="(item, index) in materialList" :key="index">
<template #title>
<view class="header">
<view class="matInfo">
<uni-tag :text="String(index + 1)" />
<text class="matName">
{{ item.materialName }}
</text>
</view>
<checkbox :value="String(index)" :checked="item.checked" @click="handleSelectItem(index)"
class="check-dot" />
</view>
</template>
<view class="card-list">
<view class="card-item">
<span class="card-item__label">物料编码</span>
<span class="card-item__value">{{ item.materialCode || '/' }}</span>
</view>
<view class="card-item">
<span class="card-item__label">批号</span>
<span class="card-item__value">{{ item.batchNo || '/' }}</span>
</view>
<view class="card-item">
<span class="card-item__label">箱号</span>
<span class="card-item__value">{{ item.lotNo || '/' }}</span>
</view>
<!-- <view class="card-item">
<span class="card-item__label">库位编码</span>
<span class="card-item__value">{{ item.storageLocationCode }}</span>
</view> -->
<view class="card-item">
<span class="card-item__label">入库时间</span>
<span class="card-item__value">{{ item.storageInTime || '/' }}</span>
</view>
</view>
<view class="card-data">
<view class="card-data-item">
<span class="card-data-item__label">库存总数</span>
<span class="card-data-item__value">{{ item.number || '/' }}</span>
</view>
<view class="card-data-item">
<span class="card-data-item__label">锁定数量</span>
<span class="card-data-item__value lock">{{ item.lockNumber || '/' }}</span>
</view>
<view class="card-data-item">
<span class="card-data-item__label">可用数量</span>
<span class="card-data-item__value avalible">{{ item.availableNumber || '/' }}</span>
</view>
</view>
<template #actions>
<u-transition :show="item.checked" mode="fade" duration="200">
<view class="card-actions">
<uni-forms-item label="目标库位" :labelWidth="80" name="targetLocation">
<uni-easyinput suffixIcon="scan" @iconClick="scanTargetLocationCode(index)"
@change="validateLocationCode(index)" type="text" v-model="item.targetLocation" />
</uni-forms-item>
<uni-forms-item label="转移数量" :labelWidth="80" name="actualNumber" style="margin-top: 10px">
<u-number-box button-size="36" inputWidth="100%" v-model="item.actualNumber" min="0"
:max="item.availableNumber"></u-number-box>
</uni-forms-item>
</view>
</u-transition>
</template>
</uni-card>
</checkbox-group>
</scroll-view>
</uni-section>
<u-modal v-if="showMultiFillModal" :show="showMultiFillModal" title="扫描库位编码" showCancelButton closeOnClickOverlay
@cancel="cancelMultiFill" @close="cancelMultiFill" :showConfirmButton="false">
<uni-easyinput suffixIcon="scan" @iconClick="scanMultiFill" v-model="multiTargetLocation"
@confirm="handleMultiFill" :focus="true" />
</u-modal>
<view class="btns">
<u-button @click="showMultiFill" class="sub-btn">批量移库</u-button>
<u-button type="primary" @click="submit" class="pri-btn">提交</u-button>
</view>
</view>
</template>
<script>
import { listStock, addTransfer } from '@/api/wms/stock.js';
import { listLocation } from '@/api/basic/location';
import { getConfigKey } from '@/api/system/config.js';
export default {
mounted() {
// 获取参数: 是否使用 货架-库位 查出完整库位
getConfigKey('wms.location.queryOption').then((res) => {
this.isShortLocation = Boolean(+res.msg);
});
},
data() {
return {
// 是否为短库位格式(货架-库位)
isShortLocation: false,
selectedRows: [],
showMultiFillModal: false,
multiTargetLocation: null,
formData: {
transferBy: null,
transportBy: null,
currentLocationCode: null,
currentWholeLocationCode: null
},
materialList: []
};
},
methods: {
// 原库位扫描事件
async scanCurrentLocationCode() {
this.$modal.scanCode(async (res) => {
if (!res.result) return;
this.$set(this.formData, 'currentLocationCode', res.result);
if (this.isShortLocation) {
this.formData.currentWholeLocationCode = await this.fetchWholeLocationCode(res.result);
} else {
this.formData.currentWholeLocationCode = this.formData.currentLocationCode;
}
});
},
// 原库位 change 事件,查询库存明细
async fetchLocationDetail(code) {
if (!code) return;
if (this.isShortLocation) {
this.formData.currentWholeLocationCode = await this.fetchWholeLocationCode(code);
} else {
this.formData.currentWholeLocationCode = this.formData.currentLocationCode;
}
this.fetchMaterialList();
},
// 目标库位扫描事件
async scanTargetLocationCode() {
this.$modal.scanCode(async (response) => {
if (!response.result) return;
let res;
if (this.isShortLocation) {
res = await this.fetchWholeLocationCode(response.result);
} else {
res = response.result;
}
if (res === this.formData.currentWholeLocationCode) {
this.$modal.msgError(`${i + 1} 条明细:原库位与目标库位相同`);
return;
}
if (res.split('-')[0] !== this.formData.currentWholeLocationCode.split('-')[0]) {
this.$modal.msgError(`${i + 1} 条明细:目标仓库与原仓库不一致`);
return;
}
this.materialList[i].targetLocation = response.result;
this.materialList[i].storageLocationBarcode = res;
});
},
// 目标库位 change 事件,校验库位是否合法
async validateLocationCode(i) {
if (!this.materialList[i].targetLocation) return;
let res;
if (this.isShortLocation) {
res = await this.fetchWholeLocationCode(this.materialList[i].targetLocation);
} else {
res = this.materialList[i].targetLocation;
}
if (res === this.formData.currentLocationCode) {
this.$modal.msgError(`${i + 1} 条明细:原库位与目标库位相同`);
this.materialList[i].targetLocation = null;
return;
}
if (res.split('-')[0] !== this.formData.currentWholeLocationCode.split('-')[0]) {
this.$modal.msgError(`${i + 1} 条明细:目标仓库与原仓库不一致`);
this.materialList[i].targetLocation = null;
return;
}
this.materialList[i].storageLocationBarcode = res;
},
// 获取完整库位
async fetchWholeLocationCode(shortLocationCode) {
if (!shortLocationCode) return null;
try {
this.$modal.loading('获取完整库位中...');
const storageShelvesCode = shortLocationCode.split('-')[0];
const storageLocationCode = shortLocationCode.split('-').slice(1).join('-');
if (!storageShelvesCode || !storageLocationCode) {
throw new Error(`库位编码格式不正确: ${shortLocationCode}`);
}
const res = await listLocation({
storageShelvesCode,
storageLocationCode
});
if (!res.total > 0) {
throw new Error(`未查询到 ${shortLocationCode} 的完整库位`);
} else if (res.total > 1) {
throw new Error(`查询到 ${shortLocationCode} 的完整库位有多个`);
}
return res.rows[0].storageLocationBarcode;
} catch (err) {
this.$modal.alert(err.message);
return null;
} finally {
this.$modal.closeLoading();
}
},
// 获取库存明细列表
async fetchMaterialList() {
this.$modal.loading('获取库存明细中...');
await listStock({
storageLocationCode: this.formData.currentLocationCode.split('-').slice(1).join('-'),
storageLocationBarcode: this.formData.currentWholeLocationCode
})
.then((res) => {
res.rows.forEach((item) => {
item.availableNumber = item.number - item.lockNumber;
});
this.materialList = res.rows;
})
.catch((err) => {
this.$modal.msgError(`查询明细失败\n${err}`);
});
this.$modal.closeLoading();
},
// 选中列表中某一项
handleSelectItem(i) {
this.$set(this.materialList[i], 'checked', !this.materialList[i].checked);
},
// 选中回调
handleSelectRows(e) {
this.selectedRows = e.target.value;
// for (let i = 0; i < this.materialList.length; i++) {
// this.$set(this.materialList[i], 'checked', Boolean(e.target.value.includes(String(i))));
// }
},
// 拆解库位
splitLocationCode(code) {
const parts = (code || '').split('-');
const whCode = parts[0] || null;
const areaCode = parts[1] || null;
const shelvesCode = parts[2] || null;
const storageLocationCode = parts.slice(3).join('-') || null;
return {
whCode,
areaCode,
shelvesCode,
storageLocationCode
};
},
// 批量填充扫码事件
scanMultiFill() {
this.$modal.scanCode(async (response) => {
let res;
if (this.isShortLocation) {
res = await this.fetchWholeLocationCode(response.result);
} else {
res = response.result;
}
if (res === this.formData.currentLocationCode) {
this.$modal.msgError(`${i + 1} 条明细:原库位与目标库位相同`);
return;
}
if (res.split('-')[0] !== this.formData.currentWholeLocationCode.split('-')[0]) {
this.$modal.msgError(`${i + 1} 条明细:目标仓库与原仓库不一致`);
return;
}
this.handleMultiFill(res);
});
},
// 批量填充选中项的目标库位
async handleMultiFill(code) {
console.log(code);
this.materialList.forEach(async (item) => {
if (item.checked) {
item.storageLocationBarcode = await this.fetchWholeLocationCode(code);
item.targetLocation = code;
}
});
this.showMultiFillModal = false;
},
// 打开批量填充
showMultiFill() {
if (!this.selectedRows.length > 0) {
this.$modal.msgError('请先选择明细');
return;
}
this.showMultiFillModal = true;
},
// 取消标签
cancelMultiFill() {
this.showMultiFillModal = false;
},
// 运输员
scanBarTransportBy() {
this.$modal.scanCode((res) => {
this.formData.transportBy = res.result;
});
},
// 发起人
scanBarTransferBy() {
this.$modal.scanCode((res) => {
this.formData.transferBy = res.result;
});
},
// 生成转移单明细
renderTransferData() {
const transferArr = [];
this.materialList.forEach((item) => {
if (item.checked) {
const { areaCode: targetAreaCode, shelvesCode: targetShelves, storageLocationCode: targetLocation } = this
.splitLocationCode(item.storageLocationBarcode);
const params = {
wmsMaterialStockId: item.id,
materialBatchNo: item.batchNo,
materialCode: item.materialCode,
materialName: item.materialName,
materialLotNo: item.lotNo,
originAreaCode: item.areaCode,
originShelvesCode: item.shelvesCode,
originLocationCode: item.storageLocationCode,
targetAreaCode,
targetShelves,
targetLocation,
availableNumber: item.availableNumber,
actualNumber: item.actualNumber,
specification1: item.specification,
texture: item.texture,
schemeNumber: null,
delStatus: null,
numUnitId: null,
remark: null
};
transferArr.push(params);
}
});
return transferArr;
},
submit() {
const _this = this;
this.materialList
.filter((item) => item.checked)
.forEach((item) => {
if (!item.id) {
console.log(item);
this.$modal.msg('存在未选择库存的明细!');
return;
} else if (item.actualNumber == null) {
this.$modal.msg('实际数量不能为空!');
return;
} else if (item.targetLocation == null) {
this.$modal.msg('目标库区不能为空!');
return;
}
});
uni.showModal({
title: '提示',
content: '您确定转移这些物料吗?',
success: function(res) {
if (res.confirm) {
const wmsStockTransferDetailList = _this.renderTransferData();
_this.$modal.loading('提交中...');
addTransfer({
warehouse: _this.formData.currentWholeLocationCode.split('-')[0],
//跳过审批流
transferStatus: '4',
transferBy: _this.formData.transferBy,
transportBy: _this.formData.transportBy,
delStatus: '0',
wmsStockTransferDetailList
}).then((res) => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess('转移成功!');
setTimeout(() => {
_this.$tab.switchTab('/pages/work/index');
}, 500);
}).catch((err) => {
_this.$modal.alert('提交失败', err);
});
}
}
});
}
}
};
</script>
<style scoped lang="scss">
.container {
/* #ifdef H5 */
height: calc(100vh - 44px);
/* #endif */
/* #ifndef H5 */
height: 100vh;
/* #endif */
padding: 10px;
display: flex;
flex-direction: column;
.section {
flex: 1;
background: transparent;
overflow: hidden;
display: flex;
flex-direction: column;
::v-deep .uni-section-content {
flex: 1;
overflow: scroll;
}
}
.uni-card {
margin: 0 0 10px !important;
padding: 0 !important;
box-shadow: none !important;
border-radius: 11px;
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px;
border-bottom: 1px solid #d9d9d9;
.matInfo {
display: flex;
align-items: center;
.matName {
font-size: 16px;
font-weight: bold;
}
.uni-tag {
box-sizing: border-box;
height: 100%;
text-align: center;
margin-right: 8px;
aspect-ratio: 1;
}
}
.check-dot {
border-radius: 50%;
}
}
.card-list {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 4px;
.card-item {
display: flex;
flex-direction: column;
align-items: flex-start;
.card-item__label {
font-size: 13px;
}
.card-item__value {
font-weight: bold;
font-size: 15px;
color: #333;
}
}
}
.card-data {
display: flex;
margin-top: 10px;
background-color: #f1f1f1;
border-radius: 4px;
padding: 6px 0;
.card-data-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.card-data-item__label {
font-size: 13px;
}
.card-data-item__value {
font-weight: bold;
font-size: 15px;
color: #333;
&.lock {
color: #ef4444;
}
&.avalible {
color: #059669;
}
}
}
}
.card-actions {
padding: 8px;
border-top: 1px solid #d9d9d9;
.uni-forms-item {
margin-bottom: 0;
}
}
}
.btns {
display: flex;
justify-content: space-evenly;
align-items: center;
margin-top: 10px;
.sub-btn {
width: 47%;
}
.pri-btn {
width: 47%;
}
}
.u-popup {
position: absolute;
}
}
</style>

205
pages/wms/stock/search.vue Normal file
View File

@@ -0,0 +1,205 @@
<template>
<view>
<uni-collapse>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<!-- <uni-collapse-item title="库存查询" :open="true"> -->
<uni-forms-item label="物料编码" :labelWidth='90' name="materialCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.materialCode"
@confirm="scanBarMaterialCode" type="text" />
</uni-forms-item>
<uni-forms-item label="物料名称" :labelWidth='90' name="materialName">
<uni-easyinput v-model="formData.materialName"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="批号" :labelWidth='90' name="batchNo">
<uni-easyinput v-model="formData.batchNo" type="text" />
</uni-forms-item>
<uni-forms-item label="库位条码" :labelWidth='90' name="storageLocationBarcode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarstorageLocationBarcode"
@confirm="splitStlBarcode" type="text" v-model="formData.storageLocationBarcode" />
</uni-forms-item>
<button @click="queryStockInfo" form-type="submit" type="primary"
style="text-align: center;font-size: 18px;width: 50%;">查询</button>
<!-- </uni-collapse-item> -->
</uni-forms>
<uni-collapse-item title="库位库存明细" :open="true">
<view v-for="(item, index) in wmsMaterialDetailList" :key="index" :disabled="item.disabled"
class="item">
<text>物料编码{{ item.materialCode }}</text>
<text>批号{{ item.batchNo }}</text>
<text>箱号{{ item.lotNo }}</text>
<text>物料名称{{ item.materialName }}</text>
<text>拼接库位{{ item.connectBin }}</text>
<text>入库时间{{ item.storageInTime }}</text>
<text>库存总数{{ item.number }}</text>
<text>锁定数量{{ item.lockNumber }}</text>
<text>可用数量{{ item.MaterialAvailableNumber }}</text>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
</template>
<script>
import {
listStock,
listStockLike
} from "@/api/wms/stock";
import {
listMaterial
} from "@/api/mes/material.js";
export default {
data() {
return {
formData: {
storageLocationBarcode: null,
materialCode: null,
materialName: null,
batchNo: null,
},
wmsMaterialDetailList: [],
// rules: {
// materialCode: {
// rules: [{
// required: true,
// errorMessage: '请输入物料编码!'
// }]
// },
// materialName: {
// rules: [{
// required: true,
// errorMessage: '请输入物料名称!'
// }]
// },
// }
};
},
methods: {
// 【物料编码】的扫描按钮点击操作
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.formData, "materialCode", res.result);
_this.scanBarMaterialCode(res.result);
}
});
},
// 输入物料编码确认后的操作
scanBarMaterialCode(code) {
// 查出物料编码关联的物料名称
listMaterial({
materialCode: code
}).then(res => {
if (res.total > 0) {
this.formData.materialName = res.rows[0].materialName;
}
});
},
// 【库位条码】的扫描按钮点击操作
scanBarstorageLocationBarcode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.formData, "storageLocationBarcode", res.result);
_this.splitStlBarcode(res.result);
}
});
},
// 分割库位条码
splitStlBarcode(e) {
this.formData.whCode = null;
this.formData.areaCode = null;
this.formData.shelvesCode = null;
this.formData.storageLocationCode = null;
let array = e.split('-');
switch (array.length) {
case 1:
this.formData.whCode = array[0];
this.queryStockInfo();
break;
case 2:
this.formData.whCode = array[0];
this.formData.areaCode = array[1];
this.queryStockInfo();
break;
case 3:
this.formData.whCode = array[0];
this.formData.areaCode = array[1];
this.formData.shelvesCode = array[2];
this.queryStockInfo();
break;
case 4:
this.formData.whCode = array[0];
this.formData.areaCode = array[1];
this.formData.shelvesCode = array[2];
this.formData.storageLocationCode = array[3];
this.queryStockInfo();
break;
case 5:
this.formData.whCode = array[0];
this.formData.areaCode = array[1];
this.formData.shelvesCode = array[2];
this.formData.storageLocationCode = array[3] + '-' + array[4];
this.queryStockInfo();
break;
}
},
queryStockInfo() {
// 获取库位库存明细数据
listStockLike(this.formData).then(res => {
for (let obj of res.rows) {
obj.MaterialAvailableNumber = obj.number - obj.lockNumber;
}
this.wmsMaterialDetailList = res.rows;
}).catch(err => {
uni.showToast({
title: '请输入必填字段',
icon: 'none',
})
console.error('获取库存明细失败:', err);
});
// // 先验证表单不知道为什么uniapp里的验证功能没用查不出来自己写吧
// this.$refs.form.validate((res) => {
// // 自己写个验证逻辑
// let required = ['materialCode', 'materialName'];
// for (let field of required) {
// if (!this.formData[field]) {
// uni.showToast({
// title: '请输入必填字段',
// icon: 'none',
// })
// return;
// }
// }
// console.log('表单数据信息:', res);
// }).catch((error) => {
// console.error('表单验证失败:', error);
// });
},
},
onReady() {
this.$refs.form.setRules(this.rules);
},
}
</script>
<style>
.item {
margin-bottom: 10px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f7f7f7;
font-size: 14px;
}
.item text {
display: block;
margin: 5px 0;
}
</style>