| | |
| | | XbarInfo: [], |
| | | DAA001: [], |
| | | DAANum: "", |
| | | ItemDetail: [], |
| | | xcslItemList: [], //材料列表 |
| | | xcslWjsBarList: [],//未接收列表 |
| | | xcslYjsBarList: [],//已接收列表 |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | }; |
| | | }, |
| | | methods: { |
| | | getKbBarInfo() { |
| | | GetItemsXcsl() { |
| | | var that = this; |
| | | that.isLoading = true; |
| | | that.AxiosHttp("post", 'Womdaa/getKbBarInfo', { |
| | | Xt: that.GX, |
| | | Kbbarcode: that.KbBar |
| | | }, false) |
| | | .then(function (res) { |
| | | var json = res; |
| | | if (json.status == 0) { |
| | | that.KbBarInfo = json.data.tbBillList.kbBarInfo[0]; |
| | | that.DAA001 = that.KbBarInfo.daA001; |
| | | that.KbBarMxInfo = json.data.tbBillList.kbBarMxInfo; |
| | | that.$refs.XBar.focus(); |
| | | that.XbarInfo = []; |
| | | that.XBar = ""; |
| | | } |
| | | else { |
| | | that.$toast.fail(json.message); |
| | | that.$refs.KbBar.focus(); |
| | | that.KbBar = ""; |
| | | } |
| | | that.isLoading = false; |
| | | }) |
| | | .catch(function (error) { |
| | | that.isLoading = false; |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | that.$refs.KbBar.focus(); |
| | | that.KbBar = ""; |
| | | }); |
| | | }, |
| | | getXBarInfo() { |
| | | var that = this; |
| | | if (that.KbBar.length <= 0) { |
| | | that.$toast.fail("卡板条码不能为空!"); |
| | | that.$refs.KbBar.focus(); |
| | | that.XBar = ""; |
| | | return; |
| | | } |
| | | |
| | | if (that.DAA001.length <= 0) { |
| | | that.$toast.fail("指令工单不能为空!"); |
| | | that.$refs.KbBar.focus(); |
| | | that.XBar = ""; |
| | | return; |
| | | } |
| | | |
| | | // 检查是否超过装箱数 |
| | | if (that.XbarInfo.length >= that.Xvalue) { |
| | | that.$toast.fail(`已达到装箱数限制(${that.Xvalue})`); |
| | | that.XBar = ""; |
| | | return; |
| | | } |
| | | |
| | | // 检查条码是否已存在 |
| | | const isExist = that.XbarInfo.some(item => item.iteM_BARCODE === that.XBar); |
| | | if (isExist) { |
| | | that.$toast.fail("该箱条码已存在,请勿重复扫描"); |
| | | that.XBar = ""; |
| | | that.$toast.fail("工单单号不能为空!"); |
| | | that.$refs.DAA001.focus(); |
| | | return; |
| | | } |
| | | |
| | | that.isLoading = true; |
| | | that.AxiosHttp("post", 'Womdaa/getXBarInfo', { |
| | | Kbbarcode: that.KbBar, |
| | | DAA001: that.DAA001, |
| | | Xbarcode: that.XBar |
| | | that.AxiosHttp("post", 'Womdaa/GetItemsXcsl', { |
| | | daa001: that.DAA001 |
| | | }, false) |
| | | .then(function (res) { |
| | | var json = res; |
| | | if (json.status == 0) { |
| | | that.XbarInfo.push(json.data.tbBillList.xBarInfo[0]); |
| | | that.$refs.XBar.focus(); |
| | | that.XBar = ""; |
| | | that.DAANum = json.data.tbBillList.gD_Num; |
| | | that.xcslItemList = json.data.tbBillList.xcslItemList; |
| | | that.xcslWjsBarList = json.data.tbBillList.xcslWjsBarList; |
| | | that.xcslYjsBarList = json.data.tbBillList.xcslYjsBarList; |
| | | that.$refs.Bar.focus(); |
| | | } |
| | | else { |
| | | that.$toast.fail(json.message); |
| | | that.$refs.DAA001.focus(); |
| | | that.DAA001 = ""; |
| | | } |
| | | that.isLoading = false; |
| | | }) |
| | |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | }); |
| | | }, |
| | | |
| | | |
| | | productBinding() { |
| | | var that = this; |
| | | if (that.ZsBar.length <= 0) { |
| | | that.$toast.fail("追溯码不能为空!"); |
| | | ScanXcsl() { |
| | | // 添加防抖判断 |
| | | if (this.isLoading) { |
| | | return; |
| | | } |
| | | if (that.LsBar.length <= 0) { |
| | | that.$toast.fail("后盖码不能为空!"); |
| | | |
| | | var that = this; |
| | | if (that.Bar.length <= 0) { |
| | | that.$toast.fail("物料条码不能为空!"); |
| | | that.$refs.Bar.focus(); |
| | | return; |
| | | } |
| | | |
| | | |
| | | if (that.DAA001.length <= 0) { |
| | | that.$toast.fail("工单单号不能为空!"); |
| | | that.$refs.DAA001.focus(); |
| | | return; |
| | | } |
| | | |
| | | that.isLoading = true; |
| | | that.AxiosHttp("post", 'Womdaa/ProductBinding', { |
| | | ZsBar: that.ZsBar, |
| | | LsBar: that.LsBar, |
| | | userName: that.userInfo.loginAccount, |
| | | that.AxiosHttp("post", 'Womdaa/ScanXcsl', { |
| | | DAA001: that.DAA001, |
| | | Bar: that.Bar, |
| | | userAccount: that.userInfo.loginAccount, |
| | | }, false) |
| | | .then(function (res) { |
| | | var json = res; |
| | | if (json.status == 0) { |
| | | // that.scanInfo = json.data.tbBillList; |
| | | that.$notify({ type: 'success', message: json.message }); |
| | | that.$refs.ZsBar.focus(); |
| | | that.ZsBar = null; |
| | | that.ZsBar = null; |
| | | that.GetItemsXcsl(); |
| | | } |
| | | else { |
| | | that.$toast.fail(json.message); |
| | | that.$refs.ZsBar.focus(); |
| | | that.ZsBar = null; |
| | | that.ZsBar = null; |
| | | } |
| | | |
| | | that.isLoading = false; |
| | | that.$refs.Bar.focus(); |
| | | that.Bar = ""; |
| | | }) |
| | | .catch(function (error) { |
| | | that.isLoading = false; |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | that.$refs.ZsBar.focus(); |
| | | that.ZsBar = null; |
| | | that.ZsBar = null; |
| | | }); |
| | | }, |
| | | //打印机注释 |
| | | //selectPrinter(printer) { |
| | | // this.selectedPrinter = printer.printerId; // 更新选中的打印机编号 |
| | | //}, |
| | | //confirmSelection() { |
| | | // if (this.selectedPrinter) { |
| | | // alert(`您选择了打印机:${this.selectedPrinter}`); |
| | | // // 在这里处理选择结果,例如调用接口或更新状态 |
| | | // this.isPrinterPopupVisible = false; // 关闭弹窗 |
| | | // } else { |
| | | // alert('请选择一个打印机!'); |
| | | // } |
| | | //}, |
| | | //onPrinterSelected(value) { |
| | | // console.log('当前选中的打印机编号:', value); |
| | | //}, |
| | | checkProductBarcode() { |
| | | var that = this; |
| | | if (!that.LsBar) { |
| | | that.$toast.fail("请输入产品条码"); |
| | | return; |
| | | } |
| | | |
| | | // 在XbarInfo中查找匹配的条码 |
| | | const matchedItem = that.XbarInfo.find(item => |
| | | item.iteM_BARCODE === that.LsBar |
| | | ); |
| | | |
| | | if (matchedItem) { |
| | | if (matchedItem.is_hedui === "1") { |
| | | that.$toast("已核对"); |
| | | } else { |
| | | that.$set(matchedItem, 'is_hedui', "1"); |
| | | that.$notify({ type: 'success', message: "核对成功" }); |
| | | that.LsBar = ""; |
| | | // 检查是否所有行都已核对 |
| | | const allChecked = that.XbarInfo.every(item => item.is_hedui === "1"); |
| | | if (allChecked && that.XbarInfo.length > 0) { |
| | | that.submitAllChecked(); |
| | | } |
| | | } |
| | | } else { |
| | | that.$toast.fail("未找到匹配的箱条码"); |
| | | } |
| | | |
| | | that.LsBar = ""; // 清空输入框 |
| | | }, |
| | | |
| | | // 新增方法:提交所有已核对的数据 |
| | | submitAllChecked() { |
| | | var that = this; |
| | | that.isLoading = true; |
| | | |
| | | that.AxiosHttp("post", 'Womdaa/submitAllChecked', { |
| | | XbarInfo: that.XbarInfo, |
| | | KbBar: that.KbBar, |
| | | userName: that.userInfo.loginAccount |
| | | }, false) |
| | | .then(function (res) { |
| | | var json = res; |
| | | if (json.status == 0) { |
| | | that.$notify({ type: 'success', message: json.message }); |
| | | that.getKbBarInfo(); |
| | | } else { |
| | | that.$toast.fail(json.message); |
| | | that.XbarInfo = []; |
| | | that.XBar = ""; |
| | | that.LsBar = ""; |
| | | that.$refs.XBar.focus(); |
| | | } |
| | | that.isLoading = false; |
| | | }) |
| | | .catch(function (error) { |
| | | that.isLoading = false; |
| | | that.$toast.fail("绑定失败,请重试!"); |
| | | }); |
| | | }, |
| | | handleSubmit() { |
| | | var that = this; |
| | | if (!that.KbBar) { |
| | | that.$toast.fail("请先扫描卡板条码"); |
| | | return; |
| | | } |
| | | |
| | | // 计算可装数和已装数 |
| | | const oldqty = +(that.KbBarInfo.oldqty || 0); |
| | | const ySum = +(that.KbBarInfo.ySum || 0); |
| | | |
| | | if (oldqty !== ySum) { |
| | | that.$toast.fail(`装板未完成,待装数:${oldqty - ySum}`); |
| | | return; |
| | | } |
| | | |
| | | that.isLoading = true; |
| | | that.AxiosHttp("post", 'Womdaa/submitInspection', { |
| | | KbBar: that.KbBar, |
| | | userAccount: that.userInfo.loginAccount |
| | | }, false) |
| | | .then(function (res) { |
| | | var json = res; |
| | | if (json.status == 0) { |
| | | that.$notify({ type: 'success', message: json.tbBillList.message }); |
| | | // 清空数据 |
| | | that.KbBar = ""; |
| | | that.XbarInfo = []; |
| | | that.KbBarInfo = []; |
| | | that.$refs.KbBar.focus(); |
| | | } else { |
| | | that.$toast.fail(json.message); |
| | | } |
| | | that.isLoading = false; |
| | | }) |
| | | .catch(function (error) { |
| | | that.isLoading = false; |
| | | that.$toast.fail("提交失败,请重试!"); |
| | | that.$refs.KbBar.focus(); |
| | | }); |
| | | }, |
| | | } |