From 843cc2ea1b104ecdf9da61318a4136a5d4096411 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期五, 24 四月 2026 11:07:21 +0800
Subject: [PATCH] 集成Quartz定时任务,支持NG出库自动化及WMS/WCS接口扩展
---
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs | 35 ++++++++++++++++++++++++-----------
1 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs
index d39fe99..86fe1e6 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs
@@ -37,7 +37,7 @@
ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository,
IStockInfoDetailRepository stockInfoDetailRepository,
IMapper mapper,
- IDt_TaskService taskService,
+ IDt_TaskService taskService,
IDt_AreaInfoRepository AreaInfoRepository,
ISys_ConfigService configService) : base(BaseDal)
{
@@ -52,7 +52,7 @@
_mapper = mapper;
_taskService = taskService;
_AreaInfoRepository = AreaInfoRepository;
- _configService= configService;
+ _configService = configService;
}
/// <summary>
@@ -130,22 +130,35 @@
public WebResponseContent HandOutTask(int locationID)
{
LogFactory.GetLog("鎵嬪姩鍑哄簱浠诲姟").InfoFormat(true, "鎵嬪姩鍑哄簱浠诲姟", JsonConvert.SerializeObject(locationID), App.User.UserName);
- WebResponseContent content=new WebResponseContent();
+ WebResponseContent content = new WebResponseContent();
try
{
Dt_AreaInfo areaInfo = _AreaInfoRepository.QueryFirst(x => x.AreaCode == "CWSC1");
DtLocationInfo location = BaseDal.QueryFirst(x => x.Id == locationID);
DtStockInfo stock = _stockInfoRepository.QueryFirst(x => x.LocationId == location.Id && x.LocationCode == location.LocationCode);
+ string targetAddress = location.RoadwayNo switch
+ {
+ var s when s.StartsWith("CWSC") =>
+ int.TryParse(s.Substring(4), out var num)
+ ? num switch
+ {
+ >= 1 and <= 9 => "001-035-001",
+ >= 11 and <= 17 => "001-036-001"
+
+ }
+ : throw new Exception("鏈壘鍒拌宸烽亾淇℃伅"),
+ _ => throw new Exception("鏈壘鍒拌宸烽亾淇℃伅")
+ };
if (location.AreaId == areaInfo.AreaID)
{
Dt_Task task = new Dt_Task
{
Grade = 3,
Roadway = location.RoadwayNo,
- TargetAddress = "001-035-001",
+ TargetAddress = targetAddress,
Dispatchertime = DateTime.Now,
MaterialNo = "",
- NextAddress = "001-035-001",
+ NextAddress = targetAddress,
OrderNo = null,
PalletCode = stock == null ? "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000) : stock.PalletCode,
SourceAddress = location.LocationCode,
@@ -227,9 +240,9 @@
return content.Error("鏈壘鍒拌揣浣嶄俊鎭�!");
}
DtStockInfo stock = _stockInfoRepository.QueryFirst(x => x.LocationId == location.Id);
- if(stock == null)
+ if (stock == null)
{
- location.LocationStatus= (int)LocationEnum.Free;
+ location.LocationStatus = (int)LocationEnum.Free;
BaseDal.UpdateData(location);
}
else
@@ -246,7 +259,7 @@
AddStockInfoDetailHty(details);
}
await AddStockInfoHtyAsync(stockInfo_Hty);
-
+
location.LocationStatus = (int)LocationEnum.Free;
BaseDal.UpdateData(location);
@@ -324,7 +337,7 @@
int enable = Convert.ToBoolean(saveModel.Extra) ? 0 : 4;
for (int i = 0; i < saveModel.DelKeys.Count; i++)
{
- DtLocationInfo location = BaseDal.QueryData(x => x.Id == int.Parse(saveModel.DelKeys[i].ToString())).FirstOrDefault();
+ DtLocationInfo location = BaseDal.QueryFirst(x => x.Id == int.Parse(saveModel.DelKeys[i].ToString()));
location.LocationStatus = enable;
locations.Add(location);
}
@@ -517,12 +530,12 @@
{
var isStockAdd = SqlSugarHelper.DbWMS.Insertable(details).ExecuteCommand();
- if (isStockAdd==0)
+ if (isStockAdd == 0)
{
throw new Exception("搴撳瓨鏄庣粏鍘嗗彶淇℃伅娣诲姞澶辫触");
}
}
-
+
#endregion
#endregion 鍐呴儴鏂规硶
--
Gitblit v1.9.3