From 981a80940e47409300c09847684ca530f75b4a5f Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 10 一月 2025 23:56:33 +0800
Subject: [PATCH] 优化WCS辅料出库逻辑
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 390 ++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 308 insertions(+), 82 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index ba3138c..d5f2ef3 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -16,35 +16,31 @@
#endregion << 鐗� 鏈� 娉� 閲� >>
using AutoMapper;
-using HslCommunication.WebSocket;
-using MailKit.Search;
+using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Newtonsoft.Json;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using SqlSugar;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Net.Http.Headers;
-using System.Reflection;
-using System.Reflection.Metadata;
-using System.Text;
+using System.Reflection.Emit;
using System.Threading.Tasks;
using WIDESEA_Common.CommonEnum;
using WIDESEA_Common.LocationEnum;
+using WIDESEA_Common.OrderEnum;
using WIDESEA_Common.StockEnum;
using WIDESEA_Common.TaskEnum;
+using WIDESEA_Common.WareHouseEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Inbound;
+using WIDESEA_DTO.MES;
using WIDESEA_DTO.Stock;
+using WIDESEA_DTO.Task;
+using WIDESEA_External.ERPService;
+using WIDESEA_External.Model;
using WIDESEA_IBasicRepository;
using WIDESEA_IBasicService;
+using WIDESEA_IInboundRepository;
using WIDESEA_IInboundService;
using WIDESEA_IOutboundRepository;
using WIDESEA_IOutboundService;
@@ -65,86 +61,100 @@
private readonly IStockRepository _stockRepository;
private readonly IBasicService _basicService;
private readonly IRecordService _recordService;
+ private readonly IOutboundService _outboundService;
+ private readonly IStockService _stockService;
+ private readonly IBasicRepository _basicRepository;
+ private readonly IApiInfoRepository _apiInfoRepository;
+ private readonly IInvokeERPService _invokeERPService;
+ private readonly IInboundRepository _inboundRepository;
+ private readonly IInboundOrderService _inboundOrderService;
+ private readonly IPalletTypeInfoRepository _palletTypeInfoRepository;
public ITaskRepository Repository => BaseDal;
- public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService) : base(BaseDal)
+ private Dictionary<string, OrderByType> _taskOrderBy = new()
+ {
+ {nameof(Dt_Task.Grade),OrderByType.Desc },
+ {nameof(Dt_Task.CreateDate),OrderByType.Asc},
+ };
+
+ public List<int> TaskTypes => typeof(TaskTypeEnum).GetEnumIndexList();
+
+ public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList();
+
+ public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IStockRepository stockRepository, IBasicService basicService, IRecordService recordService, IOutboundService outboundService, IStockService stockService, IBasicRepository basicRepository, IApiInfoRepository apiInfoRepository, IInvokeERPService invokeERPService, IInboundRepository inboundRepository, IInboundOrderService inboundOrderService, IPalletTypeInfoRepository palletTypeInfoRepository) : base(BaseDal)
{
_mapper = mapper;
_unitOfWorkManage = unitOfWorkManage;
_stockRepository = stockRepository;
_basicService = basicService;
_recordService = recordService;
+ _outboundService = outboundService;
+ _stockService = stockService;
+ _basicRepository = basicRepository;
+ _apiInfoRepository = apiInfoRepository;
+ _invokeERPService = invokeERPService;
+ _inboundRepository = inboundRepository;
+ _inboundOrderService = inboundOrderService;
+ _palletTypeInfoRepository = palletTypeInfoRepository;
}
- public WebResponseContent RequestInboundTask(string palletCode, string stationCode)
+ /// <summary>
+ /// 浠诲姟淇℃伅鎺ㄩ�佽嚦WCS
+ /// </summary>
+ /// <returns></returns>
+ public WebResponseContent PushTasksToWCS(List<Dt_Task> tasks, string agvDescription = "")
{
try
{
- Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode);
- if (task != null)
+ List<WMSTaskDTO> taskDTOs = _mapper.Map<List<WMSTaskDTO>>(tasks);
+ taskDTOs.ForEach(x =>
{
- return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡鐢熸垚浠诲姟");
+ x.AGVArea = agvDescription;
+ });
+ string address = AppSettings.Get("WCSApiAddress");
+ if (string.IsNullOrEmpty(address))
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒癢CSApi鍦板潃");
}
+ string response = HttpHelper.Post($"{address}/api/Task/ReceiveTask", taskDTOs.Serialize());
- Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode);
- if (stockInfo == null)
- {
- return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�");
- }
- if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt())
- {
- return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱");
- }
- if (!string.IsNullOrEmpty(stockInfo.LocationCode))
- {
- return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅");
- }
-
- //todo 閫氳繃绔欏彴鍙锋壘宸烽亾鍙�
- string roadwayNo = "RSC01";
-
- PalletTypeEnum palletType = PalletTypeEnum.SmallPallet;
-
- Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, palletType);
- if (locationInfo == null)
- {
- return WebResponseContent.Instance.Error($"璐т綅鍒嗛厤澶辫触,鏈壘鍒板彲鍒嗛厤璐т綅");
- }
- Dt_Task newTask = new Dt_Task()
- {
- CurrentAddress = stationCode,
- Grade = 0,
- NextAddress = "",
- PalletCode = palletCode,
- Roadway = roadwayNo,
- SourceAddress = stationCode,
- TargetAddress = locationInfo.LocationCode,
- TaskType = TaskTypeEnum.Inbound.ObjToInt(),
- TaskStatus = InTaskStatusEnum.InNew.ObjToInt(),
- };
-
- LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus;
-
- stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt();
-
- _unitOfWorkManage.BeginTran();
- int taskId = BaseDal.AddData(newTask);
- newTask.TaskId = taskId;
- _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.InboundAssignLocation);
- _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock);
- _stockRepository.StockInfoRepository.UpdateData(stockInfo);
- _unitOfWorkManage.CommitTran();
-
- return WebResponseContent.Instance.OK(data: newTask);
+ return JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("杩斿洖閿欒");
}
catch (Exception ex)
{
- _unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
+ /// <summary>
+ /// 鏀捐揣瀹屾垚
+ /// </summary>
+ /// <param name="code"></param>
+ /// <returns></returns>
+ public WebResponseContent PutFinish(string code)
+ {
+ try
+ {
+ string address = AppSettings.Get("WCSApiAddress");
+ if (string.IsNullOrEmpty(address))
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒癢CSApi鍦板潃");
+ }
+ string response = HttpHelper.Post($"{address}/api/CTU_AGV/PutFinish?code=" + code);
+
+ return JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("杩斿洖閿欒");
+ }
+ catch (Exception ex)
+ {
return WebResponseContent.Instance.Error(ex.Message);
}
}
+ /// <summary>
+ /// 鍏ュ簱浠诲姟瀹屾垚
+ /// </summary>
+ /// <param name="taskNum">浠诲姟鍙�</param>
+ /// <returns></returns>
public WebResponseContent InboundTaskCompleted(int taskNum)
{
try
@@ -155,12 +165,7 @@
return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅");
}
- if (task.TaskType != TaskTypeEnum.Inbound.ObjToInt())
- {
- return WebResponseContent.Instance.Error($"浠诲姟绫诲瀷閿欒");
- }
-
- Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x => x.Details).First();
+ Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId == task.WarehouseId).Includes(x => x.Details).First();
if (stockInfo == null)
{
return WebResponseContent.Instance.Error($"鏈壘鍒版墭鐩樺搴旂殑缁勭洏淇℃伅");
@@ -171,7 +176,7 @@
return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅");
}
- if (stockInfo.Details == null || stockInfo.Details.Count == 0)
+ if (stockInfo.Details.Count == 0 && stockInfo.PalletType != PalletTypeEnum.Empty.ObjToInt())
{
return WebResponseContent.Instance.Error($"鏈壘鍒拌鎵樼洏搴撳瓨鏄庣粏淇℃伅");
}
@@ -189,18 +194,115 @@
LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus;
locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+ Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == task.WarehouseId);
- stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
stockInfo.LocationCode = locationInfo.LocationCode;
+ #region 绌虹鍏ュ簱
+ if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt())
+ {
+ stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+ task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
+ _unitOfWorkManage.BeginTran();
+ BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚);
+ _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId);
+ _stockRepository.StockInfoRepository.UpdateData(stockInfo);
+ _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.InStock, LocationChangeType.InboundCompleted);
+ _unitOfWorkManage.CommitTran();
+ return WebResponseContent.Instance.OK();
+ }
+ #endregion
+
+ Dt_InboundOrder? inboundOrder = _inboundRepository.InboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x => x.Details).First();
+ List<Dt_InboundOrderDetail> inboundOrderDetails = new List<Dt_InboundOrderDetail>();
+ if (stockInfo.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt())
+ {
+ //鎺ㄩ�佸叆搴撳畬鎴愮粰Erp
+ if (inboundOrder == null)
+ {
+ return WebResponseContent.Instance.Error($"瀵瑰簲鍏ュ簱鍗曚笉瀛樺湪");
+ }
+
+ List<ERPInboundDetailModel> detailModels = new List<ERPInboundDetailModel>();
+
+ foreach (var item in stockInfo.Details)
+ {
+ Dt_InboundOrderDetail? inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.RowNo == item.InboundOrderRowNo);
+ if (inboundOrderDetail == null)
+ {
+ continue;
+ }
+ ERPInboundDetailModel detailModel = new ERPInboundDetailModel()
+ {
+ ExpiryDate = item.EffectiveDate ?? "",
+ LocationCode = warehouse.WarehouseCode,
+ MaterialsCode = item.MaterielCode,
+ MfgDate = item.ProductionDate ?? "",
+ QtyCustoms = "0",
+ Quantity = item.StockQuantity.ToString(),
+ Rack = stockInfo.LocationCode,
+ ReceiptCode = inboundOrder.UpperOrderNo,
+ ReceiptSerNo = item.InboundOrderRowNo.ToString()
+ };
+ inboundOrderDetail.OverInQuantity += detailModel.Quantity.ObjToInt();
+ if (inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity)
+ {
+ inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
+ }
+ inboundOrderDetails.Add(inboundOrderDetail);
+ detailModels.Add(detailModel);
+ }
+
+ //鍏ュ簱鏄庣粏鏂板瀹屾垚鏁伴噺
+ int newCount = inboundOrderDetails.Select(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
+ //鍏ュ簱鏄庣粏鍘熷畬鎴愭暟閲�
+ int oldCount = inboundOrder.Details.Select(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
+ if (inboundOrder.Details.Count == (newCount + oldCount))
+ {
+ inboundOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt();
+ }
+ if (!_inboundOrderService.FeedbackInboundOrder(stockInfo, inboundOrder, detailModels).Status)//todo 淇敼澶勭悊
+ {
+ return WebResponseContent.Instance.Error($"鍏ュ簱鍚屾Erp澶辫触");
+ }
+ }
+
+ if ((stockInfo.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt() || stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt()) && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString())
+ {
+ foreach (var model in stockInfo.Details)
+ {
+ TestSynStock(new TestToolSynInfo() { ToolCode = model.BatchNo, /*MaterialName = model.MaterielName,*/ Life = int.TryParse(model.Remark, out int val) ? val : 1000 });
+ }
+ }
+
+ //娴嬭瘯鏋跺叆搴撳簱瀛樼姸鎬�
+ if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt())
+ {
+ stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚鏈缓鍑哄簱鍗�.ObjToInt();
+ }
+ else
+ {
+ stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+
+ }
+ stockInfo.Details.ForEach(x =>
+ {
+ x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+ });
+ //鏇存柊浠诲姟鐘舵��
+ task.TaskStatus = (int)TaskStatusEnum.Finish;
_unitOfWorkManage.BeginTran();
BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.浜哄伐瀹屾垚 : OperateTypeEnum.鑷姩瀹屾垚);
-
- _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
-
+ _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId);
_stockRepository.StockInfoRepository.UpdateData(stockInfo);
-
- _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.InboundCompleted);
+ _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details);
+ _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.InStock, LocationChangeType.InboundCompleted);
+ _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, stockInfo.Details.Sum(x => x.StockQuantity), stockInfo.Details.Sum(x => x.StockQuantity), StockChangeTypeEnum.Inbound, taskNum);
+ if (inboundOrder != null)
+ {
+ _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetails);
+ _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder);
+ }
_unitOfWorkManage.CommitTran();
return WebResponseContent.Instance.OK();
}
@@ -210,5 +312,129 @@
return WebResponseContent.Instance.Error(ex.Message);
}
}
+
+ /// <summary>
+ /// 鍑哄簱浠诲姟瀹屾垚
+ /// </summary>
+ /// <param name="taskNum">浠诲姟鍙�</param>
+ /// <returns></returns>
+ public WebResponseContent OutboundTaskCompleted(int taskNum)
+ {
+ try
+ {
+ Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+ if (task == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒颁换鍔′俊鎭�");
+ }
+
+ Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode);
+
+ Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+ if (stockInfo == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒板簱瀛樹俊鎭�");
+ }
+ if (locationInfo == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒拌揣浣嶄俊鎭�");
+ }
+ Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == task.WarehouseId);
+ List<Dt_OutStockLockInfo> outStockLockInfos = _outboundService.OutboundStockLockInfoService.Repository.QueryData(x => x.TaskNum == taskNum);
+ List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>();
+ List<Dt_MesOutboundOrder> mesOutboundOrders = new List<Dt_MesOutboundOrder>();
+
+ if ((outStockLockInfos == null || outStockLockInfos.Count == 0) && warehouse.WarehouseCode != WarehouseEnum.HA64.ToString() && task.TaskType != TaskTypeEnum.OutEmpty.ObjToInt())
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒板嚭搴撹鎯呬俊鎭�");
+ }
+ else
+ {
+ foreach (var item in outStockLockInfos)
+ {
+ if (task.TaskType == TaskTypeEnum.MesOutbound.ObjToInt())
+ {
+ Dt_MesOutboundOrder mesOutboundOrder = _outboundService.MesOutboundOrderService.Repository.QueryFirst(x => x.Id == item.OrderDetailId);
+ if (mesOutboundOrder != null)
+ {
+ mesOutboundOrder.OverOutQuantity = item.AssignQuantity;
+ if (mesOutboundOrder.OverOutQuantity == mesOutboundOrder.OrderQuantity)
+ {
+ mesOutboundOrder.OrderStatus = OrderDetailStatusEnum.Over.ObjToInt();
+ }
+ mesOutboundOrders.Add(mesOutboundOrder);
+ }
+ }
+ else
+ {
+ Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == item.OrderDetailId);
+ if (outboundOrderDetail != null)
+ {
+ outboundOrderDetail.OverOutQuantity = item.AssignQuantity;
+ if (outboundOrderDetail.OverOutQuantity == outboundOrderDetail.OrderQuantity)
+ {
+ outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
+ }
+ outboundOrderDetails.Add(outboundOrderDetail);
+ }
+ }
+ item.Status = OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
+ }
+ }
+
+ task.TaskStatus = TaskStatusEnum.Finish.ObjToInt();
+ _unitOfWorkManage.BeginTran();
+
+ if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
+ {
+ if (outboundOrderDetails.Count > 0)
+ {
+ _outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails);
+ }
+
+ stockInfo.LocationCode = "";
+ stockInfo.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt();
+ _stockService.StockInfoService.Repository.UpdateData(stockInfo);
+ }
+ else if (task.TaskType == TaskTypeEnum.OutEmpty.ObjToInt())
+ {
+ _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId);
+ _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+ }
+ else if (task.TaskType == TaskTypeEnum.MesOutbound.ObjToInt())
+ {
+ _outboundService.MesOutboundOrderService.Repository.UpdateData(mesOutboundOrders);
+ _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+ _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+ }
+ _outboundService.OutboundStockLockInfoService.Repository.UpdateData(outStockLockInfos);
+
+ int beforeStatus = locationInfo.LocationStatus;
+ locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId);
+
+ BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚);
+
+ _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationStatusEnum.Free, LocationChangeType.OutboundCompleted, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum);
+ _unitOfWorkManage.CommitTran();
+
+ if (warehouse.WarehouseCode != WarehouseEnum.HA64.ToString() && task.TaskType == TaskTypeEnum.Outbound.ObjToInt())
+ {
+ _outboundService.OutboundOrderService.TestOutUpload(outboundOrderDetails.FirstOrDefault().OrderId, outStockLockInfos);
+ }
+ if (task.TaskType == TaskTypeEnum.MesOutbound.ObjToInt())
+ {
+ MesMaterialLotaAceptModel model = GetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesOutboundOrders.FirstOrDefault().TaskNo, warehouse.WarehouseCode, mesOutboundOrders.FirstOrDefault().OrderQuantity);
+ UploadMesMaterialLotaAcept(model);
+ }
+ return WebResponseContent.Instance.OK();
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
+
}
}
--
Gitblit v1.9.3