| | |
| | | using Org.BouncyCastle.Asn1.Tsp; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Diagnostics.CodeAnalysis; |
| | |
| | | using WIDESEA_ITaskInfoService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_TaskInfoRepository; |
| | | using static WIDESEA_ITaskInfoService.ITaskService; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | |
| | | _taskHtyService = taskHtyService; |
| | | _locationInfoService = locationInfoService; |
| | | } |
| | | |
| | | public string ReceiveWCSTask = WIDESEA_Core.Helper.AppSettings.Configuration["ReceiveWCSTask"]; |
| | | /// <summary> |
| | | /// ä»»å¡å®æ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent TaskCompleted(int taskNum) |
| | | public WebResponseContent TaskCompleted(int taskNum,int HowWorks) |
| | | { |
| | | try |
| | | { |
| | |
| | | if (task == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | if (HowWorks == 1) |
| | | { |
| | | WebResponseContent webResponseContent = HttpHelper.Post<WebResponseContent>(ReceiveWCSTask, task.TaskNum, "ä»»å¡å é¤"); |
| | | } |
| | | MethodInfo? methodInfo = GetType().GetMethod(((TaskTypeEnum)task.TaskType) + "TaskCompleted"); |
| | | if (methodInfo != null) |
| | |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | //æ¥è´§ä½ |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | |
| | | Dt_StockInfoDetail dt_StockInfodetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockInfo.Id); |
| | | CheckCompleted(stockInfo, locationInfo); |
| | | |
| | | if (stockInfo.MaterialType == (int)InventoryMaterialType.空æ) |
| | | { |
| | | string currentTime = DateTime.Now.ToString("HHmmss"); |
| | | stockInfo.PalletCode = "KTP" + currentTime; |
| | | } |
| | | stockInfo.LocationCode = task.TargetAddress; |
| | | stockInfo.StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | if (_stockService.StockInfoService.Repository.UpdateData(stockInfo)) |
| | | { |
| | | string[] Pallet = stockInfo.PalletCode.Split("-"); |
| | | Dt_StockInfoDetail dt_StockInfoDetail = new() |
| | | { |
| | | StockId = stockInfo.Id, |
| | | MaterielCode = Pallet[0], //ç©æç¼å· |
| | | MaterielName = Pallet[1], //æè´¨ |
| | | OrderNo = stockInfo.PalletCode, //åæ®ï¼æçæ¡ç ï¼ |
| | | BatchNo = Pallet[2], //æ¹æ¬¡å· |
| | | SerialNumber = Pallet[2], //åºåå· |
| | | StockQuantity = decimal.Parse(Pallet[3]), //åºåå· |
| | | OutboundQuantity = decimal.Parse(Pallet[3]), //åºåå· |
| | | Status = (int)StockStatusEmun.å·²å
¥åº, |
| | | Creater = "WMS", |
| | | CreateDate = DateTime.Now, |
| | | }; |
| | | _stockService.StockInfoDetailService.AddData(dt_StockInfoDetail); |
| | | } |
| | | |
| | | if(dt_StockInfodetail != null) |
| | | { |
| | | dt_StockInfodetail.Status = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | | _stockService.StockInfoDetailService.Repository.UpdateData(dt_StockInfodetail); |
| | | } |
| | | beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity); |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | if (stockInfo.MaterialType == (int)InventoryMaterialType.空æ) |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | } |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false); |
| | | |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºå®æ.ObjToInt(); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | if (task.Depth == 1) |
| | | /*if (task.Depth == 1) |
| | | { |
| | | if (DepthTask(task)) { } |
| | | *//*if (DepthTask(task)) |
| | | { |
| | | } |
| | | else |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | } |
| | | }*//* |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | } |
| | | else |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | } |
| | | }*/ |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | task.TaskStatus = OutTaskStatusEnum.OutFinish.ObjToInt(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | |
| | | public WebResponseContent RelocationTaskCompleted(string PalletCode,string SourceAddress, string TargetAddress) |
| | | public WebResponseContent RelocationInTaskCompleted(Dt_Task task) |
| | | { |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(PalletCode); |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | |
| | | Dt_LocationInfo locationpoint = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == SourceAddress); |
| | | Dt_LocationInfo locationEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == TargetAddress); |
| | | Dt_LocationInfo locationpoint = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | Dt_LocationInfo locationEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | List<Dt_LocationInfo> loca = new List<Dt_LocationInfo>(); |
| | | |
| | | stockInfo.LocationCode = locationEnd.LocationCode; |
| | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |