From c7f255af77f13a52e6f01c8ec81482dc9ae07f68 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期五, 24 十月 2025 22:06:00 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhiHuiQiCe/FangCangZhiNeng
---
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs | 147 +++++++++++++++++++++++++++++++-----------------
1 files changed, 95 insertions(+), 52 deletions(-)
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
index b13f9be..54f6325 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
@@ -5,6 +5,7 @@
using System.Threading.Tasks;
using WIDESEA_Common.OrderEnum;
using WIDESEA_Common.TaskEnum;
+using WIDESEA_Common.WareHouseEnum;
using WIDESEA_Core;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
@@ -60,30 +61,30 @@
deliveryOrder.Details.Add(deliveryOrderDetail);
deliveryOrders.Add(deliveryOrder);
#region 鍒涘缓鐩樼偣浠诲姟
- if (items.Key != "001")// 闈炵珛搴撳尯鍩熼渶瑕佸垱寤虹洏鐐逛换鍔�
+ //if (items.Key != "001")// 闈炵珛搴撳尯鍩熼渶瑕佸垱寤虹洏鐐逛换鍔�
+ //{
+ foreach (var inventory in items)
{
- foreach (var inventory in items)
+ Dt_SupplyTask supplyTask = new Dt_SupplyTask()
{
- Dt_SupplyTask supplyTask = new Dt_SupplyTask()
- {
- WarehouseCode = inventory.WarehouseCode,
- TaskStatus = SupplyStatusEnum.NewCheck.ObjToInt(),
- BatchNo = inventory.BatchNo,
- MaterielName = inventory.MaterielName,
- MaterielCode = inventory.MaterielCode,
- MaterielSpec = inventory.MaterielSpec,
- TaskType = TaskTypeEnum.OutInventory.ObjToInt(),
- CreateDate = DateTime.Now,
- Creater = App.User.UserName,
- LocationCode = inventory.LocationCode,
- OrderNo = deliveryOrder.Out_no,
- StockQuantity = inventory.StockQuantity,
- SupplyQuantity = 0,
- Remark = "鐩樼偣"
- };
- supplyTasks.Add(supplyTask);
- }
+ WarehouseCode = inventory.WarehouseCode,
+ TaskStatus = SupplyStatusEnum.NewCheck.ObjToInt(),
+ BatchNo = inventory.BatchNo,
+ MaterielName = inventory.MaterielName,
+ MaterielCode = inventory.MaterielCode,
+ MaterielSpec = inventory.MaterielSpec,
+ TaskType = TaskTypeEnum.OutInventory.ObjToInt(),
+ CreateDate = DateTime.Now,
+ Creater = App.User.UserName,
+ LocationCode = inventory.LocationCode,
+ OrderNo = deliveryOrder.Out_no,
+ StockQuantity = inventory.StockQuantity,
+ SupplyQuantity = 0,
+ Remark = "鐩樼偣"
+ };
+ supplyTasks.Add(supplyTask);
}
+ //}
#endregion
}
}
@@ -104,9 +105,6 @@
return content;
}
#endregion
-
-
-
#region 鏌ヨ鐩樼偣鍗曚俊鎭�
/// <summary>
@@ -142,6 +140,7 @@
return content;
}
#endregion
+
#region 鏌ユ壘鐩樼偣/鍑哄簱浠诲姟
/// <summary>
/// 鏌ユ壘鐩樼偣/鍑哄簱浠诲姟
@@ -163,11 +162,11 @@
if (string.IsNullOrEmpty(LocationCode))
{
supplyTasks = Db.Queryable<Dt_SupplyTask>().Where(x => x.TaskStatus == TaskStatus && x.OrderNo == orderNo && x.WarehouseCode == warehouseCode).ToPageList(pageNo, 5);
- }
+ }
else
{
supplyTasks = Db.Queryable<Dt_SupplyTask>().Where(x => x.TaskStatus == TaskStatus && x.OrderNo == orderNo && x.WarehouseCode == warehouseCode && x.LocationCode.Contains(LocationCode)).ToPageList(pageNo, 5);
- }
+ }
content.OK(data: supplyTasks);
}
catch (Exception ex)
@@ -178,6 +177,7 @@
}
#endregion
+
#region 瀹屾垚鐩樼偣浠诲姟
public WebResponseContent CheckFinish(SaveModel saveModel)
{
@@ -191,6 +191,22 @@
if (supplyTask == null) throw new Exception("褰撳墠鐩樼偣浠诲姟宸插畬鎴�");
if (supplyTask.LocationCode != LocationCode) throw new Exception($"褰撳墠鐩樼偣璐т綅銆恵LocationCode}銆戜笌浠诲姟鍒嗛厤璐т綅涓嶅尮閰�");
supplyTask.SupplyQuantity = qty;
+ content = CheckTaskFinish(supplyTask, LocationCode);
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+ #endregion
+
+ #region 鐩樼偣浠诲姟瀹屾垚,骞冲簱鍜岀珛搴�
+ public WebResponseContent CheckTaskFinish(Dt_SupplyTask supplyTask, string LocationCode = null)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
supplyTask.TaskStatus = SupplyStatusEnum.CheckFinish.ObjToInt();
Dt_DeliveryOrder cabinOrder = BaseDal.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == supplyTask.OrderNo && x.Warehouse_no == supplyTask.WarehouseCode && x.Out_type == "3").Includes(x => x.Details).First();
if (cabinOrder == null) return WebResponseContent.Instance.Error($"鐩樼偣鍗曞凡瀹屾垚");
@@ -199,55 +215,82 @@
Dt_MaterielInfo materielInfo = _basicService.MaterielInfoService.Repository.QueryFirst(x => x.MaterielCode == cabinOrderDetail.Goods_no);
if (materielInfo == null) return WebResponseContent.Instance.Error($"璇风淮鎶ょ墿鏂欑紪鍙枫�恵cabinOrderDetail.Goods_no}銆戠殑鐗╂枡淇℃伅");
cabinOrderDetail.Order_Outqty += supplyTask.SupplyQuantity;
- if (cabinOrderDetail.Order_Outqty > cabinOrderDetail.Order_qty)
- return WebResponseContent.Instance.Error($"瀹炵洏鏁伴噺涓嶅彲瓒呭嚭璐﹂潰鏁伴噺");
+ //if (cabinOrderDetail.Order_Outqty > cabinOrderDetail.Order_qty)
+ // return WebResponseContent.Instance.Error($"瀹炵洏鏁伴噺涓嶅彲瓒呭嚭璐﹂潰鏁伴噺");
#region 澶勭悊鍑哄簱鍗曪紝璐т綅锛屽簱瀛橈紝搴撳瓨鎵规淇℃伅
_unitOfWorkManage.BeginTran();
- #region 鍑哄簱鍗�
+ #region 淇敼鐩樼偣鍗�
cabinOrder.OutStatus = "寮�濮�";
cabinOrderDetail.OotDetailStatus = "寮�濮�";
- if (cabinOrderDetail.Order_Outqty == cabinOrderDetail.Order_qty)
- {
- cabinOrderDetail.OotDetailStatus = "宸插畬鎴�";
- _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetail, OperateTypeEnum.鑷姩瀹屾垚);
- }
- else
- {
- _deliveryOrderDetailServices.Repository.UpdateData(cabinOrderDetail);
- }
- var cabinOrder1 = BaseDal.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == cabinOrder.Out_no && x.Out_type == "3").Includes(x => x.Details).First();
- if (cabinOrder1.Details == null || cabinOrder1.Details.Count < 1) cabinOrder.OutStatus = "宸插畬鎴�";
- if (cabinOrder.OutStatus == "宸插畬鎴�")
- Repository.DeleteAndMoveIntoHty(cabinOrder, OperateTypeEnum.鑷姩瀹屾垚);
- else
- Repository.UpdateData(cabinOrder);
+ Repository.UpdateData(cabinOrder);
+ _deliveryOrderDetailServices.Repository.UpdateData(cabinOrderDetail);
#endregion
#region 搴撳瓨
- Dt_InventoryInfo inventoryInfo = _inventoryInfoService.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.LocationCode == LocationCode);
- if (inventoryInfo == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌揣浣嶃�恵LocationCode}銆戠殑搴撳瓨淇℃伅");
- inventoryInfo.StockQuantity = supplyTask.SupplyQuantity;
+ Dt_InventoryInfo inventoryInfo = new Dt_InventoryInfo();
+ if (supplyTask.WarehouseCode != WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"))
+ {
+ inventoryInfo = _inventoryInfoService.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.WarehouseCode == supplyTask.WarehouseCode && x.LocationCode == supplyTask.LocationCode);
+ if (inventoryInfo == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌揣浣嶃�恵LocationCode}銆戠殑搴撳瓨淇℃伅");
+ }
+ else
+ {
+ inventoryInfo = _inventoryInfoService.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.WarehouseCode == supplyTask.WarehouseCode);
+ }
+ inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity;
_inventoryInfoService.UpdateData(inventoryInfo);
#endregion
#region 浠诲姟璁板綍
- _supplyTaskService.UpdateData(supplyTask);
+ //_supplyTaskService.UpdateData(supplyTask);
+ _supplyTaskService.Repository.DeleteAndMoveIntoHty(supplyTask, OperateTypeEnum.鑷姩瀹屾垚);
#endregion
#region 搴撳瓨鎵规
Dt_Inventory_Batch inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode == inventoryInfo.MaterielCode);
- if (inventory_Batch != null)
+ if (inventory_Batch == null) throw new Exception($"鏈壘鍒扮墿鏂欑紪鍙枫�恵inventoryInfo.MaterielCode}銆戠墿鏂欐壒娆°�恵inventoryInfo.BatchNo}銆戠殑搴撳瓨鎵规淇℃伅");
+ inventory_Batch.SupplyQuantity += supplyTask.SupplyQuantity;
+ _inventory_BatchServices.UpdateData(inventory_Batch);
+ #endregion
+
+ #region 鍒ゆ柇褰撳墠鐗╂枡鎵规鐨勭洏鐐逛换鍔℃槸鍚﹀叏閮ㄥ畬鎴�
+ List<Dt_SupplyTask> supplyTasks = _supplyTaskService.Repository.QueryData(x => x.MaterielCode == supplyTask.MaterielCode && x.BatchNo == supplyTask.BatchNo && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt() && x.WarehouseCode == supplyTask.WarehouseCode).ToList();
+ if (supplyTasks.Count < 1)
{
- inventory_Batch.SupplyQuantity += supplyTask.SupplyQuantity;
- _inventory_BatchServices.UpdateData(inventory_Batch);
+ #region 瀹屾垚鐩樼偣鍗�
+ cabinOrder.OutStatus = "宸插畬鎴�";
+ cabinOrder.Details.ForEach(x =>
+ {
+ x.OotDetailStatus = "宸插畬鎴�";
+ });
+ Repository.DeleteAndMoveIntoHty(cabinOrder, OperateTypeEnum.鑷姩瀹屾垚);
+ _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrder.Details, OperateTypeEnum.鑷姩瀹屾垚);
+ #endregion
+ }
+ supplyTasks = _supplyTaskService.Repository.QueryData(x => x.MaterielCode == supplyTask.MaterielCode && x.BatchNo == supplyTask.BatchNo && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt()).ToList();
+ if (supplyTasks.Count < 1)
+ {
+ #region 妫�鏌ユ槸鍚︽湁鐩樼偣宸紓锛屾棤宸紓鐩存帴澶勭悊鏁版嵁
+ if (inventory_Batch.SupplyQuantity == inventory_Batch.StockQuantity)
+ {
+ var inventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.BatchNo == inventory_Batch.BatchNo && x.MaterielCode == inventory_Batch.MaterielCode);
+ foreach (var item in inventoryInfos)
+ {
+ item.StockQuantity = item.SupplyQuantity;
+ item.SupplyQuantity = 0;
+ }
+ _inventoryInfoService.UpdateData(inventoryInfos);
+ inventory_Batch.SupplyQuantity = 0;
+ _inventory_BatchServices.UpdateData(inventory_Batch);
+ }
+ #endregion
}
#endregion
_unitOfWorkManage.CommitTran();
#endregion
-
content.OK();
}
catch (Exception ex)
--
Gitblit v1.9.3