ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/inbound/Dt_AllocateOrder.js
@@ -67,10 +67,10 @@ .post(`api/MesFeedback/OutboundFeedback?orderNo=${selectedRows[0].orderNo}`, {}, "æ°æ®å¤çä¸...") .then((x) => { if (x.status) { _this.$Message.success('åæ¹åºåºåè°å®æ'); _this.$Message.success(x.message); _this.refresh(); } else { return _this.$Message.error('åæ¹åºåºåè°å¤±è´¥'); return _this.$Message.error(x.message); } }) .catch((error) => { ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/outbound/allocateoutboundOrder.js
@@ -59,10 +59,10 @@ .post(`api/MesFeedback/OutboundFeedback?orderNo=${selectedRows[0].orderNo}`, {}, "æ°æ®å¤çä¸...") .then((x) => { if (x.status) { _this.$Message.success('åæ¹åºåºåè°å®æ'); _this.$Message.success(x.message); _this.refresh(); } else { return _this.$Message.error('åæ¹åºåºåè°å¤±è´¥'); return _this.$Message.error(x.message); } }) .catch((error) => { ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/outbound/extend/DirectOutbound.vue
@@ -1,4 +1,7 @@ <template> <!-- å ¨å±é®ç½©å±ï¼å¨è¯·æ±å¤çæ¶æ¾ç¤º --> <div class="mask-layer" v-if="loading"></div> <vol-box v-model="show" title="ç´æ¥åºåº" :width="800" :height="1200"> <template #content> <el-form ref="form" :model="form" label-width="90px"> @@ -18,7 +21,7 @@ </template> <template #footer> <div> <el-button type="danger" size="small" plain @click="submit"> <el-button type="danger" size="small" plain @click="submit" :loading="loading"> <i class="el-icon-check">确认</i> </el-button> <el-button size="small" type="primary" plain @click="() => { this.show = false }"> @@ -48,6 +51,8 @@ orderNo: "", keys: [], isBatch: "", loading: false, // æ§å¶é®ç½©åæé®å è½½ç¶æ form: {} // è¡¥å å代ç 䏿ªå®ä¹çform } }, methods: { @@ -59,9 +64,19 @@ if (params.isBatch == 1) { this.outboundQuantity = params.outboundQuantity } }, submit() { // éªè¯å¿ 填项 if (!this.station) { this.$message.warning("è¯·éæ©åºåºåºå"); return; } if (this.isBatch === 1 && !this.outboundQuantity) { this.$message.warning("请填ååºåºæ°é"); return; } this.loading = true; // æå¼é®ç½©åå è½½ç¶æ this.$emit('parentCall', ($vue) => { const requestParams = { detailIds: this.keys, @@ -74,13 +89,27 @@ console.log(requestParams); this.http.post("api/Outbound/ProcessPickingOutbound", requestParams, 'æ°æ®å¤çä¸...') .then((x) => { this.loading = false; // å ³éé®ç½©åå è½½ç¶æ if (!x.status) { this.$message.error(x.message) } else { this.show = false this.$Message.success(x.message) this.$message.success(x.message) // ä¿®æ£$Message为$message // ä¿®å¤æ ¸å¿ï¼å®å ¨è°ç¨refreshæ¹æ³ if ($vue && typeof $vue.refresh === 'function') { $vue.refresh(); } else { // å¤éæ¹æ¡ï¼å¦æç¶ç»ä»¶æ²¡ærefreshæ¹æ³ï¼è§¦åèªå®ä¹äºä»¶éç¥å·æ° this.$emit('needRefresh'); console.warn('ç¶ç»ä»¶æªå®ä¹refreshæ¹æ³ï¼å·²è§¦åneedRefreshäºä»¶'); } } }) .catch((error) => { this.loading = false; // å¼å¸¸æ¶ä¹è¦å ³éé®ç½© this.$message.error("请æ±å¤±è´¥ï¼" + (error.message || "æªç¥é误")); console.error("请æ±å¼å¸¸ï¼", error); }) }) }, @@ -88,3 +117,35 @@ } </script> <style scoped> /* é®ç½©å±æ ·å¼ */ .mask-layer { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(0, 0, 0, 0.5); /* åéæé»è²é®ç½© */ z-index: 9999; /* ç¡®ä¿é®ç½©å¨æä¸å±ï¼é«äºå¼¹çªï¼ */ display: flex; justify-content: center; align-items: center; pointer-events: auto; /* 黿¢ç¹å»é®ç½©ä¸æ¹çå 容 */ } /* å è½½å¨ç» */ .mask-layer::after { content: ""; width: 40px; height: 40px; border: 4px solid #ffffff; border-top: 4px solid #409eff; border-radius: 50%; animation: spin 1s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } </style> ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/outbound/extend/NoStockOut.vue
@@ -208,6 +208,21 @@ const outboundInputRef = ref(null); const purchaseInputRef = ref(null); const successAudioSrc = require('@/assets/audio/success.mp3'); const errorAudioSrc = require('@/assets/audio/error.mp3'); // ========== ä» æ°å¢ï¼é³é¢ææ¾å½æ°ï¼æ å ¶ä»ä»£ç æ¹å¨ï¼ ========== const playAudio = (audioSrc, volume = 0.8) => { try { const audio = new Audio(audioSrc); audio.volume = volume; audio.play().catch(() => {}); } catch (e) {} }; const playSuccess = () => playAudio(successAudioSrc); const playError = () => playAudio(errorAudioSrc); // ========== é³é¢å½æ°ç»æ ========== // ç»ä»¶æè½½æ¶èç¦å°åºåºåè¾å ¥æ¡ onMounted(() => { nextTick(() => { @@ -340,6 +355,7 @@ // æ ¸å¿æ°å¢ï¼åç½®æ ¡éªï¼ç¡®ä¿åºåºåå·²éªè¯ if (!isOutboundVerified.value) { ElMessage.warning("请å éªè¯ææçåºåºåæ®å·ååæ«ææ¡ç "); playError(); // ========== ä» æ°å¢è¿ä¸è¡ ========== nextTick(() => { outboundInputRef.value?.focus(); }); @@ -356,6 +372,7 @@ const isDuplicate = scannedBarcodes.value.some(item => item.barcode === barcode); if (isDuplicate) { ElMessage.warning(`æ¡ç ã${barcode}ãå·²åå¨ï¼æ éé夿«æ`); playError(); // ========== ä» æ°å¢è¿ä¸è¡ ========== formData.barcode = ""; nextTick(() => barcodeInputRef.value?.focus()); // å»éåä»èç¦æ¡ç æ¡ return; @@ -365,13 +382,18 @@ loading.value = true; // æ¥éª¤1ï¼æ¥è¯¢éè´åå· const purchaseOrderNo = await getPurchaseOrderByBarcode(barcode); let purchaseOrderNo = ''; try { purchaseOrderNo = await getPurchaseOrderByBarcode(barcode); if (purchaseOrderNo) { orderForm.purchaseOrderNo = purchaseOrderNo; } else { ElMessage.info("æªæ¥è¯¢å°è¯¥æ¡ç 对åºçéè´åå·ï¼ç»§ç»éªè¯æ¡ç æææ§"); formData.barcode = ""; nextTick(() => barcodeInputRef.value?.focus()); playError(); // ========== ä» æ°å¢è¿ä¸è¡ ========== } } catch (error) { ElMessage.info("æªæ¥è¯¢å°è¯¥æ¡ç 对åºçéè´åå·ï¼ç»§ç»éªè¯æ¡ç æææ§ï¼" + error.message); playError(); // ========== ä» æ°å¢è¿ä¸è¡ ========== } // æ¥éª¤2ï¼éªè¯æ¡ç å¹¶è·åç©æä¿¡æ¯ @@ -384,6 +406,7 @@ if (validateRes.status === true) { if (!Array.isArray(validateRes.data) || validateRes.data.length === 0) { ElMessage.warning("该æ¡ç éªè¯æåï¼ä½æªè¿åç©æä¿¡æ¯"); playError(); // ========== ä» æ°å¢è¿ä¸è¡ ========== formData.barcode = ""; nextTick(() => barcodeInputRef.value?.focus()); } else { @@ -398,15 +421,18 @@ })); scannedBarcodes.value.push(...newItems); ElMessage.success(`æ«ææåï¼æ°å¢ ${newItems.length} æ¡ç©æä¿¡æ¯ï¼ç´¯è®¡ ${scannedBarcodes.value.length} æ¡`); playSuccess(); // ========== ä» æ°å¢è¿ä¸è¡ ========== formData.barcode = ""; } } else { ElMessage.error("æ«æå¤±è´¥ï¼" + (validateRes.message || 'æ¡ç éªè¯å¤±è´¥')); playError(); // ========== ä» æ°å¢è¿ä¸è¡ ========== formData.barcode = ""; nextTick(() => barcodeInputRef.value?.focus()); } } catch (error) { ElMessage.error(error.message); playError(); // ========== ä» æ°å¢è¿ä¸è¡ ========== formData.barcode = ""; nextTick(() => barcodeInputRef.value?.focus()); } finally { ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/outbound/outboundOrder.js
@@ -521,7 +521,7 @@ return; } ElMessage.success("æä½æå"); ElMessage.success(x.message); this.showDetialBox = false; this.$emit("parentCall", ($vue) => { $vue.getData(); ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/router/viewGird.js
@@ -190,11 +190,7 @@ name: 'customerInfo', component: () => import('@/views/basic/customerInfo.vue') } , { path: '/userInfo', name: 'userInfo', component: () => import('@/views/basic/userInfo.vue') } , { path: '/mesOutboundOrder', name: 'mesOutboundOrder', ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/Index.vue
@@ -270,7 +270,7 @@ { name: "white", color: "#fff" }, ]); const links = ref([ // { text: "个人ä¸å¿", path: "/UserInfo", id: -1, icon: "el-icon-s-custom" }, { text: "个人ä¸å¿", path: "/UserInfo", id: -1, icon: "el-icon-s-custom" }, { text: "å®å ¨éåº", path: "/login", ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/Login.vue
@@ -28,13 +28,7 @@ </div> <div class="item"> <div class="input-icon el-icon-mobile"></div> <input v-focus type="text" v-model="userInfo.verificationCode" placeholder="è¾å ¥éªè¯ç " /> <div class="code" @click="getVierificationCode"> <img v-show="codeImgSrc != ''" :src="codeImgSrc" /> </div> </div> </div> <div class="loging-btn"> <el-button size="large" :loading="loading" color="#3a6cd1" :dark="true" @click="login" long> @@ -113,9 +107,7 @@ const login = () => { if (!userInfo.userName) return $message.error("请è¾å ¥ç¨æ·å"); if (!userInfo.password) return $message.error("请è¾å ¥å¯ç "); if (!userInfo.verificationCode) { return $message.error("请è¾å ¥éªè¯ç "); } // ç¡®ä¿ç«å°å¼å·²ä¿å if (stationValue.value) { ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/basic/userInfo.vue
ÎļþÒÑɾ³ý ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/outbound/outPicking.vue
@@ -433,6 +433,12 @@ this.playErrorAudio(); const errorMsg = response.message || '该æçå·æªå ³èä»»ä½è®¢å'; this.$message.error(errorMsg); this.$nextTick(() => { if (this.$refs.palletInput) { this.$refs.palletInput.focus(); this.$refs.palletInput.select(); // éä¸å ¨é¨å 容 } }); return null; } } catch (error) { @@ -440,6 +446,12 @@ const errorMsg = `è·å订åå·å¼å¸¸ï¼${error.message || 'ç½ç»é误'}`; this.$message.error(errorMsg); console.error("ãæçå·æ¥è®¢åå·æ¥å£å¼å¸¸ã", error); this.$nextTick(() => { if (this.$refs.palletInput) { this.$refs.palletInput.focus(); this.$refs.palletInput.select(); // éä¸å ¨é¨å 容 } }); return null; } finally { this.hideFullScreenLoading(); @@ -663,6 +675,13 @@ if (!palletCode) { return; } this.$nextTick(() => { if (this.$refs.palletInput) { this.$refs.palletInput.focus(); this.$refs.palletInput.select(); // éä¸å ¨é¨å 容 } }); // å æ ¹æ®æçå·è·å订åå· this.getOrderNoByPallet(palletCode).then((orderNo) => { if (orderNo) { @@ -718,10 +737,12 @@ await this.loadPalletData(false) } else { this.$message.error(response.message || 'æ£é确认失败') this.scanForm.materialBarcode = ''; this.playErrorAudio() } } catch (error) { this.$message.error('æ£é确认失败') this.scanForm.materialBarcode = ''; this.playErrorAudio() } finally { this.confirmLoading = false ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/outbound/outboundOrder.vue
@@ -341,6 +341,15 @@ required: true, }, { field: "warehouseCode", title: "ä»åºç¼å·", type: "string", width: 90, align: "left", edit: { type: "string" }, required: true, }, { field: "lineNo", title: "è¡å·", type: "string", ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_BasicService/MESOperation/FeedbackMesService.cs
@@ -139,7 +139,7 @@ _outboundOrderRepository.UpdateData(outboundOrder); return webResponse = WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼å¤±è´¥æ°æ®åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x=>x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); return webResponse = WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x=>x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); } @@ -197,7 +197,7 @@ _outboundOrderRepository.UpdateData(outboundOrder); return webResponse = WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼å¤±è´¥æ°æ®åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); return webResponse = WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); } string apiUrl = AppSettings.GetValue("AllocationFeedbackUrl"); ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs
@@ -58,7 +58,8 @@ private readonly ILocationInfoService _locationInfoService; private readonly IRepository<Dt_TakeStockOrder> _takeStockOrder; private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository; public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper, IRepository<Dt_MesReturnRecord> mesReturnRecord,ILocationInfoService locationInfoService,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfoDetail> stockInfoDetailRepository) private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository; public InboundService(IUnitOfWorkManage unitOfWorkManage, IInboundOrderDetailService inboundOrderDetailService, IInboundOrderService inbounOrderService, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IStockService stockService, IRepository<Dt_Task> taskRepository,IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, HttpClientHelper httpClientHelper, IRepository<Dt_MesReturnRecord> mesReturnRecord,ILocationInfoService locationInfoService,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository) { _unitOfWorkManage = unitOfWorkManage; InboundOrderDetailService = inboundOrderDetailService; @@ -76,6 +77,7 @@ _locationInfoService = locationInfoService; _takeStockOrder = takeStockOrder; _stockInfoDetailRepository = stockInfoDetailRepository; _allocateOrderRepository = allocateOrderRepository; } public async Task<WebResponseContent> GroupPallet(GroupPalletDto palletDto) @@ -148,10 +150,22 @@ return content.Error($"å½åååºä¸ä¸è´"); } if(inboundOrder.BusinessType != "11"&& inboundOrder.Details.FirstOrDefault().WarehouseCode != palletDto.WarehouseType) if(inboundOrder.BusinessType != "11") { return content.Error($"该æ¡ç æå±ä»åºä¸º{inboundOrder.Details.FirstOrDefault().WarehouseCode}ä¸å½åä»åº{palletDto.WarehouseType}ä¸ä¸è´ï¼ä¸å 许ç»ç"); var warehouseType = _inboundOrderDetailRepository.Db.Queryable<Dt_InboundOrderDetail>().Where(x => x.Barcode == palletDto.Barcode || x.OutBoxbarcodes == palletDto.Barcode).Select(x => x.WarehouseCode).First(); if (string.IsNullOrEmpty(warehouseType)) { return content.Error($"æªæ¥è¯¢å°æ¡ç [{palletDto.Barcode}]对åºçä»åºä¿¡æ¯ï¼ä¸å 许ç»ç"); } if (!warehouseType.Equals(palletDto.WarehouseType)) { return content.Error($"该æ¡ç æå±ä»åºä¸º{warehouseType}ä¸å½åä»åº{palletDto.WarehouseType}ä¸ä¸è´ï¼ä¸å 许ç»ç"); } } Dt_StockInfo? stockInfo = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletDto.PalletCode).FirstAsync(); @@ -443,9 +457,27 @@ WebResponseContent content = new WebResponseContent(); try { var inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>() Dt_InboundOrder inboundOrder = null; var allocateOrder = _allocateOrderRepository.Db.Queryable<Dt_AllocateOrder>().Where(x => x.Id == id).First(); if (allocateOrder != null) { inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == allocateOrder.OrderNo).First(); if (inboundOrder.IsBatch == 0 && inboundOrder.OrderStatus == InOrderStatusEnum.å ¥åºä¸.ObjToInt()) { return content = WebResponseContent.Instance.OK($"è¯¥åæ®å±äºä¸åæ¹èªå¨åä¼ ï¼ä¸å¯æå¨åæ¹åä¼ "); } }else { inboundOrder = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>() .Where(x => x.Id == id) .First(); if (inboundOrder.IsBatch == 0 && inboundOrder.OrderStatus == InOrderStatusEnum.å ¥åºä¸.ObjToInt()) { return content = WebResponseContent.Instance.OK($"è¯¥åæ®å±äºä¸åæ¹èªå¨åä¼ ï¼ä¸å¯æå¨åæ¹åä¼ "); } } List<Dt_MesReturnRecord> returnRecords = _mesReturnRecord.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo && x.OrderId == inboundOrder.Id && x.ReturnStatus == 2); foreach (var item in returnRecords) @@ -558,7 +590,7 @@ inboundOrder.ReturnToMESStatus = 2; } _inboundOrderRepository.UpdateData(inboundOrder); return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼å¤±è´¥æ°æ®åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); } var response = responseModel(inboundOrder, 3, null, allocatefeedmodel); @@ -653,7 +685,7 @@ inboundOrder.ReturnToMESStatus = 2; } _inboundOrderRepository.UpdateData(inboundOrder); return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼å¤±è´¥æ°æ®åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); return WebResponseContent.Instance.OK($"è¯¥åæ®æ²¡æéè¦åä¼ æç»ï¼åä¼ {returnRecords.Count()}æ¡ï¼åä¼ æå{returnRecords.Count(x => x.ReturnStatus == 1)}æ¡ï¼åä¼ å¤±è´¥{returnRecords.Count(x => x.ReturnStatus == 2)}æ¡"); } var response = responseModel(inboundOrder, 3, feedmodel); ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs
@@ -166,12 +166,20 @@ || !string.Equals(outboundOrderDetail.Unit, item.Unit) || !string.Equals(outboundOrderDetail.WarehouseCode, item.WarehouseCode) || !string.Equals(outboundOrderDetail.lineNo, item.lineNo) || outboundOrderDetail.MoveQty != item.MoveQty; ; if (isFieldChanged) { return WebResponseContent.Instance.Error($"è¡å·{item.lineNo}å·²éå®åºåºï¼é宿°éï¼{outboundOrderDetail.LockQuantity}ï¼ï¼ä» å 许修æ¹è®¢åæ°éï¼ç¦æ¢ä¿®æ¹ç©æ/æ¹æ¬¡/ä»åºçå ¶ä»ä¿¡æ¯"); } else { if(item.MoveQty > (outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity)) { return WebResponseContent.Instance.Error($"è¡å·{item.lineNo}æªææ°éä¸è½è¶ è¿å©ä¸çè®¢åæ°é{outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity}"); } outboundOrderDetail.MoveQty = item.MoveQty; } } #endregion ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs
@@ -1,14 +1,16 @@ using System.Reflection.Emit; using AutoMapper; using AutoMapper; using Dm.filter; using MailKit.Search; using Mapster; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; using Org.BouncyCastle.Asn1.Ocsp; using Org.BouncyCastle.Crypto; using SqlSugar; using System; using System.Reflection.Emit; using WIDESEA_BasicService; using WIDESEA_Common.CommonEnum; using WIDESEA_Common.LocationEnum; @@ -29,6 +31,7 @@ using WIDESEA_IRecordService; using WIDESEA_IStockService; using WIDESEA_Model.Models; using WIDESEA_Model.Models.Basic; using WIDESEA_Model.Models.Check; using static HslCommunication.Profinet.Knx.KnxCode; @@ -65,6 +68,8 @@ private readonly IRepository<Dt_AllocateMaterialInfo> _allocateMaterialInfoRepository; public readonly IRepository<Dt_InboundOrderDetail> _inboundOrderDetailRepository; public readonly IRepository<Dt_InboundOrder> _inboundOrderRepository; public readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository; public readonly IRepository<Dt_LocationType> _locationTypeRepository; private Dictionary<string, string> stations = new Dictionary<string, string> { @@ -78,7 +83,7 @@ {"3-1","3-5" }, }; public OutboundService(IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> detailRepository, IRepository<Dt_OutboundOrder> outboundRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_StockQuantityChangeRecord> stockChangeRepository, IRepository<Dt_StockInfoDetail_Hty> stockDetailHistoryRepository, IBasicService basicService, IOutboundOrderDetailService outboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IFeedbackMesService feedbackMesService, IRepository<Dt_Task> taskRepository, ILocationInfoService locationInfoService, IESSApiService eSSApiService, IRepository<Dt_AllocateOrder> allocateOrderRepository, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository) public OutboundService(IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> detailRepository, IRepository<Dt_OutboundOrder> outboundRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_StockQuantityChangeRecord> stockChangeRepository, IRepository<Dt_StockInfoDetail_Hty> stockDetailHistoryRepository, IBasicService basicService, IOutboundOrderDetailService outboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IFeedbackMesService feedbackMesService, IRepository<Dt_Task> taskRepository, ILocationInfoService locationInfoService, IESSApiService eSSApiService, IRepository<Dt_AllocateOrder> allocateOrderRepository, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfoRepository, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository) { _mapper = mapper; _unitOfWorkManage = unitOfWorkManage; @@ -103,6 +108,8 @@ _allocateMaterialInfoRepository = allocateMaterialInfoRepository; _inboundOrderDetailRepository = inboundOrderDetailRepository; _inboundOrderRepository = inboundOrderRepository; _locationTypeRepository = locationTypeRepository; _warehouseAreaRepository = warehouseAreaRepository; } public WebResponseContent PrintFromData (string barcode) @@ -144,6 +151,14 @@ PickingOutboundResponseDTO response = new PickingOutboundResponseDTO(); decimal totalNeedAllocate = 0; // æ»éæ±åé é decimal totalActualAllocate = 0; // å®é æ»åé é string targetWarehouse = string.Empty;// ç®æ ä»åº string targetLocationCode = string.Empty; // ç®æ è´§ä½ bool isWholeCaseOutbound = false; // æ¯å¦æ´ç®±åºåº List<string> wholeCasePallets = new List<string>(); Dictionary<string, string> palletLocationMap = new Dictionary<string, string>(); Dictionary<string, bool> palletIsWholeCaseMap = new Dictionary<string, bool>(); int? targetLocationType = null; try { @@ -158,6 +173,7 @@ } // è®°å½æ»éæ±æ°é totalNeedAllocate = calculationResult.MaterielCalculations.Sum(x => x.UnallocatedQuantity); // 2. å¤çç©æåé List<PickedStockDetailDTO> pickedDetails = new List<PickedStockDetailDTO>(); @@ -192,11 +208,116 @@ materielCalc.OutStockLockInfos.Add(item); } outStockLockInfos.Add(item); if (outboundOrder.OrderType == 117) { // å¹é å½ååæ®çéå®è®°å½ if (outboundOrder.OrderNo == item.OrderNo) { // æ¥è¯¢åºåä¿¡æ¯ var stockInfo = _stockInfoRepository.QueryFirst(x => x.PalletCode == item.PalletCode); if (stockInfo == null) { content = WebResponseContent.Instance.Error($"æç{item.PalletCode}æªæ¥è¯¢å°åºåä¿¡æ¯ï¼æ æ³å¤çæ´ç®±åºåº"); _unitOfWorkManage.RollbackTran(); return content; } // 计ç®åºåæ»éï¼å¤ææ¯å¦æ´ç®±ï¼å¢å 0å¼ä¿æ¤ï¼ decimal stockQuantity = _stockDetailRepository.QueryData(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity); if (stockQuantity > 0 && stockQuantity == item.AssignQuantity) { // æ è®°å½åæç为æ´ç®±ï¼æ ¸å¿ä¿®å¤ï¼ææç维度记å½ç¶æï¼ if (!palletIsWholeCaseMap.ContainsKey(item.PalletCode)) { palletIsWholeCaseMap.Add(item.PalletCode, true); } else { palletIsWholeCaseMap[item.PalletCode] = true; } // ç®æ ä»åº/è´§ä½ç±»ååªæ¥è¯¢ä¸æ¬¡ï¼æ§è½ä¼å+空å¼ä¿æ¤ï¼ if (string.IsNullOrEmpty(targetWarehouse)) { targetWarehouse = GetToWarehouseByOrderNo(request.OrderNo); if (string.IsNullOrEmpty(targetWarehouse)) { content = WebResponseContent.Instance.Error("æºä»è°æºä»æ´ç®±åºåºåæ®æªé ç½®ç®æ ä»åº"); _unitOfWorkManage.RollbackTran(); return content; } // æ¿æ¢First()为FirstOrDefault()ï¼é¿å 空å¼å¼å¸¸ string warehouseAreaName = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>() .Where(x => x.Code == targetWarehouse) .Select(x => x.Name) .First(); if (string.IsNullOrEmpty(warehouseAreaName)) { content = WebResponseContent.Instance.Error($"ç®æ ä»åº{targetWarehouse}æªæ¥è¯¢å°å¯¹åºçåºåºåç§°"); _unitOfWorkManage.RollbackTran(); return content; } int? locationType = _locationTypeRepository.Db.Queryable<Dt_LocationType>() .Where(x => string.Equals(x.LocationTypeDesc, warehouseAreaName, StringComparison.OrdinalIgnoreCase)) .Select(x => x.LocationType) .First(); if (!locationType.HasValue) { content = WebResponseContent.Instance.Error($"åºåº{warehouseAreaName}æªå¹é å°å¯¹åºçè´§ä½ç±»å"); _unitOfWorkManage.RollbackTran(); return content; } targetLocationType = locationType.Value; } // åé ç®æ è´§ä½ï¼æ¯ä¸ªæçç¬ç«è´§ä½ï¼ if (!palletLocationMap.ContainsKey(item.PalletCode) && targetLocationType.HasValue) { Dt_LocationInfo locationInfo = _locationInfoService.AssignLocation(targetLocationType.Value); if (locationInfo == null || string.IsNullOrEmpty(locationInfo.LocationCode)) { content = WebResponseContent.Instance.Error($"è´§ä½ç±»å{targetLocationType.Value}æªåé å°å¯ç¨è´§ä½ï¼æçï¼{item.PalletCode}ï¼"); _unitOfWorkManage.RollbackTran(); return content; } palletLocationMap.Add(item.PalletCode, locationInfo.LocationCode); } // å å ¥æ´ç®±æçå表 if (!wholeCasePallets.Contains(item.PalletCode)) { wholeCasePallets.Add(item.PalletCode); } } else { if (!palletIsWholeCaseMap.ContainsKey(item.PalletCode)) { palletIsWholeCaseMap.Add(item.PalletCode, false); } else { palletIsWholeCaseMap[item.PalletCode] = false; } } } } } // å¤çä»»å¡ foreach (var item in materielPickedDetails.Tasks) { if (outboundOrder.OrderType == 117 && palletIsWholeCaseMap.ContainsKey(item.PalletCode) && palletIsWholeCaseMap[item.PalletCode] && palletLocationMap.ContainsKey(item.PalletCode)) { item.TaskType = (int)TaskTypeEnum.Relocation; item.TargetAddress = palletLocationMap[item.PalletCode]; } if (tasks.FirstOrDefault(x => x.PalletCode == item.PalletCode) == null) tasks.Add(item); } @@ -234,6 +355,24 @@ if (tasks.Any()) _taskRepository.AddData(tasks); if (outboundOrder.OrderType == 117 && wholeCasePallets.Any()) { foreach (var palletCode in wholeCasePallets) { var completeReq = new OutboundCompletePalletRequestDTO { OrderNo = request.OrderNo, PalletCode = palletCode }; var res = CompleteOutboundWithPallet(completeReq); if (!res.Status) { _unitOfWorkManage.RollbackTran(); return res; } } } _unitOfWorkManage.CommitTran(); @@ -259,6 +398,18 @@ content = WebResponseContent.Instance.Error("å¤çæ£è´§åºåºå¤±è´¥ï¼" + ex.Message); } return content; } /// <summary> /// æ ¹æ®åæ®å·è·åç®æ ä»åº /// </summary> /// <param name="orderNo"></param> /// <returns></returns> public String GetToWarehouseByOrderNo(string orderNo) { var order =_allocateOrderRepository.QueryFirst(x => x.OrderNo == orderNo); return order.ToWarehouse; } /// <summary> @@ -1327,9 +1478,15 @@ _stockDetailHistoryRepository.AddData(historyRecords); // å é¤åºåæç»è®°å½ var orderNo =_outboundRepository.QueryFirst(x => x.OrderNo == request.OrderNo); if(orderNo.OrderType != 117) { _stockDetailRepository.DeleteData(stockInfo.Details); } _stockChangeRepository.AddData(changeRecords); } #endregion #region æ£é @@ -1549,6 +1706,10 @@ item.OverOutQuantity = item.LockQuantity; } if (item.OverOutQuantity == item.OrderQuantity) { item.OrderDetailStatus = (int)OrderDetailStatusEnum.Over; } updateDetails.Add(item); List<Barcodes> barcodesList = new List<Barcodes>(); @@ -1643,7 +1804,7 @@ { UpdateOutboundOrderStatus(request.OrderNo, OutOrderStatusEnum.åºåºå®æ.ObjToInt()); if (outboundOrder.OrderType != OutOrderTypeEnum.InternalAllocat.ObjToInt() && outboundOrder.CreateType!=OrderCreateTypeEnum.CreateInSystem.ObjToInt()) if (outboundOrder.CreateType!=OrderCreateTypeEnum.CreateInSystem.ObjToInt()) { _feedbackMesService.OutboundFeedback(outboundOrder.OrderNo); } @@ -2191,5 +2352,7 @@ } #endregion } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_StockService/StockDetailByMaterielService.cs
@@ -167,10 +167,8 @@ } int count = groupedData.Count; return new PageGridData<StockDetailByMateriel>(count, materielnfoStatistics) { TotalStockQuantity = totalStockQuantity }; return new PageGridData<StockDetailByMateriel>(count, materielnfoStatistics); } catch (Exception ex) { ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -58,6 +58,7 @@ using WIDESEA_IStockService; using WIDESEA_ITaskInfoService; using WIDESEA_Model.Models; using WIDESEA_Model.Models.Basic; using WIDESEA_Model.Models.Check; using WIDESEA_Model.Models.Outbound; using static HslCommunication.Profinet.Knx.KnxCode; @@ -95,6 +96,8 @@ private readonly HttpClientHelper _httpClientHelper; private readonly IBasicService _basicService; private readonly IRepository<Dt_TakeStockOrder> _takeStockOrder; public readonly IRepository<Dt_LocationType> _locationTypeRepository; public readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository; public IRepository<Dt_Task> Repository => BaseDal; private Dictionary<string, SqlSugar.OrderByType> _taskOrderBy = new() @@ -114,7 +117,7 @@ public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList(); public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService,IRepository<Dt_TakeStockOrder> takeStockOrder) : base(BaseDal) public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService,IRepository<Dt_TakeStockOrder> takeStockOrder, IRepository<Dt_LocationType> locationTypeRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository) : base(BaseDal) { _mapper = mapper; _unitOfWorkManage = unitOfWorkManage; @@ -143,6 +146,8 @@ _httpClientHelper = httpClientHelper; _basicService = basicService; _takeStockOrder = takeStockOrder; _locationTypeRepository = locationTypeRepository; _warehouseAreaRepository = warehouseAreaRepository; } public async Task TaskStatusChange(string taskNum, TaskStatusEnum taskStatusEnum) @@ -482,6 +487,293 @@ return WebResponseContent.Instance.OK(); } public async Task<WebResponseContent> RelocationTaskCompleted(Dt_Task task) { WebResponseContent content = new WebResponseContent(); try { if (task == null || string.IsNullOrEmpty(task.PalletCode) || string.IsNullOrEmpty(task.TargetAddress)) { return WebResponseContent.Instance.Error("ç§»åºä»»å¡ä¿¡æ¯ä¸å®æ´ï¼æçå·/ç®æ è´§ä½ä¸ºç©ºï¼"); } // 2. æ¥è¯¢æçåºåä¿¡æ¯ Dt_StockInfo stockInfo = await _stockRepository.Db.Queryable<Dt_StockInfo>() .Includes(x => x.Details) .Where(x => x.PalletCode == task.PalletCode) .FirstAsync(); if (stockInfo == null) { return WebResponseContent.Instance.Error($"æªæ¾å°æç[{task.PalletCode}]对åºçç»çä¿¡æ¯"); } // é空æçå¿ é¡»ææç» if (stockInfo.Details.Count == 0 && stockInfo.PalletType != PalletTypeEnum.Empty.ObjToInt()) { _logger.LogInformation($"TaskService RelocationTaskCompleted: æªæ¾å°è¯¥æçåºåæç»ä¿¡æ¯.{task.TaskNum}"); return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥æç[{task.PalletCode}]åºåæç»ä¿¡æ¯"); } // 3. æ¥è¯¢ç®æ è´§ä½+åè´§ä½ä¿¡æ¯ Dt_LocationInfo targetLocationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); if (targetLocationInfo == null) { return content.Error($"æªæ¾å°å¯¹åºçç»ç¹è´§ä½[{task.TargetAddress}]ä¿¡æ¯"); } // åè´§ä½ä¿¡æ¯ Dt_LocationInfo oldLocationInfo = null; if (!string.IsNullOrEmpty(stockInfo.LocationCode)) { oldLocationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); if (oldLocationInfo == null) { return content.Error($"æªæ¾å°åè´§ä½[{stockInfo.LocationCode}]ä¿¡æ¯"); } } // 4. è´§ä½ç¶ææ ¡éª if (targetLocationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) { return WebResponseContent.Instance.Error($"ç®æ è´§ä½[{task.TargetAddress}]ç¶æä¸æ£ç¡®ï¼å½å为已å ç¨ï¼"); } // 5. å¼å¯äºå¡å¤çæ ¸å¿é»è¾ _unitOfWorkManage.BeginTran(); // 5.1 è®°å½ç®æ è´§ä½åç¶æï¼æ´æ°ä¸ºå ç¨ var beforeTargetLocationStatus = targetLocationInfo.LocationStatus; targetLocationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); _locationInfoService.Repository.UpdateData(targetLocationInfo); // 5.2 éæ¾åè´§ä½ int beforeOldLocationStatus = 0; if (oldLocationInfo != null) { beforeOldLocationStatus = oldLocationInfo.LocationStatus; // åè´§ä½æ¢å¤ä¸ºç©ºé² oldLocationInfo.LocationStatus = stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt() ? LocationStatusEnum.Pallet.ObjToInt() : LocationStatusEnum.Free.ObjToInt(); _locationInfoService.Repository.UpdateData(oldLocationInfo); } var stockLockInfo = _outStockLockInfoService.Db.Queryable<Dt_OutboundLockInfo_Hty>().Where(x => x.PalletCode == stockInfo.PalletCode && x.TaskNum == task.TaskNum).First(); var allocateOrderToWarehouse = _allocateOrderRepository.Db.Queryable<Dt_AllocateOrder>().Where(x => x.OrderNo == stockLockInfo.OrderNo).First(); // 5.3 æ´æ°åºåæç»ç¶æï¼ç§»åºå®æï¼ stockInfo.Details.ForEach(x => { x.Status = StockStatusEmun.å ¥åºå®æ.ObjToInt(); x.WarehouseCode = allocateOrderToWarehouse.ToWarehouse; }); _stockService.StockInfoDetailService.Repository.UpdateData(stockInfo.Details); // 5.4 æ´æ°åºå主信æ¯ï¼ç»å®æ°è´§ä½ï¼ string oldLocationCode = stockInfo.LocationCode; // è®°å½åè´§ä½ stockInfo.LocationCode = targetLocationInfo.LocationCode; // ç»å®ç®æ è´§ä½ stockInfo.PalletCode = task.PalletCode; stockInfo.StockStatus = StockStatusEmun.å ¥åºå®æ.ObjToInt(); var name =_warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().Where(x => x.Code == allocateOrderToWarehouse.ToWarehouse).First(); var locationType =_locationTypeRepository.QueryFirst(x => x.LocationTypeDesc.Equals(name.Name)); if(locationType != null) { stockInfo.LocationType = locationType.LocationType; } _stockRepository.UpdateData(stockInfo); // 5.5 æ´æ°ä»»å¡ç¶æä¸ºå®æ task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.èªå¨å®æ); // æäº¤äºå¡ _unitOfWorkManage.CommitTran(); // ä»»å¡å½æ¡£å¤±è´¥åç´æ¥å é¤ if (!result) { await Db.Deleteable(task).ExecuteCommandAsync(); } // 6. å¤çåºåºå+è°æ¨ç©æä¿¡æ¯ Dt_OutboundOrder outboundOrder = null; //var firstDetail = stockInfo.Details.FirstOrDefault(); if (stockLockInfo != null && !string.IsNullOrEmpty(stockLockInfo.OrderNo)) { outboundOrder = _outboundOrderService.Db.Queryable<Dt_OutboundOrder>() .Where(x => x.OrderNo == stockLockInfo.OrderNo) .Includes(x => x.Details) .First(); if (outboundOrder != null) { var allocatInfo =_allocateMaterialInfo.Db.Queryable<Dt_AllocateMaterialInfo>().Where(x => x.OrderNo == outboundOrder.OrderNo).ToList(); // å é¤è°æ¨ç©æä¿¡æ¯ foreach (var item in allocatInfo) { var inbounddetail = _allocateMaterialInfo.QueryFirst(x => x.OrderNo == item.OrderNo && x.Barcode == item.Barcode); if (inbounddetail != null) { var alldelete = _allocateMaterialInfo.DeleteAndMoveIntoHty(inbounddetail, OperateTypeEnum.èªå¨å é¤); if (!alldelete) { await Db.Deleteable(task).ExecuteCommandAsync(); } } } // 7. åè°MES string Operator = outboundOrder.Modifier; HttpResponseResult<MesResponseDTO> httpResponseResult = new HttpResponseResult<MesResponseDTO>(); string reqCode = Guid.NewGuid().ToString(); string reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string requestData = string.Empty; List<string> lineNos = new List<string>(); Dt_AllocateMaterialInfo allocateMaterialInfo = _allocateMaterialInfo.QueryFirst(x => x.OrderNo == outboundOrder.OrderNo); // ç§»åºåºæ¯ï¼åºåºå®æä¸æªåä¼ MESãæ è°æ¨ç©æä¿¡æ¯æ¶åè° if (outboundOrder.OrderStatus == OutOrderStatusEnum.åºåºå®æ.ObjToInt() && outboundOrder.ReturnToMESStatus == 0 && allocateMaterialInfo == null) { Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.OrderNo == outboundOrder.OrderNo); if (allocateOrder == null) { return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºçè°æ¨å[{outboundOrder.OrderNo}]"); } // æå»ºç§»åºåè°æ°æ® AllocationReturnDTO? returnDTO = BuildAllocationFeedbackData( outboundOrder, allocateOrder.FromWarehouse, allocateOrder.ToWarehouse, Operator); if (returnDTO == null) { return WebResponseContent.Instance.Error($"æå»ºç§»åºåè°å¯¹è±¡å¤±è´¥"); } string apiUrl = AppSettings.GetValue("AllocationFeedbackUrl"); returnDTO.ReqCode = reqCode; returnDTO.ReqTime = reqTime; JsonSerializerSettings settings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }; requestData = JsonConvert.SerializeObject(returnDTO, settings); lineNos = returnDTO.Details.Select(x => x.LineNo).ToList(); httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, requestData); httpResponseResult.ApiUrl = apiUrl; } // 8. å¤çMESåè°ç»æ bool isSuccess = httpResponseResult.IsSuccess && httpResponseResult.Data?.Code == "200"; string message = "æå"; if (!isSuccess) { if (!httpResponseResult.IsSuccess) { message = $"MESæ¥å£è¿åé误ï¼HTTP代ç ï¼{httpResponseResult.StatusCode}ï¼ä¿¡æ¯ï¼{httpResponseResult.ErrorMessage}"; } else if (httpResponseResult?.Data?.Code != "200") { message = $"è°ç¨MESæ¥å£å¤±è´¥ï¼ä»£ç ï¼{httpResponseResult?.Data?.Code}ï¼ä¿¡æ¯ï¼{httpResponseResult?.Data?.Message}"; } } // 9. è®°å½MESåä¼ è®°å½ Dt_MesReturnRecord mesReturnRecord = new Dt_MesReturnRecord() { ApiUrl = httpResponseResult.ApiUrl, InterfaceType = outboundOrder.OrderType == 0 ? 1 : 3, // ç§»åºæ¥å£ç±»åï¼å¤ç¨è°æ¨ç±»å3 OrderId = outboundOrder.Id, OrderNo = outboundOrder.OrderNo, RequestCode = reqCode, RequestData = requestData, FailureReason = message, LastReturnTime = DateTime.Now, HttpStatusCode = httpResponseResult.StatusCode.ObjToInt(), ResponseData = httpResponseResult.Content, ReturnType = 0, ReturnCount = 1, ReturnStatus = isSuccess ? 1 : 2, SuccessTime = isSuccess ? DateTime.Now : null }; // å¼å¯äºå¡ä¿åMESè®°å½+æ´æ°åºåºåç¶æ _unitOfWorkManage.BeginTran(); _unitOfWorkManage.Db.Insertable(mesReturnRecord).ExecuteCommand(); List<Dt_OutboundOrderDetail> outboundOrderDetails = outboundOrder.Details.Where(x => lineNos.Contains(x.lineNo)).ToList(); outboundOrderDetails.ForEach(x => { if (x.OverOutQuantity == x.OrderQuantity - x.MoveQty) { x.ReturnToMESStatus = isSuccess ? 1 : 2; } else { x.ReturnToMESStatus = isSuccess ? 3 : 4; } x.CurrentDeliveryQty = 0; x.ReturnJsonData = ""; }); mesReturnRecord.ReturnType = outboundOrder.Details.Count == outboundOrderDetails.Count ? 1 : 2; if (outboundOrder.Details.Count == outboundOrderDetails.Count && outboundOrderDetails.All(x => x.ReturnToMESStatus == 1 || x.ReturnToMESStatus == 2)) { outboundOrder.ReturnToMESStatus = isSuccess ? 1 : 2; } else { outboundOrder.ReturnToMESStatus = isSuccess ? 3 : 4; } _outboundOrderService.Db.Updateable(outboundOrderDetails).ExecuteCommand(); _outboundOrderService.UpdateData(outboundOrder); _unitOfWorkManage.CommitTran(); } } // 10. è®°å½è´§ä½ç¶æåæ´ï¼ç®æ è´§ä½+åè´§ä½ï¼ try { // è®°å½ç®æ è´§ä½ç¶æåæ´ _locationStatusChangeRecordService.AddLocationStatusChangeRecord( targetLocationInfo, beforeTargetLocationStatus, StockChangeType.Inbound.ObjToInt(), $"ç§»åºå ¥åºï¼åè´§ä½ï¼{oldLocationCode}ï¼", task.TaskNum); // è®°å½åè´§ä½ç¶æåæ´ï¼è¥æï¼ if (oldLocationInfo != null) { _locationStatusChangeRecordService.AddLocationStatusChangeRecord( oldLocationInfo, beforeOldLocationStatus, StockChangeType.Outbound.ObjToInt(), $"ç§»åºåºåºï¼ç®æ è´§ä½ï¼{targetLocationInfo.LocationCode}ï¼", task.TaskNum); } } catch (Exception ex) { _logger.LogInformation($"RelocationTaskCompleted AddLocationStatusChangeRecord : {ex.Message} "); } return content; } catch (Exception ex) { // äºå¡åæ» _unitOfWorkManage.RollbackTran(); _logger.LogError($"RelocationTaskCompleted å¤ç失败ï¼{ex.Message}", ex); return await Task.FromResult(WebResponseContent.Instance.Error($"ç§»åºä»»å¡å¤ç失败ï¼{ex.Message}")); } } public HttpResponseResult<MesResponseDTO> responseModel(Dt_InboundOrder order, int InterfaceType, FeedbackInboundRequestModel model = null, AllocateDto allocateDto = null) { HttpResponseResult<MesResponseDTO> httpResponseResult = new HttpResponseResult<MesResponseDTO>(); @@ -529,7 +821,7 @@ ResponseData = httpResponseResult.Content, ReturnType = 0, ReturnCount = 1, ReturnStatus = httpResponseResult.IsSuccess ? 1 : 2, ReturnStatus = isSuccess ? 1 : 2, SuccessTime = httpResponseResult.IsSuccess ? DateTime.Now : null }; _unitOfWorkManage.Db.Insertable(mesReturnRecord).ExecuteCommand(); ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs
@@ -4,6 +4,7 @@ using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; using SqlSugar; using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; @@ -43,12 +44,47 @@ WebResponseContent content = new WebResponseContent(); try { 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(); Dictionary<string, SqlSugar.OrderByType> orderByDict = new Dictionary<string, SqlSugar.OrderByType>() { { nameof(Dt_LocationInfo.Layer), SqlSugar.OrderByType.Asc }, { nameof(Dt_LocationInfo.Row), SqlSugar.OrderByType.Asc }, { nameof(Dt_LocationInfo.Column), SqlSugar.OrderByType.Asc }, { nameof(Dt_LocationInfo.Depth), SqlSugar.OrderByType.Desc }, }; if (stockInfos.Count() == 0) var query = _stockRepository.Db.Queryable<Dt_StockInfo>() .Where(x => x.PalletType == PalletTypeEnum.Empty.ObjToInt() && x.StockStatus == StockStatusEmun.å ¥åºå®æ.ObjToInt()) .WhereIF(locationType != 0, x => x.LocationType == locationType) .LeftJoin<Dt_LocationInfo>((s, l) => s.LocationCode == l.LocationCode); if (query.Count() == 0) { return WebResponseContent.Instance.Error("æªæ¾å°ç©ºæçåºå"); } bool isFirstOrder = true; foreach (var item in orderByDict) { string fieldName = item.Key.Equals("Column", StringComparison.OrdinalIgnoreCase) ? $"l.[{item.Key}]" : $"l.{item.Key}"; string sortSql = $"{fieldName} {(item.Value == SqlSugar.OrderByType.Asc ? "ASC" : "DESC")}"; if (isFirstOrder) { query = query.OrderBy(sortSql); isFirstOrder = false; } else { query = query.OrderBy(sortSql); } } var stockInfos = await query.Take(num).ToListAsync(); foreach (var stockInfo in stockInfos) { Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); @@ -98,6 +134,8 @@ } /// <summary> /// åºåºä»»å¡æ°æ®å¤ç /// </summary>