| | |
| | | type: 'warning', |
| | | onClick: function () { |
| | | } |
| | | },{ |
| | | name: "空æåºåº", |
| | | // icon: 'el-icon-upload2', |
| | | class: '', |
| | | value: 'EmptyTrayOutbound', |
| | | type: 'primary', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | ] |
| | | |
| | |
| | | ? "api/Task/GenerateOutboundTask?orderDetailId=" |
| | | : "api/Task/GenerateOutboundTask?orderDetailId="; |
| | | this.http |
| | | .post(url + this.row.id, this.selection, "æ°æ®å¤çä¸") |
| | | .post(url + this.row.id+"&station="+this.outboundForm.selectedPlatform, this.selection, "æ°æ®å¤çä¸") |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.$message.success("æä½æå"); |
| | |
| | | const mountNode = document.createElement('div'); |
| | | document.body.appendChild(mountNode); |
| | | |
| | | const boxCodeReg = /^[A-Z]\d{9}$/; |
| | | // ååºå¼è¡¨åæ°æ®ï¼æç®±ç ï¼å¿
å¡«ï¼æ«ç æª/æå¨è¾å
¥ï¼ |
| | | const formData = reactive({ |
| | | boxCode: '', |
| | |
| | | // æäº¤è¡¨åçç»ä¸é»è¾ï¼ä¾å车触ååæé®ç¹å»å
±ç¨ï¼ |
| | | const submitForm = async () => { |
| | | const formRef = vnode.component.refs.batchInForm; |
| | | |
| | | if (!boxCodeReg.test(formData.boxCode.trim())) { |
| | | ElMessage.warning('æç®±ç æ ¼å¼é误'); |
| | | selectBoxCodeInput(); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | // æ§è¡è¡¨åæ ¡éªï¼æç®±ç å¿
å¡«ï¼ |
| | | await formRef.validate(); |
| | | } catch (err) { |
| | | ElMessage.warning('请è¾å
¥ææçæç®±ç '); |
| | | const errorMsg = err?.[0]?.message || '请è¾å
¥ææçæç®±ç '; |
| | | ElMessage.warning(errorMsg); |
| | | selectBoxCodeInput(); |
| | | return; |
| | | } |
| | | |
| | | |
| | | http.post('/api/InboundOrder/EmptyMaterielGroup', { |
| | | palletCode: formData.boxCode.trim(), |
| | | warehouseCode:formData.warehouseCode |
| | |
| | | model: formData, |
| | | rules: { |
| | | boxCode: [ |
| | | { required: true, message: '请è¾å
¥æç®±ç ', trigger: ['blur', 'enter'] } |
| | | { required: true, message: '请è¾å
¥æç®±ç ', trigger: ['blur', 'change'] }, |
| | | { pattern: boxCodeReg, message: 'æç®±ç æ ¼å¼é误', trigger: ['blur', 'change'] } |
| | | ], |
| | | warehouseCode:[ |
| | | { required: true, message: 'è¯·éæ©åºå', trigger: ['change', 'blur'] } |
| | |
| | | data() { |
| | | return { |
| | | palletVisible: this.visible, |
| | | trayBarcodeReg:/^[A-Z]\d{9}$/, |
| | | trayBarcode: '', |
| | | barcode: '', |
| | | materials: [], |
| | |
| | | trigger: 'change' |
| | | } |
| | | ], |
| | | trayBarcode:[ |
| | | { |
| | | pattern: this.trayBarcodeReg, |
| | | message: 'æçå·æ ¼å¼é误ï¼é为1个大å忝+9个æ°åï¼å¦A000008024ï¼', |
| | | trigger: 'blur' |
| | | } |
| | | ], |
| | | warehouseType: [ |
| | | { |
| | | massage: 'è¯·éæ©ä»åº', |
| | | message: 'è¯·éæ©ä»åº', |
| | | trigger: 'change' |
| | | } |
| | | ] |
| | |
| | | inputEl.focus(); |
| | | this.currentFocus = 'tray'; |
| | | this.scanTarget = 'tray'; |
| | | inputEl.select(); |
| | | } |
| | | } |
| | | }, |
| | |
| | | |
| | | this.error = ''; |
| | | |
| | | if(!this.trayBarcodeReg.test(currentTrayBarcode)){ |
| | | ElMessage.warning({ |
| | | message: 'æçå·æ ¼å¼é误', |
| | | type: 'warning', |
| | | duration: 3000 |
| | | }) |
| | | this.focusTrayInput(); |
| | | return; |
| | | } |
| | | |
| | | // 设置æçæ¡ç åï¼èªå¨èç¦å°ç©æè¾å
¥æ¡ |
| | | this.focusBarcodeInput(); |
| | | |
| | |
| | | data() { |
| | | return { |
| | | palletVisible: this.visible, |
| | | trayBarcodeReg: /^[A-Z]\d{9}$/, |
| | | trayBarcode: '', |
| | | barcode: '', |
| | | materials: [], |
| | |
| | | trigger: 'change' |
| | | } |
| | | ], |
| | | trayBarcode: [ |
| | | { |
| | | pattern: /^[A-Z]\d{9}$/, |
| | | message: 'æçå·æ ¼å¼é误', |
| | | trigger: 'blur' |
| | | } |
| | | ], |
| | | warehouseType: [ |
| | | { |
| | | massage: 'è¯·éæ©ä»åº', |
| | |
| | | inputEl.focus(); |
| | | this.currentFocus = 'tray'; |
| | | this.scanTarget = 'tray'; |
| | | inputEl.select(); |
| | | } |
| | | } |
| | | }, |
| | |
| | | |
| | | this.error = ''; |
| | | |
| | | if (!this.trayBarcodeReg.test(currentTrayBarcode)) { |
| | | ElMessage.error('æçæ¡ç æ ¼å¼é误'); |
| | | this.focusTrayInput(); |
| | | return; |
| | | } |
| | | |
| | | // 设置æçæ¡ç åï¼èªå¨èç¦å°ç©æè¾å
¥æ¡ |
| | | this.focusBarcodeInput(); |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <vol-box v-model="show" title="空æåºåº" :width="800" :height="600"> |
| | | <template #content> |
| | | <el-form ref="form" :model="form" label-width="90px"> |
| | | <el-form-item label="åºåºåºå:"> |
| | | <el-select v-model="locationType" placeholder="è¯·éæ©åºåºåºå"> |
| | | <el-option v-for="item in locationTypes" :key="item.locationType" :label="item.locationTypeDesc.toString()" :value="item.locationType"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-form ref="form" :model="form" label-width="90px"> |
| | | <el-form-item label="åºåºæ°é:"> |
| | | <el-select v-model="num" placeholder="è¯·éæ©åºåºæ°é"> |
| | | <el-option v-for="item in 6" :key="item" :label="item.toString()" :value="item"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | </template> |
| | | <template #footer> |
| | | <div> |
| | | <el-button type="danger" size="small" plain @click="submit"> |
| | | <i class="el-icon-check">确认</i> |
| | | </el-button> |
| | | <el-button size="small" type="primary" plain @click="() => { this.show = false }"> |
| | | <i class="el-icon-close">å
³é</i> |
| | | </el-button> |
| | | </div> |
| | | </template> |
| | | </vol-box> |
| | | </template> |
| | | |
| | | <script> |
| | | import VolBox from '@/components/basic/VolBox.vue' |
| | | export default { |
| | | components: { |
| | | 'vol-box': VolBox |
| | | }, |
| | | data() { |
| | | return { |
| | | num: 1, |
| | | show: false, |
| | | locationTypes: [], |
| | | locationType:"", |
| | | } |
| | | }, |
| | | methods: { |
| | | open() { |
| | | this.show = true |
| | | this.getData(); |
| | | }, |
| | | submit() { |
| | | this.$emit('parentCall', ($vue) => { |
| | | this.http.post(`/api/Task/PalletOutboundTask?num=${this.num}&locationType=${this.locationType}`, {}, 'æ°æ®å¤çä¸...') |
| | | .then((x) => { |
| | | if (!x.status) { |
| | | this.$message.error(x.message) |
| | | } else { |
| | | this.show = false |
| | | this.$Message.success(x.message) |
| | | $vue.refresh(); |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | getData() { |
| | | this.http.post("api/LocationInfo/GetLocationTypes",null, "æ¥è¯¢ä¸") |
| | | .then((x) => { |
| | | this.locationTypes = x.data; |
| | | }) |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | |
| | | |
| | | import gridBody from './extend/outOrderDetail.vue' |
| | | import gridHeader from './extend/NoStockOut.vue' |
| | | import gridFooter from './extend/EmptyTrayOutbound.vue' |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: gridHeader, |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | gridFooter: gridFooter, |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { |
| | | view: [ |
| | | |
| | | |
| | | /* { |
| | | name: 'åºåº', |
| | | type: 'primary', |
| | |
| | | }); |
| | | } |
| | | }, */ |
| | | { |
| | | name: '空æçåºåº', |
| | | type: 'primary', |
| | | value: '空æçåºåº', |
| | | onClick: function () { |
| | | // { |
| | | // name: '空æçåºåº', |
| | | // type: 'primary', |
| | | // value: '空æçåºåº', |
| | | // onClick: function () { |
| | | |
| | | |
| | | const platformOptions = Array.from({ length: 1 }, (_, i) => { |
| | | const num = 1; |
| | | return { label: `ç«å°${num}`, value: `1-2` }; |
| | | }); |
| | | // const platformOptions = Array.from({ length: 1 }, (_, i) => { |
| | | // const num = 1; |
| | | // return { label: `ç«å°${num}`, value: `1-2` }; |
| | | // }); |
| | | |
| | | const quantityOptions = Array.from({ length: 6 }, (_, i) => ({ |
| | | label: (i + 1).toString(), |
| | | value: i + 1 |
| | | })); |
| | | // const quantityOptions = Array.from({ length: 6 }, (_, i) => ({ |
| | | // label: (i + 1).toString(), |
| | | // value: i + 1 |
| | | // })); |
| | | |
| | | const warehouseOptions = ref([]); |
| | | const isLoadingWarehouses = ref(false); |
| | | // const warehouseOptions = ref([]); |
| | | // const isLoadingWarehouses = ref(false); |
| | | |
| | | const getWarehouseList = async () => { |
| | | isLoadingWarehouses.value = true; |
| | | try { |
| | | const { data, status } = await http.post('/api/LocationInfo/GetLocationTypes'); |
| | | if (status && Array.isArray(data)) { |
| | | // æ ¼å¼åä»åºé项ï¼éé
ElSelectçlabel-valueæ ¼å¼ |
| | | warehouseOptions.value = data.map(item => ({ |
| | | label: item.locationTypeDesc, |
| | | value: item.locationType |
| | | })); |
| | | } else { |
| | | ElMessage.error('è·ååºåå表失败'); |
| | | warehouseOptions.value = []; |
| | | } |
| | | } catch (err) { |
| | | ElMessage.error('åºåæ°æ®è¯·æ±å¼å¸¸ï¼è¯·ç¨åéè¯'); |
| | | warehouseOptions.value = []; |
| | | } finally { |
| | | isLoadingWarehouses.value = false; |
| | | } |
| | | }; |
| | | // const getWarehouseList = async () => { |
| | | // isLoadingWarehouses.value = true; |
| | | // try { |
| | | // const { data, status } = await http.post('/api/LocationInfo/GetLocationTypes'); |
| | | // if (status && Array.isArray(data)) { |
| | | // // æ ¼å¼åä»åºé项ï¼éé
ElSelectçlabel-valueæ ¼å¼ |
| | | // warehouseOptions.value = data.map(item => ({ |
| | | // label: item.locationTypeDesc, |
| | | // value: item.locationType |
| | | // })); |
| | | // } else { |
| | | // ElMessage.error('è·ååºåå表失败'); |
| | | // warehouseOptions.value = []; |
| | | // } |
| | | // } catch (err) { |
| | | // ElMessage.error('åºåæ°æ®è¯·æ±å¼å¸¸ï¼è¯·ç¨åéè¯'); |
| | | // warehouseOptions.value = []; |
| | | // } finally { |
| | | // isLoadingWarehouses.value = false; |
| | | // } |
| | | // }; |
| | | |
| | | const mountNode = document.createElement('div'); |
| | | document.body.appendChild(mountNode); |
| | | // const mountNode = document.createElement('div'); |
| | | // document.body.appendChild(mountNode); |
| | | |
| | | |
| | | const formData = reactive({ |
| | | warehouseCode: '', |
| | | palletCode: '', |
| | | selectedPlatform: platformOptions[0].value, |
| | | quantity: 1 |
| | | }); |
| | | // const formData = reactive({ |
| | | // warehouseCode: '', |
| | | // palletCode: '', |
| | | // selectedPlatform: platformOptions[0].value, |
| | | // quantity: 1 |
| | | // }); |
| | | |
| | | const vnode = createVNode(ElDialog, { |
| | | title: '空æçåºåº', |
| | | width: '500px', |
| | | modelValue: true, |
| | | appendToBody: true, |
| | | onOpened: async () => { |
| | | await getWarehouseList(); |
| | | const inputRef = vnode.component.refs.boxCodeInput; |
| | | inputRef?.focus(); |
| | | }, |
| | | 'onUpdate:modelValue': (isVisible) => { |
| | | if (!isVisible) { |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | } |
| | | }, |
| | | style: { |
| | | padding: '20px 0', |
| | | borderRadius: '8px' |
| | | } |
| | | }, { |
| | | default: () => h(ElForm, { |
| | | model: formData, |
| | | rules: { |
| | | warehouseCode: [ |
| | | { required: true, message: 'è¯·éæ©åºå', trigger: ['change', 'blur'] } |
| | | ], |
| | | palletCode: [ |
| | | { type: 'string', message: 'æç®±å·å¿
须为å符串', trigger: 'blur' } |
| | | ], |
| | | selectedPlatform: [ |
| | | { required: true, message: 'è¯·éæ©åºåºç«å°', trigger: 'change' } |
| | | ], |
| | | quantity: [ |
| | | { required: true, message: 'è¯·éæ©ç©ºç®±æ°é', trigger: 'change' } |
| | | ] |
| | | }, |
| | | ref: 'batchOutForm', |
| | | labelWidth: '100px', |
| | | style: { |
| | | padding: '0 30px', |
| | | } |
| | | }, |
| | | [ |
| | | // h(ElFormItem, { |
| | | // label: 'ä»åºåºå', |
| | | // prop: 'warehouseCode', |
| | | // style: { |
| | | // marginBottom: '24px' |
| | | // } |
| | | // }, [ |
| | | // h(ElSelect, { |
| | | // placeholder: 'è¯·éæ©ä»åºåºå', |
| | | // modelValue: formData.warehouseCode, |
| | | // 'onUpdate:modelValue': (val) => { |
| | | // formData.warehouseCode = val; |
| | | // }, |
| | | // style: { |
| | | // width: '100%', |
| | | // height: '40px', |
| | | // borderRadius: '4px', |
| | | // borderColor: '#dcdfe6' |
| | | // } |
| | | // }, warehouseOptions.value.map(platform => |
| | | // h(ElOption, { label: platform.label, value: platform.value }) |
| | | // )) |
| | | // ]), |
| | | h(ElFormItem, { |
| | | label: 'åºåºç«å°', |
| | | prop: 'selectedPlatform', |
| | | style: { |
| | | marginBottom: '24px' |
| | | } |
| | | }, [ |
| | | h(ElSelect, { |
| | | placeholder: 'è¯·éæ©åºåºç«å°', |
| | | modelValue: formData.selectedPlatform, |
| | | 'onUpdate:modelValue': (val) => { |
| | | formData.selectedPlatform = val; |
| | | }, |
| | | style: { |
| | | width: '100%', |
| | | height: '40px', |
| | | borderRadius: '4px', |
| | | borderColor: '#dcdfe6' |
| | | } |
| | | }, platformOptions.map(platform => |
| | | h(ElOption, { label: platform.label, value: platform.value }) |
| | | )) |
| | | ]), |
| | | // h(ElFormItem,{ |
| | | // label:'åºåºæ°é', |
| | | // prop:'quantity', |
| | | // style:{ |
| | | // marginBottom:'24px' |
| | | // } |
| | | // },[h(ElSelect,{ |
| | | // placeholder:'è¯·éæ©ç©ºç®±æ°é', |
| | | // modelValue:formData.quantity, |
| | | // 'onUpdate:modelValue':(val)=>{ |
| | | // formData.quantity=val; |
| | | // }, |
| | | // style:{ |
| | | // width:'100%', |
| | | // height:'40px', |
| | | // borderRadius:'4px', |
| | | // borderColor:'#dcdfe6' |
| | | // }, |
| | | // filterable:false |
| | | // }, |
| | | // quantityOptions.map(option=> |
| | | // h(ElOption,{ |
| | | // label:option.label, |
| | | // value:option.value |
| | | // }) |
| | | // ) |
| | | // )]), |
| | | h(ElFormItem, { |
| | | label: 'æç®±å·', |
| | | prop: 'palletCode', |
| | | style: { |
| | | marginBottom: '16px' |
| | | } |
| | | }, [ |
| | | h(ElInput, { |
| | | type: 'text', |
| | | placeholder: 'å¯éè¾å
¥æç®±å·ï¼ä¸å¡«åèªå¨åé
空æç®±', |
| | | modelValue: formData.palletCode, |
| | | 'onUpdate:modelValue': (val) => { |
| | | formData.palletCode = val; |
| | | }, |
| | | style: { |
| | | width: '100%', |
| | | height: '40px', |
| | | borderRadius: '4px', |
| | | borderColor: '#dcdfe6' |
| | | }, |
| | | attrs: { |
| | | placeholderStyle: 'color: #909399;' |
| | | } |
| | | }) |
| | | ]), |
| | | // const vnode = createVNode(ElDialog, { |
| | | // title: '空æçåºåº', |
| | | // width: '500px', |
| | | // modelValue: true, |
| | | // appendToBody: true, |
| | | // onOpened: async () => { |
| | | // await getWarehouseList(); |
| | | // const inputRef = vnode.component.refs.boxCodeInput; |
| | | // inputRef?.focus(); |
| | | // }, |
| | | // 'onUpdate:modelValue': (isVisible) => { |
| | | // if (!isVisible) { |
| | | // render(null, mountNode); |
| | | // document.body.removeChild(mountNode); |
| | | // } |
| | | // }, |
| | | // style: { |
| | | // padding: '20px 0', |
| | | // borderRadius: '8px' |
| | | // } |
| | | // }, { |
| | | // default: () => h(ElForm, { |
| | | // model: formData, |
| | | // rules: { |
| | | // warehouseCode: [ |
| | | // { required: true, message: 'è¯·éæ©åºå', trigger: ['change', 'blur'] } |
| | | // ], |
| | | // palletCode: [ |
| | | // { type: 'string', message: 'æç®±å·å¿
须为å符串', trigger: 'blur' } |
| | | // ], |
| | | // selectedPlatform: [ |
| | | // { required: true, message: 'è¯·éæ©åºåºç«å°', trigger: 'change' } |
| | | // ], |
| | | // quantity: [ |
| | | // { required: true, message: 'è¯·éæ©ç©ºç®±æ°é', trigger: 'change' } |
| | | // ] |
| | | // }, |
| | | // ref: 'batchOutForm', |
| | | // labelWidth: '100px', |
| | | // style: { |
| | | // padding: '0 30px', |
| | | // } |
| | | // }, |
| | | // [ |
| | | // // h(ElFormItem, { |
| | | // // label: 'ä»åºåºå', |
| | | // // prop: 'warehouseCode', |
| | | // // style: { |
| | | // // marginBottom: '24px' |
| | | // // } |
| | | // // }, [ |
| | | // // h(ElSelect, { |
| | | // // placeholder: 'è¯·éæ©ä»åºåºå', |
| | | // // modelValue: formData.warehouseCode, |
| | | // // 'onUpdate:modelValue': (val) => { |
| | | // // formData.warehouseCode = val; |
| | | // // }, |
| | | // // style: { |
| | | // // width: '100%', |
| | | // // height: '40px', |
| | | // // borderRadius: '4px', |
| | | // // borderColor: '#dcdfe6' |
| | | // // } |
| | | // // }, warehouseOptions.value.map(platform => |
| | | // // h(ElOption, { label: platform.label, value: platform.value }) |
| | | // // )) |
| | | // // ]), |
| | | // h(ElFormItem, { |
| | | // label: 'åºåºç«å°', |
| | | // prop: 'selectedPlatform', |
| | | // style: { |
| | | // marginBottom: '24px' |
| | | // } |
| | | // }, [ |
| | | // h(ElSelect, { |
| | | // placeholder: 'è¯·éæ©åºåºç«å°', |
| | | // modelValue: formData.selectedPlatform, |
| | | // 'onUpdate:modelValue': (val) => { |
| | | // formData.selectedPlatform = val; |
| | | // }, |
| | | // style: { |
| | | // width: '100%', |
| | | // height: '40px', |
| | | // borderRadius: '4px', |
| | | // borderColor: '#dcdfe6' |
| | | // } |
| | | // }, platformOptions.map(platform => |
| | | // h(ElOption, { label: platform.label, value: platform.value }) |
| | | // )) |
| | | // ]), |
| | | // // h(ElFormItem,{ |
| | | // // label:'åºåºæ°é', |
| | | // // prop:'quantity', |
| | | // // style:{ |
| | | // // marginBottom:'24px' |
| | | // // } |
| | | // // },[h(ElSelect,{ |
| | | // // placeholder:'è¯·éæ©ç©ºç®±æ°é', |
| | | // // modelValue:formData.quantity, |
| | | // // 'onUpdate:modelValue':(val)=>{ |
| | | // // formData.quantity=val; |
| | | // // }, |
| | | // // style:{ |
| | | // // width:'100%', |
| | | // // height:'40px', |
| | | // // borderRadius:'4px', |
| | | // // borderColor:'#dcdfe6' |
| | | // // }, |
| | | // // filterable:false |
| | | // // }, |
| | | // // quantityOptions.map(option=> |
| | | // // h(ElOption,{ |
| | | // // label:option.label, |
| | | // // value:option.value |
| | | // // }) |
| | | // // ) |
| | | // // )]), |
| | | // h(ElFormItem, { |
| | | // label: 'æç®±å·', |
| | | // prop: 'palletCode', |
| | | // style: { |
| | | // marginBottom: '16px' |
| | | // } |
| | | // }, [ |
| | | // h(ElInput, { |
| | | // type: 'text', |
| | | // placeholder: 'å¯éè¾å
¥æç®±å·ï¼ä¸å¡«åèªå¨åé
空æç®±', |
| | | // modelValue: formData.palletCode, |
| | | // 'onUpdate:modelValue': (val) => { |
| | | // formData.palletCode = val; |
| | | // }, |
| | | // style: { |
| | | // width: '100%', |
| | | // height: '40px', |
| | | // borderRadius: '4px', |
| | | // borderColor: '#dcdfe6' |
| | | // }, |
| | | // attrs: { |
| | | // placeholderStyle: 'color: #909399;' |
| | | // } |
| | | // }) |
| | | // ]), |
| | | |
| | | h('div', { |
| | | style: { |
| | | textAlign: 'right', |
| | | marginTop: '8px', |
| | | paddingRight: '4px' |
| | | } |
| | | }, [ |
| | | h(ElButton, { |
| | | type: 'text', |
| | | onClick: () => { |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | ElMessage.info('åæ¶åºåºæä½'); |
| | | }, |
| | | style: { |
| | | marginRight: '8px', |
| | | color: '#606266' |
| | | } |
| | | }, 'åæ¶'), |
| | | h(ElButton, { |
| | | type: 'primary', |
| | | onClick: async () => { |
| | | const formRef = vnode.component.refs.batchOutForm; |
| | | try { |
| | | await formRef.validate(); |
| | | } catch (err) { |
| | | return; |
| | | } |
| | | // h('div', { |
| | | // style: { |
| | | // textAlign: 'right', |
| | | // marginTop: '8px', |
| | | // paddingRight: '4px' |
| | | // } |
| | | // }, [ |
| | | // h(ElButton, { |
| | | // type: 'text', |
| | | // onClick: () => { |
| | | // render(null, mountNode); |
| | | // document.body.removeChild(mountNode); |
| | | // ElMessage.info('åæ¶åºåºæä½'); |
| | | // }, |
| | | // style: { |
| | | // marginRight: '8px', |
| | | // color: '#606266' |
| | | // } |
| | | // }, 'åæ¶'), |
| | | // h(ElButton, { |
| | | // type: 'primary', |
| | | // onClick: async () => { |
| | | // const formRef = vnode.component.refs.batchOutForm; |
| | | // try { |
| | | // await formRef.validate(); |
| | | // } catch (err) { |
| | | // return; |
| | | // } |
| | | |
| | | http.post('/api/Task/PalletOutboundTask?palletCode=' + formData.palletCode + '&endStation=' + formData.selectedPlatform, { |
| | | // http.post('/api/Task/PalletOutboundTask?palletCode=' + formData.palletCode + '&endStation=' + formData.selectedPlatform, { |
| | | |
| | | }).then(({ data, status, message }) => { |
| | | if (status) { |
| | | // }).then(({ data, status, message }) => { |
| | | // if (status) { |
| | | |
| | | ElMessage.success(`åºåºæå`); |
| | | this.refresh(); |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | } else { |
| | | ElMessage.error(message || data?.message || 'åºåºå¤±è´¥'); |
| | | } |
| | | }).catch(() => { |
| | | ElMessage.error('请æ±å¤±è´¥ï¼è¯·ç¨åéè¯'); |
| | | }); |
| | | }, |
| | | style: { |
| | | borderRadius: '4px', |
| | | padding: '8px 20px' |
| | | } |
| | | }, 'ç¡®å®') |
| | | ]) |
| | | ]) |
| | | }); |
| | | // ElMessage.success(`åºåºæå`); |
| | | // this.refresh(); |
| | | // render(null, mountNode); |
| | | // document.body.removeChild(mountNode); |
| | | // } else { |
| | | // ElMessage.error(message || data?.message || 'åºåºå¤±è´¥'); |
| | | // } |
| | | // }).catch(() => { |
| | | // ElMessage.error('请æ±å¤±è´¥ï¼è¯·ç¨åéè¯'); |
| | | // }); |
| | | // }, |
| | | // style: { |
| | | // borderRadius: '4px', |
| | | // padding: '8px 20px' |
| | | // } |
| | | // }, 'ç¡®å®') |
| | | // ]) |
| | | // ]) |
| | | // }); |
| | | |
| | | vnode.appContext = this.$.appContext; |
| | | render(vnode, mountNode); |
| | | } |
| | | } |
| | | // vnode.appContext = this.$.appContext; |
| | | // render(vnode, mountNode); |
| | | // } |
| | | // } |
| | | ], box: [], detail: [] |
| | | }, //æ©å±çæé® |
| | | methods: { |
| | |
| | | } |
| | | } |
| | | |
| | | var EmptyTrayOutboundBtn = this.buttons.find(x => x.value == "EmptyTrayOutbound"); |
| | | if (EmptyTrayOutboundBtn != null) { |
| | | EmptyTrayOutboundBtn.onClick = () => { |
| | | this.$refs.gridFooter.open(); |
| | | } |
| | | } |
| | | |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | |
| | | bind: { key: "createType", data: [] }, |
| | | }, |
| | | { |
| | | field: "fromWarehouse", |
| | | title: "è°åºä»åº", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "toWarehouse", |
| | | title: "è°å
¥ä»åº", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "factoryArea", |
| | | title: "ååº", |
| | | type: "string", |
| | |
| | | bind: { key: "createType", data: [] }, |
| | | }, |
| | | { |
| | | field: "fromWarehouse", |
| | | title: "è°åºä»åº", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "toWarehouse", |
| | | title: "è°å
¥ä»åº", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "factoryArea", |
| | | title: "ååº", |
| | | type: "string", |
| | |
| | | { title: "ç©æç¼å·", field: "materielCode" ,type:'like'}, |
| | | { title: "ç©æåç§°", field: "materielName" ,type:'like'}, |
| | | { title: "åæ®ç¼å·", field: "orderNo" ,type:'like'}, |
| | | { title: "æçå·", field: "palletCode" ,type:'like'}, |
| | | ], |
| | | ]); |
| | | const columns = ref([ |
| | |
| | | } |
| | | } |
| | | |
| | | public override PageGridData<Dt_AllocateOrder> GetPageData(PageDataOptions options) |
| | | { |
| | | string wheres = ValidatePageOptions(options); |
| | | //è·åæåºå段 |
| | | Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties); |
| | | List<OrderByModel> orderByModels = new List<OrderByModel>(); |
| | | foreach (var item in orderbyDic) |
| | | { |
| | | OrderByModel orderByModel = new() |
| | | { |
| | | FieldName = item.Key, |
| | | OrderByType = item.Value |
| | | }; |
| | | orderByModels.Add(orderByModel); |
| | | } |
| | | |
| | | |
| | | int totalCount = 0; |
| | | List<SearchParameters> searchParametersList = new List<SearchParameters>(); |
| | | if (!string.IsNullOrEmpty(options.Wheres)) |
| | | { |
| | | try |
| | | { |
| | | searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>(); |
| | | options.Filter = searchParametersList; |
| | | } |
| | | catch { } |
| | | } |
| | | var data = BaseDal.Db.Queryable<Dt_AllocateOrder>() |
| | | .WhereIF(!wheres.IsNullOrEmpty(), wheres) |
| | | .OrderBy(orderByModels) |
| | | .ToPageList(options.Page, options.Rows, ref totalCount); |
| | | |
| | | foreach (var item in data) |
| | | { |
| | | Dt_InboundOrder _InboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == item.UpperOrderNo).First(); |
| | | if (_InboundOrder != null) |
| | | { |
| | | item.OrderStatus = _InboundOrder.OrderStatus; |
| | | item.OrderType = _InboundOrder.OrderType; |
| | | } |
| | | } |
| | | return new PageGridData<Dt_AllocateOrder>(totalCount, data); |
| | | } |
| | | |
| | | public override PageGridData<Dt_InboundOrderDetail> GetDetailPage(PageDataOptions options) |
| | | { |
| | | string wheres = ValidatePageOptions(options); |
| | |
| | | using Dm.filter; |
| | | using MailKit.Search; |
| | | using Microsoft.Extensions.Logging; |
| | | using Newtonsoft.Json; |
| | | using Org.BouncyCastle.Asn1.Ocsp; |
| | |
| | | using System.Linq; |
| | | using System.Net; |
| | | using System.Net.Http; |
| | | using System.Reflection.Metadata; |
| | | using System.Security.Policy; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | |
| | | |
| | | namespace WIDESEA_BasicService |
| | | { |
| | | public class TransferDataDto |
| | | { |
| | | public DateTime TransferTime { get; set; } |
| | | public List<TransferItemDto> Items { get; set; } |
| | | } |
| | | |
| | | public class TransferItemDto |
| | | { |
| | | public string MaterialCode { get; set; } |
| | | public decimal TotalQuantity { get; set; } |
| | | public List<LocationInfoDto> Locations { get; set; } |
| | | } |
| | | public class LocationInfoDto |
| | | { |
| | | public string LocationCode { get; set; } |
| | | public decimal Quantity { get; set; } |
| | | public List<BarcodeInfoDto> Barcodes { get; set; } |
| | | } |
| | | |
| | | public class BarcodeInfoDto |
| | | { |
| | | public string Barcode { get; set; } |
| | | public decimal Quantity { get; set; } |
| | | } |
| | | public class InvokeMESService : IInvokeMESService |
| | | { |
| | | private readonly IHttpClientFactory _httpClientFactory; |
| | |
| | | private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository; |
| | | private readonly IRepository<Dt_StockInfo> _stockInfoRepository; |
| | | private readonly IRepository<Dt_InboundOrder> _inboundOrderRepository; |
| | | private readonly IRepository<Dt_PickingRecord> _pickingRecoreRepository; |
| | | private readonly IMaterialUnitService _materialUnitService; |
| | | private readonly IOutboundOrderService _outboundOrderService; |
| | | private readonly IOutboundOrderDetailService _outboundOrderDetailService; |
| | | private readonly IOutStockLockInfoService _outStockLockInfoService; |
| | | public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService, IMaterialUnitService materialUnitService) |
| | | public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService, IMaterialUnitService materialUnitService, IRepository<Dt_PickingRecord> pickingRecoreRepository) |
| | | { |
| | | _httpClientFactory = httpClientFactory; |
| | | _logger = logger; |
| | |
| | | _outboundOrderDetailService = outboundOrderDetailService; |
| | | _outStockLockInfoService = outStockLockInfoService; |
| | | _materialUnitService = materialUnitService; |
| | | _pickingRecoreRepository = pickingRecoreRepository; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | _client.DefaultRequestHeaders.Clear(); |
| | | _client.DefaultRequestHeaders.Add("Accept", "application/json"); |
| | | |
| | | _logger.LogInformation("InvokeMESService FeedbackOutbound : " + json); |
| | | _logger.LogInformation("InvokeMESService FeedbackOutbound : "+ model.orderNo +" , " + json); |
| | | |
| | | var response = await _client.PostAsync("AldMaterialOutbound/MaterialOutbound", content); |
| | | string body = await response.Content.ReadAsStringAsync(); |
| | |
| | | |
| | | throw new HttpRequestException(body); |
| | | } |
| | | |
| | | _logger.LogInformation("InvokeMESService FeedbackOutbound body: " + body); |
| | | |
| | | return JsonConvert.DeserializeObject<ResponseModel>(body); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | |
| | | MaterialCode = group.Key.MaterielCode, |
| | | LineNo = group.Key.InboundOrderRowNo, |
| | | WarehouseCode = group.Key.WarehouseCode, |
| | | Qty = group.Sum(x => x.BarcodeQty), |
| | | Qty = group.Sum(x => x.BarcodeQty), |
| | | Unit = group.Key.BarcodeUnit, |
| | | Barcodes = group.Select(row => new BarcodeInfo |
| | | { |
| | |
| | | Qty = row.BarcodeQty, |
| | | BatchNo = row.BatchNo, |
| | | SupplyCode = row.SupplyCode, |
| | | Unit = row.Unit |
| | | Unit = row.BarcodeUnit |
| | | }).ToList() |
| | | }).ToList(); |
| | | allocatefeedmodel.Details = groupedData; |
| | |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | |
| | | private async Task<WebResponseContent> HandleOutboundOrderBatchToMESCompletion(Dt_OutboundOrder outboundOrder, string orderNo) |
| | | { |
| | | // å®ä¹é»è®¤è¿åï¼æåæï¼ |
| | | WebResponseContent response = WebResponseContent.Instance.OK("åä¼ MESå¤ç宿"); |
| | | |
| | | //0 = æªåä¼ ï¼1 = å·²åä¼ æåï¼2 = åä¼ å¤±è´¥ |
| | | try |
| | | { |
| | | // æ ¡éªï¼å·²åä¼ ç´æ¥è¿åé误 |
| | |
| | | return WebResponseContent.Instance.Error("ææ éè¦å¤çç订åæç»"); |
| | | } |
| | | |
| | | // çé已宿åºåºçæç»ID |
| | | |
| | | var pickingRecords = await _pickingRecoreRepository.Db.Queryable<Dt_PickingRecord>().Where(x => x.OrderNo == orderNo && x.ReturnToMESStatus != 1 && !x.IsCancelled).ToListAsync(); |
| | | |
| | | if (!pickingRecords.Any()) |
| | | return WebResponseContent.Instance.Error("没æéè¦åä¼ çåæ£è®°å½"); |
| | | |
| | | |
| | | var documentNo = UniqueValueGenerator.Generate(); |
| | | |
| | | |
| | | var feedModel = new FeedbackOutboundRequestModel |
| | | { |
| | | reqCode = Guid.NewGuid().ToString(), |
| | | reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | business_type = outboundOrder.BusinessType, |
| | | factoryArea = outboundOrder.FactoryArea, |
| | | operationType = 1, |
| | | Operator = outboundOrder.Operator!=""? outboundOrder.Operator:App.User.UserName, |
| | | orderNo = outboundOrder.UpperOrderNo, |
| | | documentsNO = documentNo, |
| | | status = outboundOrder.OrderStatus, |
| | | details = new List<FeedbackOutboundDetailsModel>() |
| | | }; |
| | | var detailIds = new List<int>(); |
| | | // å¡«å
æç»åæ¡ç ä¿¡æ¯ |
| | | foreach (var detail in orderDetails) |
| | | { |
| | | // æ¥è¯¢è¯¥æç»å¯¹åºçé宿¡ç è®°å½ |
| | | var detailPicks = pickingRecords.Where(x => x.OrderNo == orderNo |
| | | && detail.Id == x.OrderDetailId).ToList(); |
| | | if (!detailPicks.Any()) |
| | | { |
| | | continue; |
| | | } |
| | | var detailModel = new FeedbackOutboundDetailsModel |
| | | { |
| | | materialCode = detail.MaterielCode, |
| | | lineNo = detail.lineNo, |
| | | warehouseCode = detail.WarehouseCode, |
| | | qty = detail.BarcodeQty, |
| | | currentDeliveryQty = 0, |
| | | unit = detail.BarcodeUnit, |
| | | barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel>() |
| | | }; |
| | | |
| | | // å¡«å
æ¡ç ä¿¡æ¯ï¼å«åä½è½¬æ¢ï¼ |
| | | foreach (var item in detailPicks) |
| | | { |
| | | if (item.PickQuantity <= 0) |
| | | { |
| | | continue; |
| | | } |
| | | var barModel = new WIDESEA_DTO.Outbound.BarcodesModel |
| | | { |
| | | barcode = item.Barcode, |
| | | supplyCode = item.SupplyCode, |
| | | batchNo = item.BatchNo, |
| | | unit = item.BarcodeUnit, |
| | | qty = item.PickQuantity |
| | | }; |
| | | |
| | | // åä½ä¸ä¸è´æ¶è½¬æ¢ |
| | | if (detail.BarcodeUnit != detail.Unit) |
| | | { |
| | | var convertResult = await _materialUnitService.ConvertAsync( |
| | | item.MaterielCode, item.PickQuantity, detail.Unit, detail.BarcodeUnit); |
| | | barModel.unit = convertResult.Unit; |
| | | barModel.qty = convertResult.Quantity; |
| | | } |
| | | else |
| | | { |
| | | barModel.qty = item.PickQuantity; |
| | | } |
| | | detailModel.currentDeliveryQty += barModel.qty; |
| | | detailModel.barcodes.Add(barModel); |
| | | } |
| | | detailIds.Add(detail.Id); |
| | | feedModel.details.Add(detailModel); |
| | | } |
| | | |
| | | feedModel.details = feedModel.details.GroupBy(item => new { item.materialCode, item.lineNo, item.warehouseCode, item.unit,item.qty }).Select(group => new FeedbackOutboundDetailsModel |
| | | { |
| | | materialCode = group.Key.materialCode, |
| | | lineNo = group.Key.lineNo, |
| | | warehouseCode = group.Key.warehouseCode, |
| | | qty = group.Key.qty, |
| | | currentDeliveryQty = group.Sum(x => x.currentDeliveryQty), |
| | | unit = group.Key.unit, |
| | | barcodes = group.SelectMany(x => x.barcodes.GroupBy(o => new { o.barcode, o.supplyCode, o.batchNo, o.unit }).Select(row => new WIDESEA_DTO.Outbound.BarcodesModel |
| | | { |
| | | barcode = row.Key.barcode, |
| | | supplyCode = row.Key.supplyCode, |
| | | batchNo = row.Key.batchNo, |
| | | unit = row.Key.unit, |
| | | qty = row.Sum(y => y.qty) |
| | | })).ToList() |
| | | }).ToList(); |
| | | |
| | | var allCompleted = true; |
| | | |
| | | // çéå¾
åä¼ çæç»ï¼ReturnToMESStatus=0ï¼ |
| | | var pendingDetails = orderDetails.Where(x => x.ReturnToMESStatus == 0).ToList(); |
| | | foreach (var detail in pendingDetails) |
| | | { |
| | | if (detail.OverOutQuantity >= detail.NeedOutQuantity) |
| | | { |
| | | detailIds.Add(detail.Id); |
| | | } |
| | | else |
| | | if (detail.OverOutQuantity < detail.NeedOutQuantity) |
| | | { |
| | | allCompleted = false; |
| | | } |
| | |
| | | int newStatus = allCompleted ? (int)OutOrderStatusEnum.åºåºå®æ : (int)OutOrderStatusEnum.åºåºä¸; |
| | | if (outboundOrder.OrderStatus != newStatus) |
| | | { |
| | | // ä¿®æ£åæè¯æ³é误ï¼SetColumns æ¯èµå¼ï¼=ï¼èé夿ï¼==ï¼ |
| | | |
| | | int updateCount = await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() |
| | | .SetColumns(x => x.OrderStatus == newStatus) |
| | | .Where(x => x.OrderNo == orderNo) |
| | |
| | | if (updateCount <= 0) |
| | | { |
| | | _logger.LogWarning($"æ´æ°åºåºåç¶æå¤±è´¥ - OrderNo: {orderNo}, ç®æ ç¶æ: {newStatus}"); |
| | | // ç¶ææ´æ°å¤±è´¥ä¸ä¸ææµç¨ï¼ä½è®°å½è¦å |
| | | |
| | | } |
| | | } |
| | | |
| | | // æå»ºåä¼ MESçæ¨¡å |
| | | var documentNo = UniqueValueGenerator.Generate(); |
| | | var feedModel = new FeedbackOutboundRequestModel |
| | | { |
| | | reqCode = Guid.NewGuid().ToString(), |
| | | reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | business_type = outboundOrder.BusinessType, |
| | | factoryArea = outboundOrder.FactoryArea, |
| | | operationType = 1, |
| | | Operator = outboundOrder.Operator, |
| | | orderNo = outboundOrder.UpperOrderNo, |
| | | documentsNO = documentNo, |
| | | status = outboundOrder.OrderStatus, |
| | | details = new List<FeedbackOutboundDetailsModel>() |
| | | }; |
| | | |
| | | // å¡«å
æç»åæ¡ç ä¿¡æ¯ |
| | | foreach (var detail in orderDetails.Where(x => detailIds.Contains(x.Id)).ToList()) |
| | | { |
| | | // æ¥è¯¢è¯¥æç»å¯¹åºçé宿¡ç è®°å½ |
| | | var detailLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() |
| | | .Where(x => x.OrderNo == orderNo |
| | | && detail.Id == x.OrderDetailId |
| | | && (x.Status == (int)OutLockStockStatusEnum.æ£é宿 |
| | | || x.Status == (int)OutLockStockStatusEnum.å·²ååº)) |
| | | .ToListAsync(); |
| | | |
| | | var detailModel = new FeedbackOutboundDetailsModel |
| | | { |
| | | materialCode = detail.MaterielCode, |
| | | lineNo = detail.lineNo, |
| | | warehouseCode = detail.WarehouseCode, |
| | | qty = detail.BarcodeQty, |
| | | currentDeliveryQty = detail.BarcodeQty, |
| | | unit = detail.BarcodeUnit, |
| | | barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel>() |
| | | }; |
| | | |
| | | // å¡«å
æ¡ç ä¿¡æ¯ï¼å«åä½è½¬æ¢ï¼ |
| | | foreach (var item in detailLocks) |
| | | { |
| | | var barModel = new WIDESEA_DTO.Outbound.BarcodesModel |
| | | { |
| | | barcode = item.CurrentBarcode, |
| | | supplyCode = item.SupplyCode, |
| | | batchNo = item.BatchNo, |
| | | unit = item.BarcodeUnit, |
| | | qty = item.BarcodeQty |
| | | }; |
| | | |
| | | // åä½ä¸ä¸è´æ¶è½¬æ¢ |
| | | if (item.BarcodeUnit != item.Unit) |
| | | { |
| | | var convertResult = await _materialUnitService.ConvertAsync( |
| | | item.MaterielCode, item.BarcodeQty, item.Unit, item.BarcodeUnit); |
| | | barModel.unit = convertResult.Unit; |
| | | barModel.qty = convertResult.Quantity; |
| | | } |
| | | |
| | | detailModel.qty += barModel.qty; |
| | | detailModel.currentDeliveryQty += barModel.qty; |
| | | detailModel.barcodes.Add(barModel); |
| | | } |
| | | |
| | | feedModel.details.Add(detailModel); |
| | | } |
| | | |
| | | // è°ç¨MESåä¼ æ¥å£ |
| | | var mesResult = await FeedbackOutbound(feedModel); |
| | | if (mesResult == null || mesResult.code != 200) |
| | | { |
| | | |
| | | |
| | | // æ´æ°æç»ä¸ºåä¼ å¤±è´¥ï¼ReturnToMESStatus=2ï¼ |
| | | await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() |
| | | .SetColumns(it => new Dt_OutboundOrderDetail |
| | |
| | | |
| | | return WebResponseContent.Instance.Error($"åä¼ MES失败"); |
| | | } |
| | | |
| | | //MESåä¼ æåï¼æ´æ°æç»ä¸ºåä¼ æåç¶æ |
| | | await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() |
| | | .SetColumns(it => new Dt_OutboundOrderDetail |
| | | { |
| | | ReturnToMESStatus = 1, |
| | | documentsNO = documentNo, |
| | | }) |
| | | .Where(x => detailIds.Contains(x.Id)) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | foreach (var record in pickingRecords.Where(x => detailIds.Contains(x.OrderDetailId)).ToList()) |
| | | { |
| | | record.ReturnToMESStatus = 1; |
| | | } |
| | | var updates = pickingRecords.Where(x => detailIds.Contains(x.OrderDetailId)).ToList(); |
| | | updates.ForEach(x => |
| | | { |
| | | x.ReturnToMESStatus = 1; |
| | | }); |
| | | await _pickingRecoreRepository.Db.Updateable(updates).ExecuteCommandAsync(); |
| | | if (allCompleted) |
| | | { |
| | | //MESåä¼ æåï¼æ´æ°æç»ä¸ºåä¼ æåç¶æ |
| | | await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() |
| | | .SetColumns(it => new Dt_OutboundOrderDetail |
| | | { |
| | | ReturnToMESStatus = 1, |
| | | documentsNO = documentNo, |
| | | }) |
| | | .Where(x => detailIds.Contains(x.Id)) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | // æ ¡éªæ¯å¦æææç»é½å®æï¼æ´æ°è®¢åæç»ç¶æ |
| | | if (allCompleted && newStatus == (int)OutOrderStatusEnum.åºåºå®æ) |
| | | { |
| | |
| | | materialCode = group.Key.MaterielCode, |
| | | lineNo = group.Key.lineNo, |
| | | warehouseCode = group.Key.WarehouseCode, |
| | | qty = group.Sum(x => x.BarcodeQty), |
| | | currentDeliveryQty = group.Sum(x => x.BarcodeQty), |
| | | qty = group.Sum(x => x.PickedQty), |
| | | currentDeliveryQty = group.Sum(x => x.PickedQty), |
| | | unit = group.Key.BarcodeUnit, |
| | | barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel |
| | | { |
| | |
| | | supplyCode = lockInfo.SupplyCode, |
| | | batchNo = lockInfo.BatchNo, |
| | | unit = lockInfo.BarcodeUnit, |
| | | qty = lockInfo.BarcodeQty |
| | | qty = lockInfo.PickedQty |
| | | }).ToList() |
| | | }).ToList(); |
| | | |
| | |
| | | .Where(x => x.OrderNo == orderNo) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | await _pickingRecoreRepository.Db.Updateable<Dt_PickingRecord>() |
| | | .SetColumns(x => x.ReturnToMESStatus == 1) |
| | | .Where(x => x.OrderNo == orderNo) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | return WebResponseContent.Instance.OK("åä¼ MESæå"); |
| | | } |
| | | else |
| | |
| | | return WebResponseContent.Instance.Error("å¤çåä¼ MESæ¶åçå¼å¸¸ï¼è¯·è系管çå"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static class UniqueValueGenerator |
| | | { |
| | |
| | | public static string Generate() |
| | | { |
| | | var now = DateTime.Now; |
| | | string datePart = now.ToString("yyyyMMdd"); |
| | | string datePart = now.ToString("MMdd"); |
| | | long ticksPart = now.Ticks; |
| | | |
| | | // ååéå¢è®¡æ°å¨ï¼å模1000ï¼ç¡®ä¿è®¡æ°å¨ä»
3ä½ï¼æ§å¶é¿åº¦ï¼ |
| | | long counterPart = Interlocked.Increment(ref _counter) % 1000; |
| | | |
| | | // æ¼æ¥ï¼è®¡æ°å¨è¡¥0为3ä½ï¼é¿å
使°ä¸ä¸è´ï¼ |
| | | return $"{datePart}{ticksPart}{counterPart:D3}"; |
| | | return $"{datePart}{ticksPart}"; |
| | | } |
| | | |
| | | public static string GenerateCount() |
| | | { |
| | | var now = DateTime.Now; |
| | | string datePart = now.ToString("yyyyMMddHHmmss"); |
| | | |
| | | |
| | | // ååéå¢è®¡æ°å¨ï¼å模1000ï¼ç¡®ä¿è®¡æ°å¨ä»
3ä½ï¼æ§å¶é¿åº¦ï¼ |
| | | long counterPart = Interlocked.Increment(ref _counter) % 1000; |
| | | |
| | | // æ¼æ¥ï¼è®¡æ°å¨è¡¥0为3ä½ï¼é¿å
使°ä¸ä¸è´ï¼ |
| | | return $"{datePart}{counterPart:D3}"; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | Task<WebResponseContent> RequestInboundTask(string palletCode, string stationCode); |
| | | |
| | | Task<WebResponseContent> PalletOutboundTask(string endStation, string palletCode = ""); |
| | | Task<WebResponseContent> PalletOutboundTask(int num, int locationType); |
| | | |
| | | Task<WebResponseContent> TaskCompleted(string taskNum); |
| | | |
| | | Task<WebResponseContent> GenerateOutboundTasksAsync(int[] keys, string outStation); |
| | | |
| | | Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews); |
| | | Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews,string station=null); |
| | | |
| | | Task<WebResponseContent> GenerateOutboundBatchTasksAsync(int orderDetailId, decimal batchQuantity, string outStation); |
| | | |
| | | Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews); |
| | | Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews, string station); |
| | | } |
| | | } |
| | |
| | | [SqlSugar.SugarColumn(IsIgnore = true)] |
| | | public decimal RemainQuantity => AssignQuantity - PickedQty; |
| | | |
| | | public int ReturnToMESStatus { get; set; } |
| | | |
| | | } |
| | | } |
| | |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "barcodemoveQty", ColumnDescription = "æ°é")] |
| | | public decimal BarcodeMoveQty { get; set; } |
| | | |
| | | public int ReturnToMESStatus { get; set; } |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) |
| | | AssignStockOutbound(Dt_OutboundOrderDetail outboundOrderDetail, List<StockSelectViewDTO> stockSelectViews) |
| | | public (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>)AssignStockOutbound(Dt_OutboundOrderDetail outboundOrderDetail, List<StockSelectViewDTO> stockSelectViews) |
| | | { |
| | | // éªè¯ç¨æ·éæ© |
| | | (bool, string) checkResult = CheckSelectStockDeital(outboundOrderDetail, stockSelectViews); |
| | |
| | | decimal totalAssignedFromUserSelection = 0; |
| | | |
| | | // æå
è¿å
åºæåºç¨æ·éæ©çåºå |
| | | var userSelectedStocks = _stockService.StockInfoService.GetStockInfosByPalletCodes( |
| | | stockSelectViews.Select(x => x.PalletCode).ToList()); |
| | | var userSelectedStocks = _stockService.StockInfoService.GetStockInfosByPalletCodes(stockSelectViews.Select(x => x.PalletCode).ToList()); |
| | | |
| | | var sortedUserSelectedStocks = userSelectedStocks |
| | | .OrderBy(x => x.CreateDate) |
| | | .ToList(); |
| | | var sortedUserSelectedStocks = userSelectedStocks.OrderBy(x => x.CreateDate).ToList(); |
| | | |
| | | // åé
ç¨æ·éæ©çåºå |
| | | foreach (var stock in sortedUserSelectedStocks) |
| | |
| | | outboundOrderDetail.BatchNo, outboundOrderDetail.SupplyCode); |
| | | |
| | | // ç¡®å®åé
æ°éï¼åç¨æ·éæ©æ°éãå¯ç¨æ°éåå©ä½éæ±çæå°å¼ |
| | | var assignQuantity = Math.Min( |
| | | Math.Min(userSelection.UseableQuantity, availableQuantity), |
| | | remainingNeedQuantity); |
| | | var assignQuantity = Math.Min(Math.Min(userSelection.UseableQuantity, availableQuantity),remainingNeedQuantity); |
| | | |
| | | if (assignQuantity <= 0) continue; |
| | | |
| | |
| | | } |
| | | |
| | | // å¦æç¨æ·éæ©çåºåä¸å¤ï¼èªå¨åé
å©ä½é¨å |
| | | decimal autoAssignedQuantity = 0; |
| | | |
| | | if (remainingNeedQuantity > 0) |
| | | { |
| | | List<Dt_StockInfo> autoStocks = _stockService.StockInfoService.GetUseableStocks( |
| | | outboundOrderDetail.MaterielCode, outboundOrderDetail.BatchNo, ""); |
| | | //// å¯éï¼è¿éå¯ä»¥æ ¹æ®ä¸å¡éæ±å³å®æ¯å¦å
许èªå¨åé
|
| | | //// å¦æè¦æ±ä¸¥æ ¼æç¨æ·éæ©åºåºï¼å¯ä»¥æåºå¼å¸¸ |
| | | //// throw new Exception($"ç¨æ·éæ©çåºåæ°éä¸è¶³ï¼è¿é{remainingNeedQuantity}ï¼è¯·éæ°éæ©"); |
| | | |
| | | // æé¤ç¨æ·å·²éæ©çæç |
| | | autoStocks = autoStocks |
| | | .Where(x => !stockSelectViews.Select(v => v.PalletCode).Contains(x.PalletCode)) |
| | | .ToList(); |
| | | //// 妿éè¦èªå¨åé
ï¼è®°å½æ¥å¿ |
| | | //_logger.LogInformation($"ç¨æ·éæ©çåºåæ°éä¸è¶³ï¼è¿é{remainingNeedQuantity}ï¼ç³»ç»å°èªå¨åé
"); |
| | | |
| | | var (autoAssignStocks, stockAllocations) = _stockService.StockInfoService.GetOutboundStocks( |
| | | autoStocks, outboundOrderDetail.MaterielCode, remainingNeedQuantity, out decimal residueQuantity); |
| | | //List<Dt_StockInfo> autoStocks = _stockService.StockInfoService.GetUseableStocks( |
| | | // outboundOrderDetail.MaterielCode, |
| | | // outboundOrderDetail.BatchNo, |
| | | // ""); |
| | | |
| | | // æ£æ¥èªå¨åé
ç»æ |
| | | autoAssignedQuantity = remainingNeedQuantity - residueQuantity; |
| | | if (autoAssignedQuantity <= 0 && remainingNeedQuantity > 0) |
| | | { |
| | | // é¨ååé
æ¯å¯ä»¥æ¥åçï¼è®°å½è¦åä½ä¸æ¥é |
| | | _logger.LogWarning($"èªå¨åé
失败ï¼å©ä½éæ±{remainingNeedQuantity}æ æ³æ»¡è¶³"); |
| | | } |
| | | else if (autoAssignedQuantity > 0) |
| | | { |
| | | outStocks.AddRange(autoAssignStocks); |
| | | //// æé¤ç¨æ·å·²éæ©ä¸å·²åé
çæç |
| | | //var assignedPalletCodes = outStocks.Select(x => x.PalletCode).ToList(); |
| | | //autoStocks = autoStocks |
| | | // .Where(x => !assignedPalletCodes.Contains(x.PalletCode)) |
| | | // .ToList(); |
| | | |
| | | // 为èªå¨åé
çåºåå建éå®è®°å½ |
| | | var autoLockInfos = CreateLockInfosForAutoAssign(outboundOrder, outboundOrderDetail, autoAssignStocks, stockAllocations); |
| | | outStockLockInfos.AddRange(autoLockInfos); |
| | | } |
| | | //var (autoAssignStocks, stockAllocations) = _stockService.StockInfoService.GetOutboundStocks( |
| | | // autoStocks, |
| | | // outboundOrderDetail.MaterielCode, |
| | | // remainingNeedQuantity, |
| | | // out decimal residueQuantity); |
| | | |
| | | //if (autoAssignStocks != null && autoAssignStocks.Any()) |
| | | //{ |
| | | // outStocks.AddRange(autoAssignStocks); |
| | | |
| | | // // 为èªå¨åé
çåºåå建éå®è®°å½ |
| | | // var autoLockInfos = CreateLockInfosForAutoAssign(outboundOrder, outboundOrderDetail, autoAssignStocks, stockAllocations); |
| | | // outStockLockInfos.AddRange(autoLockInfos); |
| | | |
| | | // // æ´æ°å·²åé
æ°é |
| | | // decimal autoAssignedQuantity = remainingNeedQuantity - residueQuantity; |
| | | // totalAssignedFromUserSelection += autoAssignedQuantity; |
| | | // remainingNeedQuantity = residueQuantity; // æ´æ°å©ä½éæ± |
| | | //} |
| | | //else if (remainingNeedQuantity > 0) |
| | | //{ |
| | | // _logger.LogWarning($"èªå¨åé
失败ï¼å©ä½éæ±{remainingNeedQuantity}æ æ³æ»¡è¶³"); |
| | | //} |
| | | } |
| | | |
| | | // æ´æ°é宿°é |
| | | outboundOrderDetail.LockQuantity += totalAssignedFromUserSelection + autoAssignedQuantity; |
| | | outboundOrderDetail.LockQuantity += totalAssignedFromUserSelection + totalAssignedFromUserSelection; |
| | | |
| | | // æ´æ°ç¶æ |
| | | UpdateOrderDetailStatus(outboundOrderDetail, remainingNeedQuantity - autoAssignedQuantity); |
| | | UpdateOrderDetailStatus(outboundOrderDetail, remainingNeedQuantity); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = _locationInfoService.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList()); |
| | | |
| | |
| | | decimal remainingAssign = assignQuantity; |
| | | |
| | | // æå
è¿å
åºåé
åºåæç» |
| | | var sorteds = stock.Details |
| | | var query = stock.Details.AsQueryable() |
| | | .Where(d => d.MaterielCode == detail.MaterielCode && |
| | | (d.StockQuantity - d.OutboundQuantity) > 0); |
| | | // .OrderBy(d => d.CreateDate); |
| | | |
| | | if (!string.IsNullOrEmpty(detail.BatchNo)) |
| | | { |
| | | sorteds= stock.Details.Where(x => x.BatchNo == detail.BatchNo); |
| | | query = query.Where(x => x.BatchNo == detail.BatchNo); |
| | | } |
| | | |
| | | var sortedDetails= sorteds.ToList().OrderBy(d => d.CreateDate); |
| | | // 妿åºåºåæä¾åºåè¦æ±ï¼æä¾åºåè¿æ»¤ |
| | | if (!string.IsNullOrEmpty(detail.SupplyCode)) |
| | | { |
| | | query = query.Where(d => d.SupplyCode == detail.SupplyCode); |
| | | } |
| | | var sortedDetails= query.ToList().OrderBy(d => d.CreateDate); |
| | | |
| | | |
| | | foreach (var stockDetail in sortedDetails) |
| | |
| | | var completedLockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() |
| | | .Where(it => it.CurrentBarcode == barcode && |
| | | (it.Status == (int)OutLockStockStatusEnum.æ£é宿 || |
| | | it.Status == (int)OutLockStockStatusEnum.已鿾 || |
| | | it.Status == (int)OutLockStockStatusEnum.å·²åèµ° || |
| | | it.PickedQty >= it.AssignQuantity)).FirstAsync(); |
| | | |
| | | if (completedLockInfo != null) |
| | | throw new Exception($"æ¡ç {barcode}å·²ç»å®æåæ£ï¼ä¸è½éå¤åæ£"); |
| | | { |
| | | string statusMsg = completedLockInfo.Status switch |
| | | { |
| | | (int)OutLockStockStatusEnum.æ£é宿 => "å·²ç»å®æåæ£", |
| | | (int)OutLockStockStatusEnum.已鿾 => "å·²ç»éæ¾", |
| | | (int)OutLockStockStatusEnum.å·²åèµ° => "å·²ç»åèµ°", |
| | | _ => "å·²ç»å®æåæ£" |
| | | }; |
| | | throw new Exception($"æ¡ç {barcode}{statusMsg}ï¼ä¸è½éå¤åæ£"); |
| | | } |
| | | else |
| | | return null; |
| | | } |
| | |
| | | |
| | | private async Task<bool> CanCancelPicking(Dt_OutStockLockInfo lockInfo, Dt_StockInfoDetail stockDetail) |
| | | { |
| | | if (lockInfo.Status == (int)OutLockStockStatusEnum.已鿾 || lockInfo.Status == (int)OutLockStockStatusEnum.å·²åèµ°) |
| | | return false; |
| | | // éå®ä¿¡æ¯ç¶ææ£æ¥ |
| | | if (lockInfo.Status != (int)OutLockStockStatusEnum.æ£é宿) |
| | | return false; |
| | | |
| | | ////// åºåç¶ææ£æ¥ |
| | | ////if (stockDetail.Status == StockStatusEmun.åºåºå®æ.ObjToInt()) |
| | | //// return false; |
| | | |
| | | |
| | | // å¦ææ¯æå
è®°å½ï¼è¿éè¦æ£æ¥ç¶éå®ä¿¡æ¯ç¶æ |
| | | if (lockInfo.IsSplitted == 1 && lockInfo.ParentLockId.HasValue) |
| | |
| | | var parentLock = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() |
| | | .FirstAsync(x => x.Id == lockInfo.ParentLockId.Value); |
| | | |
| | | if (parentLock == null || parentLock.Status == (int)OutLockStockStatusEnum.ååºä¸) |
| | | if (parentLock == null || parentLock.Status == (int)OutLockStockStatusEnum.ååºä¸ || |
| | | parentLock.Status == (int)OutLockStockStatusEnum.已鿾 || |
| | | parentLock.Status == (int)OutLockStockStatusEnum.å·²åèµ°) |
| | | return false; |
| | | } |
| | | |
| | |
| | | await _outStockLockInfoService.Db.Updateable<Dt_OutStockLockInfo>() |
| | | .SetColumns(it => new Dt_OutStockLockInfo |
| | | { |
| | | Status = (int)OutLockStockStatusEnum.已鿾, // éè¦æ°å¢è¿ä¸ªç¶æ |
| | | // ReleaseTime = DateTime.Now, |
| | | Status = (int)OutLockStockStatusEnum.已鿾, |
| | | |
| | | Operator = App.User.UserName |
| | | }) |
| | | .Where(it => lockIds.Contains(it.Id)) |
| | |
| | | |
| | | _logger.LogInformation($"订åç¶ææ´æ° - OrderNo: {orderNo}, æ§ç¶æ: {outboundOrder.OrderStatus}, æ°ç¶æ: {newStatus}"); |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | .Where(x => x.OrderNo == orderNo && x.Status == (int)OutLockStockStatusEnum.æ£é宿) |
| | | .ToListAsync(); |
| | | |
| | | var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.Unit, item.WarehouseCode }) |
| | | var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode }) |
| | | .Select(group => new AllocateDtoDetail |
| | | { |
| | | MaterialCode = group.Key.MaterielCode, |
| | |
| | | WarehouseCode = group.Key.WarehouseCode, |
| | | Qty = group.Sum(x => x.PickedQty), |
| | | |
| | | Unit = group.Key.Unit, |
| | | Unit = group.Key.BarcodeUnit, |
| | | Barcodes = group.Select(row => new BarcodeInfo |
| | | { |
| | | Barcode = row.CurrentBarcode, |
| | | SupplyCode = row.SupplyCode, |
| | | BatchNo = row.BatchNo, |
| | | Unit = row.Unit, |
| | | Unit = row.BarcodeUnit, |
| | | Qty = row.PickedQty |
| | | }).ToList() |
| | | |
| | |
| | | materialCode = group.Key.MaterielCode, |
| | | lineNo = group.Key.lineNo, |
| | | warehouseCode = group.Key.WarehouseCode, |
| | | qty = group.Sum(x => x.BarcodeQty), |
| | | currentDeliveryQty = group.Sum(x => x.BarcodeQty), |
| | | qty = group.Sum(x => x.PickedQty), |
| | | currentDeliveryQty = group.Sum(x => x.PickedQty), |
| | | unit = group.Key.BarcodeUnit, |
| | | barcodes = group.Select(row => new WIDESEA_DTO.Outbound.BarcodesModel |
| | | { |
| | |
| | | supplyCode = row.SupplyCode, |
| | | batchNo = row.BatchNo, |
| | | unit = row.BarcodeUnit, |
| | | qty = row.BarcodeQty |
| | | qty = row.PickedQty |
| | | }).ToList() |
| | | }).ToList(); |
| | | |
| | |
| | | (x.Status == (int)OutLockStockStatusEnum.æ£é宿 || x.Status == (int)OutLockStockStatusEnum.å·²ååº)) |
| | | .ToListAsync(); |
| | | |
| | | var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode }) |
| | | .Select(group => new FeedbackOutboundDetailsModel |
| | | { |
| | | materialCode = group.Key.MaterielCode, |
| | | lineNo = group.Key.lineNo, |
| | | warehouseCode = group.Key.WarehouseCode, |
| | | qty = group.Sum(x => x.BarcodeQty), |
| | | currentDeliveryQty = group.Sum(x => x.BarcodeQty), |
| | | unit = group.Key.BarcodeUnit, |
| | | barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel |
| | | { |
| | | barcode = lockInfo.CurrentBarcode, |
| | | supplyCode = lockInfo.SupplyCode, |
| | | batchNo = lockInfo.BatchNo, |
| | | unit = lockInfo.BarcodeUnit, |
| | | qty = lockInfo.BarcodeQty |
| | | }).ToList() |
| | | }).ToList(); |
| | | outfeedmodel.details.AddRange(groupdata); |
| | | } |
| | | var result = await _invokeMESService.FeedbackOutbound(outfeedmodel); |
| | | if (result != null && result.code == 200) |
| | | { |
| | | await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() |
| | | .SetColumns(x => x.ReturnToMESStatus == 1) |
| | | .Where(x => x.OrderId == outboundOrder.Id) |
| | | .ExecuteCommandAsync(); |
| | | var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode }) |
| | | .Select(group => new FeedbackOutboundDetailsModel |
| | | { |
| | | |
| | | materialCode = group.Key.MaterielCode, |
| | | lineNo = group.Key.lineNo, |
| | | warehouseCode = group.Key.WarehouseCode, |
| | | qty = group.Sum(x => x.PickedQty), |
| | | currentDeliveryQty = group.Sum(x => x.PickedQty), |
| | | unit = group.Key.BarcodeUnit, |
| | | barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel |
| | | { |
| | | barcode = lockInfo.CurrentBarcode, |
| | | supplyCode = lockInfo.SupplyCode, |
| | | batchNo = lockInfo.BatchNo, |
| | | unit = lockInfo.BarcodeUnit, |
| | | qty = lockInfo.PickedQty |
| | | }).ToList() |
| | | }).ToList(); |
| | | feedmodel.details.AddRange(groupdata); |
| | | } |
| | | var result = await _invokeMESService.FeedbackOutbound(feedmodel); |
| | | if (result != null && result.code == 200) |
| | | { |
| | | await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() |
| | | .SetColumns(x => x.ReturnToMESStatus == 1) |
| | | .Where(x => x.OrderId == outboundOrder.Id) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() |
| | | .SetColumns(x => x.ReturnToMESStatus == 1) |
| | |
| | | using AutoMapper; |
| | | using Dm.filter; |
| | | using MailKit.Search; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.Extensions.Logging; |
| | | using Newtonsoft.Json; |
| | | using Org.BouncyCastle.Asn1.Ocsp; |
| | |
| | | private readonly IRepository<Dt_StockInfo> _stockRepository; |
| | | private readonly ILocationInfoService _locationInfoService; |
| | | private readonly IInboundOrderService _inboundOrderService; |
| | | private readonly IInboundOrderDetailService _inboundOrderDetailService; |
| | | private readonly IInboundOrderDetailService _inboundOrderDetailService; |
| | | |
| | | private readonly IRepository<Dt_AllocateOrderDetail> _allocateOrderDetailRepository; |
| | | private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository; |
| | | private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository; |
| | | private readonly IRepository<Dt_ReCheckOrder> _reCheckOrderRepository; |
| | | private readonly IRepository<Dt_OutboundBatch> _OutboundBatchRepository; |
| | | private readonly IOutboundOrderService _outboundOrderService; |
| | |
| | | } |
| | | else if (inboundOrder.OrderType == InOrderTypeEnum.InternalAllocat.ObjToInt()) //æºä»è°æºä» |
| | | { |
| | | _logger.LogInformation($"InboundTaskCompleted ååMES : {inboundOrder.InboundOrderNo } ,ordertype: {InOrderTypeEnum.InternalAllocat.ObjToInt()} " ); |
| | | _logger.LogInformation($"InboundTaskCompleted ååMES : {inboundOrder.InboundOrderNo} ,ordertype: {InOrderTypeEnum.InternalAllocat.ObjToInt()} "); |
| | | // BusinessTypeEnum.æºä»è°æºä» |
| | | if (inboundOrder != null && inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | |
| | | { |
| | | _logger.LogInformation($"TaskService OutAllocateTaskCompleted: {task.TaskNum}"); |
| | | |
| | | return await OutboundTaskCompleted(task); |
| | | return await OutboundTaskCompleted(task); |
| | | } |
| | | public async Task<WebResponseContent> OutboundTaskCompleted(Dt_Task task) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public async Task<WebResponseContent> InPickTaskCompleted(Dt_Task task) |
| | | { |
| | | _logger.LogInformation($"TaskService InPickTaskCompleted: {task.TaskNum}"); |
| | |
| | | |
| | | // æ´æ°åºåä¿¡æ¯ |
| | | stockInfo.LocationCode = task.TargetAddress; |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | |
| | | // æ´æ°åºåæç»ç¶æ |
| | | if (stockInfo.Details != null && stockInfo.Details.Any()) |
| | | { |
| | | foreach (var detail in stockInfo.Details) |
| | | { |
| | | detail.Status = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | |
| | | // ç¡®ä¿åºåæ°éä¸åºåºæ°éä¸è´ |
| | | if (detail.Status == StockStatusEmun.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | detail.OutboundQuantity = 0; // å
¥åºå®ææ¶åºåºæ°éæ¸
é¶ |
| | | } |
| | | detail.Status = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | detail.OutboundQuantity = 0; // å
¥åºå®ææ¶åºåºæ°éæ¸
é¶ |
| | | } |
| | | _stockService.StockInfoDetailService.Repository.UpdateData(stockInfo.Details); |
| | | _stockService.StockInfoDetailService.Repository.UpdateData(stockInfo.Details); |
| | | } |
| | | |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | |
| | | // å¤çååºç¸å
³çåºåæç» |
| | | await ProcessStockDetailsForReturn(task, stockInfo.Id); |
| | | |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | // å é¤é¶åºåæ°æ® |
| | | await DeleteZeroQuantityStockDetails(stockInfo.Id); |
| | | |
| | | await UpdateAffectedOrderDetails(task.OrderNo, returnLocks); |
| | | // æ´æ°è´§ä½ç¶æ |
| | | if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt()) |
| | | { |
| | |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | } |
| | | |
| | | _locationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | // æ´æ°è®¢åç¸å
³æ°æ® |
| | | await UpdateOrderDataAfterReturn(task.OrderNo, returnLocks); |
| | | _locationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | // è·åå¹¶æ´æ°åºåºè®¢å |
| | | var outboundOrder = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>() |
| | | .FirstAsync(x => x.OrderNo == task.OrderNo); |
| | | |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | |
| | | // å é¤ä»»å¡è®°å½ |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | |
| | | "", |
| | | task.TaskNum |
| | | ); |
| | | |
| | | if (outboundOrder != null) |
| | | { |
| | | // æ£æ¥è®¢åç¶ææ¯å¦éè¦æ´æ° |
| | | await CheckAndUpdateOrderStatusAfterReturn(task.OrderNo); |
| | | |
| | | // å¤çMESåé¦ |
| | | await HandleOutboundOrderToMESCompletion(outboundOrder, outboundOrder.OrderNo); |
| | | } |
| | | else |
| | | { |
| | | _logger.LogInformation($"TaskService InPickTaskCompleted: {task.TaskNum} ,æªæ¾å°åºåºåã"); |
| | | } |
| | | await RecalculateOrderStatus(task.OrderNo); |
| | | |
| | | _unitOfWorkManage.CommitTran(); // æäº¤äºå¡ |
| | | _logger.LogInformation($"æçååºå®æå¤çæå - ä»»å¡å·: {task.TaskNum}, æç: {task.PalletCode}, 订å: {task.OrderNo}"); |
| | | _ = Task.Run(async () => |
| | | { |
| | | try |
| | | { |
| | | var outboundOrder = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>() |
| | | .FirstAsync(x => x.OrderNo == task.OrderNo); |
| | | |
| | | _logger.LogInformation($"ååºä»»å¡å®æå¤çæå - ä»»å¡å·: {task.TaskNum}, æç: {task.PalletCode}"); |
| | | if (outboundOrder != null) |
| | | { |
| | | // æ£æ¥è®¢åæ¯å¦å·²å®æï¼åªæå®ææ¶æåMESåé¦ |
| | | if (outboundOrder.OrderStatus == (int)OutOrderStatusEnum.åºåºå®æ) |
| | | { |
| | | await HandleOutboundOrderToMESCompletion(outboundOrder, outboundOrder.OrderNo); |
| | | } |
| | | else |
| | | { |
| | | _logger.LogInformation($"订å{task.OrderNo}ç¶æä¸º{outboundOrder.OrderStatus}ï¼æä¸åMESåé¦"); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogError($"弿¥MESåé¦å¤ç失败 - OrderNo: {task.OrderNo}, Error: {ex.Message}"); |
| | | } |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ååºåæ´æ°è®¢åæ°æ® |
| | | // <summary> |
| | | /// æ´æ°åå½±åç订åæç»é宿°é |
| | | /// </summary> |
| | | private async Task UpdateOrderDataAfterReturn(string orderNo, List<Dt_OutStockLockInfo> returnLocks) |
| | | private async Task UpdateAffectedOrderDetails(string orderNo, List<Dt_OutStockLockInfo> returnLocks) |
| | | { |
| | | try |
| | | { |
| | | // è·åææåå½±åç订åæç»ID |
| | | // è·ååå½±åç订åæç»IDï¼å»éï¼ |
| | | var affectedDetailIds = returnLocks |
| | | .Select(x => x.OrderDetailId) |
| | | .Distinct() |
| | | .ToList(); |
| | | |
| | | if (!affectedDetailIds.Any()) |
| | | { |
| | | _logger.LogInformation($"没æåå½±åç订åæç» - OrderNo: {orderNo}"); |
| | | return; |
| | | } |
| | | |
| | | _logger.LogInformation($"æ´æ°{affectedDetailIds.Count}个åå½±åç订åæç» - OrderNo: {orderNo}"); |
| | | |
| | | foreach (var detailId in affectedDetailIds) |
| | | { |
| | | // 计ç®è¯¥è®¢åæç»çååºæ»æ°é |
| | | var detailReturnLocks = returnLocks |
| | | .Where(x => x.OrderDetailId == detailId) |
| | | .ToList(); |
| | | // éæ°è®¡ç®è¯¥è®¢åæç»çé宿°é |
| | | decimal currentLockQty = await CalculateOrderDetailLockQuantity(detailId); |
| | | |
| | | decimal totalReturnQty = detailReturnLocks.Sum(x => x.AssignQuantity - x.PickedQty); |
| | | |
| | | if (totalReturnQty > 0) |
| | | // æ£æ¥æ°æ®ä¸è´æ§ |
| | | if (currentLockQty < 0) |
| | | { |
| | | // è·å订åæç» |
| | | var orderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>() |
| | | .FirstAsync(x => x.Id == detailId); |
| | | |
| | | if (orderDetail != null) |
| | | { |
| | | // æ´æ°é宿°éï¼ååºåé宿°éåºåå°ï¼ |
| | | var remainingLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() |
| | | .Where(x => x.OrderDetailId == detailId && |
| | | x.Status == (int)OutLockStockStatusEnum.åºåºä¸) |
| | | .ToListAsync(); |
| | | |
| | | decimal remainingLockQty = remainingLocks.Sum(x => x.AssignQuantity - x.PickedQty); |
| | | |
| | | // æ´æ°è®¢åæç» |
| | | await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() |
| | | .SetColumns(it => new Dt_OutboundOrderDetail |
| | | { |
| | | LockQuantity = remainingLockQty, |
| | | }) |
| | | .Where(it => it.Id == detailId) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | // æ´æ°è®¢åæç»ç¶æ |
| | | await UpdateOrderDetailStatus(detailId); |
| | | |
| | | _logger.LogInformation($"ååºæ´æ°è®¢åæç» - OrderDetailId: {detailId}, " + |
| | | $"æ£åé宿°é: {totalReturnQty}, æ°é宿°é: {remainingLockQty}"); |
| | | } |
| | | _logger.LogWarning($"é宿°é计ç®ä¸ºè´å¼ - OrderDetailId: {detailId}, å½åå¼: {currentLockQty}ï¼é置为0"); |
| | | currentLockQty = 0; |
| | | } |
| | | |
| | | // è·å订åæç» |
| | | var orderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>() |
| | | .FirstAsync(x => x.Id == detailId); |
| | | |
| | | if (orderDetail == null) |
| | | { |
| | | _logger.LogWarning($"æªæ¾å°è®¢åæç» - OrderDetailId: {detailId}"); |
| | | continue; |
| | | } |
| | | |
| | | // æ´æ°é宿°é |
| | | if (orderDetail.LockQuantity != currentLockQty) |
| | | { |
| | | await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() |
| | | .SetColumns(it => new Dt_OutboundOrderDetail |
| | | { |
| | | LockQuantity = currentLockQty, |
| | | }) |
| | | .Where(it => it.Id == detailId) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | _logger.LogInformation($"æ´æ°è®¢åæç»é宿°é - OrderDetailId: {detailId}, " + |
| | | $"æ§å¼: {orderDetail.LockQuantity}, æ°å¼: {currentLockQty}"); |
| | | } |
| | | |
| | | // æ´æ°è®¢åæç»ç¶æ |
| | | await UpdateOrderDetailStatus(orderDetail); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogError($"UpdateOrderDataAfterReturn失败 - OrderNo: {orderNo}, Error: {ex.Message}"); |
| | | _logger.LogError($"UpdateAffectedOrderDetails失败 - OrderNo: {orderNo}, Error: {ex.Message}"); |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°è®¢åæç»ç¶æ |
| | | /// éæ°è®¡ç®è®¢åæç»é宿°é |
| | | /// </summary> |
| | | private async Task UpdateOrderDetailStatus(int orderDetailId) |
| | | private async Task<decimal> CalculateOrderDetailLockQuantity(int orderDetailId) |
| | | { |
| | | try |
| | | { |
| | | var orderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>() |
| | | .FirstAsync(x => x.Id == orderDetailId); |
| | | // æ¥æ¾è¯¥è®¢åæç»ä¸ææç¶æä¸º"åºåºä¸"çéå®è®°å½ |
| | | var activeLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() |
| | | .Where(x => x.OrderDetailId == orderDetailId && |
| | | x.Status == (int)OutLockStockStatusEnum.åºåºä¸) |
| | | .ToListAsync(); |
| | | |
| | | if (orderDetail == null) |
| | | // è¿æ»¤æå
è®°å½ |
| | | var filteredLocks = new List<Dt_OutStockLockInfo>(); |
| | | |
| | | foreach (var lockInfo in activeLocks) |
| | | { |
| | | _logger.LogWarning($"UpdateOrderDetailStatuså¤±è´¥ï¼æªæ¾å°è®¢åæç»ï¼ID: {orderDetailId}"); |
| | | return; |
| | | // å¦ææ¯æå
è®°å½ï¼éè¦ç¹æ®å¤ç |
| | | if (lockInfo.IsSplitted == 1 && lockInfo.ParentLockId.HasValue) |
| | | { |
| | | // æ¥æ¾ç¶éå®è®°å½ |
| | | var parentLock = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() |
| | | .Where(x => x.Id == lockInfo.ParentLockId.Value) |
| | | .FirstAsync(); |
| | | |
| | | // 妿ç¶è®°å½åå¨ä¸ç¶æä¹æ¯åºåºä¸ï¼ååªè®¡ç®ç¶è®°å½ |
| | | if (parentLock != null && parentLock.Status == (int)OutLockStockStatusEnum.åºåºä¸) |
| | | { |
| | | // ç¶è®°å½å·²ç»å¨å表ä¸ï¼è·³è¿å½åæå
è®°å½ |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | filteredLocks.Add(lockInfo); |
| | | } |
| | | |
| | | decimal totalLockQty = filteredLocks.Sum(x => x.AssignQuantity - x.PickedQty); |
| | | |
| | | _logger.LogDebug($"计ç®é宿°é - OrderDetailId: {orderDetailId}, " + |
| | | $"æ¾å°{filteredLocks.Count}个ææéå®è®°å½, " + |
| | | $"æ»é宿°é: {totalLockQty}"); |
| | | |
| | | return totalLockQty; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogError($"CalculateOrderDetailLockQuantity失败 - OrderDetailId: {orderDetailId}, Error: {ex.Message}"); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°è®¢åæç»ç¶æ |
| | | /// </summary> |
| | | private async Task UpdateOrderDetailStatus(Dt_OutboundOrderDetail orderDetail) |
| | | { |
| | | try |
| | | { |
| | | int newStatus = orderDetail.OrderDetailStatus; |
| | | |
| | | // 1. æ£æ¥æ¯å¦å·²å®æ |
| | | // æ ¹æ®å®é
æä¸¾å¼è°æ´ |
| | | // æ£æ¥æ¯å¦å·²å®æï¼å·²åºåºæ°é >= éæ±æ°éï¼ |
| | | if (orderDetail.OverOutQuantity >= orderDetail.NeedOutQuantity) |
| | | { |
| | | newStatus = (int)OrderDetailStatusEnum.Over; |
| | | newStatus = (int)OrderDetailStatusEnum.Over; // 已宿 |
| | | } |
| | | // 2. æ£æ¥æ¯å¦æ£å¨è¿è¡ä¸ï¼æé宿°éæé¨åæ£éï¼ |
| | | else if (orderDetail.LockQuantity > 0 || |
| | | (orderDetail.OverOutQuantity > 0 && orderDetail.OverOutQuantity < orderDetail.NeedOutQuantity)) |
| | | // æ£æ¥æ¯å¦æé¨ååºåºææé宿°é |
| | | else if (orderDetail.OverOutQuantity > 0 || orderDetail.LockQuantity > 0) |
| | | { |
| | | newStatus = (int)OrderDetailStatusEnum.Outbound; |
| | | newStatus = (int)OrderDetailStatusEnum.Outbound; // é¨å宿/è¿è¡ä¸ |
| | | } |
| | | // 3. æ£æ¥æ¯å¦æéå®ä½æªæ£é |
| | | else if (orderDetail.LockQuantity > 0 && orderDetail.OverOutQuantity == 0) |
| | | { |
| | | newStatus = (int)OrderDetailStatusEnum.AssignOverPartial; |
| | | } |
| | | // 4. å¦å为æ°è®¢å |
| | | // å¦å为æ°è®¢å |
| | | else |
| | | { |
| | | newStatus = (int)OrderDetailStatusEnum.New; |
| | | newStatus = (int)OrderDetailStatusEnum.New; // æ°å»º |
| | | } |
| | | |
| | | // åªæç¶æååæ¶ææ´æ° |
| | |
| | | await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() |
| | | .SetColumns(it => new Dt_OutboundOrderDetail |
| | | { |
| | | OrderDetailStatus = newStatus, |
| | | OrderDetailStatus = newStatus, |
| | | }) |
| | | .Where(it => it.Id == orderDetailId) |
| | | .Where(it => it.Id == orderDetail.Id) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | _logger.LogInformation($"æ´æ°è®¢åæç»ç¶æ - OrderDetailId: {orderDetailId}, " + |
| | | _logger.LogInformation($"æ´æ°è®¢åæç»ç¶æ - OrderDetailId: {orderDetail.Id}, " + |
| | | $"æ§ç¶æ: {orderDetail.OrderDetailStatus}, æ°ç¶æ: {newStatus}, " + |
| | | $"å·²åºåº: {orderDetail.OverOutQuantity}/{orderDetail.NeedOutQuantity}, " + |
| | | $"é宿°é: {orderDetail.LockQuantity}"); |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogError($"UpdateOrderDetailStatus失败 - OrderDetailId: {orderDetailId}, Error: {ex.Message}"); |
| | | _logger.LogError($"UpdateOrderDetailStatus失败 - OrderDetailId: {orderDetail.Id}, Error: {ex.Message}"); |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ååºåæ£æ¥å¹¶æ´æ°è®¢åç¶æ |
| | | /// éæ°è®¡ç®å¹¶æ´æ°è®¢åç¶æ |
| | | /// </summary> |
| | | private async Task CheckAndUpdateOrderStatusAfterReturn(string orderNo) |
| | | private async Task RecalculateOrderStatus(string orderNo) |
| | | { |
| | | try |
| | | { |
| | | // è·å订åçæææç» |
| | | var orderDetails = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>() |
| | | .LeftJoin<Dt_OutboundOrder>((o, item) => o.OrderId == item.Id) |
| | | .Where((o, item) => item.OrderNo == orderNo) |
| | | .Select((o, item) => o) |
| | | .ToListAsync(); |
| | | |
| | | if (!orderDetails.Any()) |
| | | { |
| | | _logger.LogWarning($"æªæ¾å°è®¢åæç» - OrderNo: {orderNo}"); |
| | | return; |
| | | } |
| | | |
| | | // æ£æ¥ç¶æ |
| | | bool allCompleted = true; |
| | | bool hasInProgress = false; |
| | | |
| | |
| | | |
| | | // æ£æ¥æ¯å¦æè¿è¡ä¸çä»»å¡ï¼é宿é¨åæ£éï¼ |
| | | if (detail.LockQuantity > 0 || |
| | | detail.OrderDetailStatus == OrderDetailStatusEnum.Outbound.ObjToInt()) |
| | | detail.OrderDetailStatus == (int)OrderDetailStatusEnum.Outbound) |
| | | { |
| | | hasInProgress = true; |
| | | } |
| | |
| | | var outboundOrder = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>() |
| | | .FirstAsync(x => x.OrderNo == orderNo); |
| | | |
| | | if (outboundOrder == null) return; |
| | | if (outboundOrder == null) |
| | | { |
| | | _logger.LogWarning($"æªæ¾å°åºåºè®¢å - OrderNo: {orderNo}"); |
| | | return; |
| | | } |
| | | |
| | | int newStatus; |
| | | if (allCompleted) |
| | |
| | | .Where(x => x.OrderNo == orderNo) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | _logger.LogInformation($"ååºåæ´æ°è®¢åç¶æ - OrderNo: {orderNo}, æ°ç¶æ: {newStatus}"); |
| | | _logger.LogInformation($"æ´æ°è®¢åç¶æ - OrderNo: {orderNo}, æ§ç¶æ: {outboundOrder.OrderStatus}, æ°ç¶æ: {newStatus}"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogError($"CheckAndUpdateOrderStatusAfterReturn失败 - OrderNo: {orderNo}, Error: {ex.Message}"); |
| | | _logger.LogError($"RecalculateOrderStatus失败 - OrderNo: {orderNo}, Error: {ex.Message}"); |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å¤çååºçåºåæç»ï¼å¢å¼ºçï¼ |
| | | /// </summary> |
| | | private async Task ProcessStockDetailsForReturn(Dt_Task task, int stockId) |
| | | { |
| | | try |
| | | { |
| | | // è·åææéè¦å¤ççåºåæç» |
| | | var stockDetails = await _stockService.StockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() |
| | | .Where(x => x.StockId == stockId) |
| | | .ToListAsync(); |
| | | |
| | | foreach (var detail in stockDetails) |
| | | { |
| | | // ç¡®ä¿åºåç¶ææ£ç¡® |
| | | if (detail.Status == StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt()) |
| | | { |
| | | // å¦æå·²ç»æ¯å
¥åºç¡®è®¤ç¶æï¼æ´æ°ä¸ºå
¥åºå®æ |
| | | detail.Status = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | detail.OutboundQuantity = 0; |
| | | |
| | | await _stockService.StockInfoDetailService.Db.Updateable(detail).ExecuteCommandAsync(); |
| | | |
| | | _logger.LogInformation($"æ´æ°åºåæç»ç¶æ - æ¡ç : {detail.Barcode}, " + |
| | | $"æ°ç¶æ: {detail.Status}, åºåºæ°é: {detail.OutboundQuantity}"); |
| | | } |
| | | else if (detail.Status == StockStatusEmun.åºåºéå®.ObjToInt() || |
| | | detail.Status == StockStatusEmun.åºåºå®æ.ObjToInt()) |
| | | { |
| | | // è¿äºç¶æä¸åºè¯¥åå¨ï¼è®°å½è¦å |
| | | _logger.LogWarning($"å¼å¸¸åºåç¶æ - æ¡ç : {detail.Barcode}, ç¶æ: {detail.Status}, " + |
| | | $"ä»»å¡å·: {task.TaskNum}"); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogError($"ProcessStockDetailsForReturn失败 - StockId: {stockId}, Error: {ex.Message}"); |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å é¤é¶åºåæ°æ®ï¼å¢å¼ºçï¼ |
| | |
| | | var detailModel = new AllocateDtoDetail |
| | | { |
| | | MaterialCode = detail.MaterielCode, |
| | | LineNo = detail.lineNo, |
| | | LineNo = detail.lineNo, |
| | | WarehouseCode = detail.WarehouseCode, |
| | | Qty = detailLocks.Sum(x=>x.PickedQty), |
| | | Qty = 0, |
| | | Unit = detail.BarcodeUnit, |
| | | Barcodes = new List<BarcodeInfo> () |
| | | Barcodes = new List<BarcodeInfo>() |
| | | }; |
| | | foreach (var item in detailLocks) |
| | | { |
| | | var barModel = new BarcodeInfo |
| | | if (item.PickedQty > 0) |
| | | { |
| | | Barcode = item.CurrentBarcode, |
| | | SupplyCode = item.SupplyCode, |
| | | BatchNo = item.BatchNo, |
| | | Unit = item.BarcodeUnit, |
| | | Qty = item.PickedQty |
| | | }; |
| | | // åä½ä¸ä¸è´æ¶è½¬æ¢ |
| | | if (item.BarcodeUnit != item.Unit) |
| | | { |
| | | var convertResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.PickedQty, item.Unit, item.BarcodeUnit); |
| | | barModel.Unit = convertResult.Unit; |
| | | barModel.Qty = convertResult.Quantity; |
| | | var barModel = new BarcodeInfo |
| | | { |
| | | Barcode = item.CurrentBarcode, |
| | | SupplyCode = item.SupplyCode, |
| | | BatchNo = item.BatchNo, |
| | | Unit = detail.BarcodeUnit, |
| | | Qty = 0 |
| | | }; |
| | | // åä½ä¸ä¸è´æ¶è½¬æ¢ |
| | | if (detail.BarcodeUnit != detail.Unit) |
| | | { |
| | | var convertResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.PickedQty, detail.Unit, detail.BarcodeUnit); |
| | | barModel.Unit = convertResult.Unit; |
| | | barModel.Qty = convertResult.Quantity; |
| | | } |
| | | else |
| | | { |
| | | barModel.Qty = item.PickedQty; |
| | | } |
| | | detailModel.Qty += barModel.Qty; |
| | | detailModel.Barcodes.Add(barModel); |
| | | } |
| | | |
| | | detailModel.Qty += barModel.Qty; |
| | | detailModel.Barcodes.Add(barModel); |
| | | |
| | | allocatefeedmodel.Details.Add(detailModel); |
| | | } |
| | | |
| | | var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel); |
| | | if (result != null && result.code == 200) |
| | | { |
| | | await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() |
| | | .SetColumns(x => x.ReturnToMESStatus == 1) |
| | | .Where(x => x.OrderId == outboundOrder.Id).ExecuteCommandAsync(); |
| | | |
| | | allocatefeedmodel.Details.Add(detailModel); |
| | | } |
| | | |
| | | var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel); |
| | | if (result != null && result.code == 200) |
| | | { |
| | | await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() |
| | | .SetColumns(x => x.ReturnToMESStatus == 1) |
| | | .Where(x => x.OrderId == outboundOrder.Id).ExecuteCommandAsync(); |
| | | |
| | | await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() |
| | | .SetColumns(x => new Dt_OutboundOrder |
| | | { |
| | | ReturnToMESStatus = 1, |
| | | Operator = App.User.UserName, |
| | | }).Where(x => x.OrderNo == orderNo).ExecuteCommandAsync(); |
| | | await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() |
| | | .SetColumns(x => new Dt_OutboundOrder |
| | | { |
| | | ReturnToMESStatus = 1, |
| | | Operator = App.User.UserName, |
| | | }).Where(x => x.OrderNo == orderNo).ExecuteCommandAsync(); |
| | | } |
| | | } |
| | | } |
| | | else if (outboundOrder.OrderType == OutOrderTypeEnum.ReCheck.ObjToInt()) |
| | |
| | | //ä¸ç¨åä¼ |
| | | } |
| | | else |
| | | { |
| | | var feedmodel = new FeedbackOutboundRequestModel |
| | | { |
| | | if (outboundOrder != null && outboundOrder.IsBatch == 0) |
| | | { |
| | | reqCode = Guid.NewGuid().ToString(), |
| | | reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | business_type = outboundOrder.BusinessType, |
| | | factoryArea = outboundOrder.FactoryArea, |
| | | operationType = 1, |
| | | Operator = outboundOrder.Operator, |
| | | orderNo = outboundOrder.UpperOrderNo, |
| | | documentsNO = outboundOrder.OrderNo, |
| | | status = outboundOrder.OrderStatus, |
| | | details = new List<FeedbackOutboundDetailsModel>() |
| | | }; |
| | | |
| | | |
| | | foreach (var detail in orderDetails) |
| | | { |
| | | // è·å该æç»å¯¹åºçæ¡ç ä¿¡æ¯ï¼ä»éå®è®°å½ï¼ |
| | | var detailLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() |
| | | .Where(x => x.OrderNo == orderNo && |
| | | x.OrderDetailId == detail.Id && |
| | | (x.Status == (int)OutLockStockStatusEnum.æ£é宿 || x.Status == (int)OutLockStockStatusEnum.å·²ååº)) |
| | | .ToListAsync(); |
| | | |
| | | var detailModel = new FeedbackOutboundDetailsModel |
| | | var feedmodel = new FeedbackOutboundRequestModel |
| | | { |
| | | materialCode = detail.MaterielCode, |
| | | lineNo = detail.lineNo, // 注æï¼è¿éå¯è½éè¦è°æ´å段å |
| | | warehouseCode = detail.WarehouseCode, |
| | | qty = detail.PickedQty, |
| | | currentDeliveryQty = detail.PickedQty, |
| | | unit = detail.Unit, |
| | | barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel>() |
| | | reqCode = Guid.NewGuid().ToString(), |
| | | reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | business_type = outboundOrder.BusinessType, |
| | | factoryArea = outboundOrder.FactoryArea, |
| | | operationType = 1, |
| | | Operator = outboundOrder.Operator, |
| | | orderNo = outboundOrder.UpperOrderNo, |
| | | documentsNO = outboundOrder.OrderNo, |
| | | status = outboundOrder.OrderStatus, |
| | | details = new List<FeedbackOutboundDetailsModel>() |
| | | }; |
| | | foreach (var item in detailLocks) |
| | | foreach (var detail in orderDetails) |
| | | { |
| | | var barModel = new WIDESEA_DTO.Outbound.BarcodesModel |
| | | // è·å该æç»å¯¹åºçæ¡ç ä¿¡æ¯ï¼ä»éå®è®°å½ï¼ |
| | | var detailLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() |
| | | .Where(x => x.OrderNo == orderNo && |
| | | x.OrderDetailId == detail.Id && |
| | | (x.Status == (int)OutLockStockStatusEnum.æ£é宿 || x.Status == (int)OutLockStockStatusEnum.å·²ååº)) |
| | | .ToListAsync(); |
| | | |
| | | var detailModel = new FeedbackOutboundDetailsModel |
| | | { |
| | | barcode = item.CurrentBarcode, |
| | | supplyCode = item.SupplyCode, |
| | | batchNo = item.BatchNo, |
| | | unit = item.BarcodeUnit, |
| | | qty = item.PickedQty |
| | | materialCode = detail.MaterielCode, |
| | | lineNo = detail.lineNo, // 注æï¼è¿éå¯è½éè¦è°æ´å段å |
| | | warehouseCode = detail.WarehouseCode, |
| | | qty = 0, |
| | | currentDeliveryQty = 0, |
| | | unit = detail.Unit, |
| | | barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel>() |
| | | }; |
| | | // åä½ä¸ä¸è´æ¶è½¬æ¢ |
| | | if (item.BarcodeUnit != item.Unit) |
| | | foreach (var item in detailLocks) |
| | | { |
| | | var convertResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.PickedQty, item.Unit, item.BarcodeUnit); |
| | | barModel.unit = convertResult.Unit; |
| | | barModel.qty = convertResult.Quantity; |
| | | if (item.PickedQty > 0) |
| | | { |
| | | var barModel = new WIDESEA_DTO.Outbound.BarcodesModel |
| | | { |
| | | barcode = item.CurrentBarcode, |
| | | supplyCode = item.SupplyCode, |
| | | batchNo = item.BatchNo, |
| | | unit = item.BarcodeUnit, |
| | | qty = item.PickedQty |
| | | }; |
| | | // åä½ä¸ä¸è´æ¶è½¬æ¢ |
| | | if (detail.BarcodeUnit != detail.Unit) |
| | | { |
| | | var convertResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.PickedQty, detail.Unit, detail.BarcodeUnit); |
| | | barModel.unit = convertResult.Unit; |
| | | barModel.qty = convertResult.Quantity; |
| | | } |
| | | else |
| | | { |
| | | barModel.qty = item.PickedQty; |
| | | } |
| | | detailModel.qty += barModel.qty; |
| | | detailModel.currentDeliveryQty += barModel.qty; |
| | | detailModel.barcodes.Add(barModel); |
| | | } |
| | | } |
| | | |
| | | detailModel.qty += barModel.qty; |
| | | detailModel.currentDeliveryQty += barModel.qty; |
| | | detailModel.barcodes.Add(barModel); |
| | | feedmodel.details.Add(detailModel); |
| | | } |
| | | feedmodel.details.Add(detailModel); |
| | | } |
| | | var result = await _invokeMESService.FeedbackOutbound(feedmodel); |
| | | if (result != null && result.code == 200) |
| | | { |
| | | await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() |
| | | .SetColumns(x => x.ReturnToMESStatus == 1) |
| | | .Where(x => x.OrderId == outboundOrder.Id) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() |
| | | .SetColumns(x => x.ReturnToMESStatus == 1) |
| | | .Where(x => x.OrderNo == orderNo) |
| | | .ExecuteCommandAsync(); |
| | | var result = await _invokeMESService.FeedbackOutbound(feedmodel); |
| | | if (result != null && result.code == 200) |
| | | { |
| | | await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>() |
| | | .SetColumns(x => x.ReturnToMESStatus == 1) |
| | | .Where(x => x.OrderId == outboundOrder.Id) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() |
| | | .SetColumns(x => x.ReturnToMESStatus == 1) |
| | | .Where(x => x.OrderNo == orderNo) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | } |
| | | else if (outboundOrder != null && outboundOrder.IsBatch == 1) |
| | | { |
| | | await _invokeMESService.BatchOrderFeedbackToMes(new List<string>(){outboundOrder.OrderNo },2); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public async Task<WebResponseContent> OutEmptyTaskCompleted(Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | /// </summary> |
| | | /// <param name="inTask"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> PalletOutboundTask(string endStation, string palletCode = "") |
| | | public async Task<WebResponseContent> PalletOutboundTask(int num, int locationType) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StockInfo stockInfo; |
| | | if (string.IsNullOrEmpty(palletCode)) |
| | | { |
| | | stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt() && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt() && !string.IsNullOrWhiteSpace(x.LocationCode)).First(); |
| | | } |
| | | else |
| | | { |
| | | stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt() && x.PalletCode == palletCode && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt()).First(); |
| | | } |
| | | var stockInfos = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt() && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt()).WhereIF(locationType != 0, x => x.LocationType == locationType).Take(num).ToList(); |
| | | |
| | | if (stockInfo == null) |
| | | if (stockInfos.Count() == 0) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ç©ºæçåºå"); |
| | | } |
| | | Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | | if (locationInfo == null) |
| | | foreach (var stockInfo in stockInfos) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ç©ºæçåºå对åºçè´§ä½ä¿¡æ¯"); |
| | | } |
| | | |
| | | Dt_Task task = new Dt_Task() |
| | | { |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 0, |
| | | NextAddress = endStation, |
| | | PalletCode = stockInfo.PalletCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = endStation, |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = TaskTypeEnum.OutEmpty.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType |
| | | |
| | | }; |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | _unitOfWorkManage.BeginTran(); |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | |
| | | int taskId = BaseDal.AddData(task); |
| | | task.TaskId = taskId; |
| | | |
| | | _stockService.StockInfoService.UpdateData(stockInfo); |
| | | |
| | | _locationInfoService.UpdateData(locationInfo); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), "", task.TaskNum); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | TaskModel esstask = new TaskModel() |
| | | { |
| | | taskType = "carry", |
| | | taskGroupCode = "", |
| | | groupPriority = 0, |
| | | tasks = new List<TasksType> |
| | | Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | | if (locationInfo == null) |
| | | { |
| | | new() |
| | | { |
| | | taskCode=task.TaskNum.ToString(), |
| | | taskPriority=0, |
| | | taskDescribe=new TaskDescribeType{ |
| | | containerCode=stockInfo.PalletCode, |
| | | containerType= "CT_KUBOT_STANDARD", |
| | | fromLocationCode=stockInfo.LocationCode??"", |
| | | toStationCode="", |
| | | toLocationCode=endStation, |
| | | deadline=0,storageTag="" |
| | | } |
| | | } |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ç©ºæçåºå对åºçè´§ä½ä¿¡æ¯"); |
| | | } |
| | | }; |
| | | var result = await _eSSApiService.CreateTaskAsync(esstask); |
| | | |
| | | _logger.LogInformation("å建任å¡PalletOutboundTask è¿å: " + result); |
| | | if (result) |
| | | { |
| | | return WebResponseContent.Instance.OK(200); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("ä¸åæºå¨äººä»»å¡å¤±è´¥ï¼"); |
| | | } |
| | | Dt_Task task = new Dt_Task() |
| | | { |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 0, |
| | | NextAddress = "1-2", |
| | | PalletCode = stockInfo.PalletCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = "1-2", |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = TaskTypeEnum.OutEmpty.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType |
| | | |
| | | }; |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | _unitOfWorkManage.BeginTran(); |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | |
| | | int taskId = BaseDal.AddData(task); |
| | | task.TaskId = taskId; |
| | | |
| | | _stockService.StockInfoService.UpdateData(stockInfo); |
| | | |
| | | _locationInfoService.UpdateData(locationInfo); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Outbound.ObjToInt(), "", task.TaskNum); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | TaskModel esstask = new TaskModel() |
| | | { |
| | | taskType = "carry", |
| | | taskGroupCode = "", |
| | | groupPriority = 0, |
| | | tasks = new List<TasksType> |
| | | { |
| | | new() |
| | | { |
| | | taskCode=task.TaskNum.ToString(), |
| | | taskPriority=0, |
| | | taskDescribe=new TaskDescribeType{ |
| | | containerCode=stockInfo.PalletCode, |
| | | containerType= "CT_KUBOT_STANDARD", |
| | | fromLocationCode=stockInfo.LocationCode??"", |
| | | toStationCode="", |
| | | toLocationCode="1-2", |
| | | deadline=0,storageTag="" |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | var result = await _eSSApiService.CreateTaskAsync(esstask); |
| | | |
| | | _logger.LogInformation("å建任å¡PalletOutboundTask è¿å: " + result); |
| | | } |
| | | return content.OK("空æåºåºæå!"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | public async Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews) |
| | | /// <summary> |
| | | /// æºä»è°æºä» |
| | | /// </summary> |
| | | /// <param name="orderDetailId"></param> |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <param name="station"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews, string station = null) |
| | | { |
| | | try |
| | | { |
| | |
| | | return WebResponseContent.Instance.Error("æ¾ä¸å°åºåºæç»åæ®"); |
| | | } |
| | | |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(outboundOrder.Details.First().Id, stockSelectViews); |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(outboundOrder.Details.First().Id, stockSelectViews,station); |
| | | |
| | | WebResponseContent content =await GenerateOutboundTaskDataUpdate(result.Item1, result.Item2, result.Item3, result.Item4, result.Item5); |
| | | |
| | |
| | | /// <param name="orderDetailId"></param> |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews) |
| | | public async Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews,string station=null) |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error("æ¾ä¸å°åæ®"); |
| | | } |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(outboundOrder.Details.First().Id, stockSelectViews); |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(outboundOrder.Details.First().Id, stockSelectViews,station); |
| | | |
| | | WebResponseContent content =await GenerateOutboundTaskDataUpdate(result.Item1, result.Item2, result.Item3, result.Item4, result.Item5); |
| | | |
| | |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutboundTaskDataHandle(int orderDetailId, List<StockSelectViewDTO> stockSelectViews) |
| | | public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutboundTaskDataHandle(int orderDetailId, List<StockSelectViewDTO> stockSelectViews,string station=null) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | Dt_OutboundOrderDetail outboundOrderDetail = _outboundOrderDetailService.Repository.QueryFirst(x => x.Id == orderDetailId); |
| | |
| | | (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundOrderDetailService.AssignStockOutbound(outboundOrderDetail, stockSelectViews); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | Dt_OutboundOrder outboundOrder = _outboundOrderService.Repository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId); |
| | | Dt_OutboundOrder outboundOrder = _outboundOrderService.Repository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId); |
| | | TaskTypeEnum typeEnum = outboundOrder.OrderType switch |
| | | { |
| | | (int)OutOrderTypeEnum.Issue => TaskTypeEnum.Outbound, |
| | | (int)OutOrderTypeEnum.Allocate => TaskTypeEnum.OutAllocate, |
| | | (int)OutOrderTypeEnum.Quality => TaskTypeEnum.OutQuality, |
| | | _ => new TaskTypeEnum() |
| | | _ => TaskTypeEnum.Outbound |
| | | }; |
| | | tasks = GetTasks(result.Item1, typeEnum); |
| | | tasks = GetTasks(result.Item1, typeEnum,station); |
| | | result.Item2.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | result.Item3.ForEach(x => |
| | | { |
| | |
| | | using Autofac.Core; |
| | | using MailKit.Search; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_BasicService; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Attributes; |
| | | using WIDESEA_Core.BaseController; |
| | | using WIDESEA_DTO.Allocate; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_DTO.Mes; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IInboundService; |
| | | using WIDESEA_InboundService; |
| | | using WIDESEA_IOutboundService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_OutboundService; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers.Inbound |
| | | { |
| | |
| | | private readonly ILocationInfoService _locationInfoService; |
| | | private readonly IDailySequenceService _dailySequenceService; |
| | | private readonly IMaterialUnitService _materialUnitService; |
| | | private readonly IOutStockLockInfoService _outStockLockInfoService; |
| | | private readonly IOutboundOrderDetailService _outboundOrderDetailService; |
| | | private readonly ILogger<InboundOrderController> _logger; |
| | | public InboundOrderController(IInboundOrderService service, WIDESEA_IBasicService.IErpApiService erpApiService, WIDESEA_IBasicService.IInvokeMESService invokeMESService, IESSApiService eSSApiService, IDailySequenceService dailySequenceService, ILocationInfoService locationInfoService, ILogger<InboundOrderController> logger, IMaterialUnitService materialUnitService, IInboundService inboundService) : base(service) |
| | | public InboundOrderController(IInboundOrderService service, WIDESEA_IBasicService.IErpApiService erpApiService, WIDESEA_IBasicService.IInvokeMESService invokeMESService, IESSApiService eSSApiService, IDailySequenceService dailySequenceService, ILocationInfoService locationInfoService, ILogger<InboundOrderController> logger, IMaterialUnitService materialUnitService, IInboundService inboundService, IOutStockLockInfoService outStockLockInfoService, IOutboundOrderDetailService outboundOrderDetailService) : base(service) |
| | | { |
| | | this.erpApiService = erpApiService; |
| | | _invokeMESService = invokeMESService; |
| | |
| | | _logger = logger; |
| | | _materialUnitService = materialUnitService; |
| | | _inboundService = inboundService; |
| | | _outStockLockInfoService = outStockLockInfoService; |
| | | _outboundOrderDetailService = outboundOrderDetailService; |
| | | } |
| | | |
| | | [HttpPost, Route("Test"), AllowAnonymous, MethodParamsValidate] |
| | | public async Task<WebResponseContent> Test() |
| | | { |
| | | |
| | | |
| | | // Service.Db.Deleteable<Dt_InboundOrder>().Where(x=>x.UpperOrderNo== "12020251100040").ExecuteCommand(); |
| | | //_inboundService.InboundOrderDetailService.Db.Deleteable<Dt_InboundOrderDetail>() |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// 鿣 æºä»è°æºä» ç»çå
¥åº |
| | | /// </summary> |
| | | /// <param name="materielGroupDTO"></param> |
| | | /// <returns></returns> |
| | |
| | | } |
| | | |
| | | [HttpPost, Route("PalletOutboundTask"), AllowAnonymous, MethodParamsValidate] |
| | | public async Task<WebResponseContent> PalletOutboundTask(string endStation, string palletCode = "") |
| | | public async Task<WebResponseContent> PalletOutboundTask(int num, int locationType) |
| | | { |
| | | |
| | | var result = await Service.PalletOutboundTask(endStation, palletCode); |
| | | |
| | | return result; |
| | | return await Service.PalletOutboundTask(num, locationType); |
| | | } |
| | | |
| | | |
| | |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("GenerateOutboundTask"), AllowAnonymous] |
| | | public async Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, [FromBody] List<StockSelectViewDTO> stockSelectViews) |
| | | public async Task<WebResponseContent> GenerateOutboundTask(int orderDetailId, string station, [FromBody] List<StockSelectViewDTO> stockSelectViews) |
| | | { |
| | | return await Service.GenerateOutboundTask(orderDetailId, stockSelectViews); |
| | | return await Service.GenerateOutboundTask(orderDetailId, stockSelectViews, station); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("GenerateAllocatOutboundTask"), AllowAnonymous] |
| | | public async Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, [FromBody] List<StockSelectViewDTO> stockSelectViews) |
| | | public async Task<WebResponseContent> GenerateAllocatOutboundTask(int orderDetailId, string station, [FromBody] List<StockSelectViewDTO> stockSelectViews) |
| | | { |
| | | return await Service.GenerateAllocatOutboundTask(orderDetailId, stockSelectViews); |
| | | return await Service.GenerateAllocatOutboundTask(orderDetailId, stockSelectViews,station); |
| | | } |
| | | |
| | | /// <summary> |