From ab4498f9390202dc4a9dd602d55bf1eb9385d9ab Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期二, 28 四月 2026 16:25:31 +0800
Subject: [PATCH] 出入库流程
---
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 440 +++++++++++++++++++++++++++++++++++-------------------
1 files changed, 282 insertions(+), 158 deletions(-)
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index 9cc9396..3310331 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -19,6 +19,7 @@
using MailKit.Search;
using Microsoft.AspNetCore.SignalR;
using Newtonsoft.Json;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Database;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Org.BouncyCastle.Asn1.Tsp;
using SqlSugar;
@@ -90,7 +91,7 @@
private readonly IStockInfoDetailRepository _stockInfoDetailRepository;
public ITaskRepository Repository => BaseDal;
- public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IMaterielInfoService materielInfoService, IInboundOrderDetail_HtyService inboundOrderDetail_HtyService, IOutboundOrder_HtyService outboundOrder_HtyService, IOutboundOrderDetail_HtyService outboundOrderDetail_HtyService, IInboundOrder_HtyService inboundOrder_HtyService, IStockRepository stockRepository, IInboundOrderDetailService inboundOrderDetailService, IBasicService basicService, IOutboundService outboundService, IInboundService inboundService, IRecordService recordService, IStockService stockService, ITask_HtyService taskHtyService, ILocationInfoService locationInfoService, IOutboundOrderDetailRepository outboundOrderDetailRepository, IBasicRepository basicRepository, IStockInfoDetailRepository stockInfoDetailRepository) : base(BaseDal)
+ public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IMaterielInfoService materielInfoService, IInboundOrderDetail_HtyService inboundOrderDetail_HtyService, IOutboundOrder_HtyService outboundOrder_HtyService, IOutboundOrderDetail_HtyService outboundOrderDetail_HtyService, IInboundOrder_HtyService inboundOrder_HtyService, IStockRepository stockRepository, IInboundOrderDetailService inboundOrderDetailService, IBasicService basicService, IOutboundService outboundService, IInboundService inboundService, IRecordService recordService, IStockService stockService, ITask_HtyService taskHtyService, ILocationInfoService locationInfoService, IOutboundOrderDetailRepository outboundOrderDetailRepository, IBasicRepository basicRepository, IStockInfoDetailRepository stockInfoDetailRepository, IPalletTypeInfoRepository palletTypeInfoRepository) : base(BaseDal)
{
_mapper = mapper;
_stockRepository = stockRepository;
@@ -111,6 +112,7 @@
_outboundOrderDetailRepository = outboundOrderDetailRepository;
_basicRepository = basicRepository;
_stockInfoDetailRepository = stockInfoDetailRepository;
+ _palletTypeInfoRepository = palletTypeInfoRepository;
}
public string ReceiveWMSTaskin = WIDESEA_Core.Helper.AppSettings.Configuration["ReceiveWMSTaskin"];
@@ -443,18 +445,18 @@
Dt_InboundOrderDetail inboundOrderDetail = inboundOrder.Details
.FirstOrDefault(x => x.LinId == stockInfo.Details.FirstOrDefault()?.LinId);
- if (inboundOrder.OrderType == 0 && inboundOrder != null && stockInfo.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt())
- {
- //鍏ュ簱鏁伴噺鍥炰紶
- return ProcessNormalInbound(task, stockInfo, locationInfo, lastStatus, inboundOrder, inboundOrderDetail);
- }
- else
- {
- //璋冩嫧鍑哄叆搴撲换鍔℃暟閲忓洖浼�
- return ProcessAllocateInbound(task, stockInfo, locationInfo, lastStatus, inboundOrder, inboundOrderDetail);
- }
+ //if (inboundOrder != null && stockInfo.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt())
+ //{
+ //鍏ュ簱鏁伴噺鍥炰紶
+ return ProcessNormalInbound(task, stockInfo, locationInfo, lastStatus, inboundOrder, inboundOrderDetail);
+ //}
+ //else
+ //{
+ // //璋冩嫧鍑哄叆搴撲换鍔℃暟閲忓洖浼�
+ // return ProcessAllocateInbound(task, stockInfo, locationInfo, lastStatus, inboundOrder, inboundOrderDetail);
+ //}
}
-
+ //鍏朵粬鍏ュ簱
private WebResponseContent ProcessNormalInbound(Dt_Task task, Dt_StockInfo stockInfo, Dt_LocationInfo locationInfo,
int lastStatus, Dt_InboundOrder inboundOrder, Dt_InboundOrderDetail inboundOrderDetail)
{
@@ -484,10 +486,14 @@
UpdateInboundOrder(inboundOrder, inboundOrderDetail);
// 鍗曟嵁鏁伴噺鍏ㄩ儴涓婃灦瀹屾垚锛屽鐞哤MS鍥炰紶
- if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt())
+ if (inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && inboundOrder.OrderType == 0)
{
var stockInfoDetail = stockInfo.Details.FirstOrDefault();
SendInboundInfoToWMS(task, inboundOrder, stockInfo);
+ }
+ else if (inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && inboundOrder.OrderType == 2)
+ {
+ SendAllocateInfoToWMS(task, inboundOrder, stockInfo);
}
_unitOfWorkManage.CommitTran();
@@ -499,41 +505,51 @@
throw;
}
}
+ ////璋冩嫧鍏ュ簱
+ //private WebResponseContent ProcessAllocateInbound(Dt_Task task, Dt_StockInfo stockInfo, Dt_LocationInfo locationInfo,
+ // int lastStatus, Dt_InboundOrder inboundOrder, Dt_InboundOrderDetail inboundOrderDetail)
+ //{
+ // // 鏇存柊鍏ュ簱鍗曟槑缁嗙姸鎬�
+ // UpdateInboundOrderDetails(stockInfo, inboundOrder, ref inboundOrderDetail);
- private WebResponseContent ProcessAllocateInbound(Dt_Task task, Dt_StockInfo stockInfo, Dt_LocationInfo locationInfo,
- int lastStatus, Dt_InboundOrder inboundOrder, Dt_InboundOrderDetail inboundOrderDetail)
- {
- // 濡傛灉鏄渶鍚庝竴鏉℃槑缁�
- if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt())
- {
- try
- {
- _unitOfWorkManage.BeginTran();
+ // // 鏇存柊搴撳瓨鏄庣粏鐘舵��
+ // stockInfo.Details.ForEach(x => x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt());
- // 澶勭悊璋冩嫧鍏ュ簱鍗�
- //ProcessAllocateInboundOrder(inboundOrder, inboundOrderDetail);
+ // try
+ // {
+ // _unitOfWorkManage.BeginTran();
- // 鑾峰彇鐩稿叧搴撳瓨淇℃伅
- var relatedStockInfo = _stockService.StockInfoService.Repository
- .QueryData(x => x.BatchNo == inboundOrderDetail.BatchNo);
+ // // 鏇存柊浠诲姟鐘舵��
+ // UpdateTaskStatus(task);
- // 鍙戦�佽皟鎷ㄤ俊鎭埌WMS
- SendAllocateInfoToWMS(task, inboundOrder, relatedStockInfo);
+ // // 鏇存柊璐т綅鐘舵��
+ // UpdateLocationStatus(locationInfo, lastStatus);
- _unitOfWorkManage.CommitTran();
- }
- catch
- {
- _unitOfWorkManage.RollbackTran();
- throw;
- }
- }
+ // // 鏇存柊搴撳瓨淇℃伅
+ // UpdateStockInfo(stockInfo);
- // 娣诲姞鍘嗗彶璁板綍
- AddInboundOrderDetailHistory(inboundOrderDetail);
+ // // 娣诲姞璁板綍
+ // AddRecords(task, stockInfo, locationInfo, lastStatus);
- return WebResponseContent.Instance.OK();
- }
+ // // 鏇存柊鍏ュ簱鍗�
+ // UpdateInboundOrder(inboundOrder, inboundOrderDetail);
+
+ // // 鍗曟嵁鏁伴噺鍏ㄩ儴涓婃灦瀹屾垚锛屽鐞哤MS鍥炰紶
+ // if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt())
+ // {
+ // var stockInfoDetail = stockInfo.Details.FirstOrDefault();
+ // SendInboundInfoToWMS(task, inboundOrder, stockInfo);
+ // }
+
+ // _unitOfWorkManage.CommitTran();
+ // return WebResponseContent.Instance.OK();
+ // }
+ // catch
+ // {
+ // _unitOfWorkManage.RollbackTran();
+ // throw;
+ // }
+ //}
#region Helper Methods
@@ -557,7 +573,12 @@
else if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
{
inboundOrderDetail.OrderDetailStatus = InboundStatusEnum.鍏ュ簱涓�.ObjToInt();
+ inboundOrder.OrderStatus = InboundStatusEnum.鍏ュ簱涓�.ObjToInt();
}
+ }
+ if (inboundOrder.Details.Count == overCount)
+ {
+ inboundOrder.OrderStatus = InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt();
}
}
@@ -602,8 +623,17 @@
private void SendInboundInfoToWMS(Dt_Task task, Dt_InboundOrder inboundOrder, Dt_StockInfo stockInfo)
{
- List<Dt_StockInfoDetail> dt_StockInfo = _stockInfoDetailRepository.QueryData(x => x.BatchNo == stockInfo.BatchNo).ToList();
- if (dt_StockInfo.Count == 0) return;
+
+ List<Dt_StockInfo> StockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.WarehouseId == task.WarehouseId).Includes(x => x.Details).Where(x => x.Details.Any(v => v.OrderNo == inboundOrder.OrderNo)).ToList();
+ //var dt_StockInfo = _stockRepository.StockInfoRepository.QueryData(x => x.Id == stockInfo.Id).ToList();
+ //List<Dt_StockInfo> StockInfos = new List<Dt_StockInfo>();
+ //foreach (var item in dt_StockInfo)
+ //{
+ // Dt_StockInfo StockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.Id == item.Id).Includes(x => x.Details).First();
+ // StockInfos.Add(StockInfo);
+ //}
+
+ if (StockInfos.Count == 0) throw new Exception("鏈壘鍒板簱瀛樹俊鎭�");
var houseInboundPassBack = new HouseInboundPassBack
{
ApiType = "AsnController",
@@ -616,21 +646,21 @@
{
new data.data1
{
- AsnNo = task.OrderNo,
- InWarehouse = task.Roadway,
+ AsnNo = inboundOrder.OrderNo,
+ //InWarehouse = task.Roadway,
TransactionCode = inboundOrder.TransactionCode,
InoutType = inboundOrder.OrderType,
OrderType = inboundOrder.InoutType,
// 閬嶅巻鎵�鏈夊簱瀛樻槑缁嗭紝娣诲姞鍒� DetailList
- DetailList = dt_StockInfo.Select(d => new data.data1.Inbound
+ DetailList = StockInfos.Select(d => new data.data1.Inbound
{
- LinId = d.LinId,
- MaterielCode = d.MaterielCode,
- OrderQuantity = d.StockQuantity,
+ LinId = d.Details.FirstOrDefault()?.LinId?? "",
+ MaterielCode = d.Details.FirstOrDefault()?.MaterielCode?? "",
+ OrderQuantity = d.Details.FirstOrDefault().StockQuantity,
BatchNo = d.BatchNo,
- LPNNo = task.PalletCode,
- FinishQty = d.StockQuantity,
- LocationName = task.TargetAddress
+ LPNNo = d.PalletCode,
+ FinishQty = d.Details.FirstOrDefault().StockQuantity,
+ LocationName = d.LocationCode
}).ToList()
}
}
@@ -689,40 +719,48 @@
_inboundService.InboundOrderDetailService.DeleteData(inboundOrderDetail);
}
- private void SendAllocateInfoToWMS(Dt_Task task, Dt_InboundOrder inboundOrder, List<Dt_StockInfo> stockInfos)
+ private void SendAllocateInfoToWMS(Dt_Task task, Dt_InboundOrder inboundOrder, Dt_StockInfo stockInfos)
{
- var detail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockInfos.FirstOrDefault().Id);
+ List<Dt_StockInfo> StockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.WarehouseId == task.WarehouseId).Includes(x => x.Details).Where(x => x.Details.Any(v => v.OrderNo == inboundOrder.OrderNo)).ToList();
+ //var dt_StockInfo = _stockRepository.StockInfoRepository.QueryData(x => x.Id == stockInfo.Id).ToList();
+ //List<Dt_StockInfo> StockInfos = new List<Dt_StockInfo>();
+ //foreach (var item in dt_StockInfo)
+ //{
+ // Dt_StockInfo StockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.Id == item.Id).Includes(x => x.Details).First();
+ // StockInfos.Add(StockInfo);
+ //}
+
+ if (StockInfos.Count == 0) throw new Exception("鏈壘鍒板簱瀛樹俊鎭�");
var inventoryAllocate = new InventoryAllocate
{
- ApiType = "AsnController",
- Method = "AsrsGroudingAsn",
+ ApiType = "InventoryAllocateController",
+ Method = "AsrsFinishedStockCount",
Parameters = new List<InventoryAllocate.Allocate>
{
new InventoryAllocate.Allocate
{
Value = new List<Allocate.data1>
{
- new Allocate.data1
+ new Allocate.data1
+ {
+ No = inboundOrder.OrderNo,
+ //InWarehouse = task.Roadway,
+ TransactionCode = inboundOrder.TransactionCode,
+ InoutType = inboundOrder.OrderType,
+ OrderType = inboundOrder.InoutType,
+ // 閬嶅巻鎵�鏈夊簱瀛樻槑缁嗭紝娣诲姞鍒� DetailList
+ DetailList = StockInfos.Select(d => new Allocate.data1.Inventory
{
- No = task.OrderNo,
- InWarehouse = task.Roadway,
- TransactionCode = inboundOrder.TransactionCode,
- InoutType = inboundOrder.OrderType,
- OrderType = inboundOrder.InoutType,
- DetailList = new List<Allocate.data1.Inventory>
- {
- new Allocate.data1.Inventory
- {
- LinId = detail.LinId,
- MaterielCode = detail.MaterielCode,
- OrderQuantity = detail.StockQuantity,
- BatchNo = detail.BatchNo,
- FinishQty = detail.StockQuantity,
- LocationName = task.TargetAddress
- }
- }
- }
+ LinId = d.Details.FirstOrDefault()?.LinId?? "",
+ MaterielCode = d.Details.FirstOrDefault()?.MaterielCode?? "",
+ OrderQuantity = d.Details.FirstOrDefault().StockQuantity,
+ BatchNo = d.BatchNo,
+ LPN_No = d.PalletCode,
+ FinishQty = d.Details.FirstOrDefault().StockQuantity,
+ LocationName = d.LocationCode
+ }).ToList()
+ }
}
}
}
@@ -799,8 +837,26 @@
out var locationInfo, out var outStockLockInfos);
if (!validationResult.Status) return validationResult;
+ int lastStatus = locationInfo.LocationStatus;
+ locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+
+
+
+ Dt_OutboundOrderDetail outboundOrderDetails = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrderDetail>()
+ .Where(x => x.BatchNo == stockInfo.Details.FirstOrDefault().BatchNo)
+ .First();
+ if (outboundOrderDetails == null) return WebResponseContent.Instance.Error("鏈壘鍒板嚭搴撳崟淇℃伅");
+
+ Dt_OutboundOrder inboundOrder = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrder>()
+ .Where(x => x.Id == outboundOrderDetails.OrderId)
+ .Includes(x => x.Details)
+ .First();
+
+ if (inboundOrder == null) return WebResponseContent.Instance.Error("鏈壘鍒板嚭搴撳崟淇℃伅");
// 2. 澶勭悊鍑哄簱璁㈠崟璇︽儏
- var outboundOrderDetails = ProcessOutboundOrderDetails(outStockLockInfos);
+ //var outboundOrderDetails = ProcessOutboundOrderDetails(outStockLockInfos);
+
+ UpdateOutboundOrderDetails(stockInfo, inboundOrder, ref outboundOrderDetails);
// 3. 鎵ц鏍稿績鍑哄簱閫昏緫
return ExecuteOutboundLogic(task, stockInfo, locationInfo, outboundOrderDetails);
@@ -839,33 +895,34 @@
return WebResponseContent.Instance.OK();
}
- private List<Dt_OutboundOrderDetail> ProcessOutboundOrderDetails(List<Dt_OutStockLockInfo> outStockLockInfos)
- {
- var outboundOrderDetails = new List<Dt_OutboundOrderDetail>();
+ //private List<Dt_OutboundOrderDetail> ProcessOutboundOrderDetails(List<Dt_OutStockLockInfo> outStockLockInfos)
+ //{
+ // var outboundOrderDetails = new List<Dt_OutboundOrderDetail>();
- foreach (var lockInfo in outStockLockInfos)
- {
- var detail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == lockInfo.OrderDetailId);
- if (detail != null)
- {
- detail.OverOutQuantity = detail.LockQuantity;
- if (detail.LockQuantity == detail.OrderQuantity)
- {
- detail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
- }
- outboundOrderDetails.Add(detail);
- }
- }
+ // foreach (var lockInfo in outStockLockInfos)
+ // {
+ // List<Dt_OutboundOrderDetail> detail = _outboundService.OutboundOrderDetailService.Repository.QueryData(x => x.Id == lockInfo.Id);
+ // if (detail != null)
+ // {
+ // detail.OverOutQuantity = lockInfo.OriginalQuantity;
+ // if (detail.LockQuantity == detail.OrderQuantity)
+ // {
+ // detail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
+ // }
+ // outboundOrderDetails.Add(detail);
+ // }
+ // }
- return outboundOrderDetails;
- }
+ // return outboundOrderDetails;
+ //}
private WebResponseContent ExecuteOutboundLogic(Dt_Task task, Dt_StockInfo stockInfo,
- Dt_LocationInfo locationInfo, List<Dt_OutboundOrderDetail> outboundOrderDetails)
+ Dt_LocationInfo locationInfo, Dt_OutboundOrderDetail outboundOrderDetails)
{
try
{
_unitOfWorkManage.BeginTran();
+
// 鏇存柊鍑哄簱璁㈠崟璇︽儏
_outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails);
@@ -884,22 +941,26 @@
// 鏍规嵁璁㈠崟绫诲瀷澶勭悊涓嶅悓閫昏緫
var outDetail = _outboundService.OutboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
- .Where(x => x.LPNNo == stockInfo.PalletCode).First();
+ .Where(x => x.BatchNo == outboundOrderDetails.BatchNo).First();
var outboundOrder = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrder>()
.Where(x => x.Id == outDetail.OrderId).Includes(x => x.Details).First();
- if (outboundOrder.OrderType == 1) // 鏅�氬嚭搴�
+
+ if (outboundOrder.OrderStatus == OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt())
{
- ProcessNormalOutbound(task, stockInfo, outboundOrder, outDetail);
+ var stockInfoDetail = stockInfo.Details.FirstOrDefault();
+ //ProcessNormalOutbound(task, stockInfo, outboundOrder, outDetail);
+ SendNormalOutboundToWMS(task, outboundOrder, stockInfoDetail, outDetail);
}
- else if (outboundOrder.OrderType == 240) // 鐩樼偣鍑哄簱
+
+ if (outboundOrder.OrderType == 240) // 鐩樼偣鍑哄簱
{
// 鐩樼偣鍑哄簱鐗规畩澶勭悊閫昏緫
}
- else // 璋冩嫧鍑哄簱
- {
- ProcessAllocateOutbound(task, stockInfo, outboundOrder, outDetail);
- }
+ //else // 璋冩嫧鍑哄簱
+ //{
+ // ProcessAllocateOutbound(task, stockInfo, outboundOrder, outDetail);
+ //}
_unitOfWorkManage.CommitTran();
return WebResponseContent.Instance.OK();
@@ -910,12 +971,45 @@
throw;
}
}
+ private void UpdateOutboundOrderDetails(Dt_StockInfo stockInfo, Dt_OutboundOrder inboundOrder,
+ ref Dt_OutboundOrderDetail inboundOrderDetail)
+ {
+ int overCount = inboundOrder.Details.Count(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt());
+ inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == stockInfo.Details.FirstOrDefault()?.BatchNo);
+
+ foreach (var item in stockInfo.Details)
+ {
+ if (inboundOrderDetail == null) continue;
+
+ inboundOrderDetail.OverOutQuantity += item.OutboundQuantity;
+
+ if (inboundOrderDetail.OverOutQuantity == inboundOrderDetail.OrderQuantity)
+ {
+ inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
+ overCount++;
+ }
+ else if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
+ {
+ inboundOrderDetail.OrderDetailStatus = OutboundStatusEnum.鍑哄簱涓�.ObjToInt();
+ inboundOrder.OrderStatus = OutboundStatusEnum.鍑哄簱涓�.ObjToInt();
+ }
+ }
+ if (inboundOrder.Details.Count == overCount)
+ {
+ inboundOrder.OrderStatus = OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
+ }
+ }
private void UpdateStockStatus(Dt_StockInfo stockInfo, Dt_LocationInfo locationInfo)
{
- stockInfo.LocationCode = locationInfo.LocationCode;
+ stockInfo.LocationCode = "";
stockInfo.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt();
- _stockService.StockInfoService.Repository.UpdateData(stockInfo);
+ stockInfo.Details.ForEach(x =>
+ {
+ x.Status = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt();
+ });
+ _stockRepository.StockInfoRepository.UpdateData(stockInfo);
+ _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details);
}
private void UpdateLocationStatus(Dt_LocationInfo locationInfo)
@@ -946,18 +1040,40 @@
var stockInfoDetail = _stockRepository.StockInfoDetailRepository.Db.Queryable<Dt_StockInfoDetail>()
.Where(x => x.StockId == stockInfo.Id).First();
- if (outboundOrder.Details.Count == 1)
- {
- MoveOutboundOrderToHistory(outboundOrder);
- }
+ //if (outboundOrder.OrderStatus == OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt())
+ //{
+ // var history = new Dt_OutboundOrder_Hty
+ // {
+ // OrderStatus = outboundOrder.OrderStatus,
+ // CreateType = outboundOrder.CreateType,
+ // UpperOrderNo = outboundOrder.UpperOrderNo,
+ // OrderNo = outboundOrder.OrderNo,
+ // OutWareHouse = outboundOrder.OutWareHouse,
+ // TransactionCode = outboundOrder.TransactionCode,
+ // InoutType = outboundOrder.InoutType,
+ // OrderType = outboundOrder.OrderType,
+ // Creater = "WMS",
+ // CreateDate = DateTime.Now,
+ // };
+ // _outboundOrder_HtyService.AddData(history);
+ // _outboundService.OutboundOrderService.DeleteData(outboundOrder);
+ //}
- MoveOutboundDetailToHistory(outDetail);
+ //MoveOutboundDetailToHistory(outDetail);
// 鍙戦�佸嚭搴撲俊鎭埌WMS
- SendNormalOutboundToWMS(task, outboundOrder, stockInfoDetail, outDetail);
+ if (outboundOrder.OrderStatus == OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt() && outboundOrder.OrderType == 0)
+ {
+ SendNormalOutboundToWMS(task, outboundOrder, stockInfoDetail, outDetail);
+ }
+ else if (outboundOrder.OrderStatus == OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt() && outboundOrder.OrderType == 2)
+ {
+ SendAllocateOutboundToWMS(task, outboundOrder, stockInfoDetail, outDetail);
+ }
+
// 鍒犻櫎搴撳瓨淇℃伅
- DeleteStockInfo(stockInfo);
+ //DeleteStockInfo(stockInfo);
}
private void ProcessAllocateOutbound(Dt_Task task, Dt_StockInfo stockInfo,
@@ -967,36 +1083,32 @@
if (outboundOrder.Details.Count == 1)
{
- MoveOutboundOrderToHistory(outboundOrder);
+ var history = new Dt_OutboundOrder_Hty
+ {
+ OrderStatus = outboundOrder.OrderStatus,
+ CreateType = outboundOrder.CreateType,
+ UpperOrderNo = outboundOrder.UpperOrderNo,
+ OrderNo = outboundOrder.OrderNo,
+ OutWareHouse = outboundOrder.OutWareHouse,
+ TransactionCode = outboundOrder.TransactionCode,
+ InoutType = outboundOrder.InoutType,
+ OrderType = outboundOrder.OrderType,
+ Creater = "WMS",
+ CreateDate = DateTime.Now,
+ };
+ _outboundOrder_HtyService.AddData(history);
+ _outboundService.OutboundOrderService.DeleteData(outboundOrder);
}
MoveOutboundDetailToHistory(outDetail);
// 鍙戦�佽皟鎷ㄥ嚭搴撲俊鎭埌WMS
- SendAllocateOutboundToWMS(task, outboundOrder, outDetail, relatedStockInfos);
+
// 鍒犻櫎搴撳瓨淇℃伅
DeleteStockInfo(stockInfo);
}
- private void MoveOutboundOrderToHistory(Dt_OutboundOrder outboundOrder)
- {
- var history = new Dt_OutboundOrder_Hty
- {
- OrderStatus = outboundOrder.OrderStatus,
- CreateType = outboundOrder.CreateType,
- UpperOrderNo = outboundOrder.UpperOrderNo,
- OrderNo = outboundOrder.OrderNo,
- OutWareHouse = outboundOrder.OutWareHouse,
- TransactionCode = outboundOrder.TransactionCode,
- InoutType = outboundOrder.InoutType,
- OrderType = outboundOrder.OrderType,
- Creater = "WMS",
- CreateDate = DateTime.Now,
- };
- _outboundOrder_HtyService.AddData(history);
- _outboundService.OutboundOrderService.DeleteData(outboundOrder);
- }
private void MoveOutboundDetailToHistory(Dt_OutboundOrderDetail outDetail)
{
@@ -1018,40 +1130,48 @@
private void SendNormalOutboundToWMS(Dt_Task task, Dt_OutboundOrder outboundOrder,
Dt_StockInfoDetail stockInfoDetail, Dt_OutboundOrderDetail outDetail)
{
+
+
+ //List<Dt_StockInfo> StockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.WarehouseId == task.WarehouseId).Includes(x => x.Details).Where(x => x.Details.Any(v => v.BatchNo == outDetail.BatchNo)).ToList();
+ List<Dt_OutStockLockInfo> outStockLockInfos = _outboundService.OutboundStockLockInfoService.Repository.QueryData(x => x.OrderNo == outboundOrder.OrderNo);
+
+
+ if (outStockLockInfos.Count == 0) throw new Exception("鏈壘鍒板簱瀛樹俊鎭�");
+
+ // 鏋勫缓鍥炰紶鏁版嵁锛屽皢鎵�鏈夊尮閰嶇殑搴撳瓨鏄庣粏鍔犲叆 DetailList
var passBack = new HouseoutboundPassBack
{
- ApiType = "ShippingOrderController",
- Method = "AsrsOutboundSO",
+ ApiType = "InventoryAllocateController",
+ Method = "AsrsFinishedStockCount",
Parameters = new List<HouseoutboundPassBack.datas>
+ {
+ new HouseoutboundPassBack.datas
{
- new HouseoutboundPassBack.datas
+ Value = new List<HouseoutboundPassBack.datas.data1>
{
- Value = new List<HouseoutboundPassBack.datas.data1>
+ new HouseoutboundPassBack.datas.data1
{
- new HouseoutboundPassBack.datas.data1
- {
- No = outboundOrder.OrderNo,
- OutWareHouse = task.Roadway,
- TransactionCode = outboundOrder.TransactionCode,
- InoutType = outboundOrder.OrderType,
- OrderType = outboundOrder.InoutType,
- DetailList = new List<HouseoutboundPassBack.datas.data1.Inbound>
+ No = outboundOrder.OrderNo,
+ OutWareHouse = task.Roadway,
+ TransactionCode = outboundOrder.TransactionCode,
+ InoutType = outboundOrder.OrderType,
+ OrderType = outboundOrder.InoutType,
+ DetailList = outStockLockInfos.Select(d => new HouseoutboundPassBack.datas.data1.Inbound
{
- new HouseoutboundPassBack.datas.data1.Inbound
- {
- LinId = outDetail.LinId,
- LPN_No = task.PalletCode,
- MaterielCode = stockInfoDetail.MaterielCode,
- OrderQuantity = stockInfoDetail.OutboundQuantity,
- BatchNo = stockInfoDetail.BatchNo,
- FinishQty = stockInfoDetail.OutboundQuantity,
- LocationName = task.SourceAddress
- }
- }
- }
+ LinId = d.LinId?? "",
+ LPN_No = d.PalletCode,
+ MaterielCode = d.MaterielCode?? "",
+ OrderQuantity = d.OrderQuantity,
+ BatchNo = d.BatchNo,
+ FinishQty = d.OrderQuantity,
+ LocationName = d.LocationCode
+ })
+ .ToList()
+
}
}
}
+ }
};
var authResult = AuthenticateWithWMS();
@@ -1068,8 +1188,12 @@
}
private void SendAllocateOutboundToWMS(Dt_Task task, Dt_OutboundOrder outboundOrder,
- Dt_OutboundOrderDetail outDetail, List<Dt_StockInfo> stockInfos)
+ Dt_StockInfoDetail stockInfoDetail, Dt_OutboundOrderDetail outDetail)
{
+ List<Dt_OutStockLockInfo> outStockLockInfos = _outboundService.OutboundStockLockInfoService.Repository.QueryData(x => x.OrderNo == outboundOrder.OrderNo);
+
+
+ if (outStockLockInfos.Count == 0) throw new Exception("鏈壘鍒板簱瀛樹俊鎭�");
var allocate = new InventoryAllocate
{
ApiType = "InventoryAllocateController",
@@ -1087,7 +1211,7 @@
TransactionCode = outboundOrder.TransactionCode,
InoutType = outboundOrder.OrderType,
OrderType = outboundOrder.InoutType,
- DetailList = stockInfos.Select(item =>
+ DetailList = outStockLockInfos.Select(item =>
{
var detail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == item.Id);
return new Allocate.data1.Inventory
--
Gitblit v1.9.3