From f58ce4647a1c246eb441d547cd12b9b9f417a7c1 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期五, 24 十月 2025 01:55:15 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhiHuiQiCe/FangCangZhiNeng

---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs |   31 ++++++++-----------------------
 1 files changed, 8 insertions(+), 23 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 f24f1aa..0c0e69f 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"
@@ -120,12 +120,13 @@
                 var LocationCode = saveModel.MainData["LocationCode"].ToString();
                 var orderNo = saveModel.MainData["orderNo"].ToString();
                 var batchNo = saveModel.MainData["batchNo"].ToString();
+                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.Batch_num == batchNo && x.Status == 2).First();
+                Dt_CabinOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Goods_no == materielCode && x.Batch_num == batchNo && x.Status == 2).First();
                 if (cabinOrderDetail == null || cabinOrderDetail.OrderDetailStatus == "宸插畬鎴�")
                     return WebResponseContent.Instance.Error($"鍏ュ簱鍗曟槑缁嗗凡瀹屾垚");
                 Dt_MaterielInfo materielInfo = _basicService.MaterielInfoService.Repository.QueryFirst(x => x.MaterielCode == cabinOrderDetail.Goods_no);
@@ -143,28 +144,9 @@
                 if (cabinOrderDetail.Order_Inqty == cabinOrderDetail.Order_qty)
                 {
                     cabinOrderDetail.OrderDetailStatus = "宸插畬鎴�";
-                    //_cabinOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetail, OperateTypeEnum.鑷姩瀹屾垚);
-
-                    //Dt_CabinOrderDetail_Hty hty = new Dt_CabinOrderDetail_Hty
-                    //{
-                    //    Id = cabinOrderDetail.OrderId,
-                    //    Reservoirarea = cabinOrderDetail.Reservoirarea,
-                    //    Goods_no = cabinOrderDetail.Goods_no,
-                    //    Order_qty = cabinOrderDetail.Order_qty,
-                    //    Order_Inqty = cabinOrderDetail.Order_Inqty,
-                    //    Batch_num = cabinOrderDetail.Batch_num,
-                    //    Exp_date = cabinOrderDetail.Exp_date,
-                    //    OrderDetailStatus = cabinOrderDetail.OrderDetailStatus,
-                    //    Status = cabinOrderDetail.Status,
-                    //    Creater = cabinOrderDetail.Creater,
-                    //    CreateDate = cabinOrderDetail.CreateDate,
-                    //    Modifier = App.User.UserName,
-                    //    ModifyDate = DateTime.Now
-                    //};
-                    //var i = BaseDal.Db.Insertable(hty).ExecuteCommand();
                 }
                 _cabinOrderDetailServices.Repository.UpdateData(cabinOrderDetail);
-                var cabinOrder1 = BaseDal.Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == cabinOrder.Order_no).Includes(x => x.Details).First();
+                var cabinOrder1 = BaseDal.Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == cabinOrder.Order_no && x.Warehouse_no == warehouseCode).Includes(x => x.Details).First();
                 if (!cabinOrder1.Details.Where(x => x.OrderDetailStatus != "宸插畬鎴�").Any()) cabinOrder.OdrderStatus = "宸插畬鎴�";
                 Repository.UpdateData(cabinOrder);
                 #endregion
@@ -174,6 +156,8 @@
                 if (location == null) return WebResponseContent.Instance.Error($"璇风淮鎶よ揣浣嶇紪鍙枫�恵LocationCode}銆戠殑璐т綅淇℃伅");
                 if (location.EnableStatus == EnableStatusEnum.Disable.ObjToInt())
                     return WebResponseContent.Instance.Error($"璐т綅缂栧彿銆恵LocationCode}銆戝凡绂佺敤锛岃鎭㈠姝e父鍐嶄娇鐢�");
+                if (location.WarehouseCode != cabinOrderDetail.Reservoirarea)
+                    return WebResponseContent.Instance.Error($"璐т綅缂栧彿銆恵LocationCode}銆戞墍灞炲簱鎴夸笌褰撳墠鍏ュ簱鍗曟墍灞炲簱鎴夸笉鍖归厤");
                 if (location.LocationStatus == LocationStatusEnum.Free.ObjToInt())
                 {
                     location.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
@@ -187,6 +171,7 @@
                 {
                     inventoryInfo.StockQuantity += Inqty;
                     inventoryInfo.AvailableQuantity += Inqty;
+                    inventoryInfo.InDate = DateTime.Now;
                     _inventoryInfoService.UpdateData(inventoryInfo);
                 }
                 else
@@ -586,7 +571,7 @@
                 //鏌ュ嚭鍖呭惈鍏ㄩ儴鐨勫叆搴撳崟锛屽寘鍚叏閮ㄦ槑缁�+涓�涓槑缁嗗搴斾竴涓晢鍝�
                 var orders = BaseDal.Db.CopyNew()
                 .Queryable<Dt_CabinOrder>()
-                .Where(o => o.OdrderStatus == "鏂板缓")
+                .Where(o => o.OdrderStatus == "鏂板缓" && o.Warehouse_no == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"))
                 .Includes(o => o.Details, d => d.MedicineGoods)
                 .ToList();
                 // 3. 鍐嶈繃婊ゆ帀涓嶇鍚堟潯浠剁殑鏄庣粏锛堝彧淇濈暀 Status=0锛�
@@ -698,7 +683,7 @@
             try
             {
                 #region 鏌ユ壘鎵�鏈夊凡瀹屾垚鍏ュ簱鍗�
-                var inorders = BaseDal.QueryData(x => x.OdrderStatus == "宸插畬鎴�").Select(x => x.Order_no).ToList();
+                var inorders = BaseDal.QueryData(x => x.OdrderStatus == "宸插畬鎴�").Select(x => x.Order_no).Distinct().ToList();
                 foreach (var inorder in inorders)
                 {
                     //var Orders = BaseDal.QueryData(x => x.Order_no == inorder);

--
Gitblit v1.9.3