From 89e2243271a81bd6a11612b95d986f0972b6a08e Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 24 十月 2025 20:04:50 +0800
Subject: [PATCH] 添加出入库退货单
---
新建文件夹/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs | 2
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs | 51 ++++++++--
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs | 1
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs | 147 +++++++++++++++++++----------
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs | 27 +++++
新建文件夹/WIDESEA_WMSServer/WIDESEA_DTO/SquareCabin/TowcsDto.cs | 4
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs | 55 +++++-----
新建文件夹/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs | 3
8 files changed, 197 insertions(+), 93 deletions(-)
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_DTO/SquareCabin/TowcsDto.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_DTO/SquareCabin/TowcsDto.cs"
index 7b744d1..de1a4e0 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_DTO/SquareCabin/TowcsDto.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_DTO/SquareCabin/TowcsDto.cs"
@@ -348,8 +348,8 @@
public string productSpecifications { get; set; }
public DateTime finishDate { get; set; } //瀹屾垚鏃堕棿
// 鏂板瀛楁锛堢洏鐐圭敤锛�
- public decimal? ea { get; set; }
- public int? isLossOrProfit { get; set; }
+ public decimal ea { get; set; }
+ public int isLossOrProfit { get; set; }
/// <summary>
/// 鐩樼偣鍗曚笓灞烇紙鐩樼偣鍗曞樊寮傛槑缁嗭級
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs"
index 04f81d8..026df50 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs"
@@ -6,6 +6,7 @@
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
+using WIDESEA_DTO.SquareCabin;
using WIDESEA_Model.Models;
namespace WIDESEA_ISquareCabinServices
@@ -40,5 +41,6 @@
WebResponseContent GetCabinOrders(SaveModel saveModel);
WebResponseContent GetCabinOrderDetail(int pageNo, string orderNo);
WebResponseContent FeedbackIn(SaveModel saveModel);
+ WebResponseContent CreateInboundOrder(OrderDto.UpstreamOrderInfo order);
}
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs"
index 07bf254..db2daf6 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs"
@@ -5,6 +5,7 @@
using System.Threading.Tasks;
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
+using WIDESEA_DTO.SquareCabin;
using WIDESEA_Model.Models;
namespace WIDESEA_ISquareCabinServices
@@ -83,5 +84,7 @@
WebResponseContent CheckFinish(SaveModel saveModel);
WebResponseContent GetCheckOutTasks(SaveModel saveModel);
WebResponseContent OutTaskFinish(Dt_SupplyTask supplyTask);
+ WebResponseContent CheckTaskFinish(Dt_SupplyTask supplyTask, string LocationCode = null);
+ WebResponseContent CreateOutboundOrder(OrderDto.UpstramOutOrderInfo upstramOutOrderInfo);
}
}
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 0c0e69f..101709c 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"
@@ -1,6 +1,7 @@
锘縰sing HslCommunication;
using MailKit.Search;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Data.SqlClient;
using Newtonsoft.Json;
using SqlSugar;
using System;
@@ -40,11 +41,12 @@
private readonly IInventory_BatchServices _inventory_BatchServices;
private readonly IInventoryInfoService _inventoryInfoService;
private readonly ICabinOrderDetailServices _cabinOrderDetailServices;
+ private readonly IDeliveryOrderServices _eliveryOrderServices;
private readonly ISupplyTaskService _supplyTaskService;
private readonly ISupplyTaskHtyService _supplyTaskHtyService;
public IRepository<Dt_CabinOrder> Repository => BaseDal;
- public CabinOrderServices(IRepository<Dt_CabinOrder> BaseDal, IBasicService basicService, IMedicineGoodsServices medicineGoodsServices, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, ICabinOrderDetailServices cabinOrderDetailServices, ICabinOrderHtyServices cabinOrderHtyServices, ICabinOrderDetailHtyServices cabinOrderDetailHtyServices, ISupplyTaskService supplyTaskService, ISupplyTaskHtyService supplyTaskHtyService) : base(BaseDal)
+ public CabinOrderServices(IRepository<Dt_CabinOrder> BaseDal, IBasicService basicService, IMedicineGoodsServices medicineGoodsServices, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, ICabinOrderDetailServices cabinOrderDetailServices, ICabinOrderHtyServices cabinOrderHtyServices, ICabinOrderDetailHtyServices cabinOrderDetailHtyServices, ISupplyTaskService supplyTaskService, ISupplyTaskHtyService supplyTaskHtyService, IDeliveryOrderServices eliveryOrderServices) : base(BaseDal)
{
_basicService = basicService;
_medicineGoodsServices = medicineGoodsServices;
@@ -54,6 +56,7 @@
_cabinOrderDetailServices = cabinOrderDetailServices;
_supplyTaskService = supplyTaskService;
_supplyTaskHtyService = supplyTaskHtyService;
+ _eliveryOrderServices = eliveryOrderServices;
}
@@ -359,7 +362,27 @@
else
{
//鍒涘缓鍑哄簱鍗�
-
+ #region 杞崲涓哄嚭搴撳崟
+ UpstramOutOrderInfo upstramOutOrderInfo = new UpstramOutOrderInfo()
+ {
+ order_no = order.order_no,
+ order_type = order.order_type,
+ warehouse_no = order.warehouse_no,
+ details=new List<UpstreamOutOrderDetail>()
+ };
+ foreach (var item in order.details)
+ {
+ UpstreamOutOrderDetail detail = new UpstreamOutOrderDetail()
+ {
+ batch_num = item.batch_num,
+ goods_no = item.goods_no,
+ order_qty = item.order_qty,
+ exp_date = item.exp_date,
+ };
+ upstramOutOrderInfo.details.Add(detail);
+ }
+ _eliveryOrderServices.CreateOutboundOrder(upstramOutOrderInfo);
+ #endregion
}
};
BaseDal.Db.InsertNav(_CabinOrders).Include(x => x.Details).ExecuteCommand();
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 41662d0..1a23626 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"
@@ -117,7 +117,31 @@
{
// 鍒涘缓鍑哄簱閫�璐у崟 - 杩欓噷闇�瑕佹牴鎹笟鍔¢�昏緫瀹炵幇
// 鏆傛椂璺宠繃鎴栧疄鐜伴��璐ч�昏緫
- continue;
+ //continue;
+ #region 杞崲鎴愬叆搴撳崟
+ UpstreamOrderInfo order = new UpstreamOrderInfo()
+ {
+ order_no = outorder.order_no,
+ order_type = outorder.order_type,
+ warehouse_no = outorder.warehouse_no,
+ details = new List<UpstreamOrderDetail>()
+ };
+ foreach (var item in outorder.details)
+ {
+ UpstreamOrderDetail detail = new UpstreamOrderDetail()
+ {
+ batch_num = item.batch_num,
+ goods_no = item.goods_no,
+ order_qty = item.order_qty,
+ exp_date = item.exp_date,
+ };
+ order.details.Add(detail);
+ }
+ responseContent = _cabinOrderServices.CreateInboundOrder(order);
+ List<Dt_CabinOrder>? dt_CabinOrders = responseContent.Data as List<Dt_CabinOrder>;
+ if (dt_CabinOrders != null && dt_CabinOrders.Count > 0)
+ BaseDal.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
+ #endregion
}
else if (outorder.order_type == "1") // 姝e父鍑哄簱鍗�
{
@@ -126,19 +150,19 @@
}
// 鎵归噺鎻掑叆鍑哄簱鍗曞拰鏄庣粏
- if (_DeliveryOrders.Any())
- {
- BaseDal.Db.InsertNav(_DeliveryOrders).Include(x => x.Details).ExecuteCommand();
- }
+ //if (_DeliveryOrders.Any())
+ //{
+ // BaseDal.Db.InsertNav(_DeliveryOrders).Include(x => x.Details).ExecuteCommand();
+ //}
//涓嬪彂鍑哄簱鍗曚换鍔$粰wcs
Db.Ado.CommitTran();
- var tex = CreateSupplyTask(order_no);
- if (!tex)
- {
- return responseContent.Error("鍒涘缓渚涘簲浠诲姟澶辫触");
- }
+ //var tex = CreateSupplyTask(order_no);
+ //if (!tex)
+ //{
+ // return responseContent.Error("鍒涘缓渚涘簲浠诲姟澶辫触");
+ //}
return responseContent.OK($"鍚屾鍑哄簱鍗曟垚鍔燂紝鍏眥_DeliveryOrders.Count}鏉�");
}
catch (Exception ex)
@@ -1045,7 +1069,12 @@
}
#endregion
if (supplyTask.WarehouseCode == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"))
- CreateAllocatInOut(materielInfo);//鍒涘缓璋冩嫧浠诲姟
+ {
+ materielInfo.Business_qty -= supplyTask.StockQuantity;
+ _basicService.MaterielInfoService.Repository.UpdateData(materielInfo);
+ if (materielInfo.Business_qty < materielInfo.MinQty)
+ CreateAllocatInOut(materielInfo);//鍒涘缓璋冩嫧浠诲姟
+ }
_unitOfWorkManage.CommitTran();
#endregion
content.OK();
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
index a4d154b..c61496f 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
@@ -237,37 +237,40 @@
#endregion
//UpdateInboundOrderDetailStatus(request.orderNo, detail.batchNo, detail.productCode);
- break;
}
- case "2":
- #region 鎵惧嚭搴撲换鍔�
- Dt_SupplyTask supplyTask = Db.Queryable<Dt_SupplyTask>().Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo && x.OrderNo == request.orderNo && x.WarehouseCode == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000") && x.TaskStatus == SupplyStatusEnum.NewOut.ObjToInt()).First();
- if (supplyTask == null) throw new Exception($"鏈壘鍒拌鍗曞彿銆恵request.orderNo}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠殑鍑哄簱浠诲姟");
- #endregion
-
- #region 澶勭悊鍑哄簱鍗曘�佸簱瀛樹俊鎭�佸嚭搴撲换鍔°�佽皟鎷ㄤ换鍔�
- _deliveryOrderServices.OutTaskFinish(supplyTask);
- #endregion
break;
+ case "2":
+ {
+ #region 鎵惧嚭搴撲换鍔�
+ Dt_SupplyTask supplyTask = Db.Queryable<Dt_SupplyTask>().Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo && x.OrderNo == request.orderNo && x.WarehouseCode == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000") && x.TaskStatus == SupplyStatusEnum.NewOut.ObjToInt()).First();
+ if (supplyTask == null) throw new Exception($"鏈壘鍒拌鍗曞彿銆恵request.orderNo}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠殑鍑哄簱浠诲姟");
+ if (supplyTask.StockQuantity != orderQty) throw new Exception($"璁㈠崟鍙枫�恵request.orderNo}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠殑鍑哄簱鏁伴噺涓庡嚭搴撲换鍔℃暟閲忎笉鐩哥瓑");
+ #endregion
+ #region 澶勭悊鍑哄簱鍗曘�佸簱瀛樹俊鎭�佸嚭搴撲换鍔°�佽皟鎷ㄤ换鍔�
+ _deliveryOrderServices.OutTaskFinish(supplyTask);
+ #endregion
+ }
+ break;
case "3": // 鐩樼偣
- decimal diff = detail.ea ?? 0; // 宸紓鏁�
- int flag = detail.isLossOrProfit ?? 3; // 1=鐩樹簭, 2=鐩樼泩, 3=鐩樹腑
- if (flag == 1) // 鐩樹簭
{
- //搴撳瓨鏁�-宸紓鏁�=鐩樹簭
- //batch.SupplyQuantity += (batch.StockQuantity - diff);
- //batch.Remark = "鐩樼偣鍗曞洖浼� - 鐩樹簭";
- }
- else if (flag == 2) // 鐩樼泩
- {
- //搴撳瓨鏁�+宸紓鏁�=鐩樼泩
- //batch.SupplyQuantity += (batch.StockQuantity + diff);
- //batch.Remark = "鐩樼偣鍗曞洖浼� - 鐩樼泩";
- }
- else // 鐩樹腑
- {
- //batch.Remark = "鐩樼偣鍗曞洖浼� - 鐩樹腑";
+ #region 鎵剧洏鐐逛换鍔�
+ Dt_SupplyTask supplyTask = Db.Queryable<Dt_SupplyTask>().Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo && x.OrderNo == request.orderNo && x.WarehouseCode == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000") && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt()).First();
+ if (supplyTask == null) throw new Exception($"鏈壘鍒拌鍗曞彿銆恵request.orderNo}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠殑鐩樼偣浠诲姟");
+ #endregion
+ if (detail.isLossOrProfit == 1) // 鐩樹簭
+ {
+ supplyTask.SupplyQuantity = supplyTask.StockQuantity - detail.ea;
+ }
+ else if (detail.isLossOrProfit == 2) // 鐩樼泩
+ {
+ supplyTask.SupplyQuantity = supplyTask.StockQuantity + detail.ea;
+ }
+ else // 鐩樹腑
+ {
+ supplyTask.SupplyQuantity = supplyTask.StockQuantity;
+ }
+ _deliveryOrderServices.CheckTaskFinish(supplyTask);
}
break;
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs"
index 97a1ef4..662944a 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs"
@@ -132,6 +132,7 @@
#endregion
_unitOfWorkManage.BeginTran();
+ _basicService.MaterielInfoService.Repository.UpdateData(materielInfo);
_inventoryInfoService.Repository.UpdateData(dt_InventoryInfos);
_supplyTaskService.AddData(supplyTasks);
BaseDal.Db.InsertNav(deliveryOrder).Include(x => x.Details).ExecuteCommand();
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