From 6966c63c04c57ddec44e2e0c00c544a09737097b Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期一, 27 十月 2025 17:17:31 +0800
Subject: [PATCH] 优化PDA入库功能

---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs |   40 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)

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 dd4a2a8..87850ea 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"
@@ -316,6 +316,7 @@
                         Warehouse_no = order.warehouse_no,
                         Details = order.details.Select(d => new Dt_CabinOrderDetail
                         {
+                            Reservoirarea=order.warehouse_no,
                             Goods_no = d.goods_no,
                             Order_qty = Math.Abs(d.order_qty),
                             Batch_num = d.batch_num,
@@ -362,7 +363,6 @@
                         if (!Enum.IsDefined(typeof(MaterielSourceTypeEnum), materielInfo.MaterielSourceType))
                             throw new Exception($"璇疯缃嵂鍝佺紪鍙枫�恵item.goods_no}銆戠殑灞炴�у垎绫�");
                         if (materielInfo.BoxQty < 1) throw new Exception($"璇疯缃嵂鍝佺紪鍙枫�恵item.goods_no}銆戠殑绠辫鏁伴噺");
-                        if (materielInfo.MinQty < 1) throw new Exception($"璇疯缃嵂鍝佺紪鍙枫�恵item.goods_no}銆戠殑绔嬪簱鏈�浣庡簱瀛樻暟");
                         #endregion
                         #region 澶т欢
                         if (materielInfo.MaterielSourceType == MaterielSourceTypeEnum.PurchasePart)//濡傛灉鐗╂枡鏄ぇ浠�
@@ -382,6 +382,7 @@
                         #endregion
                         else
                         {
+                            if (materielInfo.MinQty < 1) throw new Exception($"璇疯缃嵂鍝佺紪鍙枫�恵item.goods_no}銆戠殑绔嬪簱鏈�浣庡簱瀛樻暟");
                             Dt_CabinOrderDetail orderDetail = null;
                             var ys = item.order_qty % materielInfo.BoxQty; //涓嶈兘鏁撮櫎绠辫鐨勬暎浠舵暟 
                             var xs = (int)(item.order_qty / materielInfo.BoxQty);//淇濈暀鏁存暟
@@ -738,5 +739,42 @@
             return content;
         }
         #endregion
+
+        public WebResponseContent FinishInOrder(int key)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                Dt_CabinOrder cabinOrder = BaseDal.QueryFirst(x => x.Id == key);
+                List<Dt_CabinOrder> cabinOrders = Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == cabinOrder.Order_no).Includes(x => x.Details).ToList();//鎵惧嚭鎵�鏈夊嚭搴撳崟鍙风浉鍚岀殑鍑哄簱鍗�
+                _unitOfWorkManage.BeginTran();
+                foreach (var item in cabinOrders)
+                {
+                    if (item.Details != null)
+                        _cabinOrderDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.浜哄伐瀹屾垚);
+                    item.Modifier = App.User.UserName;
+                    item.ModifyDate = DateTime.Now;
+                    item.Details = null;
+                }
+                BaseDal.DeleteAndMoveIntoHty(cabinOrders, OperateTypeEnum.浜哄伐瀹屾垚);
+                var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
+                var requestDate = new
+                {
+                    order_no = cabinOrder.Order_no
+                };
+                var result = HttpHelper.Post(url, requestDate.ToJsonString());
+                var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
+                if (response == null) throw new Exception("涓婃姤ERP鍏ュ簱鍗曞畬鎴愬け璐ワ紒");
+                if (response.resultCode != "0") throw new Exception(response.resultMsg);
+                _unitOfWorkManage.CommitTran();
+                content.OK();
+            }
+            catch (Exception ex)
+            {
+                _unitOfWorkManage.RollbackTran();
+                content.Error(ex.Message);
+            }
+            return content;
+        }
     }
 }

--
Gitblit v1.9.3