From 7d173d42cba04b4243f13c6ce013b04e1be4dc95 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 07 三月 2025 16:59:34 +0800
Subject: [PATCH] 成品输送线
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs | 76 ++++++++++++++++++++++++++++----------
1 files changed, 56 insertions(+), 20 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
index aee204f..cc46e19 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
@@ -29,6 +29,7 @@
using WIDESEA_DTO.Task;
using WIDESEA_DTO.Stock;
using SqlSugar;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
namespace WIDESEA_TaskInfoService
{
@@ -76,7 +77,7 @@
(x.EnableStatus == (int)EnableStatusEnum.Normal || x.EnableStatus == (int)EnableStatusEnum.OnlyOut));
if (locationInfo == null)
{
- return responseContent.Error($"娴嬭瘯鏋惰揣浣�:{stockInfo.LocationCode}鍑哄簱鏉′欢涓嶆弧瓒�");
+ return responseContent.Error($"娴嬭瘯鏋惰揣浣嶃�傘�傘�傘�傘�傘�傘�傘�傘��:{stockInfo.LocationCode}鍑哄簱鏉′欢涓嶆弧瓒�");
}
//鐢熸垚娴嬭瘯鏋跺嚭搴撲换鍔� 閿佸畾搴撳瓨 鏇存敼璐т綅鐘舵��
Dt_Task taskOut = new()
@@ -653,11 +654,14 @@
//}
#endregion
+ _unitOfWorkManage.BeginTran();
Db.InsertNav(mesOutboundOrder).Include(x => x.Details).ExecuteCommand();
+ _unitOfWorkManage.CommitTran();
return MesResponseContent.Instance.OK();
}
catch (Exception ex)
{
+ _unitOfWorkManage.RollbackTran();
return MesResponseContent.Instance.Error(ex.Message);
}
@@ -773,6 +777,7 @@
{
try
{
+ //涓�娆″彧鍙戜竴鍗风墿鏂欏叆搴撴槑缁�
foreach (var item in model.MaterialLotInfo)
{
//鑾峰彇鐗╂枡淇℃伅
@@ -975,7 +980,12 @@
{
return content.Error("鏈壘鍒颁粨搴撲俊鎭�");
}
- //鍒ゆ柇鏄惁MES鍐呭寘淇℃伅鏄惁閲嶅
+ Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.WarehouseId == warehouse.WarehouseId);
+ if (locationInfo==null)
+ {
+ return content.Error($"鏈壘鍒皗warehouse.WarehouseCode}璐т綅淇℃伅");
+ }
+ //鍐呭寘淇℃伅缁勭洏
List<Dt_MesProInOrderDetail> mesProInOrderDetails = new List<Dt_MesProInOrderDetail>();
foreach (var item in bagInfoModel.BagDetails)
{
@@ -1020,13 +1030,31 @@
PalletCode = bagInfoModel.BatchNo,
PalletType = 1,
WarehouseId = warehouse.WarehouseId,
- StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(),
+ StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(),
proStockInfoDetails = proStockInfoDetails
};
+ Dt_Task newTask = new Dt_Task()
+ {
+ CurrentAddress = bagInfoModel.WorkCenter,
+ Grade = 0,
+ NextAddress = "",
+ PalletCode = proStockInfo.PalletCode,
+ Roadway = locationInfo.RoadwayNo,
+ SourceAddress = bagInfoModel.WorkCenter,
+ TargetAddress = "",
+ TaskType = TaskTypeEnum.InProduct.ObjToInt(),
+ TaskStatus = TaskStatusEnum.New.ObjToInt(),
+ WarehouseId = warehouse.WarehouseId,
+ PalletType = proStockInfo.PalletType
+ };
_unitOfWorkManage.BeginTran();
+ int taskId = BaseDal.AddData(newTask);
+ newTask.TaskId = taskId;
Db.InsertNav(mesProInOrder).Include(x => x.Details).ExecuteCommand();
Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand();
_unitOfWorkManage.CommitTran();
+ //鎺ㄩ�佷换鍔�
+ PushTasksToWCS(new List<Dt_Task> { newTask });
return content.OK("鎺ユ敹鎴愬姛");
}
catch (Exception ex)
@@ -1100,28 +1128,40 @@
/// <returns></returns>
public MesResponseContent RworkTask(RworkTaskModel model)
{
+ MesResponseContent content = new MesResponseContent();
try
{
Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA72.ToString());
- //鑾峰彇搴撳瓨璁板綍
- List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x =>
- x.WarehouseId == warehouse.WarehouseId &&
- x.StockStatus == (int)StockStatusEmun.鍏ュ簱瀹屾垚).Includes(x => x.Details).ToList();
- Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == model.ProductVersion));
- if (stockInfo == null)
+ if (warehouse==null)
{
- return MesResponseContent.Instance.Error($"灏炬暟浠�:{model.ProductVersion}鏃犲彲鐢ㄥ簱瀛�");
+ return MesResponseContent.Instance.Error("鏈壘鍒版浠撳簱");
}
- Dt_Task exsit2 = Repository.QueryFirst(x => x.PalletCode == stockInfo.PalletCode);
-
-
+ Dt_MesRworkOutboundOrder mesRworkOutboundOrder = new Dt_MesRworkOutboundOrder()
+ {
+ WarehouseId=warehouse.WarehouseId,
+ TaskNo=model.TaskNo,
+ OrderStatus = InOrderStatusEnum.鏈紑濮�.ObjToInt(),
+ CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(),
+ ProductCode=model.ProductCode,
+ ProductName=model.ProductName,
+ ProductVersion=model.ProductVersion,
+ DateCode=model.DateCode,
+ RequiredQuantity=model.RequiredQuantity,
+ FactoryCode= model.FactoryCode,
+ SaleOrder=model.SaleOrder,
+ InventoryType=model.InventoryType,
+ };
+ _unitOfWorkManage.BeginTran();
+ _outboundService.RworkOutboundOrderService.AddData(mesRworkOutboundOrder);
+ _unitOfWorkManage.CommitTran();
+ return content.OK("鎻愪緵杩斿簱鍗曟帴鏀舵垚鍔�");
}
catch (Exception ex)
{
-
- throw;
+ _unitOfWorkManage.RollbackTran();
+ content.Error(ex.Message);
}
- return MesResponseContent.Instance.OK();
+ return content;
}
@@ -1618,9 +1658,5 @@
return WebResponseContent.Instance.Error(ex.Message);
}
}
-
-
-
-
}
}
--
Gitblit v1.9.3