| | |
| | | type: 'primary', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | },{ |
| | | name: "åæ¹å
¥åºåä¼ MES", |
| | | // icon: 'el-icon-upload2', |
| | | class: '', |
| | | value: 'BatchInOrderFeedbackToMes', |
| | | type: 'primary', |
| | | onClick: function () { |
| | | } |
| | | } |
| | | ] |
| | | |
| | | export default buttons |
| | |
| | | let loadingInstance; |
| | | let loadingStatus = false; |
| | | if (process.env.NODE_ENV == 'development') { |
| | | // axios.defaults.baseURL = 'http://127.0.0.1:9291/'; |
| | | axios.defaults.baseURL = window.webConfig.webApiBaseUrl; |
| | | axios.defaults.baseURL = 'http://127.0.0.1:9291/'; |
| | | // axios.defaults.baseURL = window.webConfig.webApiBaseUrl; |
| | | } |
| | | else if (process.env.NODE_ENV == 'debug') { |
| | | axios.defaults.baseURL = 'http://127.0.0.1:8098/'; |
| | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import gridHeader from './extend/EmptyTrayInbound.vue' |
| | | import gridBody from './extend/Pallet.vue' |
| | | import http from '@/api/http.js' |
| | | import { h, createVNode, render, reactive, ref } from 'vue'; |
| | | import { ElDialog, ElForm, ElFormItem, ElInput, ElButton, ElMessage, ElSelect, ElOption } from 'element-plus'; |
| | | import gridHeader from "./extend/EmptyTrayInbound.vue"; |
| | | import gridBody from "./extend/Pallet.vue"; |
| | | import http from "@/api/http.js"; |
| | | import { h, createVNode, render, reactive, ref } from "vue"; |
| | | import { |
| | | ElDialog, |
| | | ElForm, |
| | | ElFormItem, |
| | | ElInput, |
| | | ElButton, |
| | | ElMessage, |
| | | ElSelect, |
| | | ElOption, |
| | | } from "element-plus"; |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: gridHeader, |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | gridFooter: "", |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | modelHeader: "", |
| | | modelBody: "", |
| | | modelFooter: "", |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | tableAction: "", //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { |
| | | view: [ |
| | | { |
| | | name: 'æ¤éç»ç', |
| | | type: 'primary', |
| | | value: 'æ¤éç»ç', |
| | | name: "æ¤éç»ç", |
| | | type: "primary", |
| | | value: "æ¤éç»ç", |
| | | onClick: function () { |
| | | console.log('æ¤éç»çæé®è¢«ç¹å»'); |
| | | const mountNode = document.createElement('div'); |
| | | console.log("æ¤éç»çæé®è¢«ç¹å»"); |
| | | const mountNode = document.createElement("div"); |
| | | document.body.appendChild(mountNode); |
| | | |
| | | // ååºå¼è¡¨åæ°æ®ï¼æçå·ï¼å¿
å¡«ï¼ |
| | | const formData = reactive({ |
| | | palletCode: '', // æçå·è¾å
¥æ¡ |
| | | barcode: '' |
| | | palletCode: "", // æçå·è¾å
¥æ¡ |
| | | barcode: "", |
| | | }); |
| | | |
| | | // æäº¤è¡¨åçç»ä¸é»è¾ |
| | |
| | | // æ§è¡è¡¨åæ ¡éªï¼æçå·å¿
å¡«ï¼ |
| | | await formRef.validate(); |
| | | } catch (err) { |
| | | ElMessage.warning('请è¾å
¥ææçæçå·'); |
| | | ElMessage.warning("请è¾å
¥ææçæçå·"); |
| | | return; |
| | | } |
| | | |
| | | // åèµ·æ¤éç»çè¯·æ± |
| | | try { |
| | | const response = await http.post('/api/InboundOrder/UndoPalletGroup?palletCode=' + formData.palletCode.trim() + '&barcode=' + formData.barcode.trim()); |
| | | const response = await http.post( |
| | | "/api/InboundOrder/UndoPalletGroup?palletCode=" + |
| | | formData.palletCode.trim() + |
| | | "&barcode=" + |
| | | formData.barcode.trim() |
| | | ); |
| | | const { status, message, data } = response; |
| | | if (status) { |
| | | ElMessage.success(response.message); |
| | |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | } else { |
| | | ElMessage.error(message || data?.message || 'æ¤éç»ç失败'); |
| | | ElMessage.error(message || data?.message || "æ¤éç»ç失败"); |
| | | selectPalletCodeInput(); // éä¸è¾å
¥æ¡æ¹ä¾¿éæ°è¾å
¥ |
| | | } |
| | | } catch (error) { |
| | | console.error('æ¤éç»ç请æ±å¼å¸¸ï¼', error); |
| | | ElMessage.error('ç½ç»å¼å¸¸ææ¥å£é误ï¼è¯·ç¨åéè¯'); |
| | | console.error("æ¤éç»ç请æ±å¼å¸¸ï¼", error); |
| | | ElMessage.error("ç½ç»å¼å¸¸ææ¥å£é误ï¼è¯·ç¨åéè¯"); |
| | | selectPalletCodeInput(); |
| | | } |
| | | }; |
| | |
| | | setTimeout(() => { |
| | | const inputRef = vnode.component.refs.palletCodeInput; |
| | | if (inputRef) { |
| | | const targetInput = inputRef.$el?.querySelector('input') || inputRef; |
| | | const targetInput = |
| | | inputRef.$el?.querySelector("input") || inputRef; |
| | | targetInput?.focus(); |
| | | targetInput?.select(); |
| | | } |
| | |
| | | }; |
| | | |
| | | // åå»ºå¯¹è¯æ¡VNode |
| | | const vnode = createVNode(ElDialog, { |
| | | title: 'æ¤éç»ç', |
| | | width: '400px', |
| | | const vnode = createVNode( |
| | | ElDialog, |
| | | { |
| | | title: "æ¤éç»ç", |
| | | width: "400px", |
| | | modelValue: true, |
| | | appendToBody: true, |
| | | onOpened: () => { |
| | |
| | | inputRef?.focus(); |
| | | }, 100); |
| | | }, |
| | | 'onUpdate:modelValue': (isVisible) => { |
| | | "onUpdate:modelValue": (isVisible) => { |
| | | if (!isVisible) { |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | } |
| | | } |
| | | }, { |
| | | default: () => h(ElForm, { |
| | | }, |
| | | }, |
| | | { |
| | | default: () => |
| | | h( |
| | | ElForm, |
| | | { |
| | | model: formData, |
| | | rules: { |
| | | palletCode: [ |
| | | { required: true, message: '请è¾å
¥æçå·', trigger: ['blur', 'enter'] }, |
| | | { min: 1, max: 50, message: 'æçå·é¿åº¦ä¸è½è¶
è¿50个å符', trigger: ['blur', 'input'] } |
| | | ] |
| | | { |
| | | required: true, |
| | | message: "请è¾å
¥æçå·", |
| | | trigger: ["blur", "enter"], |
| | | }, |
| | | ref: 'cancelPalletForm' |
| | | }, [ |
| | | { |
| | | min: 1, |
| | | max: 50, |
| | | message: "æçå·é¿åº¦ä¸è½è¶
è¿50个å符", |
| | | trigger: ["blur", "input"], |
| | | }, |
| | | ], |
| | | }, |
| | | ref: "cancelPalletForm", |
| | | }, |
| | | [ |
| | | // æçå·è¾å
¥é¡¹ |
| | | h(ElFormItem, { label: 'æçæ¡ç ', prop: 'palletCode', required: true }, [ |
| | | h( |
| | | ElFormItem, |
| | | { label: "æçæ¡ç ", prop: "palletCode", required: true }, |
| | | [ |
| | | h(ElInput, { |
| | | type: 'text', |
| | | type: "text", |
| | | modelValue: formData.palletCode, |
| | | 'onUpdate:modelValue': (val) => { |
| | | "onUpdate:modelValue": (val) => { |
| | | formData.palletCode = val; |
| | | }, |
| | | ref: 'palletCodeInput', |
| | | placeholder: 'æ«ç è¾å
¥ææå¨è¾å
¥æçå·', |
| | | ref: "palletCodeInput", |
| | | placeholder: "æ«ç è¾å
¥ææå¨è¾å
¥æçå·", |
| | | maxLength: 50, |
| | | // çå¬å车äºä»¶ï¼æ«ç æªé»è®¤ä¼åéåè½¦ï¼ |
| | | onKeydown: (e) => { |
| | | if (e.key === 'Enter') { |
| | | if (e.key === "Enter") { |
| | | e.preventDefault(); |
| | | submitForm(); |
| | | } |
| | | } |
| | | }) |
| | | ]), |
| | | h(ElFormItem, { label: ' å
ç®±æ ç¾', prop: 'barcode' }, [ |
| | | }, |
| | | }), |
| | | ] |
| | | ), |
| | | h(ElFormItem, { label: " å
ç®±æ ç¾", prop: "barcode" }, [ |
| | | h(ElInput, { |
| | | type: 'text', |
| | | type: "text", |
| | | modelValue: formData.barcode, |
| | | 'onUpdate:modelValue': (val) => { |
| | | "onUpdate:modelValue": (val) => { |
| | | formData.barcode = val; |
| | | }, |
| | | placeholder: 'å¯éï¼æ«ç è¾å
¥ææå¨è¾å
¥æ¡ç ', |
| | | placeholder: "å¯éï¼æ«ç è¾å
¥ææå¨è¾å
¥æ¡ç ", |
| | | maxLength: 50, |
| | | onKeydown: (e) => { |
| | | if (e.key === 'Enter') { |
| | | if (e.key === "Enter") { |
| | | e.preventDefault(); |
| | | submitForm(); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | }), |
| | | ]), |
| | | // åºé¨æé®åº |
| | | h('div', { style: { textAlign: 'right', marginTop: '16px' } }, [ |
| | | h(ElButton, { |
| | | type: 'text', |
| | | h( |
| | | "div", |
| | | { style: { textAlign: "right", marginTop: "16px" } }, |
| | | [ |
| | | h( |
| | | ElButton, |
| | | { |
| | | type: "text", |
| | | onClick: () => { |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | ElMessage.info('åæ¶æ¤éç»ç'); |
| | | ElMessage.info("åæ¶æ¤éç»ç"); |
| | | }, |
| | | }, |
| | | "åæ¶" |
| | | ), |
| | | h( |
| | | ElButton, |
| | | { |
| | | type: "primary", |
| | | onClick: submitForm.bind(this), // ç»å®thisä¸ä¸æ |
| | | }, |
| | | "确认æ¤é" |
| | | ), |
| | | ] |
| | | ), |
| | | ] |
| | | ), |
| | | } |
| | | }, 'åæ¶'), |
| | | h(ElButton, { |
| | | type: 'primary', |
| | | onClick: submitForm.bind(this) // ç»å®thisä¸ä¸æ |
| | | }, '确认æ¤é') |
| | | ]) |
| | | ]) |
| | | }); |
| | | ); |
| | | |
| | | vnode.appContext = this.$.appContext; |
| | | render(vnode, mountNode); |
| | | } |
| | | }, |
| | | { |
| | | name: 'åæ¹å
¥åº', |
| | | type: 'primary', |
| | | value: 'åæ¹å
¥åº', |
| | | onClick: async function () { |
| | | console.log('åæ¹å
¥åºæé®è¢«ç¹å»ï¼å¼å§æ ¡éª'); |
| | | const selectedRows = this.$refs.table.getSelected(); |
| | | |
| | | // æ ¡éª1ï¼æ¯å¦éä¸è¡ï¼è³å°éæ©ä¸æ¡ï¼ |
| | | if (selectedRows.length === 0) { |
| | | console.log('æ ¡éªä¸éè¿ï¼æªéä¸ä»»ä½åæ®'); |
| | | ElMessage.warning('è¯·éæ©è³å°ä¸æ¡åæ®'); |
| | | return; |
| | | } |
| | | |
| | | // æ¶éææéä¸åæ®çç¼å·ï¼è¿æ»¤æ åæ®å·çå¼å¸¸è¡ï¼ |
| | | const inboundOrderNos = selectedRows |
| | | .filter(row => row.inboundOrderNo) |
| | | .map(row => row.inboundOrderNo); |
| | | |
| | | // æ ¡éª2ï¼æ¯å¦æææåæ®å· |
| | | if (inboundOrderNos.length === 0) { |
| | | console.log('æ ¡éªä¸éè¿ï¼éä¸åæ®æ ææç¼å·'); |
| | | ElMessage.warning('éä¸ç忮䏿 ææç¼å·ï¼è¯·éæ°éæ©'); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | console.log('åèµ·åæ¹å
¥åºè¯·æ±ï¼åæ°ï¼', { inboundOrderNos }); |
| | | const response = await http.post('/api/InboundOrder/BatchOrderFeedbackToMes', { |
| | | orderNos: inboundOrderNos, |
| | | inout: 1 |
| | | }); |
| | | |
| | | const { status, message, data } = response; |
| | | if (status) { |
| | | console.log('åæ¹å
¥åºæåï¼å端è¿åï¼', data); |
| | | ElMessage.success(`åæ¹å
¥åºæåï¼`); |
| | | this.refresh(); // å
¥åºæååå·æ°å表ï¼å¤ç¨åæé»è¾ï¼ |
| | | } else { |
| | | console.log('åæ¹å
¥åºå¤±è´¥ï¼å端æç¤ºï¼', message); |
| | | ElMessage.error(message || data?.message || 'åæ¹å
¥åºå¤±è´¥'); |
| | | } |
| | | } catch (error) { |
| | | console.error('åæ¹å
¥åºè¯·æ±å¼å¸¸ï¼', error); |
| | | ElMessage.error('ç½ç»å¼å¸¸ææ¥å£é误ï¼è¯·ç¨åéè¯'); |
| | | } |
| | | } |
| | | }, |
| | | ], box: [], detail: [] |
| | | // { |
| | | // name: 'åæ¹å
¥åº', |
| | | // type: 'primary', |
| | | // value: 'åæ¹å
¥åº', |
| | | // onClick: async function () { |
| | | // console.log('åæ¹å
¥åºæé®è¢«ç¹å»ï¼å¼å§æ ¡éª'); |
| | | // const selectedRows = this.$refs.table.getSelected(); |
| | | |
| | | // // æ ¡éª1ï¼æ¯å¦éä¸è¡ï¼è³å°éæ©ä¸æ¡ï¼ |
| | | // if (selectedRows.length === 0) { |
| | | // console.log('æ ¡éªä¸éè¿ï¼æªéä¸ä»»ä½åæ®'); |
| | | // ElMessage.warning('è¯·éæ©è³å°ä¸æ¡åæ®'); |
| | | // return; |
| | | // } |
| | | |
| | | // // æ¶éææéä¸åæ®çç¼å·ï¼è¿æ»¤æ åæ®å·çå¼å¸¸è¡ï¼ |
| | | // const inboundOrderNos = selectedRows |
| | | // .filter(row => row.inboundOrderNo) |
| | | // .map(row => row.inboundOrderNo); |
| | | |
| | | // // æ ¡éª2ï¼æ¯å¦æææåæ®å· |
| | | // if (inboundOrderNos.length === 0) { |
| | | // console.log('æ ¡éªä¸éè¿ï¼éä¸åæ®æ ææç¼å·'); |
| | | // ElMessage.warning('éä¸ç忮䏿 ææç¼å·ï¼è¯·éæ°éæ©'); |
| | | // return; |
| | | // } |
| | | |
| | | // try { |
| | | // console.log('åèµ·åæ¹å
¥åºè¯·æ±ï¼åæ°ï¼', { inboundOrderNos }); |
| | | // const response = await http.post('/api/InboundOrder/BatchOrderFeedbackToMes', { |
| | | // orderNos: inboundOrderNos, |
| | | // inout: 1 |
| | | // }); |
| | | |
| | | // const { status, message, data } = response; |
| | | // if (status) { |
| | | // console.log('åæ¹å
¥åºæåï¼å端è¿åï¼', data); |
| | | // ElMessage.success(`åæ¹å
¥åºæåï¼`); |
| | | // this.refresh(); // å
¥åºæååå·æ°å表ï¼å¤ç¨åæé»è¾ï¼ |
| | | // } else { |
| | | // console.log('åæ¹å
¥åºå¤±è´¥ï¼å端æç¤ºï¼', message); |
| | | // ElMessage.error(message || data?.message || 'åæ¹å
¥åºå¤±è´¥'); |
| | | // } |
| | | // } catch (error) { |
| | | // console.error('åæ¹å
¥åºè¯·æ±å¼å¸¸ï¼', error); |
| | | // ElMessage.error('ç½ç»å¼å¸¸ææ¥å£é误ï¼è¯·ç¨åéè¯'); |
| | | // } |
| | | // } |
| | | // }, |
| | | ], |
| | | box: [], |
| | | detail: [], |
| | | }, |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | var EmptyTrayInboundBtn = this.buttons.find(x => x.value == "EmptyTrayInbound"); |
| | | var EmptyTrayInboundBtn = this.buttons.find( |
| | | (x) => x.value == "EmptyTrayInbound" |
| | | ); |
| | | if (EmptyTrayInboundBtn != null) { |
| | | EmptyTrayInboundBtn.onClick = () => { |
| | | this.$refs.gridHeader.open(); |
| | | }; |
| | | } |
| | | var BatchInOrderFeedbackToMesBtn = this.buttons.find( |
| | | (x) => x.value == "BatchInOrderFeedbackToMes" |
| | | ); |
| | | if (BatchInOrderFeedbackToMesBtn != null) { |
| | | BatchInOrderFeedbackToMesBtn.onClick = () => { |
| | | var rows = this.$refs.table.getSelected(); |
| | | // æ ¡éªæ¯å¦æé䏿°æ® |
| | | if (!rows || rows.length === 0) { |
| | | return this.$Message.error("请å
éæ©éè¦å¤ççåæ®"); |
| | | } |
| | | var GroupPalletBtn = this.buttons.find(x => x.value == "GroupPallet"); |
| | | if (rows.length > 1) { |
| | | return this.$Message.error("è¯·éæ©ä¸æ¡æ°æ®"); |
| | | } |
| | | this.http.post(`api/Inbound/BatchInOrderFeedbackToMes?OrderNo=${rows[0].inboundOrderNo}`,{},"æ°æ®å¤çä¸...") |
| | | .then((x) => { |
| | | if (x.status) { |
| | | this.$Message.success(x.message); |
| | | this.refresh(); |
| | | } else { |
| | | return this.$Message.error(x.message); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | // å¢å å¼å¸¸æè·ï¼å¤çç½ç»é误çæ
åµ |
| | | //_this.$Message.error('请æ±å¤±è´¥ï¼' + (error.message || 'æªç¥é误')); |
| | | }); |
| | | }; |
| | | } |
| | | |
| | | // let BatchInOrderFeedbackToMesBtn = this.buttons.find((x) => x.value == "BatchInOrderFeedbackToMes"); |
| | | // if (BatchInOrderFeedbackToMesBtn != null) { |
| | | // BatchInOrderFeedbackToMesBtn.onClick = ()=> { |
| | | // let selectedRows = this.$refs.table.getSelected(); |
| | | |
| | | // // æ ¡éªæ¯å¦æé䏿°æ® |
| | | // if (!selectedRows || selectedRows.length === 0) { |
| | | // return this.$Message.warning("请å
éæ©éè¦å¤ççåæ®"); |
| | | // } |
| | | // if (selectedRows.length > 1) { |
| | | // return this.$Message.warning("è¯·éæ©ä¸æ¡æ°æ®"); |
| | | // } |
| | | // this.http.post(`api/Inbound/BatchInOrderFeedbackToMes?orderNo=${selectedRows[0].orderNo}`,{},"æ°æ®å¤çä¸...") |
| | | // .then((x) => { |
| | | // if (x.status) { |
| | | // this.$Message.success("åæ¹åºåºåè°å®æ"); |
| | | // this.refresh(); |
| | | // } else { |
| | | // return this.$Message.error("åæ¹åºåºåè°å¤±è´¥"); |
| | | // } |
| | | // }) |
| | | // .catch((error) => { |
| | | // // å¢å å¼å¸¸æè·ï¼å¤çç½ç»é误çæ
åµ |
| | | // //_this.$Message.error('请æ±å¤±è´¥ï¼' + (error.message || 'æªç¥é误')); |
| | | // }); |
| | | // }; |
| | | // } |
| | | |
| | | var GroupPalletBtn = this.buttons.find((x) => x.value == "GroupPallet"); |
| | | if (GroupPalletBtn != null) { |
| | | GroupPalletBtn.onClick = () => { |
| | | // console.log(this.$refs) |
| | | this.$refs.gridBody.open(); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | this.columns.forEach(column => { |
| | | if (column.field === 'orderStatistics') { |
| | | this.columns.forEach((column) => { |
| | | if (column.field === "orderStatistics") { |
| | | column.formatter = (row) => { |
| | | // æ ¡éªdetailsæ¯å¦åå¨ä¸ææ°æ® |
| | | if (row.details && row.details.length > 0) { |
| | | //æmaterielCodeåç»ç»è®¡orderQuantityæ»å |
| | | const materielSumMap = row.details.reduce((acc, item) => { |
| | | const materielCode = item.materielCode || 'æªç¥ç©æ'; |
| | | const materielCode = item.materielCode || "æªç¥ç©æ"; |
| | | const quantity = Number(item.orderQuantity) || 0; |
| | | acc[materielCode] = (acc[materielCode] || 0) + quantity; |
| | | return acc; |
| | | }, {}); |
| | | |
| | | //æ¯ä¸ªç©æé¡¹çæç¬ç«divï¼è·¨è¡æ¾ç¤º |
| | | const displayItems = Object.entries(materielSumMap).map(([code, total]) => { |
| | | const displayItems = Object.entries(materielSumMap).map( |
| | | ([code, total]) => { |
| | | return `<div style="line-height: 1.5; white-space: normal;">${code}ï¼${total}个</div>`; |
| | | }); |
| | | const displayContent = displayItems.join(''); |
| | | } |
| | | ); |
| | | const displayContent = displayItems.join(""); |
| | | return `<div style="color: #F56C6C; white-space: normal; word-break: break-all;">${displayContent}</div>`; |
| | | } else { |
| | | return '<span style="color: #F56C6C">æ å
¥åºæç»</span>'; |
| | |
| | | }); |
| | | }, |
| | | onInited() { |
| | | |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | // this.searchFormFields.orderType=[0] |
| | | let wheres = [{ |
| | | 'name': 'orderType', |
| | | 'value': '0', |
| | | 'displayType': 'text' |
| | | }]; |
| | | |
| | | let wheres = [ |
| | | { |
| | | name: "orderType", |
| | | value: "0", |
| | | displayType: "text", |
| | | }, |
| | | ]; |
| | | |
| | | param.wheres.push(...wheres); |
| | | return true; |
| | |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | }; |
| | | export default extension; |
| | |
| | | bind: { key: "orderDetailStatusEnum", data: [] }, |
| | | }, |
| | | { |
| | | field: "returnToMESStatus", |
| | | title: "åä¼ ç¶æ", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | bind: { key: "returnStatus", data: [{ key: 0, value: "æªåä¼ " }, { key: 1, value: "å·²åä¼ æå" }, { key: 2, value: "åä¼ å¤±è´¥" }] } |
| | | }, |
| | | { |
| | | field: "creater", |
| | | title: "å建人", |
| | | type: "string", |
| | |
| | | public List<BarcodeInfo>? Barcodes { get; set; } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ¡ç ä¿¡æ¯ |
| | | /// </summary> |
| | |
| | | /// <returns></returns> |
| | | Task<WebResponseContent> AllcatedGroupPallet(GroupPalletDto palletDto); |
| | | |
| | | |
| | | /// <summary> |
| | | /// å
¥åºåæ¹åä¼ |
| | | /// </summary> |
| | | /// <param name="OrderNo"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent BatchInOrderFeedbackToMes(string OrderNo); |
| | | |
| | | } |
| | | } |
| | |
| | | using LogLibrary.Log; |
| | | using MailKit; |
| | | using MailKit.Search; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.Util; |
| | | using WIDESEA_Core.Utilities; |
| | | using WIDESEA_DTO.Allocate; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_DTO.ReturnMES; |
| | | using WIDESEA_IInboundService; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_Model.Models; |
| | |
| | | private readonly IRepository<Dt_Task> _taskRepository; |
| | | private IStockService _stockService; |
| | | private readonly IRepository<Dt_AllocateMaterialInfo> _allocateMaterialInfo; |
| | | |
| | | public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo) |
| | | private readonly HttpClientHelper _httpClientHelper; |
| | | public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | InboundOrderDetailService = inboundOrderDetailService; |
| | |
| | | _stockService = stockService; |
| | | _taskRepository = taskRepository; |
| | | _allocateMaterialInfo = allocateMaterialInfo; |
| | | _httpClientHelper = httpClientHelper; |
| | | } |
| | | |
| | | public async Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto) |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent BatchInOrderFeedbackToMes(string OrderNo) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>() |
| | | .Where(x => x.InboundOrderNo == OrderNo) |
| | | .First(); |
| | | |
| | | var inboundOrderDetail = _inboundOrderRepository.Db.Queryable<Dt_InboundOrderDetail>() |
| | | .Where(x => x.OrderId == inboundOrder.Id && x.OrderDetailStatus==(int)OrderDetailStatusEnum.Over && x.ReturnToMESStatus == 0) |
| | | .ToList(); |
| | | |
| | | var stocks = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.StockStatus == 6) |
| | | .Where(it => SqlFunc.Subqueryable<Dt_StockInfoDetail>().Where(s => s.StockId == it.Id && s.OrderNo == OrderNo).Any()) |
| | | .ToList(); |
| | | |
| | | var stockIds = stocks.Select(s => s.Id).ToList(); |
| | | |
| | | var allDetailsData = _stockInfoRepository.Db.Queryable<Dt_StockInfoDetail>() |
| | | .Where(x => stockIds.Contains(x.StockId)) |
| | | .ToList(); |
| | | |
| | | var matchedData = inboundOrderDetail |
| | | .Join(allDetailsData, |
| | | inbound => inbound.Barcode, |
| | | stockdetail => stockdetail.Barcode, |
| | | (inbound, stockdetail) => inbound.Barcode) |
| | | .ToList(); |
| | | |
| | | var inbounddetailID = inboundOrderDetail |
| | | .Join(allDetailsData, |
| | | inbound => inbound.Barcode, |
| | | stockdetail => stockdetail.Barcode, |
| | | (inbound, stockdetail) => inbound.Id) |
| | | .ToList(); |
| | | |
| | | var detail = allDetailsData.Where(x => matchedData.Contains(x.Barcode)).ToList(); |
| | | |
| | | if (inboundOrder.OrderType == (int)InOrderTypeEnum.AllocatInbound)//è°æ¨å
¥åº |
| | | { |
| | | var allocate = _inboundOrderRepository.Db.Queryable<Dt_AllocateOrder>().Where(x => x.OrderNo == inboundOrder.InboundOrderNo).First(); |
| | | var allocatefeedmodel = new AllocateDto |
| | | { |
| | | ReqCode = Guid.NewGuid().ToString(), |
| | | ReqTime = DateTime.Now.ToString(), |
| | | BusinessType = "3", |
| | | FactoryArea = inboundOrder.FactoryArea, |
| | | OperationType = 1, |
| | | Operator = inboundOrder.Operator, |
| | | OrderNo = inboundOrder.UpperOrderNo, |
| | | fromWarehouse = allocate?.FromWarehouse ?? "", |
| | | toWarehouse = allocate?.ToWarehouse ?? "", |
| | | Details = GetAllocateDtoDetails(detail) |
| | | }; |
| | | |
| | | if (allocatefeedmodel.Details.Count <= 0) |
| | | { |
| | | throw new Exception("æªæ¾å°éè¦åä¼ çæ°æ®"); |
| | | } |
| | | |
| | | var response = responseModel(inboundOrder, 3,null, allocatefeedmodel); |
| | | |
| | | if (response != null && response.IsSuccess) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 }) |
| | | .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var feedmodel = new FeedbackInboundRequestModel |
| | | { |
| | | reqCode = Guid.NewGuid().ToString(), |
| | | reqTime = DateTime.Now.ToString(), |
| | | business_type = inboundOrder.BusinessType, |
| | | factoryArea = inboundOrder.FactoryArea, |
| | | operationType = 1, |
| | | Operator = inboundOrder.Operator, |
| | | orderNo = inboundOrder.UpperOrderNo, |
| | | status = inboundOrder.OrderStatus, |
| | | details = FeedbackInboundDetailsModelDto(detail) |
| | | }; |
| | | |
| | | if (feedmodel.details.Count<=0) |
| | | { |
| | | throw new Exception("æªæ¾å°éè¦åä¼ çæ°æ®"); |
| | | } |
| | | var response = responseModel(inboundOrder, 3, feedmodel); |
| | | |
| | | if (response != null && response.IsSuccess) |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 }) |
| | | .Where(it => inbounddetailID.Contains(it.Id)).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | _inboundOrderRepository.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 }) |
| | | .Where(it => inbounddetailID.Contains(it.Id)).ExecuteCommand(); |
| | | return content.Error("åä¼ MES失败"); |
| | | } |
| | | } |
| | | |
| | | return content.OK("åä¼ MESæå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public List<AllocateDtoDetail> GetAllocateDtoDetails(List<Dt_StockInfoDetail> stockInfoDetails) |
| | | { |
| | | var groupedData = stockInfoDetails.GroupBy(item => new { item.MaterielCode, item.InboundOrderRowNo, item.BarcodeUnit, item.WarehouseCode }) |
| | | .Select(group => new AllocateDtoDetail |
| | | { |
| | | MaterialCode = group.Key.MaterielCode, |
| | | LineNo = group.Key.InboundOrderRowNo, |
| | | WarehouseCode = group.Key.WarehouseCode, |
| | | Qty = group.Sum(x => x.BarcodeQty), |
| | | Unit = group.Key.BarcodeUnit, |
| | | Barcodes = group.Select(row => new BarcodeInfo |
| | | { |
| | | Barcode = row.Barcode, |
| | | Qty = row.BarcodeQty, |
| | | BatchNo = row.BatchNo, |
| | | SupplyCode = row.SupplyCode, |
| | | Unit = row.BarcodeUnit |
| | | }).ToList() |
| | | }).ToList(); |
| | | return groupedData; |
| | | } |
| | | public List<FeedbackInboundDetailsModel> FeedbackInboundDetailsModelDto(List<Dt_StockInfoDetail> stockInfoDetails) |
| | | { |
| | | var groupedData = stockInfoDetails.GroupBy(item => new { item.MaterielCode, item.InboundOrderRowNo, item.BarcodeUnit, item.WarehouseCode }) |
| | | .Select(group => new FeedbackInboundDetailsModel |
| | | { |
| | | materialCode = group.Key.MaterielCode, |
| | | lineNo = group.Key.InboundOrderRowNo, |
| | | warehouseCode = group.Key.WarehouseCode, |
| | | qty = group.Sum(x => x.BarcodeQty), |
| | | unit = group.Key.BarcodeUnit, |
| | | barcodes = group.Select(row => new FeedbackBarcodesModel |
| | | { |
| | | barcode = row.Barcode, |
| | | qty = row.BarcodeQty |
| | | }).ToList() |
| | | }).ToList(); |
| | | return groupedData; |
| | | } |
| | | |
| | | public HttpResponseResult<MesResponseDTO> responseModel(Dt_InboundOrder order, int InterfaceType, FeedbackInboundRequestModel model = null, AllocateDto allocateDto = null) |
| | | { |
| | | HttpResponseResult<MesResponseDTO> httpResponseResult = new HttpResponseResult<MesResponseDTO>(); |
| | | string reqCode = Guid.NewGuid().ToString(); |
| | | string reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | string requestData = string.Empty; |
| | | string apiUrl = string.Empty; |
| | | if (model != null) |
| | | { |
| | | apiUrl = AppSettings.GetValue("AldMaterialWarehousing"); |
| | | httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, model.Serialize()); |
| | | requestData = model.Serialize(); |
| | | } |
| | | else |
| | | { |
| | | apiUrl = AppSettings.GetValue("AldAllocationOperation"); |
| | | httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, allocateDto.Serialize()); |
| | | requestData = allocateDto.Serialize(); |
| | | } |
| | | httpResponseResult.ApiUrl = apiUrl; |
| | | bool isSuccess = httpResponseResult.IsSuccess && httpResponseResult.Data.Code == "200"; |
| | | string message = "æå"; |
| | | if (!isSuccess) |
| | | { |
| | | if (!httpResponseResult.IsSuccess) |
| | | { |
| | | message = $"MESæ¥å£è¿åé误ï¼HTTP代ç ï¼{httpResponseResult.StatusCode}ï¼ä¿¡æ¯ï¼{httpResponseResult.ErrorMessage}"; |
| | | } |
| | | else if (httpResponseResult?.Data?.Code != "200") |
| | | { |
| | | message = $"è°ç¨MESæ¥å£å¤±è´¥ï¼ä»£ç ï¼{httpResponseResult?.Data?.Code}ï¼ä¿¡æ¯ï¼{httpResponseResult?.Data?.Message}"; |
| | | } |
| | | } |
| | | Dt_MesReturnRecord mesReturnRecord = new Dt_MesReturnRecord() |
| | | { |
| | | ApiUrl = httpResponseResult.ApiUrl, |
| | | InterfaceType = InterfaceType, |
| | | OrderId = order.Id, |
| | | OrderNo = order.InboundOrderNo, |
| | | RequestCode = reqCode, |
| | | RequestData = requestData, |
| | | FailureReason = message, |
| | | LastReturnTime = DateTime.Now, |
| | | HttpStatusCode = httpResponseResult.StatusCode.ObjToInt(), |
| | | ResponseData = httpResponseResult.Content, |
| | | ReturnType = 0, |
| | | ReturnCount = 1, |
| | | ReturnStatus = httpResponseResult.IsSuccess ? 1 : 2, |
| | | SuccessTime = httpResponseResult.IsSuccess ? DateTime.Now : null |
| | | }; |
| | | _unitOfWorkManage.Db.Insertable(mesReturnRecord).ExecuteCommand(); |
| | | |
| | | return httpResponseResult; |
| | | } |
| | | } |
| | | } |
| | |
| | | public string BarcodeUnit { get; set; } = null!; |
| | | |
| | | /// <summary> |
| | | /// åä¼ MES |
| | | /// åä¼ MES 0æªåä¼ 1å·²åä¼ 2åä¼ å¤±è´¥ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "åä¼ MES")] |
| | | public int ReturnToMESStatus { get; set; } = 0; |
| | |
| | | { |
| | | return await Service.AllcatedGroupPallet(palletDto); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
¥åºåæ¹åä¼ MES |
| | | /// </summary> |
| | | /// <param name="palletDto"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("BatchInOrderFeedbackToMes"), AllowAnonymous] |
| | | public WebResponseContent BatchInOrderFeedbackToMes(string OrderNo) |
| | | { |
| | | return Service.BatchInOrderFeedbackToMes(OrderNo); |
| | | } |
| | | } |
| | | } |