From 4e81beaf39a525c1ecb86d50dd05438959af6e12 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 17 十月 2025 23:16:03 +0800
Subject: [PATCH] 优化PDA出库流程、盘点流程
---
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 159 insertions(+), 8 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 5bb01d2..e574369 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"
@@ -6,6 +6,7 @@
using WIDESEA_Common.OrderEnum;
using WIDESEA_Common.TaskEnum;
using WIDESEA_Core;
+using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_Model.Models;
using static WIDESEA_DTO.SquareCabin.OrderDto;
@@ -33,15 +34,16 @@
List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => item.MaterielCode == x.MaterielCode && x.BatchNo == item.BatchNo);
if (inventoryInfos.Count > 0)
{
- Dt_DeliveryOrder deliveryOrder = new Dt_DeliveryOrder()
- {
- Out_no = item.MaterielCode + "_" + item.BatchNo,
- Out_type = "3",
- OutStatus = "鏂板缓",
- Details = new List<Dt_DeliveryOrderDetail>()
- };
foreach (var items in inventoryInfos.GroupBy(x => x.WarehouseCode))
{
+ Dt_DeliveryOrder deliveryOrder = new Dt_DeliveryOrder()
+ {
+ Out_no = item.MaterielCode + "_" + item.BatchNo,
+ Out_type = "3",
+ OutStatus = "鏂板缓",
+ Warehouse_no = items.Key,
+ Details = new List<Dt_DeliveryOrderDetail>()
+ };
var Status = items.Key == "001" ? 0 : 2;//鍒ゆ柇鏄惁涓虹珛搴撳尯鍩�
Dt_DeliveryOrderDetail deliveryOrderDetail = new Dt_DeliveryOrderDetail()
{
@@ -56,6 +58,7 @@
Reservoirarea = items.Key
};
deliveryOrder.Details.Add(deliveryOrderDetail);
+ deliveryOrders.Add(deliveryOrder);
#region 鍒涘缓鐩樼偣浠诲姟
if (items.Key != "001")
{
@@ -83,7 +86,6 @@
}
#endregion
}
- deliveryOrders.Add(deliveryOrder);
}
}
_unitOfWorkManage.BeginTran();
@@ -102,5 +104,154 @@
return content;
}
#endregion
+ #region 鏌ヨ鐩樼偣鍗曚俊鎭�
+ /// <summary>
+ /// 鏌ヨ鐩樼偣鍗�
+ /// </summary>
+ /// <param name="saveModel"></param>
+ /// <returns></returns>
+ public WebResponseContent GetCheckOrders(SaveModel saveModel)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ int pageNo = saveModel.MainData["pageNo"].ObjToInt();
+ string warehouseCode = saveModel.MainData["warehouseId"].ToString();
+ string orderNo = saveModel.MainData["orderNo"].ToString();
+ List<Dt_DeliveryOrder> dt_ReceiveOrders = new List<Dt_DeliveryOrder>();
+ if (string.IsNullOrEmpty(orderNo))
+ {
+ dt_ReceiveOrders = Db.Queryable<Dt_DeliveryOrder>().Where(x => (x.OutStatus == "鏂板缓" || x.OutStatus == "寮�濮�") && x.Warehouse_no == warehouseCode && x.Out_type == "3").Includes(x => x.Details).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5);
+ }
+ else
+ {
+ dt_ReceiveOrders = Db.Queryable<Dt_DeliveryOrder>().Where(x => (x.Out_no.Contains(orderNo) || x.Client_no.Contains(orderNo)) && (x.OutStatus == "鏂板缓" || x.OutStatus == "寮�濮�") && x.Out_type == "3" && x.Warehouse_no == warehouseCode).OrderByDescending(x => x.CreateDate).Includes(x => x.Details).ToPageList(pageNo, 5);
+ }
+
+ content.OK(data: dt_ReceiveOrders);
+ }
+ catch (Exception)
+ {
+
+ throw;
+ }
+ return content;
+ }
+ #endregion
+ #region 鏌ユ壘鐩樼偣/鍑哄簱浠诲姟
+ /// <summary>
+ /// 鏌ユ壘鐩樼偣/鍑哄簱浠诲姟
+ /// </summary>
+ /// <param name="saveModel"></param>
+ /// <returns></returns>
+ public WebResponseContent GetCheckOutTasks(SaveModel saveModel)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ int pageNo = saveModel.MainData["pageNo"].ObjToInt();
+ string LocationCode = saveModel.MainData["locationCode"].ToString();
+ string warehouseCode = saveModel.MainData["warehouseId"].ToString();
+ string orderNo = saveModel.MainData["orderNo"].ToString();
+ bool isCheck = saveModel.MainData["isCheck"].ObjToBool();
+ var TaskStatus = isCheck ? SupplyStatusEnum.NewCheck.ObjToInt() : SupplyStatusEnum.NewOut.ObjToInt();
+ List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
+ 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)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+ #endregion
+ #region 瀹屾垚鐩樼偣浠诲姟
+ public WebResponseContent CheckFinish(SaveModel saveModel)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ var LocationCode = saveModel.MainData["locationCode"].ToString();
+ var TaskId = saveModel.MainData["taskId"].ObjToInt();
+ var qty = saveModel.MainData["qty"].ObjToInt();
+ Dt_SupplyTask supplyTask = _supplyTaskService.Repository.QueryFirst(x => x.TaskId == TaskId && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt());
+ if (supplyTask == null) throw new Exception("褰撳墠鐩樼偣浠诲姟宸插畬鎴�");
+ if (supplyTask.LocationCode != LocationCode) throw new Exception($"褰撳墠鐩樼偣璐т綅銆恵LocationCode}銆戜笌浠诲姟鍒嗛厤璐т綅涓嶅尮閰�");
+ supplyTask.SupplyQuantity = qty;
+ 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($"鐩樼偣鍗曞凡瀹屾垚");
+ Dt_DeliveryOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Batch_num == supplyTask.BatchNo && x.Reservoirarea == supplyTask.WarehouseCode && x.Goods_no == supplyTask.MaterielCode).First();
+ if (cabinOrderDetail == null) return WebResponseContent.Instance.Error($"鐩樼偣鍗曟槑缁嗗凡瀹屾垚");
+ 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($"瀹炵洏鏁伴噺涓嶅彲瓒呭嚭璐﹂潰鏁伴噺");
+
+ #region 澶勭悊鍑哄簱鍗曪紝璐т綅锛屽簱瀛橈紝搴撳瓨鎵规淇℃伅
+ _unitOfWorkManage.BeginTran();
+
+ #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);
+ #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;
+ _inventoryInfoService.UpdateData(inventoryInfo);
+ #endregion
+
+ #region 浠诲姟璁板綍
+ _supplyTaskService.UpdateData(supplyTask);
+ #endregion
+
+ #region 搴撳瓨鎵规
+ Dt_Inventory_Batch inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode == inventoryInfo.MaterielCode);
+ if (inventory_Batch != null)
+ {
+ inventory_Batch.SupplyQuantity += supplyTask.SupplyQuantity;
+ _inventory_BatchServices.UpdateData(inventory_Batch);
+ }
+ #endregion
+
+ _unitOfWorkManage.CommitTran();
+ #endregion
+
+ content.OK();
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+ #endregion
}
}
--
Gitblit v1.9.3