From 1c8f0035e164e9780d8c35a32fc1524d67ff9d9d Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 01 十一月 2025 17:24:25 +0800
Subject: [PATCH] 优化PDA入库

---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs |   15 ++++---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs        |   18 +++++---
 新建文件夹/PDA/pages/stash/inboundorderDetail.vue                                 |    4 +-
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs    |    4 +
 新建文件夹/PDA/pages/stash/raworderboxing.vue                                     |   33 +++++++++-------
 5 files changed, 42 insertions(+), 32 deletions(-)

diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/PDA/pages/stash/inboundorderDetail.vue" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/PDA/pages/stash/inboundorderDetail.vue"
index a8fe2fd..5615762 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/PDA/pages/stash/inboundorderDetail.vue"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/PDA/pages/stash/inboundorderDetail.vue"
@@ -7,8 +7,8 @@
 		</u-sticky> -->
 		<uni-list :border="true">
 			<uni-list-item direction="column" clickable @click="groupClick(item.batch_num)" link
-				:to="page+item.batch_num+'&order_qty='+item.order_qty+'&order_Inqty='+item.order_Inqty+'&goods_no='+item.goods_no"
-				v-for="item in allReceivingOrders" :key="item.batch_num">
+				:to="page+item.batch_num+'&order_qty='+item.order_qty+'&order_Inqty='+item.order_Inqty+'&goods_no='+item.goods_no+'&id='+item.id"
+				v-for="item in allReceivingOrders" :key="item.id">
 				<template v-slot:body>
 					<uni-group margin-top="20">
 						<view> 鍗曟嵁缂栧彿:{{orderNo}} </view>
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/PDA/pages/stash/raworderboxing.vue" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/PDA/pages/stash/raworderboxing.vue"
index 4cf78c1..eafefc8 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/PDA/pages/stash/raworderboxing.vue"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/PDA/pages/stash/raworderboxing.vue"
@@ -137,7 +137,7 @@
 				matInfos: [],
 				orderNo: "",
 				batchNo: "",
-				materielCode:"",
+				materielCode: "",
 				orderqty: 0,
 				Inqty: 0,
 				goods_no: "",
@@ -161,6 +161,7 @@
 				matInfo: [],
 				value2: "",
 				matTotals: [],
+				id: "",
 				warehouseId: "",
 				Test: false,
 				Testlabel: "",
@@ -174,12 +175,13 @@
 		onShow() {},
 		onLoad(res) {
 			this.focus = false;
+			this.id = res.id;
 			this.addressFocus = false;
 			this.orderNo = res.orderNo;
 			this.Inqty = res.order_Inqty;
 			this.orderqty = res.order_qty;
 			this.batchNo = res.batchNo;
-			this.materielCode=res.goods_no;
+			this.materielCode = res.goods_no;
 			this.warehouseId = res.warehouseId;
 			this.label = "鍗曟嵁缂栧彿锛�" + this.orderNo;
 			this.batch_num = "鎵规鍙凤細" + res.batchNo;
@@ -460,9 +462,10 @@
 				this.$u.post('/api/CabinOrder/FeedbackIn', {
 					MainData: {
 						"LocationCode": this.barcode,
+						"id":this.id,
 						"warehouseCode": this.warehouseId,
 						"orderNo": this.orderNo,
-						"materielCode":this.materielCode,
+						"materielCode": this.materielCode,
 						"Inqty": this.materSn,
 						"batchNo": this.batchNo,
 					},
@@ -523,18 +526,18 @@
 
 				// 鎴栬�呯洿鎺ヨ烦杞紙涓嶈闂敤鎴凤級
 				setTimeout(() => {
-				// 鏂瑰紡2锛氳烦杞埌鎸囧畾椤甸潰
-				// uni.redirectTo({
-				//     url: '/pages/order/list' // 鏇挎崲涓轰綘鐨勭洰鏍囬〉闈㈣矾寰�
-				// });
-				// 鏂瑰紡3锛氳烦杞埌棣栭〉
-				// uni.switchTab({
-				//     url: '/pages/index/index'
-				// });
-				// 鏂瑰紡1锛氫娇鐢╱ni.navigateBack杩斿洖涓婁竴椤�
-				    uni.navigateBack({
-				        delta: 1
-				    });
+					// 鏂瑰紡2锛氳烦杞埌鎸囧畾椤甸潰
+					// uni.redirectTo({
+					//     url: '/pages/order/list' // 鏇挎崲涓轰綘鐨勭洰鏍囬〉闈㈣矾寰�
+					// });
+					// 鏂瑰紡3锛氳烦杞埌棣栭〉
+					// uni.switchTab({
+					//     url: '/pages/index/index'
+					// });
+					// 鏂瑰紡1锛氫娇鐢╱ni.navigateBack杩斿洖涓婁竴椤�
+					uni.navigateBack({
+						delta: 1
+					});
 				}, 600);
 			}
 		}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
index 0bc06b6..bfefa82 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
@@ -125,13 +125,15 @@
                 var LocationCode = saveModel.MainData["LocationCode"].ToString();
                 var orderNo = saveModel.MainData["orderNo"].ToString();
                 var batchNo = saveModel.MainData["batchNo"].ToString();
+                var id = saveModel.MainData["id"].ObjToInt();
                 var materielCode = saveModel.MainData["materielCode"].ToString();
                 var Inqty = saveModel.MainData["Inqty"].ObjToInt();
                 var warehouseCode = saveModel.MainData["warehouseCode"].ToString();
                 Dt_CabinOrder cabinOrder = BaseDal.Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == orderNo && x.Warehouse_no == warehouseCode).Includes(x => x.Details).First();
                 if (cabinOrder == null || cabinOrder.OdrderStatus == "宸插畬鎴�")
                     return WebResponseContent.Instance.Error($"鍏ュ簱鍗曞凡瀹屾垚");
-                Dt_CabinOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Goods_no == materielCode && x.Batch_num == batchNo && x.Status == 2).FirstOrDefault();
+                //Dt_CabinOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Goods_no == materielCode && x.Batch_num == batchNo && x.Status == 2).FirstOrDefault();
+                Dt_CabinOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Id == id).FirstOrDefault();
                 if (cabinOrderDetail == null || cabinOrderDetail.OrderDetailStatus == "宸插畬鎴�")
                     return WebResponseContent.Instance.Error($"鍏ュ簱鍗曟槑缁嗗凡瀹屾垚");
                 Dt_MaterielInfo materielInfo = _materielInfoService.Repository.QueryFirst(x => x.MaterielCode == cabinOrderDetail.Goods_no);
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
index 938f0e2..c28476c 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
@@ -979,12 +979,6 @@
                     inventory_Batch.OutboundQuantity -= supplyTask.StockQuantity;
                 }
                 #endregion
-                if (supplyTask.WarehouseCode == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"))
-                {
-                    materielInfo.Business_qty -= supplyTask.StockQuantity;
-                    if (materielInfo.Business_qty < materielInfo.MinQty)
-                        CreateAllocatInOut(materielInfo);//鍒涘缓璋冩嫧浠诲姟
-                }
                 supplyTask.TaskStatus = SupplyStatusEnum.OutFinish.ObjToInt();
 
                 _unitOfWorkManage.BeginTran();
@@ -1000,13 +994,20 @@
                 if (location != null) _locationInfoService.UpdateData(location);
                 _deliveryOrderDetailServices.UpdateData(cabinOrderDetail);
                 _supplyTaskService.Repository.DeleteAndMoveIntoHty(supplyTask, OperateTypeEnum.浜哄伐瀹屾垚);
-                _unitOfWorkManage.CommitTran();
 
                 #region 鍒ゆ柇璇︽儏鏄惁鍏ㄩ儴瀹屾垚
                 if (!_deliveryOrderDetailServices.Repository.QueryData(x => x.DeliveryOrderId == deliveryOrder.Id && x.OotDetailStatus != "宸插畬鎴�").Any())
                     deliveryOrder.OutStatus = "宸插畬鎴�";
                 BaseDal.UpdateData(deliveryOrder);
+                if (supplyTask.WarehouseCode == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"))
+                {
+                    materielInfo.Business_qty -= supplyTask.StockQuantity;
+                    if (materielInfo.Business_qty < materielInfo.MinQty)
+                        CreateAllocatInOut(materielInfo);//鍒涘缓璋冩嫧浠诲姟
+                }
                 #endregion
+                _unitOfWorkManage.CommitTran();
+
                 content.OK();
             }
             catch (Exception ex)
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs"
index 85860f4..caa7125 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs"
@@ -37,7 +37,7 @@
                 List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
                 //// 鏌ヨ澶т欢搴撲腑鍙敤鐨勫簱瀛�
                 List<Dt_InventoryInfo> dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == materielInfo.MaterielCode && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.AvailableQuantity > 0 && x.WarehouseCode == WareCode);
-                if (dt_InventoryInfos.Count < 1) throw new Exception($"鐗╂枡缂栧彿銆恵materielInfo.MaterielCode}銆戝ぇ浠跺簱鏃犲簱瀛橈紒");
+                if (dt_InventoryInfos.Count < 1) throw new Exception($"鐗╂枡缂栧彿銆恵materielInfo.MaterielCode}銆戝ぇ浠跺簱鏃犲簱瀛橈紒璇峰強鏃惰ˉ鍏呭簱瀛橈紒");
                 if (tactics.SelectTactice == TacticsEnum.ComeOutonFirstTime.ObjToInt())
                     dt_InventoryInfos = dt_InventoryInfos.OrderBy(x => x.ValidityPeriod).ToList();
                 else
@@ -59,7 +59,11 @@
                 //娣诲姞鎶ヨ淇℃伅
                 if (materielInfo.Business_qty < materielInfo.MinQty)
                 {
-                    _messageInfoService.AddMessageInfo(MessageGroupByEnum.InventoryLowAlarm, $"鐗╂枡鍚嶇О:{materielInfo.MaterielName}", $"銆愮墿鏂欑紪鐮亄materielInfo.MaterielCode}澶т欢搴撳簱瀛樿繃浣庛��");
+                    _messageInfoService.AddMessageInfo(MessageGroupByEnum.InventoryLowAlarm, $"鐗╂枡鍚嶇О:{materielInfo.MaterielName}", $"銆愮墿鏂欑紪鐮亄materielInfo.MaterielCode}宸茬敓鎴愯皟鎷ㄥ嚭鍏ュ簱鍗曪紝璇疯繘琛屽嚭鍏ュ簱娴佺▼銆傚ぇ浠跺簱搴撳瓨杩囦綆锛佽鍙婃椂琛ュ厖搴撳瓨锛併��");
+                }
+                else
+                {
+                    _messageInfoService.AddMessageInfo(MessageGroupByEnum.InventoryLowAlarm, $"鐗╂枡鍚嶇О:{materielInfo.MaterielName}", $"銆愮墿鏂欑紪鐮亄materielInfo.MaterielCode}宸茬敓鎴愯皟鎷ㄥ嚭鍏ュ簱鍗曪紝璇疯繘琛屽嚭鍏ュ簱娴佺▼銆�");
                 }
                 #endregion
                 #region 娣诲姞璋冩嫧鍑哄簱鍗�
@@ -138,17 +142,17 @@
                 }
                 #endregion
 
-                _unitOfWorkManage.BeginTran();
+                //_unitOfWorkManage.BeginTran();
                 _materielInfoService.UpdateData(materielInfo);
                 _inventoryInfoService.Repository.UpdateData(dt_InventoryInfos);
                 _supplyTaskService.AddData(supplyTasks);
-                BaseDal.Db.InsertNav(deliveryOrder).Include(x => x.Details).ExecuteCommand();
-                _cabinOrderServices.Repository.Db.InsertNav(cabinOrder).Include(x => x.Details).ExecuteCommand();
-                _unitOfWorkManage.CommitTran();
+                if (deliveryOrder.Details.Count > 1) BaseDal.Db.InsertNav(deliveryOrder).Include(x => x.Details).ExecuteCommand();
+                if (cabinOrder.Details.Count > 1) _cabinOrderServices.Repository.Db.InsertNav(cabinOrder).Include(x => x.Details).ExecuteCommand();
+                //_unitOfWorkManage.CommitTran();
             }
             catch (Exception ex)
             {
-                _unitOfWorkManage.RollbackTran();
+                //_unitOfWorkManage.RollbackTran();
                 _messageInfoService.AddMessageInfo(MessageGroupByEnum.InventoryLowAlarm, "澶т欢搴撹ˉ璐х珛搴�", ex.Message);
                 response.Error(ex.Message);
             }

--
Gitblit v1.9.3