| | |
| | | |
| | | using AutoMapper; |
| | | using MailKit.Search; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using SqlSugar; |
| | | using System; |
| | |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_DTO.WCSInfo; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IInboundService; |
| | |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | public WebResponseContent ModifyBarcode(string barcode, string newBarcode) |
| | | { |
| | | WebResponseContent webResponseContent = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_Task? dt_Task = BaseDal.QueryFirst(x => x.PalletCode == barcode); |
| | | if (dt_Task == null) throw new Exception($"æªæ¾å°æçå·ä¸ºã{barcode}ãçä»»å¡ï¼"); |
| | | if (TaskEnumHelper.GetTaskTypeGroup(dt_Task.TaskType) != TaskTypeGroup.InboundGroup) |
| | | throw new Exception($"åªå¯ä¿®æ¹å
¥åºä»»å¡,å¦éä¿®æ¹å
¶ä»ä»»å¡ç±»å请è系管çåï¼"); |
| | | var stock = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == newBarcode); |
| | | if (stock != null) throw new Exception($"æçå·ã{newBarcode}ãå·²åå¨åºåä¿¡æ¯ï¼"); |
| | | stock = _stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == barcode); |
| | | if (stock == null) throw new Exception($"æçå·ã{barcode}ãæªæ¾å°åºåä¿¡æ¯ï¼"); |
| | | stock.PalletCode = newBarcode; |
| | | dt_Task.PalletCode = newBarcode; |
| | | Db.Ado.BeginTran(); |
| | | WMSTaskDTO wMSTaskDTOs = _mapper.Map<WMSTaskDTO>(dt_Task); |
| | | var ResultData = HttpHelper.PostAsync(WCSInterfaceAddress.ModifyBarcode, wMSTaskDTOs.ToJson(), headers: new Dictionary<string, string>()); |
| | | if (ResultData.Result == null) throw new Exception($"WCSååºè¶
æ¶"); |
| | | WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(ResultData.Result); |
| | | if (content == null) throw new Exception($"WCSæ ååº"); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | BaseDal.UpdateData(dt_Task); |
| | | _stockService.StockInfoService.Repository.UpdateData(stock); |
| | | Db.Ado.CommitTran(); |
| | | webResponseContent.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | webResponseContent.Error(ex.Message); |
| | | } |
| | | return webResponseContent; |
| | | } |
| | | public WebResponseContent CancelTask(WMSTaskDTO WMStask) |
| | | { |
| | | WebResponseContent webResponseContent = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == WMStask.TaskNum && x.TaskType == WMStask.TaskType); |
| | | if (task == null) return WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ä¿¡æ¯"); |
| | | Dt_StockInfo? _StockInfo = _stockService.StockInfoService.GetStockByPalletCode(task.PalletCode); |
| | | if (_StockInfo != null) |
| | | { |
| | | Dt_StockInfoDetail? detail = _StockInfo.Details.FirstOrDefault(); |
| | | if (detail != null) |
| | | { |
| | | Dt_InboundOrder dt_InboundOrder = _inboundService.InbounOrderService.GetInboundOrder(detail.OrderNo); |
| | | Dt_InboundOrderDetail? inboundOrderDetail = dt_InboundOrder.Details.FirstOrDefault(x => x.BatchNo == detail.BatchNo); |
| | | if (inboundOrderDetail != null) |
| | | { |
| | | inboundOrderDetail.ReceiptQuantity--; |
| | | _inboundService.InboundOrderDetailService.Repository.UpdateData(inboundOrderDetail); |
| | | } |
| | | _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(_StockInfo.Details, OperateType.AGVå é¤); |
| | | } |
| | | _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(_StockInfo, OperateType.AGVå é¤); |
| | | } |
| | | BaseDal.DeleteAndMoveIntoHty(task, /*App.User.UserId == 0 ? OperateType.èªå¨å®æ :*/ OperateType.AGVå é¤); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | webResponseContent.Error(ex.Message); |
| | | } |
| | | return webResponseContent; |
| | | } |
| | | /// <summary> |
| | | /// 忥任å¡ç¶æ |
| | | /// </summary> |
| | |
| | | if (Sourcelocation != null) |
| | | { |
| | | /*if (task.TaskType == TaskOutboundTypeEnum.Outbound.ObjToInt())*/ |
| | | if (BaseDal.QueryFirst(x => x.SourceAddress == task.SourceAddress && x.TaskState < TaskOutStatusEnum.SC_OutFinish.ObjToInt()) == null) |
| | | Sourcelocation.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | Sourcelocation.CurrentQty--; |
| | | if (Sourcelocation.CurrentQty <= 0) |
| | | { |