From 36226b8adcbfb46fe71fc9526134a54886b3312c Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 17 十月 2025 23:21:32 +0800
Subject: [PATCH] 1
---
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs | 147 ++++++++++++++++++++++---------------------------
1 files changed, 66 insertions(+), 81 deletions(-)
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 cf05342..2b13edc 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"
@@ -1,4 +1,5 @@
锘縰sing HslCommunication;
+using MailKit.Search;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -25,7 +26,7 @@
namespace WIDESEA_SquareCabinServices
{
- public class DeliveryOrderServices : ServiceBase<Dt_DeliveryOrder, IRepository<Dt_DeliveryOrder>>, IDeliveryOrderServices
+ public partial class DeliveryOrderServices : ServiceBase<Dt_DeliveryOrder, IRepository<Dt_DeliveryOrder>>, IDeliveryOrderServices
{
static string SearchDate = "";
private readonly IBasicService _basicService;
@@ -34,8 +35,9 @@
private readonly IInventoryInfoService _inventoryInfoService;
private readonly IDeliveryOrderDetailServices _deliveryOrderDetailServices;
private readonly ISupplyTaskService _supplyTaskService;
+ private readonly ICabinOrderServices _cabinOrderServices;
public IRepository<Dt_DeliveryOrder> Repository => BaseDal;
- public DeliveryOrderServices(IRepository<Dt_DeliveryOrder> BaseDal, IBasicService basicService, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, IDeliveryOrderDetailServices deliveryOrderDetailServices, ISupplyTaskService supplyTaskService) : base(BaseDal)
+ public DeliveryOrderServices(IRepository<Dt_DeliveryOrder> BaseDal, IBasicService basicService, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, IDeliveryOrderDetailServices deliveryOrderDetailServices, ISupplyTaskService supplyTaskService, ICabinOrderServices cabinOrderServices) : base(BaseDal)
{
_basicService = basicService;
_unitOfWorkManage = unitOfWorkManage;
@@ -43,6 +45,7 @@
_supplyTaskService = supplyTaskService;
_inventory_BatchServices = inventory_BatchServices;
_inventoryInfoService = inventoryInfoService;
+ _cabinOrderServices = cabinOrderServices;
}
/// <summary>
@@ -301,7 +304,7 @@
};
entityOrder.Details.Add(detail);
- inv.OutboundQuantity += (float)use;
+ inv.OutboundQuantity += use;
BaseDal.Db.Updateable(inv).ExecuteCommand();
remainingPartial -= use;
@@ -332,7 +335,7 @@
};
entityOrder.Details.Add(detail);
- inv.OutboundQuantity += (float)use;
+ inv.OutboundQuantity += use;
BaseDal.Db.Updateable(inv).ExecuteCommand();
remainingPartial -= use;
@@ -375,7 +378,7 @@
};
entityOrder.Details.Add(detail);
- inv.OutboundQuantity += (float)useQty;
+ inv.OutboundQuantity += useQty;
BaseDal.Db.Updateable(inv).ExecuteCommand();
remainingFullBoxes -= useBoxes;
@@ -410,7 +413,7 @@
};
entityOrder.Details.Add(detail);
- inv.OutboundQuantity += (float)useQty;
+ inv.OutboundQuantity += useQty;
BaseDal.Db.Updateable(inv).ExecuteCommand();
remainingFullBoxes -= useBoxes;
@@ -602,7 +605,7 @@
};
entityOrder.Details.Add(detail);
- inv.OutboundQuantity += (float)use;
+ inv.OutboundQuantity += use;
BaseDal.Db.Updateable(inv).ExecuteCommand();
remainingPartial -= use;
@@ -633,7 +636,7 @@
};
entityOrder.Details.Add(detail);
- inv.OutboundQuantity += (float)use;
+ inv.OutboundQuantity += use;
BaseDal.Db.Updateable(inv).ExecuteCommand();
remainingPartial -= use;
@@ -676,7 +679,7 @@
};
entityOrder.Details.Add(detail);
- inv.OutboundQuantity += (float)useQty;
+ inv.OutboundQuantity += useQty;
BaseDal.Db.Updateable(inv).ExecuteCommand();
remainingFullBoxes -= useBoxes;
@@ -711,7 +714,7 @@
};
entityOrder.Details.Add(detail);
- inv.OutboundQuantity += (float)useQty;
+ inv.OutboundQuantity += useQty;
BaseDal.Db.Updateable(inv).ExecuteCommand();
remainingFullBoxes -= useBoxes;
@@ -1072,7 +1075,7 @@
}
-
+
/// <summary>
/// 鎺ㄩ�佸紓甯镐俊鎭粰涓婃父绯荤粺 1.鍏ュ簱鍗曟帴鍙o紱2.鍏ュ簱鍗曟姤瀹屾垚鎺ュ彛锛�3.鍑哄簱鍗曟帴鍙o紱4.鍑哄簱鎶ュ畬鎴愭帴鍙o紱5.鑽搧鍩虹淇℃伅鍚屾鎺ュ彛锛�6.渚涘簲鍟嗕俊鎭帴鍙o紱7.瀹㈡埛淇℃伅鎺ュ彛锛�8.搴撳瓨鏌ヨ鎺ュ彛
@@ -1101,33 +1104,6 @@
}
}
- public WebResponseContent GetPdDeliveryOrders(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;
- }
public WebResponseContent GetDeliveryOrders(SaveModel saveModel)
{
@@ -1144,7 +1120,7 @@
}
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);
+ 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);
@@ -1156,7 +1132,13 @@
}
return content;
}
-
+ /// <summary>
+ /// 鏌ヨ鍑哄簱/鐩樼偣鍗曡鎯�
+ /// </summary>
+ /// <param name="pageNo"></param>
+ /// <param name="orderNo"></param>
+ /// <param name="isPick"></param>
+ /// <returns></returns>
public WebResponseContent GetDeliveryOrderDetail(int pageNo, string orderNo, bool isPick)
{
WebResponseContent content = new WebResponseContent();
@@ -1169,25 +1151,29 @@
content.OK(data: cabinOrderDetails);
return content;
}
- public WebResponseContent MatPicking(SaveModel saveModel)
+ public WebResponseContent OutFinish(SaveModel saveModel)
{
WebResponseContent content = new WebResponseContent();
try
{
- var LocationCode = saveModel.MainData["LocationCode"].ToString();
- var orderNo = saveModel.MainData["orderNo"].ToString();
- var batchNo = saveModel.MainData["batchNo"].ToString();
- var Inqty = saveModel.MainData["Inqty"].ObjToInt();
- var warehouseCode = saveModel.MainData["warehouseCode"].ToString();
- Dt_DeliveryOrder cabinOrder = BaseDal.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == orderNo && x.Warehouse_no == 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 == batchNo && x.Reservoirarea == warehouseCode).First();
- if (cabinOrderDetail == null) return WebResponseContent.Instance.Error($"鐩樼偣鍗曟槑缁嗗凡瀹屾垚");
+ var LocationCode = saveModel.MainData["locationCode"].ToString();
+ var TaskId = saveModel.MainData["taskId"].ObjToInt();
+ Dt_SupplyTask supplyTask = _supplyTaskService.Repository.QueryFirst(x => x.TaskId == TaskId && x.TaskStatus == SupplyStatusEnum.NewOut.ObjToInt());
+ if (supplyTask == null) throw new Exception("褰撳墠鍑哄簱浠诲姟宸插畬鎴�");
+ if (supplyTask.LocationCode != LocationCode) throw new Exception($"褰撳墠鍑哄簱璐т綅銆恵LocationCode}銆戜笌浠诲姟鍒嗛厤璐т綅涓嶅尮閰�");
+ supplyTask.TaskStatus = SupplyStatusEnum.OutFinish.ObjToInt();
+
+ Dt_DeliveryOrder cabinOrder = BaseDal.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == supplyTask.OrderNo && x.Warehouse_no == supplyTask.WarehouseCode).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 += Inqty;
+ cabinOrderDetail.Order_Outqty += supplyTask.StockQuantity;
if (cabinOrderDetail.Order_Outqty > cabinOrderDetail.Order_qty)
- return WebResponseContent.Instance.Error($"瀹炵洏鏁伴噺涓嶅彲瓒呭嚭璐﹂潰鏁伴噺");
+ return WebResponseContent.Instance.Error($"鍑哄簱鏁伴噺涓嶅彲瓒呭嚭鍗曟嵁鏁伴噺");
+
#region 澶勭悊鍑哄簱鍗曪紝璐т綅锛屽簱瀛橈紝搴撳瓨鎵规淇℃伅
_unitOfWorkManage.BeginTran();
@@ -1204,54 +1190,51 @@
{
_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();
+ 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);
#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.SupplyQuantity += Inqty;
- _inventoryInfoService.UpdateData(inventoryInfo);
+ inventoryInfo.StockQuantity -= supplyTask.StockQuantity;
+ if (inventoryInfo.StockQuantity <= 0)
+ _inventoryInfoService.DeleteData(inventoryInfo);
+ else
+ _inventoryInfoService.UpdateData(inventoryInfo);
#endregion
- #region 浠诲姟璁板綍
- Dt_SupplyTask supplyTask = new Dt_SupplyTask()
+ #region 璐т綅
+ var location = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode);
+ if (location == null) return WebResponseContent.Instance.Error($"璇风淮鎶よ揣浣嶇紪鍙枫�恵LocationCode}銆戠殑璐т綅淇℃伅");
+ if (location.EnableStatus == EnableStatusEnum.Disable.ObjToInt())
+ return WebResponseContent.Instance.Error($"璐т綅缂栧彿銆恵LocationCode}銆戝凡绂佺敤锛岃鎭㈠姝e父鍐嶄娇鐢�");
+ Dt_InventoryInfo inventoryInfo1 = _inventoryInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode);
+ if (inventoryInfo1 == null)
{
- WarehouseCode = cabinOrderDetail.Reservoirarea,
- BatchNo = inventoryInfo.BatchNo,
- MaterielName = inventoryInfo.MaterielName,
- MaterielCode = inventoryInfo.MaterielCode,
- MaterielSpec = inventoryInfo.MaterielSpec,
- TaskType = TaskTypeEnum.OutInventory.ObjToInt(),
- CreateDate = DateTime.Now,
- Creater = App.User.UserName,
- LocationCode = LocationCode,
- OrderNo = cabinOrder.Out_no,
- StockQuantity = inventoryInfo.StockQuantity,
- SupplyQuantity = Inqty,
- Remark = "鐩樼偣"
- };
- _supplyTaskService.AddData(supplyTask);
+ location.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ _basicService.LocationInfoService.UpdateData(location);
+ }
#endregion
+
+ _supplyTaskService.UpdateData(supplyTask);
#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 += Inqty;
- _inventory_BatchServices.UpdateData(inventory_Batch);
+ inventory_Batch.StockQuantity -= supplyTask.StockQuantity;
+ if (inventory_Batch.StockQuantity <= 0)
+ _inventory_BatchServices.DeleteData(inventory_Batch);
+ else
+ _inventory_BatchServices.UpdateData(inventory_Batch);
}
#endregion
_unitOfWorkManage.CommitTran();
#endregion
-
- content.OK(cabinOrderDetail.Order_Outqty.ToString());
+ content.OK();
}
catch (Exception ex)
{
@@ -1260,7 +1243,8 @@
}
return content;
}
- public WebResponseContent FeedbackOut(SaveModel saveModel)
+
+ public WebResponseContent MatPicking(SaveModel saveModel)
{
WebResponseContent content = new WebResponseContent();
try
@@ -1331,6 +1315,7 @@
MaterielName = inventoryInfo.MaterielName,
MaterielCode = inventoryInfo.MaterielCode,
MaterielSpec = inventoryInfo.MaterielSpec,
+ TaskStatus = SupplyStatusEnum.OutFinish.ObjToInt(),
TaskType = TaskTypeEnum.OutPick.ObjToInt(),
CreateDate = DateTime.Now,
Creater = App.User.UserName,
--
Gitblit v1.9.3