|  |  |  | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <u-input | 
|---|
|  |  |  | v-model.trim="warehouse.packageCode" | 
|---|
|  |  |  | @focus="warehouse.packageCode = ''" | 
|---|
|  |  |  | @confirm="getContainerData(1)" | 
|---|
|  |  |  | placeholder="请录入或扫码" | 
|---|
|  |  |  | class="width" | 
|---|
|  |  |  | 
|---|
|  |  |  | style="background-color: #fff" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <u-col span="12"> | 
|---|
|  |  |  | <u-form-item label="板件号:" class="uFormItem"> | 
|---|
|  |  |  | <u-form-item label="部件条码:" class="uFormItem"> | 
|---|
|  |  |  | <u-input | 
|---|
|  |  |  | v-model="warehouse.upi" | 
|---|
|  |  |  | ref="materialRef" | 
|---|
|  |  |  | 
|---|
|  |  |  | <!-- 部件名称 upi、材料、尺寸,位置、板件状态 --> | 
|---|
|  |  |  | <u-row> | 
|---|
|  |  |  | <u-col span="12" class="flex align-center"> | 
|---|
|  |  |  | <u-checkbox v-model="item.checked" size="50rpx"></u-checkbox> | 
|---|
|  |  |  | <!-- <u-checkbox v-model="item.checked" size="50rpx"></u-checkbox> --> | 
|---|
|  |  |  | <view | 
|---|
|  |  |  | class="flex justify-center align-center" | 
|---|
|  |  |  | style=" | 
|---|
|  |  |  | 
|---|
|  |  |  | <u-row> | 
|---|
|  |  |  | <u-col span="8"> | 
|---|
|  |  |  | <text class="color_80 padding_left25rpx"> | 
|---|
|  |  |  | 板件状态:{{ item.upiStatus }} | 
|---|
|  |  |  | 板件状态:{{ getEnumName(item.upiStatus) }} | 
|---|
|  |  |  | </text> | 
|---|
|  |  |  | </u-col> | 
|---|
|  |  |  | <u-col span="4"> | 
|---|
|  |  |  | 
|---|
|  |  |  | </u-swipe-action> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <modal-code :rescode="rescode" :resmessage="resmessage" ref="resmodal" /> | 
|---|
|  |  |  | <u-popup | 
|---|
|  |  |  | v-model="detailshow" | 
|---|
|  |  |  | border-radius="14" | 
|---|
|  |  |  | @close="detailshow = false" | 
|---|
|  |  |  | mode="bottom" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <!-- <view class="pop "> --> | 
|---|
|  |  |  | <h2 class="text_align_center padding_bottom18 padding15">物料信息</h2> | 
|---|
|  |  |  | <view class="line flex justify-between"> | 
|---|
|  |  |  | <text class="text-gray">物料编号</text> | 
|---|
|  |  |  | <text>{{ this.materlist.materialCode }}</text> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <view class="line flex justify-between"> | 
|---|
|  |  |  | <text class="text-gray">物料名称</text> | 
|---|
|  |  |  | <text>{{ this.materlist.materialName }}</text> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <view class="line flex justify-between"> | 
|---|
|  |  |  | <text class="text-gray">物料小类</text> | 
|---|
|  |  |  | <text>{{ this.materlist.materialTypeName }}</text> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <view class="line flex justify-between"> | 
|---|
|  |  |  | <text class="text-gray">批次</text> | 
|---|
|  |  |  | <text>{{ this.materlist.batchNo }}</text> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <view class="line flex justify-between"> | 
|---|
|  |  |  | <text class="text-gray">物料规格</text> | 
|---|
|  |  |  | <text>{{ this.materlist.specificationModel }}</text> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <view class="line flex justify-between"> | 
|---|
|  |  |  | <text class="text-gray">数量</text> | 
|---|
|  |  |  | <text>{{ this.materlist.unBindQuantity }}</text> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | <!-- </view> --> | 
|---|
|  |  |  | <view class="margin_top140rpx"> | 
|---|
|  |  |  | <button-modal | 
|---|
|  |  |  | :subShow="true" | 
|---|
|  |  |  | garmenTitle="打印" | 
|---|
|  |  |  | @submit="init" | 
|---|
|  |  |  | @reset="rest" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </u-popup> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <button-modal | 
|---|
|  |  |  | :empTytowerShow="true" | 
|---|
|  |  |  | cleaningTitle="重置" | 
|---|
|  |  |  | garmenTitle="物料解绑" | 
|---|
|  |  |  | @submit="submit" | 
|---|
|  |  |  | @reset="back" | 
|---|
|  |  |  | :subShow="true" | 
|---|
|  |  |  | garmenTitle="重置" | 
|---|
|  |  |  | @submit="rest" | 
|---|
|  |  |  | @reset="rest" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </view> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | 
|---|
|  |  |  | gridFocus: false, | 
|---|
|  |  |  | gridable: true, | 
|---|
|  |  |  | kwbhAllowed: false, | 
|---|
|  |  |  | enumList: [], | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | components: { | 
|---|
|  |  |  | ButtonModal, | 
|---|
|  |  |  | ModalCode, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | created() { | 
|---|
|  |  |  | getenumDataList({ | 
|---|
|  |  |  | EnumName: "UpiStatusEnum", | 
|---|
|  |  |  | }).then((res) => { | 
|---|
|  |  |  | this.enumList = res.result || []; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | onLoad() { | 
|---|
|  |  |  | this.operator = JSON.parse(uni.getStorageSync("userInfo")).name; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | mounted() { | 
|---|
|  |  |  | getenumDataList({ | 
|---|
|  |  |  | EnumName: "UpiStatusEnum", | 
|---|
|  |  |  | }).then((res) => { | 
|---|
|  |  |  | this.singlist = res.data.result || []; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | getEnumName(value) { | 
|---|
|  |  |  | const name = this.enumList.find((item) => item.value === value); | 
|---|
|  |  |  | return name? name.name : ""; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 如果打开一个的时候,不需要关闭其他,则无需实现本方法 | 
|---|
|  |  |  | open(index) { | 
|---|
|  |  |  | // 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制, | 
|---|
|  |  |  | 
|---|
|  |  |  | this.materlist = this.singlist[index]; | 
|---|
|  |  |  | this.detailshow = true; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | //标签重新打印 | 
|---|
|  |  |  | init() { | 
|---|
|  |  |  | const arr = ["materialCode", "unBindQuantity"]; | 
|---|
|  |  |  | const arrzw = ["物料编号", "本次解绑数量"]; | 
|---|
|  |  |  | let isAllow = ""; | 
|---|
|  |  |  | Object.keys(this.materlist).forEach((item) => { | 
|---|
|  |  |  | if (arr.includes(item)) { | 
|---|
|  |  |  | if (!this.materlist[item]) { | 
|---|
|  |  |  | isAllow = arr.indexOf(item); | 
|---|
|  |  |  | // this.rescode = 400 | 
|---|
|  |  |  | // this.resmessage = `${arrzw[isAllow]}为空,不能继续打印` | 
|---|
|  |  |  | // this.resmessage = `${item}为空,不能继续打印` | 
|---|
|  |  |  | // this.$refs.resmodal.show = true | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | if (isAllow != "") { | 
|---|
|  |  |  | this.detailshow = false; | 
|---|
|  |  |  | this.rescode = 400; | 
|---|
|  |  |  | this.resmessage = `${arrzw[isAllow]}为空,不能继续打印`; | 
|---|
|  |  |  | this.$refs.resmodal.show = true; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if ( | 
|---|
|  |  |  | this.materlist.unBindQuantity <= 0 || | 
|---|
|  |  |  | this.materlist.unBindQuantity > this.materlist.quantity | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | this.detailshow = false; | 
|---|
|  |  |  | this.rescode = 400; | 
|---|
|  |  |  | this.resmessage = `数量不符合规范,不能继续打印`; | 
|---|
|  |  |  | this.$refs.resmodal.show = true; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!this.materlist.specificationModel) { | 
|---|
|  |  |  | this.materlist.specificationModel = ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | let ptintContext = [ | 
|---|
|  |  |  | { | 
|---|
|  |  |  | type: "text", | 
|---|
|  |  |  | x: 0, | 
|---|
|  |  |  | y: 0, | 
|---|
|  |  |  | text: "", | 
|---|
|  |  |  | size: 2, | 
|---|
|  |  |  | rotate: 0, | 
|---|
|  |  |  | bold: 0, | 
|---|
|  |  |  | underline: false, | 
|---|
|  |  |  | reverse: false, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | type: "text", | 
|---|
|  |  |  | x: 0, | 
|---|
|  |  |  | y: 0, | 
|---|
|  |  |  | text: "", | 
|---|
|  |  |  | size: 2, | 
|---|
|  |  |  | rotate: 0, | 
|---|
|  |  |  | bold: 0, | 
|---|
|  |  |  | underline: false, | 
|---|
|  |  |  | reverse: false, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | type: "text", | 
|---|
|  |  |  | x: 0, | 
|---|
|  |  |  | y: 0, | 
|---|
|  |  |  | text: "", | 
|---|
|  |  |  | size: 2, | 
|---|
|  |  |  | rotate: 0, | 
|---|
|  |  |  | bold: 0, | 
|---|
|  |  |  | underline: false, | 
|---|
|  |  |  | reverse: false, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | /* 以上空数据,为防止丢包时打印不正常 */ | 
|---|
|  |  |  | { type: "line", x1: 3, y1: 3, x2: 565, y2: 3, width: 2 }, | 
|---|
|  |  |  | { type: "line", x1: 3, y1: 3, x2: 3, y2: 345, width: 2 }, | 
|---|
|  |  |  | { type: "line", x1: 3, y1: 345, x2: 565, y2: 345, width: 2 }, | 
|---|
|  |  |  | { type: "line", x1: 565, y1: 345, x2: 565, y2: 3, width: 2 }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | type: "text", | 
|---|
|  |  |  | x: 80, | 
|---|
|  |  |  | y: 15, | 
|---|
|  |  |  | text: "牧野汽车装备(武汉)有限公司", | 
|---|
|  |  |  | size: 3, | 
|---|
|  |  |  | rotate: 0, | 
|---|
|  |  |  | bold: 1, | 
|---|
|  |  |  | underline: false, | 
|---|
|  |  |  | reverse: false, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { type: "line", x1: 3, y1: 60, x2: 565, y2: 60, width: 2 }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | type: "text", | 
|---|
|  |  |  | x: 10, | 
|---|
|  |  |  | y: 75, | 
|---|
|  |  |  | text: `物料编号: ${this.materlist.materialCode}`, | 
|---|
|  |  |  | size: 2, | 
|---|
|  |  |  | rotate: 0, | 
|---|
|  |  |  | bold: 1, | 
|---|
|  |  |  | underline: false, | 
|---|
|  |  |  | reverse: false, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { type: "line", x1: 3, y1: 110, x2: 380, y2: 110, width: 2 }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | type: "text", | 
|---|
|  |  |  | x: 10, | 
|---|
|  |  |  | y: 125, | 
|---|
|  |  |  | text: `物料名称: ${this.materlist.materialTypeName || ""}`, | 
|---|
|  |  |  | size: 2, | 
|---|
|  |  |  | rotate: 0, | 
|---|
|  |  |  | bold: 1, | 
|---|
|  |  |  | underline: false, | 
|---|
|  |  |  | reverse: false, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { type: "line", x1: 3, y1: 160, x2: 380, y2: 160, width: 2 }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | type: "text", | 
|---|
|  |  |  | x: 10, | 
|---|
|  |  |  | y: 175, | 
|---|
|  |  |  | text: `批次: ${this.materlist.batchNo}`, | 
|---|
|  |  |  | size: 2, | 
|---|
|  |  |  | rotate: 0, | 
|---|
|  |  |  | bold: 1, | 
|---|
|  |  |  | underline: false, | 
|---|
|  |  |  | reverse: false, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { type: "line", x1: 3, y1: 210, x2: 565, y2: 210, width: 2 }, | 
|---|
|  |  |  | { type: "line", x1: 380, y1: 60, x2: 380, y2: 210, width: 2 }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | type: "qr", | 
|---|
|  |  |  | x: 410, | 
|---|
|  |  |  | y: 72, | 
|---|
|  |  |  | text: `PARTS NUMBER: ${this.materlist.materialCode},SAP: ${ | 
|---|
|  |  |  | this.materlist.sap_Location || "" | 
|---|
|  |  |  | },BOXNUM: ${this.materlist.boxNo || ""},LOT NO: ${ | 
|---|
|  |  |  | this.materlist.batchNo | 
|---|
|  |  |  | },QUANTITY: ${this.materlist.unBindQuantity}`, | 
|---|
|  |  |  | width: 3, | 
|---|
|  |  |  | level: 1, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | type: "text", | 
|---|
|  |  |  | x: 10, | 
|---|
|  |  |  | y: 225, | 
|---|
|  |  |  | text: `规格型号: ${ | 
|---|
|  |  |  | this.materlist.specificationModel.length > 32 | 
|---|
|  |  |  | ? this.materlist.specificationModel.substr(0, 32) | 
|---|
|  |  |  | : this.materlist.specificationModel | 
|---|
|  |  |  | }`, | 
|---|
|  |  |  | size: 2, | 
|---|
|  |  |  | rotate: 0, | 
|---|
|  |  |  | bold: 1, | 
|---|
|  |  |  | underline: false, | 
|---|
|  |  |  | reverse: false, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { type: "line", x1: 3, y1: 260, x2: 565, y2: 260, width: 2 }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | type: "text", | 
|---|
|  |  |  | x: 120, | 
|---|
|  |  |  | y: 290, | 
|---|
|  |  |  | text: "MAKINO J(CHINA) CO.LTD", | 
|---|
|  |  |  | size: 3, | 
|---|
|  |  |  | rotate: 0, | 
|---|
|  |  |  | bold: 1, | 
|---|
|  |  |  | underline: false, | 
|---|
|  |  |  | reverse: false, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | console.log(ptintContext); | 
|---|
|  |  |  | BluePrint.print(this.$store, ptintContext) | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | // 关闭弹框 并恢复滑动块 | 
|---|
|  |  |  | this.detailshow = false; | 
|---|
|  |  |  | this.addForm.code = this.materlist.materlist; | 
|---|
|  |  |  | this.addForm.name = this.materlist.materialName; | 
|---|
|  |  |  | this.addForm.batchNo = this.materlist.batchNo; | 
|---|
|  |  |  | this.addForm.specificationModel = this.materlist.specificationModel; | 
|---|
|  |  |  | addPrintRecord(this.addForm).then((res) => { | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | uni.showToast({ | 
|---|
|  |  |  | title: "打印成功", | 
|---|
|  |  |  | duration: 2000, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch((err) => { | 
|---|
|  |  |  | // uni.showToast({ | 
|---|
|  |  |  | //    title:'打印失败', | 
|---|
|  |  |  | //    duration: 2000 | 
|---|
|  |  |  | // }) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rest() { | 
|---|
|  |  |  | this.warehouse.upi = ""; | 
|---|
|  |  |  | this.warehouse.packageCode = ""; | 
|---|
|  |  |  | this.singlist = []; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | materialBlur() { | 
|---|
|  |  |  | clearTimeout(this.timerSm); | 
|---|
|  |  |  | this.timerSm = null; | 
|---|
|  |  |  | if (this.warehouse.materialCode == "") { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.timer = setTimeout(() => { | 
|---|
|  |  |  | //多次触发bug 延迟bug | 
|---|
|  |  |  | //判断当前物料是否在盘点列表中 | 
|---|
|  |  |  | const index = this.singlist.findIndex( | 
|---|
|  |  |  | (item) => | 
|---|
|  |  |  | item.materialCode == this.warehouse.materialCode && | 
|---|
|  |  |  | item.batchNo == lotNo | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if (index > -1) { | 
|---|
|  |  |  | this.singlist[index].checked = 1; | 
|---|
|  |  |  | this.singlist.unshift(...this.singlist.splice(index, 1)); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | clearTimeout(this.timer); | 
|---|
|  |  |  | this.timer = null; | 
|---|
|  |  |  | this.containerBlur(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, 100); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | containerBlur() { | 
|---|
|  |  |  | if ( | 
|---|
|  |  |  | this.warehouse.packageCode == "" || | 
|---|
|  |  |  | this.warehouse.materialCode == "" | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | getContainerMaterial(this.warehouse).then((res) => { | 
|---|
|  |  |  | if (res.data == null || res.data.length == 0) { | 
|---|
|  |  |  | this.rescode = 400; | 
|---|
|  |  |  | this.resmessage = "暂无数据"; | 
|---|
|  |  |  | this.$refs.resmodal.show = true; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.warehouse.dutyCycle = res.data[0].dutyCycle || 0; | 
|---|
|  |  |  | //给所有的材料一个未选中的状态 | 
|---|
|  |  |  | res.data.map((item) => { | 
|---|
|  |  |  | (item.checked = true), (item.unBindQuantity = ""); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | this.singlist.unshift(...res.data); | 
|---|
|  |  |  | this.ordersId = res.data[0].ordersId; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | //解绑数量失焦事件 | 
|---|
|  |  |  | changeNum(option) { | 
|---|
|  |  |  | //判断是否勾选,如果勾选了,就要对数量校验 | 
|---|
|  |  |  | if (!option.checked) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (option.unBindQuantity == "") { | 
|---|
|  |  |  | this.rescode = 400; | 
|---|
|  |  |  | this.resmessage = "解绑数量不能为空"; | 
|---|
|  |  |  | this.$refs.resmodal.show = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (option.unBindQuantity <= 0) { | 
|---|
|  |  |  | this.rescode = 400; | 
|---|
|  |  |  | this.resmessage = "解绑数量必须大于0"; | 
|---|
|  |  |  | this.$refs.resmodal.show = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (option.unBindQuantity > option.quantity) { | 
|---|
|  |  |  | this.rescode = 400; | 
|---|
|  |  |  | this.resmessage = "解绑数量不能大于库存数量"; | 
|---|
|  |  |  | this.$refs.resmodal.show = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (this.detailable) { | 
|---|
|  |  |  | let filterHas = this.singlist.filter( | 
|---|
|  |  |  | (item) => item.unBindQuantity == Number(item.quantity) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if (filterHas.length > 0) { | 
|---|
|  |  |  | this.warehouse.exitNumber = | 
|---|
|  |  |  | this.warehouse.useNumber - filterHas.length; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | //确认解绑 | 
|---|
|  |  |  | submit() { | 
|---|
|  |  |  | const filterArr = this.singlist.filter((item) => item.checked); | 
|---|
|  |  |  | if (filterArr.length <= 0) { | 
|---|
|  |  |  | this.rescode = 400; | 
|---|
|  |  |  | this.resmessage = "请选择解绑的物料!"; | 
|---|
|  |  |  | this.$refs.resmodal.show = true; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //判断选中的里面是否存在解绑的数量不符合规范的 | 
|---|
|  |  |  | // const index = filterArr.findIndex(item => item.unBindQuantity == '' || item.unBindQuantity <= 0 || item.unBindQuantity > item.quantity) | 
|---|
|  |  |  | // if (index > -1) { | 
|---|
|  |  |  | //    this.rescode = 400 | 
|---|
|  |  |  | //    this.resmessage = '解绑数量不符合要求' | 
|---|
|  |  |  | //    this.$refs.resmodal.show = true | 
|---|
|  |  |  | //    return | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | const warehousOrderDetails = filterArr.reduce((curr, item) => { | 
|---|
|  |  |  | curr.push({ | 
|---|
|  |  |  | ...item, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | return curr; | 
|---|
|  |  |  | }, []); | 
|---|
|  |  |  | const params = { | 
|---|
|  |  |  | flag: 3, //3:物料解绑 | 
|---|
|  |  |  | packageCode: this.warehouse.packageCode, | 
|---|
|  |  |  | orderDetails: warehousOrderDetails, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | uni.showModal({ | 
|---|
|  |  |  | title: "解绑", | 
|---|
|  |  |  | content: "是否确认解绑?", | 
|---|
|  |  |  | showCancel: true, | 
|---|
|  |  |  | cancelColor: "#333333", | 
|---|
|  |  |  | success: (res) => { | 
|---|
|  |  |  | if (res.confirm) { | 
|---|
|  |  |  | unbindOrder(params).then((res) => { | 
|---|
|  |  |  | this.rescode = 200; | 
|---|
|  |  |  | this.$refs.resmodal.show = true; | 
|---|
|  |  |  | this.resmessage = "解绑成功"; | 
|---|
|  |  |  | this.back(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else if (res.cancel) { | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | rest() {}, | 
|---|
|  |  |  | //检查容器栅格数 | 
|---|
|  |  |  | checkGrid() {}, | 
|---|
|  |  |  | //获取容器的信息 | 
|---|
|  |  |  | 
|---|
|  |  |  | if (param == 1) { | 
|---|
|  |  |  | this.warehouse.upi = ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (this.warehouse.packageCode == "") { | 
|---|
|  |  |  | if (!this.warehouse.packageCode) { | 
|---|
|  |  |  | uni.showToast({ | 
|---|
|  |  |  | title: "请扫容器编号", | 
|---|
|  |  |  | title: "请扫包装号", | 
|---|
|  |  |  | icon: "none", | 
|---|
|  |  |  | duration: 2000, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | 
|---|
|  |  |  | packageCode: this.warehouse.packageCode, | 
|---|
|  |  |  | upi: this.warehouse.upi, | 
|---|
|  |  |  | }).then((res) => { | 
|---|
|  |  |  | // //debugger | 
|---|
|  |  |  | const result = res.result; | 
|---|
|  |  |  | if (Array.isArray(result) && result.length == 0) { | 
|---|
|  |  |  | uni.showToast({ | 
|---|
|  |  |  | title: "数据不存在", | 
|---|
|  |  |  | title: "没有查到数据", | 
|---|
|  |  |  | icon: "none", | 
|---|
|  |  |  | duration: 2000, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | this.singlist = []; | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | // this.kwbhAllowed = true | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //容器编号入口 | 
|---|
|  |  |  | // if (param == 1) { | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | if (res.result && res.result.length == 1) { | 
|---|
|  |  |  | res.result[0].checked = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.singlist = res.result; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //物料入口 根据id 判断物料是否存在 | 
|---|
|  |  |  | // res.result.forEach(item => { | 
|---|
|  |  |  | //    let index = this.singlist.findIndex(v => v.upi == item.upi); | 
|---|
|  |  |  | //    if (index == -1) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //       this.singlist.unshift({ | 
|---|
|  |  |  | //          ...item | 
|---|
|  |  |  | //       }) | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  | this.singlist = result; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | onlyUpdateDutyCycleClick() { | 
|---|
|  |  |  | this.$refs.warehouseRef.setRules(this.warehouseRules); | 
|---|
|  |  |  | this.$refs.warehouseRef.validate((valid) => { | 
|---|
|  |  |  | if (valid) { | 
|---|
|  |  |  | //请求参数 | 
|---|
|  |  |  | let params = { | 
|---|
|  |  |  | warepackageCode: this.warehouse.packageCode, | 
|---|
|  |  |  | dutyCycle: this.warehouse.dutyCycle, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | uni.showModal({ | 
|---|
|  |  |  | title: "提示", | 
|---|
|  |  |  | content: "是否确认仅更新空间占比数据?", | 
|---|
|  |  |  | showCancel: true, | 
|---|
|  |  |  | cancelColor: "#333333", | 
|---|
|  |  |  | success: (res) => { | 
|---|
|  |  |  | if (res.confirm) { | 
|---|
|  |  |  | onlyUpdateDutyCycle(params).then((res) => { | 
|---|
|  |  |  | this.warhouseTph = this.warehouse.packageCode; | 
|---|
|  |  |  | this.rescode = res.code; | 
|---|
|  |  |  | this.resmessage = res.message; | 
|---|
|  |  |  | this.$refs.resmodal.show = true; | 
|---|
|  |  |  | this.rest(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else if (res.cancel) { | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | gridBtnClick() { | 
|---|
|  |  |  | this.gridable = !this.gridable; | 
|---|
|  |  |  | if (!this.gridable) { | 
|---|
|  |  |  | this.$nextTick(() => { | 
|---|
|  |  |  | this.gridFocus = true; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$nextTick(() => { | 
|---|
|  |  |  | this.gridFocus = false; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //全部取消 | 
|---|
|  |  |  | back() { | 
|---|
|  |  |  | this.ordersId = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | this.warehouse.packageCode = ""; | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | unmounted() { | 
|---|
|  |  |  | if (this.timer) { | 
|---|
|  |  |  | clearTimeout(this.timer); | 
|---|
|  |  |  | this.timer = null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | <style lang="scss"> | 
|---|