From 9a886d711d8b21adc335fdf8c39350584c7ba6fd Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 14 十月 2025 02:12:14 +0800
Subject: [PATCH] 更新代码,取消MES出库单号同步标识,平库转立库功能,寄售周期判断取消,精品标识等
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Reloaction.cs | 130 +++++++++++++++++++++++++++++++++++++++---
1 files changed, 119 insertions(+), 11 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Reloaction.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Reloaction.cs"
index cdccf92..ce2efb9 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Reloaction.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Reloaction.cs"
@@ -10,6 +10,7 @@
using WIDESEA_Common.TaskEnum;
using WIDESEA_Core;
using WIDESEA_Core.Helper;
+using WIDESEA_DTO.Basic;
using WIDESEA_DTO.Task;
using WIDESEA_Model.Models;
@@ -49,7 +50,7 @@
}
else
{
- Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == needRelocationItem.LocationCode);
+ Dt_StockInfo stockInfo = _stockService.StockInfoService.Db.Queryable<Dt_StockInfo>().Where(x => x.LocationCode == needRelocationItem.LocationCode).Includes(x => x.Details).First();
if (stockInfo == null)
{
return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇揣浣嶇殑搴撳瓨淇℃伅");
@@ -61,7 +62,21 @@
return WebResponseContent.Instance.OK(data: _mapper.Map<WMSTaskDTO>(taskTemp));
}
- Dt_LocationInfo? newLocation = _basicService.LocationInfoService.AssignLocation(needRelocationItem.RoadwayNo, (PalletTypeEnum)task.PalletType, task.WarehouseId);
+ int heightType = 0;
+ if(needRelocationItem.Layer == 5)
+ {
+ heightType = 2;
+ }
+ //else if(needRelocationItem.Layer == 4)
+ //{
+ // heightType = 2;
+ //}
+ else if(needRelocationItem.Layer <= 4 && needRelocationItem.Layer >= 1)
+ {
+ heightType = 1;
+ }
+
+ Dt_LocationInfo? newLocation = _basicService.LocationInfoService.AssignLocation(needRelocationItem.RoadwayNo, stockInfo.PalletType, task.WarehouseId, needRelocationItem.LocationCode, heightType);
if (newLocation != null)
{
Dt_Task newTask = new Dt_Task()
@@ -78,20 +93,32 @@
TargetAddress = newLocation.LocationCode,
TaskNum = Repository.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
TaskStatus = 0,
- TaskType = 0
+ TaskType = TaskTypeEnum.Relocation.ObjToInt()
};
-
+ string MaterielCode = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode;
+ float Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity);
+ string BatchNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.BatchNo;
+ if (MaterielCode != null && Quantity != null && BatchNo != null)
+ {
+ newTask.MaterielCode = MaterielCode;
+ newTask.Quantity = Quantity;
+ newTask.BatchNo = BatchNo;
+ }
+ if (stockInfo.StockLength>0)
+ {
+ newTask.TaskLength = stockInfo.StockLength;
+ }
_unitOfWorkManage.BeginTran();
Repository.AddData(newTask);
{
LocationStatusEnum lastStatus = (LocationStatusEnum)newLocation.LocationStatus;
- _basicService.LocationInfoService.UpdateLocationStatus(newLocation, (PalletTypeEnum)task.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId);
- _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(newLocation, lastStatus, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum);
+ _basicService.LocationInfoService.UpdateLocationStatus(newLocation, task.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId);
+ _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(newLocation, lastStatus, LocationStatusEnum.Lock, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum);
}
{
LocationStatusEnum lastStatus = (LocationStatusEnum)needRelocationItem.LocationStatus;
- _basicService.LocationInfoService.UpdateLocationStatus(needRelocationItem, (PalletTypeEnum)task.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId);
- _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(needRelocationItem, lastStatus, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum);
+ _basicService.LocationInfoService.UpdateLocationStatus(needRelocationItem, task.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId);
+ _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(needRelocationItem, lastStatus, LocationStatusEnum.Lock, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum);
}
stockInfo.StockStatus = StockStatusEmun.绉诲簱閿佸畾.ObjToInt();
_stockRepository.StockInfoRepository.UpdateData(stockInfo);
@@ -110,6 +137,84 @@
{
_unitOfWorkManage.RollbackTran();
return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
+ /// <summary>
+ /// 鎵嬪姩绉诲簱
+ /// </summary>
+ /// <returns></returns>
+ public WebResponseContent ManualRelocation(RelocationDTO relocationDTO)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == relocationDTO.warehouseId);
+ if (warehouse == null)
+ {
+ return content.Error($"鏈壘鍒板搴旂殑{relocationDTO.warehouseId}浠撳簱淇℃伅");
+ }
+ Dt_LocationInfo locationInfoStart = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == relocationDTO.locationStart && x.WarehouseId== warehouse.WarehouseId && x.RoadwayNo == relocationDTO.locationRoadway && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt());
+ Dt_LocationInfo locationInfoEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == relocationDTO.locationEnd && x.WarehouseId == warehouse.WarehouseId && x.RoadwayNo== relocationDTO.locationRoadway && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.EnableStatus==EnableStatusEnum.Normal.ObjToInt());
+ if (locationInfoStart == null || locationInfoEnd==null)
+ {
+ return content.Error($"鏈壘鍒板搴旂殑璐т綅淇℃伅鎴栬捣鐐瑰強缁堢偣璐т綅鏉′欢涓嶆弧瓒�");
+ }
+ if (locationInfoStart.Column!= locationInfoEnd.Column || locationInfoStart.Layer != locationInfoEnd.Layer || locationInfoStart.Depth>= locationInfoEnd.Depth)
+ {
+ return content.Error($"璧风偣鍜岀粓鐐圭Щ搴撹揣浣嶉渶瑕佹弧瓒冲悓鍒楀悓灞傜粓鐐硅揣浣嶆繁浣嶉渶瑕佸ぇ浜庤捣鐐硅揣浣�");
+ }
+ Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.LocationCode == locationInfoStart.LocationCode);
+ if (stockInfo == null)
+ {
+ return content.Error($"鏈壘鍒板搴旇揣浣嶇殑搴撳瓨淇℃伅");
+ }
+
+ Dt_Task taskTemp = Repository.QueryFirst(x => x.PalletCode == stockInfo.PalletCode);
+ if (taskTemp != null)
+ {
+ return content.Error($"鎵樼洏{stockInfo.PalletCode}浠诲姟宸插瓨鍦�");
+ }
+ Dt_Task newTask = new Dt_Task()
+ {
+ Roadway = locationInfoStart.RoadwayNo,
+ WarehouseId = locationInfoStart.WarehouseId,
+ CurrentAddress = locationInfoStart.LocationCode,
+ Grade = 99,
+ NextAddress = locationInfoEnd.LocationCode,
+ OrderNo = "",
+ PalletCode = stockInfo.PalletCode,
+ PalletType = stockInfo.PalletType,
+ SourceAddress = locationInfoStart.LocationCode,
+ TargetAddress = locationInfoEnd.LocationCode,
+ TaskNum = Repository.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ TaskStatus = TaskStatusEnum.SC_Execute.ObjToInt(),
+ TaskType = TaskTypeEnum.Relocation.ObjToInt()
+ };
+
+ if (stockInfo.StockLength > 0)
+ {
+ newTask.TaskLength = stockInfo.StockLength;
+ }
+ _unitOfWorkManage.BeginTran();
+ Repository.AddData(newTask);
+ LocationStatusEnum lastStatusEnd = (LocationStatusEnum)locationInfoEnd.LocationStatus;
+ _basicService.LocationInfoService.UpdateLocationStatus(locationInfoEnd, newTask.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId);
+ _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfoEnd, lastStatusEnd, LocationStatusEnum.Lock, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum);
+
+ LocationStatusEnum lastStatusStart = (LocationStatusEnum)locationInfoStart.LocationStatus;
+ _basicService.LocationInfoService.UpdateLocationStatus(locationInfoStart, newTask.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId);
+ _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfoStart, lastStatusStart, LocationStatusEnum.Lock, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum);
+ stockInfo.StockStatus = StockStatusEmun.绉诲簱閿佸畾.ObjToInt();
+ _stockRepository.StockInfoRepository.UpdateData(stockInfo);
+ _unitOfWorkManage.CommitTran();
+ //鎺ㄩ�佷换鍔�
+ PushTasksToWCS(new List<Dt_Task> { newTask });
+ return content.OK(data: _mapper.Map<WMSTaskDTO>(newTask));
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return content.Error(ex.Message);
}
}
@@ -134,14 +239,17 @@
{
return WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑缁堢偣璐т綅淇℃伅");
}
-
+ task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
+ FeedBackWCSTaskCompleted(task.TaskNum);
_unitOfWorkManage.BeginTran();
stockInfo.LocationCode = locationInfoEnd.LocationCode;
+ stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
_stockService.StockInfoService.Repository.UpdateData(stockInfo);
- _basicService.LocationInfoService.UpdateLocationStatus(locationInfoStart, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId);
- _basicService.LocationInfoService.UpdateLocationStatus(locationInfoEnd, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId);
+ _basicService.LocationInfoService.UpdateLocationStatus(locationInfoStart, stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId);
+ _basicService.LocationInfoService.UpdateLocationStatus(locationInfoEnd, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId);
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? WIDESEA_Core.Enums.OperateTypeEnum.浜哄伐瀹屾垚 : WIDESEA_Core.Enums.OperateTypeEnum.鑷姩瀹屾垚);
_unitOfWorkManage.CommitTran();
+
return WebResponseContent.Instance.OK();
}
catch (Exception ex)
--
Gitblit v1.9.3