diff --git a/src/api/inout/order.js b/src/api/inout/order.js index 8fb9701b..1cd25b18 100644 --- a/src/api/inout/order.js +++ b/src/api/inout/order.js @@ -25,6 +25,17 @@ export function deleteCodesTempById(query) { }); } + + +export function deleteCodesTempByCodes(query) { + return axios({ + url: "warehouse/inout/deleteCodesTempBycodes", + method: "post", + data: query + }); +} + + export function submitOrderWeb(query) { return axios({ url: "/warehouse/inout/submitOrderWeb", diff --git a/src/views/basic/product/productUdiType.vue b/src/views/basic/product/productUdiType.vue index ac7e713f..0d6ddbf1 100644 --- a/src/views/basic/product/productUdiType.vue +++ b/src/views/basic/product/productUdiType.vue @@ -29,14 +29,23 @@ - + + + + + + + + diff --git a/src/views/basic/product/udIInfoSelect.vue b/src/views/basic/product/udIInfoSelect.vue index 12bdf4da..85a8d2fc 100644 --- a/src/views/basic/product/udIInfoSelect.vue +++ b/src/views/basic/product/udIInfoSelect.vue @@ -1,584 +1,669 @@ diff --git a/src/views/collect/IoCreateOrder.vue b/src/views/collect/IoCreateOrder.vue index 11d6f3a7..0902c751 100644 --- a/src/views/collect/IoCreateOrder.vue +++ b/src/views/collect/IoCreateOrder.vue @@ -14,6 +14,16 @@ + 扫码剔除 + + 结束剔除 + 选入已完成单据 @@ -169,7 +179,7 @@ - + + :description="result" + v-if="successVisible" + > + :description="warnResult" + > + :description="errResult" + >
@@ -270,6 +284,7 @@ { - this.curInvOptions = response.data || []; + this.curInvOptions = response.data || [] if ( this.curInvOptions != null && this.curInvOptions.length > 0 && this.orderFormData.invWarehouseCode == null ) { //this.orderFormData.invCode = this.curInvOptions[0].code; - this.getBusTypeByInv(); - this.findCurSpaceList(this.orderFormData.invCode); - this.findCurWorkPlaces(); + this.getBusTypeByInv() + this.findCurSpaceList(this.orderFormData.invCode) + this.findCurWorkPlaces() } }) .catch(() => { - }); + }) }, defaultSplitType() { - this.curWorkPlace = this.curWorkPlaces.find(item => item.workplaceId == this.orderFormData.workPlaceCode); + this.curWorkPlace = this.curWorkPlaces.find(item => item.workplaceId == this.orderFormData.workPlaceCode) this.orderFormData.fifoSplit = this.curWorkPlace.workplaceType if (this.curWorkPlace.workplaceType == 1 || this.curWorkPlace.workplaceType == 2) { - this.fifoSplitEnable = true; + this.fifoSplitEnable = true } else { - this.orderFormData.fifoSplit = 1; - this.fifoSplitEnable = false; + this.orderFormData.fifoSplit = 1 + this.fifoSplitEnable = false } }, //仓库改变 changeInv(row) { - this.orderFormData.action = null; - this.orderFormData.checkPreInOrders = null; - this.checkPreInArray = []; + this.orderFormData.action = null + this.orderFormData.checkPreInOrders = null + this.checkPreInArray = [] if (this.documentShow) { - this.documentShow = false; + this.documentShow = false } - this.curSpaceShow = false; - this.preInSpaceShow = false; - this.preSpaceShow = false; - this.orderFormData.curSpaceCode = false; - this.orderFormData.checkPreInSpaceCode = false; - this.orderFormData.preCurSpaceCode = false; - this.getBusTypeByInv(); - this.findCurSpaceList(row); + this.curSpaceShow = false + this.preInSpaceShow = false + this.preSpaceShow = false + this.orderFormData.curSpaceCode = false + this.orderFormData.checkPreInSpaceCode = false + this.orderFormData.preCurSpaceCode = false + this.getBusTypeByInv() + this.findCurSpaceList(row) this.orderFormData.workPlaceCode = null - this.findCurWorkPlaces(); + this.findCurWorkPlaces() }, //根据仓库,用户获取单据类型 getBusTypeByInv() { let query = { code: this.orderFormData.invCode, - editType: 2, //可编辑 - }; + editType: 2 //可编辑 + } if (this.viewTypeKsck) { query = { code: this.orderFormData.invCode, editType: 2, //可编辑 useDyCount: 2 //可编辑 - }; + } } findByInvUser(query) .then((response) => { - this.busTypeOptions = response.data || []; - if (this.splitBusType != null) - this.orderFormData.action = this.splitBusType; - else if (this.busTypeOptions.length == 1) { - this.orderFormData.action = this.busTypeOptions[0].action; + this.busTypeOptions = response.data || [] + if (this.splitBusType != null) { + this.orderFormData.action = this.splitBusType + } else if (this.busTypeOptions.length == 1) { + this.orderFormData.action = this.busTypeOptions[0].action this.actionChange(this.orderFormData.action) } }) .catch(() => { - }); + }) }, //关闭预选单弹框 closeDialogtwo() { - this.selectorder = false; + this.selectorder = false }, initBusType() { let query = { - action: this.orderFormData.action, - }; + action: this.orderFormData.action + } getBusTypeList(query) .then((response) => { - this.busTypeOptions = response.data.list || []; - this.curAction = this.getActionItem(this.orderFormData.action); + this.busTypeOptions = response.data.list || [] + this.curAction = this.getActionItem(this.orderFormData.action) if (isBlank(this.curAction)) { this.curAction = { @@ -781,83 +809,85 @@ export default { this.curAction.checkBalance)) || this.viewType == 1 ) { - this.bizShow = true; - } else this.bizShow = false; + this.bizShow = true + } else { + this.bizShow = false + } }) .catch(() => { - }); + }) }, delorderData() { //执行清空业务单据详情 let tQuery = Object.assign( JSON.parse(JSON.stringify(this.orderFormData)) - ); - tQuery.orderId = this.orderFormData.billNo; - console.log(tQuery.orderId); + ) + tQuery.orderId = this.orderFormData.billNo + console.log(tQuery.orderId) delmitBiz(tQuery).then((response) => { if (response.code === 20000) { // this.$message.success("成功"); - const codeDetailComponent = this.$refs.IoCreateOrderCodeDetail.getOrderDetails(); + const codeDetailComponent = this.$refs.IoCreateOrderCodeDetail.getOrderDetails() if (this.closeDialog != undefined) { - this.closeDialog(); + this.closeDialog() } - this.clearOrder(); + this.clearOrder() } else { // this.$message.error(response.message); - const codeDetailComponent = this.$refs.IoCreateOrderCodeDetail.getOrderDetails(); + const codeDetailComponent = this.$refs.IoCreateOrderCodeDetail.getOrderDetails() } - }); - const codeDetailComponent = this.$refs.IoCreateOrderCodeDetail.getOrderDetails(); - console.log("66:" + codeDetailComponent); + }) + const codeDetailComponent = this.$refs.IoCreateOrderCodeDetail.getOrderDetails() + console.log('66:' + codeDetailComponent) }, //获取往来单位候选列表 findMethod(query) { - this.fromOptions = []; + this.fromOptions = [] let cQuery = { key: query, corpType: null, outType: null, page: 1, - limit: 20, - }; + limit: 20 + } if (this.curAction.corpType == 3) { //内部科室 - cQuery.corpType = 3; + cQuery.corpType = 3 } else if (this.curAction.corpType == 2) { //供应商信息 - cQuery.corpType = 2; + cQuery.corpType = 2 } else if (this.curAction.corpType == 0) { - cQuery.corpType = 2; + cQuery.corpType = 2 } else if (this.curAction.corpType == 1) { - cQuery.corpType = 1; - cQuery.outType = 2; + cQuery.corpType = 1 + cQuery.outType = 2 } else if (this.curAction.corpType == 4) { //供应商信息 - cQuery.corpType = 4; - } else - return; + cQuery.corpType = 4 + } else { + return + } getBasicUnitMaintains(cQuery) .then((response) => { - this.loading = false; - this.fromOptions = response.data.list || []; + this.loading = false + this.fromOptions = response.data.list || [] }) .catch(() => { - this.loading = false; - }); + this.loading = false + }) }, - findSickMethod(key) { let sickQuery = { page: 1, limit: 10, - key: key, - }; + key: key + } filterNoPage(sickQuery).then(res => { this.fromSickOptions = res.data.list || [] }).catch(() => { - }); + }) }, remoteFindSickMethod(e) { @@ -865,28 +895,27 @@ export default { let sickQuery = { page: 1, limit: 10, - adNum: e.target.value, - }; + adNum: e.target.value + } remoteFilter(sickQuery).then(res => { this.fromSickOptions = res.data.list || [] }).catch(() => { - }); + }) }, - //单据类型改变 actionChange(item) { - this.orderFormData.checkPreInOption = null; + this.orderFormData.checkPreInOption = null if (!this.viewTypeKsck) { - this.orderFormData.checkPreInOrders = null; - this.checkPreInArray = []; + this.orderFormData.checkPreInOrders = null + this.checkPreInArray = [] } - this.curAction = this.getActionItem(item); + this.curAction = this.getActionItem(item) if ((this.curAction.checkEnable && this.curAction.checkWebNew != 0) || this.viewType == 1) { //单据类型需要一次校验 或 单据类型为1,显示业务单据页面 - this.bizShow = true; + this.bizShow = true } else { - this.bizShow = false; + this.bizShow = false } if ( this.curAction.corpType == 0 || @@ -895,145 +924,143 @@ export default { (this.curAction.corpType == 1 && !this.curAction.genUnit) ) { //1.切换往来单位 - this.orderFormData.fromCorp = null; + this.orderFormData.fromCorp = null - this.delorderData(); + this.delorderData() - this.findMethod(); + this.findMethod() } else if (this.curAction.corpType == 3) { //2. 切换往来仓库 - this.orderFormData.fromInvCode = null; - this.findFromInvList(); + this.orderFormData.fromInvCode = null + this.findFromInvList() } if (this.curAction.scanPreIn && this.curAction.backPreinType == 1 && this.curAction.preInBack) { - this.documentShow = true; + this.documentShow = true } else if (this.curAction.scanPreIn && this.curAction.backPreinType == 2 && this.curAction.preInBack) { - this.preInSpaceShow = true; - this.findPreInInvList(); + this.preInSpaceShow = true + this.findPreInInvList() } else { - this.documentShow = false; - this.preInSpaceShow = false; + this.documentShow = false + this.preInSpaceShow = false } if (this.curAction.vailPrescribe != null && this.curAction.vailPrescribe) { - this.viewSickVisible = true; + this.viewSickVisible = true } else { - this.viewSickVisible = false; + this.viewSickVisible = false } if (this.curAction.scanPreIn && this.curAction.spaceOut == 1) { - this.preInSpaceShow = true; - this.curSpaceShow = false; - this.preSpaceShow = false; - this.orderFormData.curSpaceCode = null; - this.orderFormData.checkPreInSpaceCode = null; - this.orderFormData.preCurSpaceCode = null; - this.findPreInSpaceList(); + this.preInSpaceShow = true + this.curSpaceShow = false + this.preSpaceShow = false + this.orderFormData.curSpaceCode = null + this.orderFormData.checkPreInSpaceCode = null + this.orderFormData.preCurSpaceCode = null + this.findPreInSpaceList() } else if (this.curAction.advancePreIn && this.curAction.spaceOut == 1) { - this.preInSpaceShow = false; - this.curSpaceShow = false; - this.preSpaceShow = true; - this.orderFormData.curSpaceCode = null; - this.orderFormData.checkPreInSpaceCode = null; - this.orderFormData.preCurSpaceCode = null; + this.preInSpaceShow = false + this.curSpaceShow = false + this.preSpaceShow = true + this.orderFormData.curSpaceCode = null + this.orderFormData.checkPreInSpaceCode = null + this.orderFormData.preCurSpaceCode = null this.findPreSpaceList() } else if (this.curAction.spaceOut == 1) { - this.curSpaceShow = true; - this.preInSpaceShow = false; - this.preSpaceShow = false; - this.orderFormData.curSpaceCode = null; - this.orderFormData.checkPreInSpaceCode = null; - this.orderFormData.preCurSpaceCode = null; + this.curSpaceShow = true + this.preInSpaceShow = false + this.preSpaceShow = false + this.orderFormData.curSpaceCode = null + this.orderFormData.checkPreInSpaceCode = null + this.orderFormData.preCurSpaceCode = null } else { - this.curSpaceShow = false; - this.preInSpaceShow = false; - this.preSpaceShow = false; - this.orderFormData.curSpaceCode = null; - this.orderFormData.checkPreInSpaceCode = null; - this.orderFormData.preCurSpaceCode = null; + this.curSpaceShow = false + this.preInSpaceShow = false + this.preSpaceShow = false + this.orderFormData.curSpaceCode = null + this.orderFormData.checkPreInSpaceCode = null + this.orderFormData.preCurSpaceCode = null } }, //获取往来仓库列表 findFromInvList(val) { let cQuery = { - locInvCode: this.orderFormData.invCode, - }; + locInvCode: this.orderFormData.invCode + } findByFrom(cQuery) .then((response) => { - this.fromInvOptions = response.data || []; + this.fromInvOptions = response.data || [] if (val == 1) { - this.orderFormData.fromInvCode = this.fromInvOptions[0].code; + this.orderFormData.fromInvCode = this.fromInvOptions[0].code } }) .catch(() => { - }); + }) }, //获取当前单据类型 getActionItem(action) { for (let i = 0; i < this.busTypeOptions.length; i++) { if (this.busTypeOptions[i].action == action) { - return this.busTypeOptions[i]; + return this.busTypeOptions[i] } } }, //切换预验收仓库 changePreInInv(row) { - this.orderFormData.checkPreInSpaceCode = null; - this.findPreInSpaceList(row.code); + this.orderFormData.checkPreInSpaceCode = null + this.findPreInSpaceList(row.code) }, //获取预验收仓库 findPreInInvList(val) { let query = { advanceType: 2, - code: this.orderFormData.checkPreInInvCode, + code: this.orderFormData.checkPreInInvCode } filterSubAll(query) .then((response) => { - this.curPreInInvOptions = response.data || []; + this.curPreInInvOptions = response.data || [] }) .catch(() => { - }); + }) }, //获取预验收货位 findPreInSpaceList(val) { let query = { - filterType: "preIn", + filterType: 'preIn', status: 1, - code: this.orderFormData.checkPreInSpaceCode, + code: this.orderFormData.checkPreInSpaceCode } getInvSpaceList(query).then((res) => { - this.curPreInSpaceOptions = res.data.list || []; + this.curPreInSpaceOptions = res.data.list || [] }) }, - //获取寄售 findPreSpaceList(val) { let query = { - filterType: "pre", + filterType: 'pre', status: 1, - code: this.orderFormData.preSpaceCode, + code: this.orderFormData.preSpaceCode } getInvSpaceList(query).then((res) => { - this.curPreSpaceOptions = res.data.list || []; + this.curPreSpaceOptions = res.data.list || [] }) }, - //获取当前货位 findCurSpaceList(val) { let query = { invWarehouseCode: val, status: 1, - code: this.orderFormData.curSpaceCode, + code: this.orderFormData.curSpaceCode } getInvSpaceList(query).then((res) => { - this.curSpaceOptions = res.data.list || []; + this.curSpaceOptions = res.data.list || [] }) }, @@ -1063,181 +1090,180 @@ export default { } filterWorkOptimize(query) .then((response) => { - this.loading = false; - this.curWorkPlaces = response.data || []; + this.loading = false + this.curWorkPlaces = response.data || [] }) .catch(() => { - this.loading = false; - this.curWorkPlaces = []; - }); + this.loading = false + this.curWorkPlaces = [] + }) }, - addInvProduct() { - this.invQueryData.invCode = this.orderFormData.invCode; - this.selectInvProductVisible = true; + this.invQueryData.invCode = this.orderFormData.invCode + this.selectInvProductVisible = true }, closeDialogC2(rData) { - this.selectInvProductVisible = false; + this.selectInvProductVisible = false if (this.$isNotBlank(rData)) { - this.codeFormData.code = rData; - this.addCode(); + this.codeFormData.code = rData + this.addCode() // this.codeFormData.code = null; } // this.refreshCodesPanel() }, - //添加条码 addCode() { if (this.$isBlank(this.orderFormData.workPlaceCode)) { - this.$message.warning("请选择工位!"); - return; - } - this.originCode = ""; - this.sictomText = ""; - this.codeFormData.batchNo = ""; - this.codeFormData.produceDate = ""; - this.codeFormData.expireDate = ""; - this.codeFormData.serialNo = ""; - this.actionEnable = true; - this.$refs.inputRef.select(); + this.$message.warning('请选择工位!') + return + } + this.originCode = '' + this.sictomText = '' + this.codeFormData.batchNo = '' + this.codeFormData.produceDate = '' + this.codeFormData.expireDate = '' + this.codeFormData.serialNo = '' + this.actionEnable = true + this.$refs.inputRef.select() if (this.$isBlank(this.codeFormData.code)) { - this.codeFormData.code = this.scanCode.trim(); - return; + this.codeFormData.code = this.scanCode.trim() + return } if (this.$isBlank(this.codeFormData.code) && this.$isBlank(this.scanCode)) { - return; + return } if (this.$isBlank(this.orderFormData.action)) { - this.$message.warning("请选择单据类型!"); - return; + this.$message.warning('请选择单据类型!') + return } if (this.splitBusType != null) { - this.orderFormData.fromCorp = "72198012799726"; + this.orderFormData.fromCorp = '72198012799726' } if (this.curAction.corpType === 0 || this.curAction.corpType === 2 || (this.curAction.corpType === 1 && !this.curAction.genUnit)) { if (this.$isBlank(this.orderFormData.fromCorp) && this.$isBlank(this.orderFormData.sickerAdNum)) { - this.$message.warning("请选择往来单位!"); - return; + this.$message.warning('请选择往来单位!') + return } } if (this.curAction.corpType == 3) { if (this.$isBlank(this.orderFormData.fromInvCode)) { - this.$message.warning("请选择往来仓库!"); - return; + this.$message.warning('请选择往来仓库!') + return } } if (this.curAction.corpType === 1 && this.curAction.genUnit) { if (this.$isBlank(this.orderFormData.fromCorp) && this.$isBlank(this.orderFormData.sickerAdNum)) { - this.$message.warning("请输入患者信息!"); - return; + this.$message.warning('请输入患者信息!') + return } } if (this.curSpaceShow) { if (this.$isBlank(this.orderFormData.curSpaceCode)) { - this.$message.warning("请选择当前货位!"); - return; + this.$message.warning('请选择当前货位!') + return } } if (this.preInSpaceShow) { if (this.$isBlank(this.orderFormData.checkPreInSpaceCode)) { - this.$message.warning("请选择预验收出库货位!"); - return; + this.$message.warning('请选择预验收出库货位!') + return } } if (this.preSpaceShow) { if (this.$isBlank(this.orderFormData.preCurSpaceCode)) { - this.$message.warning("请选择寄售出库货位!"); - return; + this.$message.warning('请选择寄售出库货位!') + return } } if (this.checkPreInArray != null) { - this.orderFormData.checkPreInOrders = this.checkPreInArray.join(","); + this.orderFormData.checkPreInOrders = this.checkPreInArray.join(',') } if (this.$isBlank(this.orderFormData.corpOrderId)) { - let date = new Date(); + let date = new Date() this.orderFormData.corpOrderId = - parseTime(date, "{y}{m}{d}{h}{i}{s}") + - Math.ceil(Math.random() * 89 + 10); + parseTime(date, '{y}{m}{d}{h}{i}{s}') + + Math.ceil(Math.random() * 89 + 10) } // this.loading = true; // this.warnResult = ""; // this.errResult = ""; // this.result = ""; - this.warnVisible = false; - this.errVisible = false; + this.warnVisible = false + this.errVisible = false - this.checkSuccess = true; - if (this.getDMHotskeyValue(this.scanCode)) + this.checkSuccess = true + if (this.getDMHotskeyValue(this.scanCode)) { return - if (this.codeFormData.code.includes(";")) { - const codeArray = this.codeFormData.code.split(";"); + } + if (this.codeFormData.code.includes(';')) { + const codeArray = this.codeFormData.code.split(';') let params = { - codeList: codeArray, - }; + codeList: codeArray + } this.batchVailCode(params) - return; + return } let tQuery = Object.assign( JSON.parse(JSON.stringify(this.orderFormData)) - ); - tQuery.code = this.codeFormData.code; - tQuery.orderType = 2; - tQuery.splitType = this.splitType; - this.addCodeSubmit(tQuery); - this.$refs.inputRef.select(); + ) + tQuery.code = this.codeFormData.code + tQuery.orderType = 2 + tQuery.splitType = this.splitType + this.addCodeSubmit(tQuery) + this.$refs.inputRef.select() }, repeatAddCode(editData) { let tQuery = Object.assign( JSON.parse(JSON.stringify(this.orderFormData)) - ); - tQuery.code = this.codeFormData.code; - tQuery.orderType = this.viewType; + ) + tQuery.code = this.codeFormData.code + tQuery.orderType = this.viewType - tQuery.batchNo = editData.batchNo; - tQuery.produceDate = editData.produceDate; - tQuery.expireDate = editData.expireDate; - tQuery.serialNo = editData.serialNo; + tQuery.batchNo = editData.batchNo + tQuery.produceDate = editData.produceDate + tQuery.expireDate = editData.expireDate + tQuery.serialNo = editData.serialNo - this.closeCodeDialog(); - this.addCodeSubmit(tQuery); + this.closeCodeDialog() + this.addCodeSubmit(tQuery) }, //添加条码后提交 addCodeSubmit(tQuery) { addOrderWeb(tQuery).then((response) => { if (response.code === 20000) { - this.orderFormData.billNo = response.data.orderId; + this.orderFormData.billNo = response.data.orderId if (response.data.errMsg != null) { - this.$alert(response.data.errMsg, "提示", { - confirmButtonText: "确定", - type: "warning", + this.$alert(response.data.errMsg, '提示', { + confirmButtonText: '确定', + type: 'warning', closeOnClickModal: true, callback: (action) => { - }, - }); + } + }) } - this.corpOrderIdDisabled = true; - this.refreshCodesPanel(); - this.$refs.inputRef.focus(); - this.$refs.inputRef.select(); - this.orderFormData.relId = null; + this.corpOrderIdDisabled = true + this.refreshCodesPanel() + this.$refs.inputRef.focus() + this.$refs.inputRef.select() + this.orderFormData.relId = null } else { if (response.code == 502) { //该产品绑定多个产品ID处理 - this.curRow = response.data; - this.orderFormData.billNo = this.curRow.orderId; - this.refreshCodesPanel(); - this.$message.error(response.message); - this.selectRlTitle = response.message; + this.curRow = response.data + this.orderFormData.billNo = this.curRow.orderId + this.refreshCodesPanel() + this.$message.error(response.message) + this.selectRlTitle = response.message //判断是出库需要选择供应商的时候把供应商值传过去 if (tQuery.selectSupId != null) { this.codeFormData.selectSupId = tQuery.selectSupId @@ -1245,175 +1271,176 @@ export default { this.codeFormData.selectSupId = false } //DI绑定多个产品,请指定对应产品 时候传递关键字做过滤 - this.codeFormData.key = "key"; - this.selectRlVisible = true; + this.codeFormData.key = 'key' + this.selectRlVisible = true } else if (response.code == 503) { //该产品绑定多个供应商处理 - this.curRow = response.data; - this.orderFormData.billNo = this.curRow.orderId; - this.codeFormData.relId = this.curRow.relId; - this.refreshCodesPanel(); - this.selectUnitTitle = response.message; - this.$message.error(response.message); - this.dialogTableVisible = true; + this.curRow = response.data + this.orderFormData.billNo = this.curRow.orderId + this.codeFormData.relId = this.curRow.relId + this.refreshCodesPanel() + this.selectUnitTitle = response.message + this.$message.error(response.message) + this.dialogTableVisible = true } else if (response.code == 504) { - this.$confirm(response.message, "提示", { - confirmButtonText: "确定", - cancelButtonText: "忽略", - type: "error", + this.$confirm(response.message, '提示', { + confirmButtonText: '确定', + cancelButtonText: '忽略', + type: 'error' }) .then(() => { - tQuery.ignoreExpire = true; - this.addCodeSubmit(tQuery); + tQuery.ignoreExpire = true + this.addCodeSubmit(tQuery) }) .catch(() => { - }); + }) } else if (response.code == 505) { - this.$confirm(response.message, "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", + this.$confirm(response.message, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' }) .then(() => { - tQuery.ignoreRecentExpire = true; - this.addCodeSubmit(tQuery); + tQuery.ignoreRecentExpire = true + this.addCodeSubmit(tQuery) }) .catch(() => { - }); + }) } else if (response.code == 605) { - this.$confirm(response.message, "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", + this.$confirm(response.message, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' }) .then(() => { }) .catch(() => { - }); - return; + }) + return } else if (response.code == 604) { - this.$confirm(response.message, "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", + this.$confirm(response.message, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' }) .then(() => { }) .catch(() => { - }); - return; + }) + return } else if (response.code == 507) { - this.editOriginCodeVisible = true; - this.editTitle = response.message; - this.codeFormData.produceDate = response.data.produceDate; - this.codeFormData.expireDate = response.data.expireDate; - this.codeFormData.batchNo = response.data.batchNo; - this.codeFormData.serialNo = response.data.serialNo; - this.codeFormData.corpOrderId = this.orderFormData.corpOrderId; + this.editOriginCodeVisible = true + this.editTitle = response.message + this.codeFormData.produceDate = response.data.produceDate + this.codeFormData.expireDate = response.data.expireDate + this.codeFormData.batchNo = response.data.batchNo + this.codeFormData.serialNo = response.data.serialNo + this.codeFormData.corpOrderId = this.orderFormData.corpOrderId this.$message({ - type: "error", - message: "提交失败!" + this.editTitle, - customClass: "messageIndex", - }); + type: 'error', + message: '提交失败!' + this.editTitle, + customClass: 'messageIndex' + }) } else if (response.code == 511) { //该UDI码绑定多个货位处理 - this.spaceCodeList = response.data; - this.selectSpaceVisible = true; + this.spaceCodeList = response.data + this.selectSpaceVisible = true } else { - this.$alert(response.message, "提示", { - confirmButtonText: "确定", - type: "warning", + this.$alert(response.message, '提示', { + confirmButtonText: '确定', + type: 'warning', closeOnClickModal: true, callback: (action) => { - this.$refs.inputRef.focus(); - this.$refs.inputRef.select(); - }, - }); + this.$refs.inputRef.focus() + this.$refs.inputRef.select() + } + }) } } // this.loading = false; - }); + }) }, refreshCodesPanel() { // this.warnResult = ""; // this.errResult = ""; // this.result = ""; - this.warnVisible = false; - this.errVisible = false; + this.warnVisible = false + this.errVisible = false - this.isCodeAlive = false; - this.isBizDetailAlive = false; - this.isCodeDetailAlive = false; - this.isSickerAlive = false; + this.isCodeAlive = false + this.isBizDetailAlive = false + this.isCodeDetailAlive = false + this.isSickerAlive = false this.$nextTick(() => { //重新加载组件 - this.isCodeAlive = true; - this.isBizDetailAlive = true; - this.isCodeDetailAlive = true; - this.isSickerAlive = true; + this.scanDeleteType = false + this.isCodeAlive = true + this.isBizDetailAlive = true + this.isCodeDetailAlive = true + this.isSickerAlive = true - }); + }) //选择性刷新 if (this.isCheckResultAlive) { - this.isCheckResultAlive = false; + this.isCheckResultAlive = false this.$nextTick(() => { //重新加载组件 - this.isCheckResultAlive = true; - }); + this.isCheckResultAlive = true + }) } }, //判断详情是否为空 为空清除billNo clearBillNo(data) { if (data) { - this.orderFormData.billNo = null; + this.orderFormData.billNo = null } }, refreshOrder(orderQuery) { - this.orderFormData = orderQuery; - this.scanCode = ""; - this.result = ""; + this.orderFormData = orderQuery + this.scanCode = '' + this.result = '' this.refreshCodesPanel() - this.init(); + this.init() }, //撤回单据 revokeBill() { - this.$confirm("是否确定撤回单据至草稿状态?", "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", + this.$confirm('是否确定撤回单据至草稿状态?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' }) .then(() => { - let query = {billNo: this.orderFormData.billNo}; + let query = { billNo: this.orderFormData.billNo } this.retractLoading = true rollbackWaitcheck(query) .then((response) => { this.retractLoading = false if (response.code == 20000) { - this.$message.success("撤回成功!"); + this.$message.success('撤回成功!') if (this.closeDialog != undefined) { - this.closeDialog(); + this.closeDialog() } } else { - this.$message.error(response.message); + this.$message.error(response.message) } }) .catch(() => { this.retractLoading = false - }); + }) }) .catch(() => { - }); + }) }, hideSearch() { - this.showSearch = !this.showSearch; + this.showSearch = !this.showSearch }, submitCheckDialog() { - this.checkTipDialogVisible = true; + this.checkTipDialogVisible = true }, //待校验以扫码结果为准 @@ -1421,14 +1448,14 @@ export default { submitCodeResult(query).then((response) => { this.codeLoading = false if (response.code === 20000) { - this.$message.success("提交成功"); + this.$message.success('提交成功') if (this.closeDialog != undefined) { - this.closeDialog(); + this.closeDialog() } } else { - this.$message.error(response.message); + this.$message.error(response.message) } - }); + }) }, //待校验以正确结果为准 @@ -1436,46 +1463,45 @@ export default { submitCheckResult(query).then((response) => { this.checkLoading = false if (response.code === 20000) { - this.$message.success("提交成功"); + this.$message.success('提交成功') if (this.closeDialog != undefined) { - this.closeDialog(); + this.closeDialog() } } else { - this.$message.error(response.message); + this.$message.error(response.message) } - }); + }) }, - submit(val) { if (this.$isBlank(this.orderFormData.action)) { - this.$message.warning("单据类型不能为空!"); + this.$message.warning('单据类型不能为空!') return } if (this.curAction.corpType === 0 || this.curAction.corpType === 2 || (this.curAction.corpType === 1 && !this.curAction.genUnit)) { if (this.$isBlank(this.orderFormData.fromCorp) && this.$isBlank(this.orderFormData.sickerAdNum)) { - this.$message.warning("请选择往来单位!"); - return; + this.$message.warning('请选择往来单位!') + return } } if (this.curAction.corpType == 3) { if (this.$isBlank(this.orderFormData.fromInvCode)) { - this.$message.warning("请选择往来单位!"); - return; + this.$message.warning('请选择往来单位!') + return } } if (this.curAction.corpType === 1 && this.curAction.genUnit) { if (this.$isBlank(this.orderFormData.fromCorp) && this.$isBlank(this.orderFormData.sickerAdNum)) { - this.$message.warning("请选择往来单位!"); - return; + this.$message.warning('请选择往来单位!') + return } } let tQuery = Object.assign( JSON.parse(JSON.stringify(this.orderFormData)) - ); - tQuery.orderId = this.orderFormData.billNo; + ) + tQuery.orderId = this.orderFormData.billNo tQuery.productType = 1 - console.log(tQuery.orderId); + console.log(tQuery.orderId) if (val == 1) { //校验btn this.checkLoading = true @@ -1497,21 +1523,22 @@ export default { this.submitLoading = false } if (response.code === 20000) { - this.$message.success("提交成功,等待处理,请刷新后查看!"); + this.$message.success('提交成功,等待处理,请刷新后查看!') this.successCloseData() console.log(this.closeDialog()) if (this.closeDialog != undefined) { - this.closeDialog(); + this.closeDialog() } } else { - this.$message.error(response.message); + this.$message.error(response.message) } - }); + }) } else if (this.viewType == 1) { //业务单据提交提交 - if (val == 1 || this.curAction.checkWebNew == 2) - tQuery.fromVailPi = 2; - else - tQuery.fromVailPi = 1; + if (val == 1 || this.curAction.checkWebNew == 2) { + tQuery.fromVailPi = 2 + } else { + tQuery.fromVailPi = 1 + } submitBiz(tQuery).then((response) => { if (val == 1) { //校验btn @@ -1523,15 +1550,15 @@ export default { this.submitLoading = false } if (response.code === 20000) { - this.$message.success("提交成功"); + this.$message.success('提交成功') this.successCloseData() if (this.closeDialog != undefined) { - this.closeDialog(); + this.closeDialog() } } else { - this.$message.error(response.message); + this.$message.error(response.message) } - }); + }) } else if (this.viewType == 4) { submitAllocateBiz(tQuery).then((response) => { if (val == 1) { @@ -1545,80 +1572,97 @@ export default { } if (response.code === 20000) { - this.$message.success("提交成功"); + this.$message.success('提交成功') this.successCloseData() if (this.closeDialog != undefined) { - this.closeDialog(); + this.closeDialog() } } else { - this.$message.error(response.message); + this.$message.error(response.message) } - }); + }) } else if (this.viewType == 7) { //待校验提交 if (val == 1) { - this.$confirm("此操作将以校验的正确结果重新生成业务单并提交,是否继续?", "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", + this.$confirm('此操作将以校验的正确结果重新生成业务单并提交,是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' }) .then(() => { this.checkLoading = true - this.submitCheckResult(tQuery); + this.submitCheckResult(tQuery) }) .catch(() => { this.this.checkLoading = false - }); + }) } else { - this.$confirm("此操作将以扫码结果重新生成业务单并提交,是否继续?", "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", + this.$confirm('此操作将以扫码结果重新生成业务单并提交,是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' }) .then(() => { this.codeLoading = true - this.submitCodeResult(tQuery); + this.submitCodeResult(tQuery) }) .catch(() => { this.codeLoading = false - }); + }) } } else { //配货拣货后后提交 submitOrderWeb(tQuery).then((response) => { this.submitLoading = false if (response.code === 20000) { - this.$message.success("提交成功"); + this.$message.success('提交成功') this.successCloseData() - this.result = "" - this.$refs.inputRef.focus(); + this.result = '' + this.$refs.inputRef.focus() if (this.closeDialog != undefined) { - this.closeDialog(); + this.closeDialog() } } else { - this.$message.error(response.message); + this.$message.error(response.message) } - }); + }) } - this.$refs.inputRef.focus(); + this.$refs.inputRef.focus() }, //选择单据 selectPrescribe() { if (this.$route.query.busType != null) { this.orderFormData.busType = this.$route.query.busType } - this.selectPrescriptionVisible = true; + this.selectPrescriptionVisible = true + }, + deleteCode() { + if (this.orderFormData.billNo == null) { + this.$message.error('请先录入单据信息!') + return + } + this.labelName = 2 + this.scanStatus = 1 + this.scanCode = '' + }, + overdeleteCode() { + if (this.orderFormData.billNo == null) { + this.scanDeleteType = true + } + this.labelName = 1 + this.scanStatus = null + this.scanCode = '' }, //选入草稿单据 chooseDraftOrder() { if (this.$isBlank(this.orderFormData.workPlaceCode)) { - this.$message.warning("请选择工位!"); - return; + this.$message.warning('请选择工位!') + return } this.rowData.workPlaceCode = this.orderFormData.workPlaceCode this.rowData.fifoSplit = this.orderFormData.fifoSplit - this.$router.push({query: {...this.$route.query, splitType: this.splitType}, path: this.$route.path}) + this.$router.push({ query: { ...this.$route.query, splitType: this.splitType }, path: this.$route.path }) this.chooseDraftOrderVisible = true }, closeChooseDialog() { @@ -1640,32 +1684,32 @@ export default { if (res.code == 20000) { } else if (res.code == 501) { - this.$message.error("当前单据正在处理中,请重新选择单据") - this.$refs.chooseDraftOrder.getList(); + this.$message.error('当前单据正在处理中,请重新选择单据') + this.$refs.chooseDraftOrder.getList() this.chooseDraftOrderVisible = true //当前订单正在处理中,刷新列表重新选择草稿订单 } else { - return this.$message.error("系统繁忙") + return this.$message.error('系统繁忙') } }) }, //获取选入的完成单 confirmSelect(row) { - this.selectPrescriptionVisible = false; - this.formData = row; - this.batchAddCodeByOrderFinish(row.billNo); + this.selectPrescriptionVisible = false + this.formData = row + this.batchAddCodeByOrderFinish(row.billNo) }, draftOrder() { let tQuery = Object.assign( JSON.parse(JSON.stringify(this.orderFormData)) - ); - tQuery.billNo = this.orderFormData.billNo; - tQuery.orderType = 2; - console.log("tQuery:"); - console.log(tQuery); + ) + tQuery.billNo = this.orderFormData.billNo + tQuery.orderType = 2 + console.log('tQuery:') + console.log(tQuery) if (this.orderFormData.billNo == null) { - this.$message.error("请先录入单据信息!"); - return; + this.$message.error('请先录入单据信息!') + return } this.saveLoading = true if (this.splitType == 'return') { @@ -1676,227 +1720,254 @@ export default { saveOrderWeb(tQuery).then((response) => { this.saveLoading = false if (response.code === 20000) { - this.$message.success("保存成功") + this.$message.success('保存成功') this.successCloseData() - this.result = "" - this.$refs.inputRef.focus(); + this.result = '' + this.$refs.inputRef.focus() } else { - this.$message.error(response.message); + this.$message.error(response.message) } - this.loading = false; + this.loading = false this.saveLoading = false - }); + }) }, // 刷新表单 resetForm() { - if (this.$refs["dataForm"]) { + if (this.$refs['dataForm']) { // 清空验证信息表单 - this.$refs["dataForm"].clearValidate(); + this.$refs['dataForm'].clearValidate() // 刷新表单 - this.$refs["dataForm"].resetFields(); + this.$refs['dataForm'].resetFields() } }, enterKey(event) { - this.warnResult = ""; - this.errResult = ""; - this.result = ""; - this.warnVisible = false; - this.errVisible = false; - - this.checkSuccess = true; - if (this.getDMHotskeyValue(this.scanCode)) + this.warnResult = '' + this.errResult = '' + this.result = '' + this.warnVisible = false + this.errVisible = false + + this.checkSuccess = true + if (this.getDMHotskeyValue(this.scanCode)) { return - this.codeFormData.code = this.scanCode.trim(); + } + this.codeFormData.code = this.scanCode.trim() - if (this.codeFormData.code.includes(";")) { - const codeArray = this.codeFormData.code.split(";"); + if (this.codeFormData.code.includes(';')) { + const codeArray = this.codeFormData.code.split(';') let params = { - codeList: codeArray, - }; + codeList: codeArray + } this.batchVailCode(params) - return; + return } let tQuery = { originCode: this.originCode, - code: this.codeFormData.code.trim(), - }; - enterCodeWeb(tQuery).then((response) => { - if (response.code === 20000) { - this.$refs.inputRef.focus(); - this.$refs.inputRef.select(); - this.isSuccess = true; - this.printCodeResult(response.data) - this.codeFormData.code = response.data.code; - this.scanCode = "" - this.addCode(); - } else { - if (response.code == 502) { - this.checkSuccess = false; - this.isSuccess = false; - this.scanCode = "" - this.printCodeResult(response.data) - this.codeFormData.code = response.data.code; - this.originCode = this.codeFormData.code; - } else if (response.code == 501) { - this.checkSuccess = false; - this.scanCode = "" - this.$message.error(response.message); - } else if (response.code == 503) { - this.checkSuccess = false; - this.isSuccess = false; - this.scanCode = "" + code: this.codeFormData.code.trim() + } + if (this.scanStatus == 1) { + const codeArray = this.codeFormData.code.split(';') + let query = { + orderId : this.orderFormData.billNo, + codeList: codeArray + } + //剔除码 + + this.removeCodesTemp(query) + } else { + enterCodeWeb(tQuery).then((response) => { + if (response.code === 20000) { + this.$refs.inputRef.focus() + this.$refs.inputRef.select() + this.isSuccess = true this.printCodeResult(response.data) - this.codeFormData.code = response.data.code; - this.$confirm(response.message, "提示", { - type: "warning", - }) - .then(() => { - this.codeFormData.code = response.data.code; - this.addCode(); - }) - .catch(() => { - this.codeFormData.code = response.data.code; - }); - } else if (response.code == 508) { - this.scanCode = "" - this.originCode = ""; - this.codeFormData.code = "01" + response.data.nameCode; - this.originCode = this.codeFormData.code; + this.codeFormData.code = response.data.code + this.scanCode = '' + this.addCode() } else { - this.$alert(response.message, "提示", { - confirmButtonText: "确定", - type: "warning", - closeOnClickModal: true, - callback: (action) => { - this.scanCode = "" - this.$refs.inputRef.focus(); - this.$refs.inputRef.select(); - }, - }); + if (response.code == 502) { + this.checkSuccess = false + this.isSuccess = false + this.scanCode = '' + this.printCodeResult(response.data) + this.codeFormData.code = response.data.code + this.originCode = this.codeFormData.code + } else if (response.code == 501) { + this.checkSuccess = false + this.scanCode = '' + this.$message.error(response.message) + } else if (response.code == 503) { + this.checkSuccess = false + this.isSuccess = false + this.scanCode = '' + this.printCodeResult(response.data) + this.codeFormData.code = response.data.code + this.$confirm(response.message, '提示', { + type: 'warning' + }) + .then(() => { + this.codeFormData.code = response.data.code + this.addCode() + }) + .catch(() => { + this.codeFormData.code = response.data.code + }) + } else if (response.code == 508) { + this.scanCode = '' + this.originCode = '' + this.codeFormData.code = '01' + response.data.nameCode + this.originCode = this.codeFormData.code + } else { + this.$alert(response.message, '提示', { + confirmButtonText: '确定', + type: 'warning', + closeOnClickModal: true, + callback: (action) => { + this.scanCode = '' + this.$refs.inputRef.focus() + this.$refs.inputRef.select() + } + }) + } } - } - this.loading = false; - }); + this.loading = false + }) + } + }, + removeCodesTemp(query){ + //todo 已经传过来 扫码明细 的数据 this.codeArray 根据id删除码明细的方法 deleteCodesTempById + deleteCodesTempByCodes(query).then(res => { + if (res.code == 20000) { + this.$message.success('剔除成功') + this.corpOrderIdDisabled = true + this.refreshCodesPanel() + this.$refs.inputRef.focus() + this.$refs.inputRef.select() + } else { + this.$message.error(res.message) + } + this.scanCode = '' + }).catch(() => { + }) + }, getInputFocus(event) { - event.currentTarget.select(); + event.currentTarget.select() }, tableSelection() { - this.$refs.multipleTable.clearSelection(); - this.$refs.multipleTable.toggleAllSelection(); + this.$refs.multipleTable.clearSelection() + this.$refs.multipleTable.toggleAllSelection() }, handleSizeChange(val) { - this.query.limit = val; - this.getCodeList(); + this.query.limit = val + this.getCodeList() }, handleCurrentChange(val) { - this.query.page = val; - this.getCodeList(); + this.query.page = val + this.getCodeList() }, intentBack() { - this.$router.go(-1); + this.$router.go(-1) }, selectSupUnit(row) { - this.dialogTableVisible = false; - this.orderFormData.selectSupId = row.erpId; - this.addCode(); + this.dialogTableVisible = false + this.orderFormData.selectSupId = row.erpId + this.addCode() }, selectBindRl(row) { - this.selectRlVisible = false; - this.orderFormData.relId = row.id; - this.addCode(); + this.selectRlVisible = false + this.orderFormData.relId = row.id + this.addCode() }, - selectSpaceBind(val) { if (this.curAction.scanPreIn) { - this.orderFormData.checkPreInSpaceCode = val; + this.orderFormData.checkPreInSpaceCode = val } else if (this.curAction.advancePreIn) { - this.orderFormData.preCurSpaceCode = val; + this.orderFormData.preCurSpaceCode = val } else { - this.orderFormData.curSpaceCode = val; + this.orderFormData.curSpaceCode = val } - this.addCode(); - this.selectSpaceVisible = false; + this.addCode() + this.selectSpaceVisible = false }, - closeCodeDialog() { - this.editOriginCodeVisible = false; - this.refreshCodesPanel(); + this.editOriginCodeVisible = false + this.refreshCodesPanel() }, //选入相关 OptionalDocument() { - this.selectorder = true; + this.selectorder = true }, sickChange(value) { - this.orderFormData.sickerAdNum = value; + this.orderFormData.sickerAdNum = value }, - getDMHotskeyValue(str) { console.log(str) - if (str.includes("DMHotskey")) { + if (str.includes('DMHotskey')) { try { - const jsonObj = JSON.parse(str); - if (jsonObj.hasOwnProperty("DMHotskey")) { - const dmhotskey = jsonObj.DMHotskey; - if (dmhotskey.hasOwnProperty("workPlace")) { - this.scanCode = "" + const jsonObj = JSON.parse(str) + if (jsonObj.hasOwnProperty('DMHotskey')) { + const dmhotskey = jsonObj.DMHotskey + if (dmhotskey.hasOwnProperty('workPlace')) { + this.scanCode = '' this.orderFormData.workPlaceCode = dmhotskey.workPlace return true - } else if (dmhotskey.hasOwnProperty("fifoSplit")) { - this.scanCode = "" - this.orderFormData.fifoSplit = dmhotskey.fifoSplit; - return true; + } else if (dmhotskey.hasOwnProperty('fifoSplit')) { + this.scanCode = '' + this.orderFormData.fifoSplit = dmhotskey.fifoSplit + return true } } } catch (error) { - console.log("字符串不是有效的 JSON 格式"); + console.log('字符串不是有效的 JSON 格式') } } - return false; + return false }, printCodeResult(data, isSuccess) { - const resultParts = ["扫码解析结果:" + data.code]; + this.successVisible = true + const resultParts = ['扫码解析结果:' + data.code] if (data.udi) { - resultParts.push("层级标识: " + data.udi); + resultParts.push('层级标识: ' + data.udi) } if (data.batchNo) { - resultParts.push("批次号: " + data.batchNo); + resultParts.push('批次号: ' + data.batchNo) } if (data.produceDate) { - resultParts.push("生产日期: " + data.produceDate); + resultParts.push('生产日期: ' + data.produceDate) } if (data.expireDate) { - resultParts.push("失效日期: " + data.expireDate); + resultParts.push('失效日期: ' + data.expireDate) } if (data.serialNo) { - resultParts.push("序列号: " + data.serialNo); + resultParts.push('序列号: ' + data.serialNo) } - this.result = resultParts.join(" , "); + this.result = resultParts.join(' , ') }, printLabel() { let query = { - labelId: 7, + labelId: 7 } printSplitLabel(query).then((response) => { - const binaryData = []; - binaryData.push(response); + const binaryData = [] + binaryData.push(response) let url = window.URL.createObjectURL( - new Blob(binaryData, {type: "application/pdf"}) - ); - window.open(url); + new Blob(binaryData, { type: 'application/pdf' }) + ) + window.open(url) }).catch(() => { - this.loading = false; - }); + this.loading = false + }) this.clearOrder() }, @@ -1927,153 +1998,169 @@ export default { sickerAdNum: null, workPlaceCode: null, splitBusType: null, - fifoSplit: 1, + fifoSplit: 1 } - this.scanCode = ""; - this.result = ""; + this.scanCode = '' + this.result = '' this.refreshCodesPanel() - this.init(); - + this.init() }, init() { //页面初始化 - this.codeFormData.code = ""; - if (this.splitType == "search") { - } else if (this.splitType == "out") { - this.orderFormData.action = 'SC72197936495755'; - } else if (this.splitType == "return") { - this.orderFormData.action = 'SC72249388338364'; + this.codeFormData.code = '' + if (this.splitType == 'search') { + } else if (this.splitType == 'out') { + this.orderFormData.action = 'SC72197936495755' + } else if (this.splitType == 'return') { + this.orderFormData.action = 'SC72249388338364' } - this.orderFormData.fromCorp = "72198012799726"; - + this.orderFormData.fromCorp = '72198012799726' //页面类型 - this.viewCodeVisible = true; - this.viewCodeDetailVisible = true; - this.orderFormData.orderType = this.viewType; - + this.viewCodeVisible = true + this.viewCodeDetailVisible = true + this.orderFormData.orderType = this.viewType if (this.$isNotBlank(this.orderQuery.billNo)) { //编辑页面 - this.corpOrderIdDisabled = true; - this.orderFormData = this.orderQuery; - this.actionEnable = true; - this.findMethod(this.orderFormData.fromCorp); + this.corpOrderIdDisabled = true + this.orderFormData = this.orderQuery + this.actionEnable = true + this.findMethod(this.orderFormData.fromCorp) this.curAction = {} - this.refreshCodesPanel(); - this.findInvListByUser(); - this.initBusType(); - this.findFromInvList(); + this.refreshCodesPanel() + this.findInvListByUser() + this.initBusType() + this.findFromInvList() // this.getWorkBindBusTypes(null); } else { //新增页面 - this.corpOrderIdDisabled = false; - let date = new Date(); + this.corpOrderIdDisabled = false + let date = new Date() this.orderFormData.createTime = parseTime( date, - "{y}-{m}-{d} {h}:{i}:{s}" - ); + '{y}-{m}-{d} {h}:{i}:{s}' + ) this.orderFormData.corpOrderId = - parseTime(date, "{y}{m}{d}{h}{i}{s}") + - Math.ceil(Math.random() * 89 + 10); - this.orderFormData.deptCode = this.$store.getters.deptCode; - this.orderFormData.invCode = this.$store.getters.locInvCode; - this.findInvListByUser(); + parseTime(date, '{y}{m}{d}{h}{i}{s}') + + Math.ceil(Math.random() * 89 + 10) + this.orderFormData.deptCode = this.$store.getters.deptCode + this.orderFormData.invCode = this.$store.getters.locInvCode + this.findInvListByUser() this.showSearch = true } }, //处理事件 handleRecCodesEvent(event) { - console.log('接收 recCodes event:', event.detail.recCodes); + console.log('接收 recCodes event:', event.detail.recCodes) let params = { - codeList: event.detail.recCodes, - }; + codeList: event.detail.recCodes + } this.batchVailCode(params) }, batchVailCode(params) { if (this.$isBlank(this.orderFormData.corpOrderId)) { - let date = new Date(); + let date = new Date() this.orderFormData.corpOrderId = - parseTime(date, "{y}{m}{d}{h}{i}{s}") + - Math.ceil(Math.random() * 89 + 10); - } - batchVailCode(params).then((response) => { - if (response.code === 20000) { - console.log("==滴码接收==", response.data); - this.valiCodes = []; - let list = response.data; - list.forEach(item => { - if (item.status === 1) { - this.valiCodes.push(item.code); - } - }); - this.printMutiCodeResult(list) - this.$refs.inputRef.focus(); - this.$refs.inputRef.select(); - if (this.valiCodes != null && this.valiCodes.length > 0) { - this.orderFormData.codeList = this.valiCodes - if (this.splitType == "out") - this.orderFormData.inoutType = 1 - else - this.orderFormData.inoutType = 2 - // this.orderFormData.inoutType = this.splitType; orderType - this.orderFormData.orderType = 2 - batchAddCode(this.orderFormData).then((res) => { - if (res.code === 20000) { - if (res.data.orderId != null) - this.orderFormData.billNo = res.data.orderId; - this.refreshCodesPanel(this); - this.printMutiCodeResult(res.data.vailCodeResultResponses) + parseTime(date, '{y}{m}{d}{h}{i}{s}') + + Math.ceil(Math.random() * 89 + 10) + } + if (this.scanStatus == 1) { + const codeArray = this.codeFormData.code.split(';') + let query = { + orderId : this.orderFormData.billNo, + codeList: codeArray + } + //剔除码 + this.removeCodesTemp(query) + } else { + batchVailCode(params).then((response) => { + if (response.code === 20000) { + console.log('==滴码接收==', response.data) + this.valiCodes = [] + let list = response.data + list.forEach(item => { + if (item.status === 1) { + this.valiCodes.push(item.code) + } + }) + this.printMutiCodeResult(list) + this.$refs.inputRef.focus() + this.$refs.inputRef.select() + if (this.valiCodes != null && this.valiCodes.length > 0) { + this.orderFormData.codeList = this.valiCodes + if (this.splitType == 'out') { + this.orderFormData.inoutType = 1 } else { - this.$message.error(res.message) + this.orderFormData.inoutType = 2 } - }); + // this.orderFormData.inoutType = this.splitType; orderType + this.orderFormData.orderType = 2 + batchAddCode(this.orderFormData).then((res) => { + if (res.code === 20000) { + if (res.data.orderId != null) { + this.orderFormData.billNo = res.data.orderId + } + this.refreshCodesPanel(this) + this.printMutiCodeResult(res.data.vailCodeResultResponses) + } else { + this.$message.error(res.message) + } + }) + } } - } - // this.scanCode = this.valiCodes.join(";"); - }); + // this.scanCode = this.valiCodes.join(";"); + }) + } + }, batchAddCodeByOrderFinish(orderFinishBillNo) { this.orderFormData.orderFinishBillNo = orderFinishBillNo batchAddCodeByOrderFinish(this.orderFormData).then((res) => { if (res.code === 20000) { - this.$refs.inputRef.focus(); - this.orderFormData.billNo = res.data.orderId; - this.refreshCodesPanel(this); + this.$refs.inputRef.focus() + this.orderFormData.billNo = res.data.orderId + this.refreshCodesPanel(this) this.printMutiCodeResult(res.data.vailCodeResultResponses) } else { this.$message.error(res.message) } - }); + }) }, async printMutiCodeResult(vailCodeResultResponses) { - this.warnResult = ""; - this.errResult = ""; - this.result = ""; - this.warnVisible = false; - this.errVisible = false; + this.warnResult = '' + this.errResult = '' + this.result = '' + this.warnVisible = false + this.errVisible = false for (let i = 0; i < vailCodeResultResponses.length; i++) { let data = vailCodeResultResponses[i] - if (data.status == 1) - this.result = this.result + ";" + vailCodeResultResponses[i].code; - else if (data.status == 2) { - this.warnResult = this.warnResult + "\n" + vailCodeResultResponses[i].code + ":" + vailCodeResultResponses[i].errMsg; + if (data.status == 1) { + this.successVisible = true + this.result = this.result + ';' + vailCodeResultResponses[i].code + } else if (data.status == 2) { + if (this.result == ''){ + this.successVisible = false + } + this.warnResult = this.warnResult + '\n' + vailCodeResultResponses[i].code + ':' + vailCodeResultResponses[i].errMsg } else if (data.status == 3) { - this.result = this.result + "\n" + vailCodeResultResponses[i].code; + this.result = this.result + '\n' + vailCodeResultResponses[i].code // this.warnResult = this.warnResult + "\n" + vailCodeResultResponses[i].code + ":" + vailCodeResultResponses[i].errMsg; await this.popupTip(data) } // else // this.errResult = this.errResult + "\n" + vailCodeResultResponses[i].code + ":" + vailCodeResultResponses[i].errMsg; } - if (!isBlank(this.warnResult)) - this.warnVisible = true; - if (!isBlank(this.errResult)) - this.errVisible = true; + if (!isBlank(this.warnResult)) { + this.warnVisible = true + } + if (!isBlank(this.errResult)) { + this.errVisible = true + } }, getOrder() { let query = { @@ -2085,109 +2172,112 @@ export default { this.refreshOrder(res.data) } } else { - this.$message.error("获取错误") + this.$message.error('获取错误') } }) }, handleScanComplete(fullScanData) { - console.log('接收 recCodes event:', fullScanData.join(";")); + console.log('接收 recCodes event:', fullScanData.join(';')) let params = { - codeList: fullScanData, - }; + codeList: fullScanData + } this.batchVailCode(params) }, socketListener() { - let lastScanTime = Date.now(); - let scanBuffer = []; - let scanTimeout = null; - const SCAN_TIMEOUT = 1000; // 1秒间隔,表示扫码结束的判定标准 - const self = this; - console.log("启用监听") - this.ws.onmessage = function (event) { - let scanData = event.data; // 获取扫码数据 - let currentTime = Date.now(); + let lastScanTime = Date.now() + let scanBuffer = [] + let scanTimeout = null + const SCAN_TIMEOUT = 1000 // 1秒间隔,表示扫码结束的判定标准 + const self = this + console.log('启用监听') + this.ws.onmessage = function(event) { + let scanData = event.data // 获取扫码数据 + let currentTime = Date.now() console.log(scanData) // 如果时间间隔超过预设的阈值,表示这是一次新的扫码 if (currentTime - lastScanTime > SCAN_TIMEOUT) { // 处理上一次完整的扫码数据 if (scanBuffer.length > 0) { - self.handleScanComplete(scanBuffer); + self.handleScanComplete(scanBuffer) } // 清空缓冲区,开始新的扫码 - scanBuffer = []; + scanBuffer = [] } // 重置上一次扫码的时间 - lastScanTime = currentTime; + lastScanTime = currentTime // 将数据添加到缓冲区 - scanBuffer.push(scanData); + scanBuffer.push(scanData) // 如果已经有一个定时器在等待,可以清除它 if (scanTimeout) { - clearTimeout(scanTimeout); + clearTimeout(scanTimeout) } // 设置新的定时器,等待指定的时间后执行扫码结束处理 scanTimeout = setTimeout(() => { // 定时器到时,处理扫码结束 - self.handleScanComplete(scanBuffer); - scanBuffer = []; - }, SCAN_TIMEOUT); - }; + self.handleScanComplete(scanBuffer) + scanBuffer = [] + }, SCAN_TIMEOUT) + } }, handleVisibilityChange() { if (document.visibilityState === 'visible') { - console.log('用户切回到了工位页面'); + console.log('用户切回到了工位页面') if (this.ws == null || this.ws.readyState === WebSocket.CLOSED) { - this.ws = new WebSocket("ws://127.0.0.1:9988"); - const self = this; - this.ws.onopen = function (evt) { - console.log("工位上货WebSocket 连接中 ..."); + this.ws = new WebSocket('ws://127.0.0.1:9988') + const self = this + this.ws.onopen = function(evt) { + console.log('工位上货WebSocket 连接中 ...') self.socketListener() - }; + } } } else { if (this.ws && this.ws.readyState === WebSocket.OPEN) { - this.ws.close(); - console.log("关闭处理单据websocket成功") + this.ws.close() + console.log('关闭处理单据websocket成功') } } }, + handleCodeArray(codeArray){ + this.codeArray = codeArray; + } }, filters: {}, mounted() { - document.body.ondrop = function (event) { - event.preventDefault(); - event.stopPropagation(); - }; - var that = this; - var inputer = document.getElementById("inputer"); - window.sc = new A.KeyScaner(inputer); //传入要监听的DOM节点 - sc.onInput = function (text) { - if (text.includes("delete")) { - that.codeFormData.code = ""; - that.sictomText = ""; - that.originCode = ""; - return; + document.body.ondrop = function(event) { + event.preventDefault() + event.stopPropagation() + } + var that = this + var inputer = document.getElementById('inputer') + window.sc = new A.KeyScaner(inputer) //传入要监听的DOM节点 + sc.onInput = function(text) { + if (text.includes('delete')) { + that.codeFormData.code = '' + that.sictomText = '' + that.originCode = '' + return } if (that.sitcomScan) { - let tempTxt = text; - let str = tempTxt.replace(/[\r]/g, ""); - that.sictomText = that.sictomText + str; - that.codeFormData.code = that.sictomText; + let tempTxt = text + let str = tempTxt.replace(/[\r]/g, '') + that.sictomText = that.sictomText + str + that.codeFormData.code = that.sictomText } else { - that.codeFormData.code = text; + that.codeFormData.code = text } - }; - inputer.focus(); - this.$refs.inputRef.focus(); + } + inputer.focus() + this.$refs.inputRef.focus() //环境判断 - if (window.navigator.userAgent.indexOf("GLXP_PC") != -1) { - this.scanDisabled = true; - window.removeEventListener('gwsh', this.handleRecCodesEvent); - window.addEventListener('gwsh', this.handleRecCodesEvent); + if (window.navigator.userAgent.indexOf('GLXP_PC') != -1) { + this.scanDisabled = true + window.removeEventListener('gwsh', this.handleRecCodesEvent) + window.addEventListener('gwsh', this.handleRecCodesEvent) } - document.addEventListener('visibilitychange', this.handleVisibilityChange); + document.addEventListener('visibilitychange', this.handleVisibilityChange) // window.addEventListener('storage', (event) => { // console.log("关闭上货单据websocket") // if (this.ws && this.ws.readyState === WebSocket.OPEN) { @@ -2206,38 +2296,37 @@ export default { // window.dispatchEvent(new CustomEvent('storage', null)); }, beforeDestroy() { - window.removeEventListener('gwsh', this.handleRecCodesEvent); - this.ws.close(); - this.ws.onclose = function (evt) { - console.log("工位上货Connection closed."); - }; - document.removeEventListener('visibilitychange', this.handleVisibilityChange); + window.removeEventListener('gwsh', this.handleRecCodesEvent) + this.ws.close() + this.ws.onclose = function(evt) { + console.log('工位上货Connection closed.') + } + document.removeEventListener('visibilitychange', this.handleVisibilityChange) }, created() { // this.splitType = this.$route.query.splitType; // if (this.splitType == null) this.splitType = this.fromSplitType - this.init(); + this.init() if (this.$route.query.workplaceId != null) { this.corpOrderIdDisabled = true this.isLinkDisabled = true this.workplaceId = this.$route.query.workplaceId - this.orderFormData.workPlaceCode = Number(this.$route.query.workplaceId); - this.orderFormData.splitBusType = "YPCF002" + this.orderFormData.workPlaceCode = Number(this.$route.query.workplaceId) + this.orderFormData.splitBusType = 'YPCF002' //查找当前用户工位是否有正在处理的单据 // this.getOrder() } else { if (this.orderQuery.workPlaceCode != null) { - this.orderFormData.workPlaceCode = String(this.orderQuery.workPlaceCode); + this.orderFormData.workPlaceCode = String(this.orderQuery.workPlaceCode) // if (this.orderQuery.splitBusType != null){ // this.orderFormData.busType = this.orderQuery.splitBusType; // } } } - - }, -}; + } +} diff --git a/src/views/collect/PanelCreateCodes.vue b/src/views/collect/PanelCreateCodes.vue index c86a77b0..81a11554 100644 --- a/src/views/collect/PanelCreateCodes.vue +++ b/src/views/collect/PanelCreateCodes.vue @@ -275,6 +275,7 @@ export default { errorCodeList(this.query) //查找该单号下的所有条码 .then((response) => { this.codeArray = response.data.list || []; + this.$emit('getCodeArray', this.codeArray); this.total = response.data.total || 0; for (let i = 0; i < this.codeArray.length; i++) { this.codeArray[i].fromType = this.formData.fromType; @@ -282,6 +283,7 @@ export default { } this.tableSelection(); this.loading = false; + }) .catch(() => { this.loading = false;