init project

This commit is contained in:
tao
2025-11-17 10:01:33 +08:00
commit 77c123408d
1018 changed files with 136951 additions and 0 deletions

View File

@@ -0,0 +1,225 @@
<template>
<view>
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-row>
<uni-col :span="24">
<uni-forms-item label="盘点单" :labelWidth='90' name="wmsMatInvCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode"
v-model="formData.wmsMatInvCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="盘点单明细编码" :labelWidth='90' name="wmsInvDetailDefCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" @confirm="scanBarCode"
v-model="formData.wmsInvDetailDefCode" type="text" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="物料编码" :labelWidth='90' name="materialCode">
<uni-easyinput v-model="formData.materialCode" type="text" disabled />
</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="batchNo">
<uni-easyinput disabled type="text" v-model="formData.batchNo" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="仓库编码" :labelWidth='90' name="warehouseCode">
<uni-easyinput disabled type="text" v-model="formData.warehouseCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="库区编码" :labelWidth='90' name="storageAreaCode">
<uni-easyinput disabled type="text" v-model="formData.storageAreaCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="库位编码" :labelWidth='90' name="locCode">
<uni-easyinput disabled type="text" v-model="formData.locCode" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="账面数量" :labelWidth='90' name="paperNum">
<uni-easyinput disabled type="number" v-model="formData.paperNum" />
</uni-forms-item>
</uni-col>
<uni-col :span="24">
<uni-forms-item label="实盘数量" :labelWidth='90' name="firmNum">
<u-number-box inputWidth="120" button-size="36" v-model="formData.firmNum"
min="0"></u-number-box>
</uni-forms-item>
</uni-col>
</uni-row>
</uni-forms>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
getInv,
listInv,
listInvDetail,
getInvDetail,
updateInv
} from "@/api/wms/inventory.js";
import {
listMaterial
} from "@/api/wms/request.js";
export default {
mounted() {
this.test();
},
data() {
return {
formData: {
wmsMatInvCode: null,
wmsInvDetailDefCode: null,
materialCode: null,
materialName: null,
batchNo: null,
warehouseCode: null,
storageAreaCode: null,
locCode: null,
paperNum: null,
firmNum: null,
},
rules: {
wmsMatInvCode: {
rules: [{
required: true,
errorMessage: '请输入盘点单!'
}]
},
wmsInvDetailDefCode: {
rules: [{
required: true,
errorMessage: '请输入盘点单明细编码!'
}]
},
firmNum: {
rules: [{
required: true,
errorMessage: '请输入实盘数量!'
}]
}
}
}
},
methods: {
scanBarCode() {
if (this.formData.wmsMatInvCode && this.formData.wmsMatInvCode != "") {
if (this.formData.wmsInvDetailDefCode != "" && this.formData.wmsInvDetailDefCode) {
console.log(this.formData.wmsMatInvCode.length);
if (this.formData.wmsMatInvCode.length >= 8) {
let obj = this.formData.wmsMatInvCode.slice(4);
console.log(obj);
getInv(obj).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].firmNum);
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.warehouseCode = res.data.wmsMatInvDetailDefList[i]
.whCode;
this.formData.storageAreaCode = res.data.wmsMatInvDetailDefList[i]
.areaCode;
this.formData.locCode = res.data.wmsMatInvDetailDefList[i].locCode;
this.formData.paperNum = res.data.wmsMatInvDetailDefList[i]
.paperNum;
}
}
} else {
this.$modal.msg("未检索到该盘点信息!")
}
});
} else {
this.$modal.msg("请输入有效盘点单!")
}
} else {
this.$modal.msg("请输入盘点单明细编码!")
}
} else {
this.$modal.msg("请输入盘点单!")
}
},
//盘点单
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);
getInv(obj).then(async res => {
for (var i in res.data.wmsMatInvDetailDefList) {
if (res.data.wmsMatInvDetailDefList[i]
.wmsInvDetailDefCode == _this.formData
.wmsInvDetailDefCode) {
res.data.wmsMatInvDetailDefList[i].firmNum =
_this.formData.firmNum;
_this.$modal.loading('提交中')
updateInv(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>
</style>

View File

@@ -0,0 +1,548 @@
<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="库位条码" required :labelWidth='90'
name="'wmsBackInDetailList.'+ 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'>
<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 _ 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);
}
});
},
splitStlBarcode(i) {
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('-');
if (whCode) {
let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
if (!warehouseObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
}
if (areaCode) {
let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode ==
areaCode);
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.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 = '';
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;
}
});
},
/** 提交按钮 */
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) {
console.log(_this,"this");
if(!_this.formData.wmsBackInDetailList[0]["storageLocationCode"]){
_this.$modal.msg("库位无法识别或未输入")
return
}
_this.$modal.loading('提交中')
// _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
}
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,454 @@
<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)" 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
} 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);
},
splitStlBarcode(i) {
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('-');
if (whCode) {
let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
if (!warehouseObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
}
if (areaCode) {
let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode ==
areaCode);
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.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,485 @@
<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="productInTaskCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" @confirm="scanBarCode" v-model="formData.productInTaskCode" type="text" />
</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"
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 disabled 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="库位条码" required :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="'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"
v-else></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 {
addIn,
listTask,
getTask,
getReveive,
getDetails,
listReceiveDetail,
getDetail,
directProductInByTaskDetail
} from "@/api/wms/pdcIn.js";
import {
listDepartment
} from "@/api/basic/department";
import {
listEmployee
} from "@/api/mes/jobIn.js";
export default {
mounted() {
this.selectTypeList();
listDepartment().then((res) => {
this.dptList = res.rows
})
listEmployee().then((res) => {
this.empList = res.rows
})
},
data() {
return {
value: '正常',
show: false,
materialLabel: null,
workOrderCode: '',
productInTaskCodeList: [],
checkStorageLocationBarcode: true,
dptList: [],
empList: [],
item: '',
dataTree: [],
pickerData: '',
formData: {
billType: '2',
status: '3',
productInTaskCode: '',
shelfPutBy: null,
wmsProductInDetailList: [],
},
//类型
typeOptions: [{
value: 1,
label: "合格",
},
{
value: 2,
label: "不良",
},
{
value: 3,
label: "报废",
},
],
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
rules: {
productInTaskCode: {
rules: [{
required: true,
errorMessage: '请输入产品入库任务单!'
}]
},
shelfPutBy: {
rules: [{
required: true,
errorMessage: '请输入上架员编码!'
}]
}
}
}
},
methods: {
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
getDetail(data.id).then(res => {
console.log(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);
}
});
},
splitStlBarcode(i) {
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('-');
if (whCode) {
let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
if (!warehouseObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
}
if (areaCode) {
let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode ==
areaCode);
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.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.formData.wmsProductInDetailList[i].storageLocationBarcode = res.result;
_this.$set(_this.formData.wmsProductInDetailList[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.productInTaskCodeList = [];
if (this.workOrderCode) {
listTask({
workOrderCode: this.workOrderCode
}).then(async res => {
for (var i in res.rows) {
this.productInTaskCodeList.push(res.rows[i].productInTaskCode);
}
});
}
},
selectTypeList() {
listTask().then(async res => {
for (var i in res.rows) {
this.productInTaskCodeList.push(res.rows[i].productInTaskCode);
}
});
},
scanBarCode() {
if (this.formData.productInTaskCode) {
let obj = {
productInTaskCode: this.formData.productInTaskCode
}
listTask(obj).then(async res => {
getTask(res.rows[0].id).then(async res => {
if (res.data.wmsProductInTaskDetailList.length != 0) {
this.formData.wmsProductInDetailList = res.data
.wmsProductInTaskDetailList.map(item => {
item.id = null;
return item
})
} else {
this.formData.wmsProductInDetailList = [];
}
});
});
} 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: ['qrCode', 'barCode'],
success: function(res) {
_this.formData.shelfPutBy = res.result;
console.log(res.result)
}
});
},
submit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成直接入库吗?',
success: function(res) {
if (res.confirm) {
if(!_this.formData.wmsProductInDetailList[0]["storageLocationCode"]){
_this.$modal.msg("库位无法识别或未输入")
return
}
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
}
if (!_this.checkStorageLocationBarcode) {
_this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
_this.$modal.loading('提交中')
directProductInByTaskDetail(obj).then(async res => {
_this.$modal.closeLoading();
_this.$modal.msgSuccess("入库成功!");
_this.$tab.switchTab('/pages/work/index');
});
} else {
// if(!_this.formData.wmsProductInDetailList[0]["storageLocationCode"]){
// _this.$modal.msg("库码必填!")
// return
// }
if (_this.formData.productInTaskCode) {
// _this.formData.wmsProductInDetailList.map(item => {
// item.secondNumber = item.number;
// item.secondUnitId = item.unitId;
// return item
// })
if (!_this.checkStorageLocationBarcode) {
_this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
_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('用户点击取消');
}
}
});
});
}
}
}
</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-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,232 @@
<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-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,382 @@
<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)" 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
} 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 = [];
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);
},
splitStlBarcode(i) {
console.log(this.wmsLotNoList[i]);
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('-');
console.log(_this.$store.getters)
if (whCode) {
let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
if (!warehouseObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("仓库不存在!");
return;
}
if (areaCode) {
let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode ==
areaCode);
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.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);
}
});
},
//提交分批入库详情
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;
}
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,489 @@
<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
} 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: true,
errorMessage: '请输入领料员编码!'
}]
},
warehouseOutBy: {
rules: [{
required: true,
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;
}
});
},
submit() {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成直接出库吗?',
success: function(res) {
if (res.confirm) {
if (!_this.checkStorageLocationBarcode) {
_this.$modal.msg("库位条码校验错误,请重新输入!")
return;
}
_this.$modal.loading('提交中')
addOut(_this.formData).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,452 @@
<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>
<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">提交</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
} from "@/api/wms/pdcMaterial.js";
import {
listEmployee
} from "@/api/mes/jobIn.js";
import {
listDepartment
} from "@/api/basic/department";
export default {
mounted() {
this.selectTypeList();
listDepartment().then((res) => {
this.dptList = res.rows
})
listEmployee().then((res) => {
this.empList = res.rows
})
},
data() {
return {
dptList: [],
empList: [],
item: '',
dataTree: [],
pickerData1: '',
pickerData2: '',
workOrderCode: '',
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: {
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])
// }
},
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) {
console.log('返回:', e);
console.log('当前索引:', index);
},
clickDetail(e, index) {
console.log('返回:', e);
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('提交中')
addOut(_this.formData).then(async res => {
_this.$modal.msgSuccess("出库成功!");
_this.$modal.closeLoading();
// _this.$refs.alertDialog.open()
setTimeout(() => {
_this.$tab.switchTab("/pages/work/index");
}, 500);
});
} 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,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,549 @@
<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="库位条码" :labelWidth='90'
:name="'wmsLotNoList.'+ 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'>
<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="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
} from "@/api/wms/pdcIn.js";
export default {
onLoad: 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.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: '请输入库位条码!'
// }]
// }
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.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;
k = parseInt(this.singleInfo[0].number / this.splitNumber);
j = this.singleInfo[0].number - (this.splitNumber - 1) * k;
let secondK;
let secondJ;
secondK = parseInt(this.singleInfo[0].secondNumber / this.splitNumber);
secondJ = this.singleInfo[0].secondNumber - (this.splitNumber - 1) * secondK;
for (let i = 0; i < this.splitNumber; i++) {
let obj = {};
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.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);
}
}
},
//不拆分批次
singleSplit() {
this.wmsLotNoList = [];
this.splitNumber = 1;
let obj = {};
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);
},
splitStlBarcode(i) {
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('-');
if (whCode) {
let warehouseObj = _this.$store.getters.warehouseOptions.find(item => item.warehouseCode == whCode);
if (!warehouseObj) {
_this.checkStorageLocationBarcode = false;
_this.$modal.msg("货架不存在!");
return;
}
if (areaCode) {
let areaObj = _this.$store.getters.areaOptions.find(item => item.storageAreaCode ==
areaCode);
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.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() {
console.log(1)
// 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)
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,539 @@
<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"></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"></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 :materialCode="item.materialCode"
:secondNumber.sync="item.secondPassNumber" :secondUnitId="item.secondUnitId"
:number.sync="item.passNumber"
:unitId="item.unitId"></second-number-change-to-convert>
<!-- <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(item,data)"></second-number-change-to-convert>
<!-- <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 disabled type="number" v-model="item.backNumber" />
</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 SecondNumberChangeToConvert from "@/components/SecondNumberChangeToConvert/index.vue";
export default {
mounted() {},
data() {
return {
isSupplierCode: false,
isQualited: false,
value: '正常',
show: false,
materialLabel: null,
fileList1: [],
formData: {
purchaseReceiveCode: null,
purchaseQualityCode: 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
},
methods: {
//获取退回数量
getBackNumber(item, e) {
if (e > item.actualNumber) {
this.$message.error("退料数量不能大于实收数量")
}
item.backNumber = item.secondActualNumber - e
},
// 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 => {
console.log(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) {
console.log(1)
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 => {
console.log(res.data)
//判断有没有质检
if (res.data.length > 0) {
console.log(1)
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;
this.formData.wmsPurchaseQualityDetailList.push(res.data[0]);
this.materialLabel = null;
this.show = false;
// this.$modal.msg("该条物料已质检!");
} else {
console.log(2)
getReceiveDetail(data.id).then(res => {
console.log(res)
//判断有没有收货
if (res.data.actualNumber != null) {
console.log(res.data)
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,
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)
console.log(event)
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'
});
console.log(response)
resolve(response.fileName)
});
})
},
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 => {
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
.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
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;
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定完成该质检吗?',
success: function(res) {
if (res.confirm) {
console.log(_this.formData)
if (_this.formData.id != null) {
console.log(1)
console.log(_this.formData)
_this.$modal.loading('提交中')
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(', ');
}
console.log(enclosure)
let data = {
purchaseReceiveCode: _this.formData
.purchaseReceiveCode,
status: '1',
wmsPurchaseQualityDetailList: _this.formData
.wmsPurchaseQualityDetailList,
enclosure: enclosure
}
console.log(data)
_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) {
console.log('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,994 @@
<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="scanBarReceiveCode"
v-model="formData.purchaseReceiveCode" type="text" />
</uni-forms-item>
<uni-forms-item label="采购质检单" :labelWidth='90' name="purchaseQualityCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarQuality" @confirm="scanBarQualityCode"
v-model="formData.purchaseQualityCode" type="text" />
</uni-forms-item>
<uni-forms-item label="采购入库单" :labelWidth='90' name="purchaseInCode">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarPInCode" @confirm="scanBarpurchaseInCode"
v-model="formData.purchaseInCode" 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-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 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=='扫物料标签' && isSupplierCode == true &&formData.wmsPurchaseInDetailList.length != 0"
type="primary" style="text-align: center;margin-left: 30%;font-size: 18px;"
@click="show=!show">添加物料标签</button>
<button size="mini"
v-if="value=='扫物料标签' &&formData.wmsPurchaseInDetailList.length == 0 &&isSupplierCode == false"
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.wmsPurchaseInDetailList" :key="index">
<view>
<uni-badge :text="index+1" class="uni-badge-left-margin" type="primary"></uni-badge>
<button @click="open(index,item)" size="mini"
v-if="value=='扫物料标签' && isSupplierCode == true"
:disabled="buttonDisabled ||!item.id || !item.materialBatchNo || !item.number"
type="primary">编辑</button>
<button @click="open(index,item)" size="mini" v-else
:disabled="buttonDisabled ||!formData.id || !item.materialBatchNo || !item.number"
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" :disabled="item.id" v-model="item.materialBatchNo" />
</uni-forms-item>
<uni-forms-item label="箱号" v-if="item.remark" :labelWidth='90'>
<uni-easyinput type="text" disabled v-model="item.remark" />
</uni-forms-item>
<uni-forms-item label="上架数量" :labelWidth='90'>
<u-number-box inputWidth="120" :disabled="item.id" button-size="36"
v-model="item.secondNumber" min="0"></u-number-box>
</uni-forms-item>
<uni-forms-item label="单位" :labelWidth='90' :disabled="true">
<uni-easyinput type="text" disabled v-model="item.unitText" />
<!-- <uni-data-select style="margin-top: 10px;" v-model="item.secondUnitId"
:localdata="unitList"></uni-data-select> -->
</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 {
listQuality,
getQuality,
addIn,
listReceive,
getReceive,
getListDetail,
updateIn,
listIn,
getIn,
getQualityDetail,
getReceiveDetail,
getDetailListsBySRM,
getListDetailByBL,
listSupplier
} from "@/api/wms/purchase.js";
import {
listMaterial
} from "@/api/wms/request.js";
import {
listUnit
} from "@/api/basic/unit";
import {
listEmployee
} from "@/api/mes/jobIn.js";
import {
getConfigKey
} from "@/api/system/config.js";
import {
listDepartment
} from "@/api/basic/department";
import {
listWarehouse
} from "@/api/wms/warehouse";
import SecondNumberChangeToConvert from "@/components/SecondNumberChangeToConvert/index.vue";
import _ from 'lodash';
export default {
created() {
//监听编辑批号分批后的状态
uni.$on('backWithParam', (param) => {
if (param.status && param.index) {
this.formData.wmsPurchaseInDetailList[Number(param.index)].status = param.status
}
this.checkIsListed();
});
},
mounted() {
//U9库存模式
getConfigKey("wms.u9.whMode").then((response) => {
this.wmsu9whMode = response.msg;
});
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
})
})
listUnit().then((res) => {
this.unitList = res.rows.map(item => {
let obj = {
text: item.unitCode + ":" + item.unitName,
value: item.id
}
return obj
})
})
},
data() {
return {
buttonDisabled: false,
dptList: [],
empList: [],
wcList: [],
unitList: [],
item: '',
dataTree: [],
pickerData: '',
wmsu9whMode: false,
isSupplierCode: false,
value: '正常',
show: false,
materialLabel: null,
//是否都入库
isAllListed: false,
isRk: false,
//是否打开编辑按钮
isSplit: true,
rightOptions: [{
text: '删除',
style: {
backgroundColor: '#ff2a17'
}
}, ],
formData: {
purchaseReceiveCode: null,
warehouseCode: null,
wmsPurchaseInDetailList: [],
status: "1",
id: null,
purchaseInCode: null,
shelfPutBy: null
},
rules: {
shelfPutBy: {
rules: [{
required: true,
errorMessage: '请输入上架员!'
}]
},
warehouseCode: {
rules: [{
required: true,
errorMessage: '请输入仓库编码!'
}]
},
}
}
},
methods: {
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])
},
deleteDetail(index) {
this.formData.wmsPurchaseInDetailList.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('@')) {
// console.log(1)
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.inList.length == 0) {
//未入库
//检查是否质检
if (res.qualityList.length == 0) {
this.$modal.msg("该条物料还未质检!");
this.materialLabel = null;
this.show = false;
} else {
//已质检才能入库
//判断有无完成质检
if (res.qualityList[0].status == 3) {
console.log(1)
this.formData.purchaseQualityCode = res.qualityList[0].purchaseQualityCode
//判断当前单据下是否已扫描添加过明细
if (this.formData.wmsPurchaseInDetailList.length > 0) {
//有明细
//判断是否在同个主表同一物料
if (this.formData.u9SourceBillCode == new_u9SourceBillCode && this
.formData
.erpDocCode1 == new_erpDocCode1 && this.formData
.wmsPurchaseInDetailList[0].erpDocLineKey1 == new_erpDocLineKey1) {
//判断是总码还是外箱
if (this.formData.wmsPurchaseInDetailList.length[0].remark) {
//外箱
//查询箱号是否重复
if (this.formData.wmsPurchaseInDetailList.find(item =>
item.remark == lotNo
)) {
this.$modal.msg("该条物料已添加!")
} else {
//箱号没重复
let obj = {
materialCode: array[1],
materialBatchNo: array[2],
number: Number(array[6]),
//ASN行号
erpDocLineKey1: array[4].split('|')[1],
remark: lotNo
}
// //供应商代码
// this.formData.supplierCode = new_supplierCode;
// //采购订单号
// this.formData.u9SourceBillCode = new_u9SourceBillCode;
// //ASN单号
// this.formData.erpDocCode1 = new_erpDocCode1;
this.formData.wmsPurchaseInDetailList.push(obj);
}
} else {
this.$modal.msg("该条物料已添加!")
}
} else {
this.$modal.msg("该条物料与现有明细不在同一ASN行号下")
}
} else {
//未入库,且当前单据下没有明细
//判断是总码还是外箱,外箱码是多加一个箱数量
if (array.length < 7) {
//总码
let obj = {
materialCode: array[1],
materialBatchNo: array[2],
number: Number(array[5]),
//ASN行号
erpDocLineKey1: new_erpDocLineKey1,
}
//供应商代码
this.formData.supplierCode = supplierCode;
//采购订单号
this.formData.u9SourceBillCode = new_u9SourceBillCode;
//ASN单号
this.formData.erpDocCode1 = new_erpDocCode1;
this.formData.wmsPurchaseInDetailList.push(obj);
} else {
console.log(2)
//外箱
let obj = {
materialCode: array[1],
materialBatchNo: array[2],
number: Number(array[5]),
//ASN行号
erpDocLineKey1: new_erpDocLineKey1,
remark: lotNo
}
//供应商代码
this.formData.supplierCode = supplierCode;
//采购订单号
this.formData.u9SourceBillCode = new_u9SourceBillCode;
//ASN单号
this.formData.erpDocCode1 = new_erpDocCode1;
this.formData.wmsPurchaseInDetailList.push(obj);
}
}
} else {
this.$modal.msg("该条物料还未完成质检!");
}
}
} else {
//已有入库
console.log(1)
//判断是总码还是外箱,外箱码是多加一个箱数量
if (array.length < 7) {
//总码
this.$modal.msg("该条物料已入库!")
} else {
//外箱
//判断当前单据下是否已扫描添加过明细
if (this.formData.wmsPurchaseInDetailList.length > 0) {
//有明细
//判断是否在同个主表同一物料
if (this.formData.u9SourceBillCode == new_u9SourceBillCode && this.formData
.erpDocCode1 == new_erpDocCode1 && this.formData
.wmsPurchaseInDetailList[0].erpDocLineKey1 == new_erpDocLineKey1) {
//查询数据库箱号是否重复
if (res.inList[0].wmsPurchaseInDetailList.find(item =>
item.remark == lotNo
)) {
this.$modal.msg("该条物料已添加!")
} else {
//查询当前单据明细箱号是否重复
if (this.formData.wmsPurchaseInDetailList.find(item =>
item.remark == lotNo
)) {
this.$modal.msg("该条物料已添加!")
} else {
console.log(1)
//外箱
let obj = {
materialCode: array[1],
materialBatchNo: array[2],
number: Number(array[5]),
//ASN行号
erpDocLineKey1: new_erpDocLineKey1,
remark: lotNo
}
// //供应商代码
// this.formData.supplierCode = new_supplierCode;
// //采购订单号
// this.formData.u9SourceBillCode = new_u9SourceBillCode;
// //ASN单号
// this.formData.erpDocCode1 = new_erpDocCode1;
this.formData.wmsPurchaseInDetailList.push(obj);
}
}
} else {
this.$modal.msg("与现有明细不在同一ASN行号下")
}
} else {
console.log(2)
//查询数据库箱号是否重复
if (res.inList[0].wmsPurchaseInDetailList.find(item =>
item.remark == lotNo
)) {
this.$modal.msg("该条物料已添加入库!")
this.formData = res.inList[0]
} else {
this.formData = res.inList[0]
//外箱
let obj = {
materialCode: array[1],
materialBatchNo: array[2],
number: Number(array[5]),
//ASN行号
erpDocLineKey1: new_erpDocLineKey1,
remark: lotNo
}
// //供应商代码
// this.formData.supplierCode = new_supplierCode;
// //采购订单号
// this.formData.u9SourceBillCode = new_u9SourceBillCode;
// //ASN单号
// this.formData.erpDocCode1 = new_erpDocCode1;
this.formData.wmsPurchaseInDetailList.push(obj);
}
}
}
}
});
this.materialLabel = null;
this.show = false;
} else {
data = JSON.parse(data)
if (data) {
getQualityDetail({
purchaseReceiveDetailId: data.id
}).then(res => {
//判断有没有质检
console.log(res)
if (res.data.length > 0 && res.data[0].qualityStatus == '3') {
let num = 0;
console.log(res.data)
for (var i in res.data) {
num += res.data[i].inNumber
}
let unitText = null;
let unitobj = this.unitList.find(i => i.value == res.data[0].secondUnitId)
if (unitobj) {
unitText = unitobj.text
}
let obj = {
materialCode: res.data[0].materialCode,
materialName: res.data[0].materialName,
materialBatchNo: res.data[0].materialBatchNo,
number: num,
purchaseReceiveDetailId: data.id,
purchaseQualityDetailId: res.data[0].id,
dynamicField1: res.data[0].dynamicField1,
unitId: res.data[0].unitId,
unit: res.data[0].unit,
secondNumber: res.data[0].secondInNumber,
secondUnitId: res.data[0].secondUnitId,
unitText: unitText,
status: 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;
this.formData.warehouseCode = res.data[0].warehouseCode;
this.formData.wmsPurchaseInDetailList.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);
}
});
},
//进入编辑页
open(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.batchNo = row.materialBatchNo;
// singleInfo.materialLotNo = row.materialLotNo;
singleInfo.number = row.number;
singleInfo.unit = row.unit;
singleInfo.purchaseInCode = row.purchaseInCode;
singleInfo.materialName = row.materialName;
// singleInfo.materialType = row.type;
singleInfo.unitName = row.unit;
singleInfo.specification = row.specification;
singleInfo.u9StorageCode = row.u9StorageCode;
singleInfo.whCode = row.whCode;
singleInfo.areaCode = row.areaCode;
singleInfo.shelvesCode = row.shelvesCode;
singleInfo.storageLocationCode = row.storageLocationCode;
singleInfo.storageInBillCode = row.purchaseInCode;
singleInfo.storageInBillDetailCode = row.purchaseInDetailCode;
singleInfo.u9LineId = row.u9RcvLineId;
singleInfo.erpDocLineKey1 = row.erpDocLineKey1;
singleInfo.unitId = row.unitId;
singleInfo.secondUnitId = row.secondUnitId;
singleInfo.secondNumber = row.secondNumber;
this.formData.purchaseInCode = row.purchaseInCode;
//U9模式下使用入库单明细进行查询
if (this.wmsu9whMode == "true") {
console.log(row);
getListDetailByBL({
storageInBillDetailCode: row.purchaseInDetailCode,
}).then((response) => {
console.log(response);
this.handleListDetail(row, response, singleInfo, index);
});
} else {
getListDetailByBL(singleInfo).then((response) => {
console.log(response);
this.handleListDetail(row, response, singleInfo, index);
});
}
},
handleListDetail: _.debounce(function(row, response, singleInfo, index) {
console.log(1)
//选中的物料明细项
let selectedRow = row;
//是否分批
let isSecondOpen = false;
//每份数量
let eachNumber = null;
//拆分数量
let splitNumber = null;
console.log(2)
/** 导入拆分信息 */
if (response.materialDetailList.length > 0) {
if (response.materialDetailList[0].splitNumber != null) {
console.log(3)
splitNumber = response.materialDetailList[0].splitNumber;
} else if (response.materialDetailList[0].eachNumber != null) {
console.log(4)
eachNumber = response.materialDetailList[0].eachNumber;
}
}
console.log(response)
/** 导入拆分详情 */
if (response.materialStockList) {
if (response.materialStockList.length > 0) {
console.log(5)
this.wmsLotNoList = response.materialStockList.map((item) => {
item.batchNo = item.materialBatchNo;
item.locCascade = [
item.whCode,
item.areaCode,
item.shelvesCode,
item.storageLocationCode,
];
return item;
});
}
if (response.materialStockList.length != 0) {
isSecondOpen = true;
}
}
console.log(6)
console.log(this.wmsLotNoList);
uni.navigateTo({
url: '/pages/wms/purchase/purchaseListing?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() {
const _this = this;
const detail = _this.formData;
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.formData.storageLocationBarcode = res.result;
_this.$set(_this.formData, "storageLocationBarcode", res
.result);
_this.splitStlBarcode();
}
});
},
scanBarQualityCode() {
listQuality(this.formData.purchaseQualityCode).then(res => {
if (res.total > 0) {
getQuality(res.rows[0].id).then((res) => {
res.data.wmsPurchaseQualityDetailList.forEach(
item => {
item.id = null;
item.number = item.actualNumber - item
.number + item
.passNumber;
item.u9RcvLineId = item.u9DocLineKey;
})
this.formData.supplierCode = res.data.supplierCode;
this.formData.u9SourceBillCode = res.data
.u9SourceBillCode;
this.formData.erpDocCode1 = res.data.erpDocCode1;
this.formData.purchaseReceiveCode = res.data
.purchaseReceiveCode;
this.formData.wmsPurchaseInDetailList = res.data
.wmsPurchaseQualityDetailList;
});
} else {
this.$modal.msg("未查询到该质检单相关信息!");
}
})
},
scanBarQuality() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.purchaseQualityCode = res.result;
_this.scanBarQualityCode();
}
});
},
scanBarReceiveCode() {
if (this.formData.purchaseReceiveCode && this.formData.purchaseReceiveCode !=
"") {
this.formData.purchaseInCode = null;
listReceive({
purchaseReceiveCode: this.formData.purchaseReceiveCode
}).then(async res => {
if (res.rows.length > 0) {
getReceive(res.rows[0].id).then(res => {
this.formData.wmsPurchaseInDetailList = res
.data
.wmsPurchaseReceiveDetailList
this.formData.wmsPurchaseInDetailList
.forEach(element => {
element.number = element
.actualNumber;
element.status = 0;
element.id = null;
});
this.formData.supplierCode = res.data
.supplierCode;
this.formData.u9SourceBillCode = res.data
.u9SourceBillCode;
this.formData.erpDocCode1 = res.data
.erpDocCode1;
})
} else {
this.$modal.msg("未查询到该收货单相关信息!");
}
});
} else {
this.$modal.msg("请输入采购收货单!");
}
},
//采购收货单
scanBar() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.purchaseReceiveCode = res.result;
_this.scanBarReceiveCode();
}
});
},
scanBarshelfPutBy() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.shelfPutBy = res.result;
_this.isEmp(res.result);
}
});
},
//验证是否为员工
isEmp(code) {
listEmployee({
empCode: code
}).then(res => {
if (res.total == 0) {
this.$modal.msg("未查询到该员工!");
this.formData.shelfPutBy = null;
}
})
},
scanBarPInCode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.purchaseInCode = res.result;
_this.scanBarpurchaseInCode()
}
});
},
scanBarpurchaseInCode() {
if (this.formData.purchaseInCode && this.formData.purchaseInCode != "") {
this.formData.purchaseReceiveCode = null;
listIn({
purchaseInCode: this.formData.purchaseInCode
}).then(res => {
if (res.rows.length > 0) {
console.log(res.rows[0].id)
getIn(res.rows[0].id).then((response) => {
this.formData = response.data;
this.checkIsListed();
});
} else {
this.$modal.msg("未查询到该入库单相关信息!");
}
});
}
},
//仓库编号
scanBarwarehouseCode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.warehouseCode = res.result;
}
});
},
savesubmit() {
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) {
// if (_this.formData.purchaseReceiveCode) {
console.log(_this.formData)
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 {
console.log(_this
.formData);
_this.$modal.loading('提交中')
addIn(_this.formData).then((
response) => {
_this.$modal.closeLoading();
console.log(_this
.formData);
_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.wmsPurchaseInDetailList.filter((obj) => obj.status != 1)
.length == 0
) {
_this.formData.status = 3;
}
_this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定入库该物料吗?',
success: function(res) {
if (res.confirm) {
console.log(_this.formData)
_this.$modal.loading('提交中')
updateIn(_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('用户点击取消');
}
}
});
});
},
//检查是否都入库
checkIsListed() {
let flag = true;
this.formData.wmsPurchaseInDetailList.forEach((item) => {
if (item.status == 0 || item.status == null) flag = false;
});
this.isAllListed = flag;
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,521 @@
<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="scanBarwarehouseCode"
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 {
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() {
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: true,
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('用户点击取消');
}
}
});
});
},
}
}
</script>
<style>
</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>

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,342 @@
<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="transferBy">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarTransferBy"
v-model="formData.transferBy" />
</uni-forms-item>
<uni-forms-item label="运输员" :labelWidth='90' name="transportBy">
<uni-easyinput type="text" suffixIcon="scan" @iconClick="scanBarTransportBy"
v-model="formData.transportBy" />
</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>
</uni-collapse-item>
<uni-collapse-item title="库位库存明细" :open="true">
<u-checkbox-group v-model="checked" @change="getCheckedList" :borderBottom="true" placement="column"
iconPlacement="right">
<u-checkbox size="25" iconSize="25" activeColor="green"
v-for="(item, index) in wmsMaterialDetailList" :key="index" :disabled="item.disabled"
:name="item.id" :label="'\n'+' 序号 : '+(index+1)+'\n\n'+
'物料编码 : '+(item.materialCode?item.materialCode:'')+'\n\n'+
'批号 : '+(item.batchNo?item.batchNo:'')+'\n\n'+
'箱号 : '+(item.lotNo?item.lotNo:'')+'\n\n'+
'物料名称 : '+(item.materialName?item.materialName:'')+'\n\n'+
'库位编码 : '+(item.storageLocationCode?item.storageLocationCode:'')+'\n\n'+
'入库时间 : '+(item.storageInTime?item.storageInTime:'')+'\n\n'+
'库存总数 : '+(item.number?item.number:'')+'\n\n'+
'锁定数量 : '+(item.lockNumber?item.lockNumber:'')+'\n\n'+
'可用数量 : '+(item.MaterialAvailableNumber?item.MaterialAvailableNumber:'')+'\n'
">
</u-checkbox>
</u-checkbox-group>
</uni-collapse-item>
<uni-collapse-item title="已选物料" :open="true">
<uni-card :is-shadow="false" is-full v-for="item,index in wmsStockTransferDetailList"
:key="item.id">
<div><strong>物料编码</strong>:{{item.materialCode}}</div>
<div><strong>物料名称</strong>:{{item.materialName}}</div>
<div><strong>批号</strong>:{{item.batchNo}}</div>
<div><strong>可用数量</strong>:{{item.MaterialAvailableNumber}}</div>
<uni-forms-item label="目标库位" :labelWidth='80' name="newStorageLocationBarcode"
style="margin-top: 10px;">
<uni-easyinput suffixIcon="scan" @iconClick="scanBarNewStorageLocationBarcode(index)"
@confirm="splitNewStlBarcode(index)" type="text"
v-model="item.newStorageLocationBarcode" />
</uni-forms-item>
<uni-forms-item label="转移数量" :labelWidth='80' name="actualNumber" style="margin-top: 10px;">
<u-number-box button-size="36" inputWidth="120" v-model="item.actualNumber"
min="0"></u-number-box>
</uni-forms-item>
</uni-card>
</uni-collapse-item>
</uni-forms>
</uni-collapse>
<u-button type="primary" @click="submit">提交</u-button>
</view>
</template>
<script>
import {
listStock,
addTransfer
} from "@/api/wms/stock.js";
export default {
mounted() {},
data() {
return {
checked: null,
formData: {
whCode: null,
areaCode: null,
shelvesCode: null,
storageLocationCode: null,
storageLocationBarcode: null,
newStorageLocationBarcode: null,
actualNumber: null
},
wmsMaterialDetailList: [],
wmsStockTransferDetailList: [],
rules: {
}
}
},
methods: {
test() {},
getCheckedList(e) {
this.wmsStockTransferDetailList = [];
var array = JSON.parse(JSON.stringify(e));
for (var i = 0; i < e.length; i++) {
let obj = {};
obj = this.wmsMaterialDetailList.filter(item => {
return item.id == e[i]
})[0];
obj.wmsMaterialStockId = array[i];
obj.materialBatchNo = obj.batchNo;
obj.materialLotNo = obj.lotNo;
obj.originAreaCode = this.formData.areaCode;
obj.originShelvesCode = this.formData.shelvesCode;
obj.originLocationCode = this.formData.storageLocationCode;
obj.targetAreaCode = null;
obj.targetShelves = null;
obj.targetLocation = null;
obj.availableNumber = obj.MaterialAvailableNumber;
obj.schemeNumber = null;
obj.actualNumber = null;
obj.numUnitId = null;
obj.delStatus = null;
obj.remark = null;
obj.id = null;
this.wmsStockTransferDetailList.push(obj)
}
},
splitStlBarcode(e) {
console.log(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.getMatList();
break;
case 2:
this.formData.whCode = array[0];
this.formData.areaCode = array[1];
this.getMatList();
break;
case 3:
this.formData.whCode = array[0];
this.formData.areaCode = array[1];
this.formData.shelvesCode = array[2];
this.getMatList();
break;
case 4:
this.formData.whCode = array[0];
this.formData.areaCode = array[1];
this.formData.shelvesCode = array[2];
this.formData.storageLocationCode = array[3];
this.getMatList();
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.getMatList();
break;
}
},
scanBarstorageLocationBarcode() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.formData, "storageLocationBarcode", res
.result);
_this.splitStlBarcode(res.result);
}
});
},
splitNewStlBarcode(i) {
this.wmsStockTransferDetailList[i].whCode = null;
this.wmsStockTransferDetailList[i].targetAreaCode = null;
this.wmsStockTransferDetailList[i].targetShelves = null;
this.wmsStockTransferDetailList[i].targetLocation = null;
let array = this.wmsStockTransferDetailList[i].newStorageLocationBarcode.split('-');
switch (array.length) {
case 1:
if (this.judgeSameWhCode(array[0])) {
this.wmsStockTransferDetailList[i].whCode = array[0];
} else {
this.wmsStockTransferDetailList[i].newStorageLocationBarcode = null;
this.$modal.msg("目标仓库与原仓库不一致!");
}
break;
case 2:
if (this.judgeSameWhCode(array[0])) {
this.wmsStockTransferDetailList[i].whCode = array[0];
this.wmsStockTransferDetailList[i].targetAreaCode = array[1];
} else {
this.wmsStockTransferDetailList[i].newStorageLocationBarcode = null;
this.$modal.msg("目标仓库与原仓库不一致!");
}
break;
case 3:
if (this.judgeSameWhCode(array[0])) {
this.wmsStockTransferDetailList[i].whCode = array[0];
this.wmsStockTransferDetailList[i].targetAreaCode = array[1];
this.wmsStockTransferDetailList[i].targetShelves = array[2];
} else {
this.wmsStockTransferDetailList[i].newStorageLocationBarcode = null;
this.$modal.msg("目标仓库与原仓库不一致!");
}
break;
case 4:
if (this.judgeSameWhCode(array[0])) {
this.wmsStockTransferDetailList[i].whCode = array[0];
this.wmsStockTransferDetailList[i].targetAreaCode = array[1];
this.wmsStockTransferDetailList[i].targetShelves = array[2];
this.wmsStockTransferDetailList[i].targetLocation = array[3];
} else {
this.wmsStockTransferDetailList[i].newStorageLocationBarcode = null;
this.$modal.msg("目标仓库与原仓库不一致!");
}
break;
case 5:
if (this.judgeSameWhCode(array[0])) {
this.wmsStockTransferDetailList[i].whCode = array[0];
this.wmsStockTransferDetailList[i].targetAreaCode = array[1];
this.wmsStockTransferDetailList[i].targetShelves = array[2];
this.wmsStockTransferDetailList[i].targetLocation = array[3] + '-' + array[4];
} else {
this.wmsStockTransferDetailList[i].newStorageLocationBarcode = null;
this.$modal.msg("目标仓库与原仓库不一致!");
}
break;
}
},
judgeSameWhCode(code) {
if (code == this.formData.whCode) return true;
return false;
},
scanBarNewStorageLocationBarcode(i) {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.$set(_this.wmsStockTransferDetailList[i], "newStorageLocationBarcode", res
.result);
_this.splitNewStlBarcode(i);
}
});
},
getMatList() {
listStock(this.formData).then(res => {
console.log(res)
for (let obj of res.rows) {
obj.MaterialAvailableNumber = obj.number - obj.lockNumber;
}
this.wmsMaterialDetailList = res.rows
})
},
//运输员
scanBarTransportBy() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.transportBy = res.result;
}
});
},
//发起人
scanBarTransferBy() {
const _this = this;
uni.scanCode({
scanType: ['barCode', 'qrCode'],
success: function(res) {
_this.formData.transferBy = res.result;
}
});
},
submit() {
let judge = true;
for (let i = 0; i < this.wmsStockTransferDetailList.length; i++) {
if (this.wmsStockTransferDetailList[i].wmsMaterialStockId == null) {
console.log(this.wmsStockTransferDetailList)
this.$modal.msg("存在未选择库存的明细!");
judge = false;
break;
} else if (this.wmsStockTransferDetailList[i].actualNumber == null) {
this.$modal.msg("实际数量不能为空!");
judge = false;
break;
} else if (this.wmsStockTransferDetailList[i].targetAreaCode == null) {
this.$modal.msg("目标库区不能为空!");
judge = false;
break;
}
}
console.log(judge);
if (judge == true) {
const _this = this;
this.$refs.form.validate().then(res => {
uni.showModal({
title: '提示',
content: '您确定转移该物料吗?',
success: function(res) {
if (res.confirm) {
let data = {
warehouse: _this.formData.whCode,
//跳过审批流
transferStatus: '4',
transferBy: _this.formData.transferBy,
transportBy: _this.formData.transportBy,
wmsStockTransferDetailList: _this
.wmsStockTransferDetailList
}
addTransfer(data).then(async res => {
_this.$modal.msgSuccess("转移成功!");
setTimeout(() => {
_this.$tab.switchTab(
"/pages/work/index");
}, 500);
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
});
}
},
}
}
</script>
<style scoped>
.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>