From e43adae114f0edc580a20e84605c34ee0671c59d Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期六, 04 一月 2025 09:36:40 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs | 168 +++++++++++++++++++++++++++++++++-----------------------
1 files changed, 99 insertions(+), 69 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs"
index 026f877..010d9b4 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs"
@@ -171,56 +171,114 @@
return WebResponseContent.Instance.Error(ex.Message);
}
}
- //涓婃姤鍑哄簱瀹屾垚 娴嬭瘯鏋�
- public WebResponseContent TestOutUpload(int id)
+ //涓婃姤鍑哄簱瀹屾垚
+ public WebResponseContent TestOutUpload(int id,List<Dt_OutStockLockInfo>? outStockLockInfos)
{
try
{
Dt_OutboundOrder outboundOrder = Db.Queryable<Dt_OutboundOrder>().Where(x=>x.Id==id).Includes(x=>x.Details).First();
Dt_Warehouse warehouse = _basicService.WarehouseService.Repository.QueryFirst(x => x.WarehouseId == outboundOrder.WarehouseId);
+ ERPIssueModel issueModel = new ERPIssueModel();
+ List<Dt_StockInfo> stockInfos = new List<Dt_StockInfo>();
+ List<Dt_OutStockLockInfo> _OutStockLockInfos=new List<Dt_OutStockLockInfo>();
//娴嬭瘯鏋跺簱缁橢RP涓婃姤鍑哄簱瀹屾垚
- ERPPickItemModel eRPOutPick = new ERPPickItemModel()
+ if (outStockLockInfos.Count<=0 || outStockLockInfos==null)
{
- Lotno = "20241227001",
- Qty = "1",
- Location = warehouse.WarehouseCode
- };
- ERPPickModel pickModel = new ERPPickModel()
- {
- Rowindex = outboundOrder.Details[0].RowNo,
- Material = outboundOrder.Details[0].MaterielCode,
- Qty = (outboundOrder.Details[0].OrderQuantity.ObjToInt()).ToString(),
- Dataitem=new List<ERPPickItemModel> { eRPOutPick }
- };
-
- ERPIssueItemModel issueItemModel = new ERPIssueItemModel()
- {
- Pickcode = outboundOrder.UpperOrderNo,
- PickList = new List<ERPPickModel>() { pickModel }
- };
- ERPIssueModel issueModel = new ERPIssueModel()
- {
- UniqueTag = id.ToString(),
- Code = "FL20241227001",//娴嬭瘯
- WarehouseCode = warehouse.WarehouseCode,
- Docremark = "",
- Deptno = outboundOrder.DepartmentCode,
- Deptname = outboundOrder.DepartmentName,
- Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
- Createuser = "TC20082",
- Issitem = new List<ERPIssueItemModel>() { issueItemModel },
- };
- string response = _invokeERPService.InvokeOutStandardsApi(issueModel);
- ErpRequestContent requestContent = response.DeserializeObject<ErpRequestContent>();
- if (requestContent.res == 1)
- {
+ stockInfos = TestOutStocksUpdate(warehouse).Data as List<Dt_StockInfo> ?? new List<Dt_StockInfo>();
+ List<ERPPickItemModel> eRPOutPick =new List<ERPPickItemModel>();
+ for (int i = 0; i < stockInfos.Count; i++)
+ {
+ ERPPickItemModel pickItemModel = new ERPPickItemModel()
+ {
+ Lotno= stockInfos[i].Details[0].BatchNo,
+ Qty= stockInfos[i].Details[0].StockQuantity.ObjToInt().ToString(),
+ Location= warehouse.WarehouseCode
+ };
+ eRPOutPick.Add(pickItemModel);
+ }
+
+ ERPPickModel pickModel = new ERPPickModel()
+ {
+ Rowindex = outboundOrder.Details[0].RowNo,
+ Material = outboundOrder.Details[0].MaterielCode,
+ Qty = (outboundOrder.Details[0].OrderQuantity.ObjToInt()).ToString(),
+ Dataitem = eRPOutPick
+ };
- return WebResponseContent.Instance.OK(requestContent.Data);
+ ERPIssueItemModel issueItemModel = new ERPIssueItemModel()
+ {
+ Pickcode = outboundOrder.UpperOrderNo,
+ PickList = new List<ERPPickModel>() { pickModel }
+ };
+ issueModel = new ERPIssueModel()
+ {
+ UniqueTag = id.ToString(),
+ Code = outboundOrder.OrderNo,//娴嬭瘯
+ WarehouseCode = warehouse.WarehouseCode,
+ Docremark = "",
+ Deptno = outboundOrder.DepartmentCode,
+ Deptname = outboundOrder.DepartmentName,
+ Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+ Createuser = outboundOrder.Creater,
+ Issitem = new List<ERPIssueItemModel>() { issueItemModel },
+ };
}
else
{
- return WebResponseContent.Instance.Error(requestContent.Data);
+ List<ERPPickModel> eRPPickModels= new List<ERPPickModel>();
+
+ //鑾峰彇鍑哄簱璇︽儏鍗�
+ foreach (var item in outStockLockInfos)
+ {
+ ERPPickItemModel pickItemModel = new ERPPickItemModel()
+ {
+ Lotno = item.BatchNo,
+ Qty = item.AssignQuantity.ObjToInt().ToString(),
+ Location = item.LocationCode
+ };
+ //鑾峰彇鍑哄簱鍗曟槑缁�
+ Dt_OutboundOrderDetail outboundOrderDetail = outboundOrder.Details.FirstOrDefault(x => x.Id == item.OrderDetailId);
+ ERPPickModel pickModel = new ERPPickModel()
+ {
+ Rowindex = outboundOrderDetail.RowNo,
+ Material = outboundOrderDetail.MaterielCode,
+ Qty = pickItemModel.Qty,
+ Dataitem = new List<ERPPickItemModel> { pickItemModel }
+ };
+ item.Status= OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
+ eRPPickModels.Add(pickModel);
+ _OutStockLockInfos.Add(item);
+ }
+ ERPIssueItemModel issueItemModel = new ERPIssueItemModel()
+ {
+ Pickcode = outboundOrder.UpperOrderNo,
+ PickList = eRPPickModels
+ };
+ issueModel = new ERPIssueModel()
+ {
+ UniqueTag = id.ToString(),
+ Code = outboundOrder.OrderNo,//娴嬭瘯
+ WarehouseCode = warehouse.WarehouseCode,
+ Docremark = "",
+ Deptno = outboundOrder.DepartmentCode,
+ Deptname = outboundOrder.DepartmentName,
+ Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+ Createuser = outboundOrder.Creater,
+ Issitem = new List<ERPIssueItemModel>() { issueItemModel },
+ };
}
+
+ if (stockInfos.Count > 0)
+ {
+ _stockInfoRepository.UpdateData(stockInfos);
+ }
+ else
+ {
+ _outStockLockInfoService.Repository.UpdateData(_OutStockLockInfos);
+ }
+ //鍑哄簱瀹屾垚涓婃姤ERP 娴嬭瘯娉ㄩ噴
+ _invokeERPService.InvokeOutStandardsApi(issueModel);
+ return WebResponseContent.Instance.OK();
}
catch (Exception ex)
{
@@ -233,15 +291,15 @@
/// <param name="warehouse"></param>
/// <param name="model"></param>
/// <returns></returns>
- public WebResponseContent TestOutStocksUpdate(Dt_Warehouse warehouse, ErpOutOrderDTO model)
+ public WebResponseContent TestOutStocksUpdate(Dt_Warehouse warehouse)
{
try
{
//鑾峰彇鍑哄簱鍗曞簱瀛�
List<Dt_StockInfo> stockInfos = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.WarehouseId == warehouse.WarehouseId).Includes(x => x.Details).ToList();
- if (model.Qty > stockInfos.Count)
+ if (stockInfos.Count<=0)
{
- return WebResponseContent.Instance.Error($"鐗╂枡:{model.MCode}搴撳瓨涓嶈冻");
+ return WebResponseContent.Instance.Error($"搴撳瓨涓嶈冻");
}
//鏇存敼鐘舵��
stockInfos.ForEach(x =>
@@ -255,33 +313,5 @@
return WebResponseContent.Instance.Error(ex.Message);
}
}
- ///鎺ㄩ�佹祴璇曟灦鍑哄簱
- //public WebResponseContent TestOutBack(int id,List<string> locationIds)
- //{
- // try
- // {
-
- // string response = _invokeERPService.InvokeOutStandardsApi(issueModel);
- // ErpRequestContent requestContent = response.DeserializeObject<ErpRequestContent>();
- // if (requestContent.res == 1)
- // {
-
- // return WebResponseContent.Instance.OK(requestContent.Data);
- // }
- // else
- // {
- // return WebResponseContent.Instance.Error(requestContent.Data);
- // }
- // }
- // catch (Exception ex)
- // {
- // return WebResponseContent.Instance.Error(ex.Message);
- // }
- //}
-
- //public WebResponseContent FeedbackOutbondIssue(List<Dt_OutStockLockInfo> outStockLockInfos)
- //{
- // ERPPickItemModel
- //}
}
}
--
Gitblit v1.9.3