From f43b7df8400f4fcffc9f19dca0888d61e2b33d5f Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期三, 12 三月 2025 18:41:52 +0800 Subject: [PATCH] WMS系统添加PDA权限,PDA程序 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderService.cs | 73 ++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 0 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderService.cs" index 8b50922..60c1dd3 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderService.cs" @@ -1,6 +1,8 @@ 锘縰sing AutoMapper; +using Microsoft.Extensions.Options; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; @@ -13,15 +15,86 @@ using WIDESEA_Core.Utilities; using WIDESEA_DTO.Inbound; using WIDESEA_DTO.Outbound; +using WIDESEA_DTO.Stock; +using WIDESEA_DTO.WCSInfo; using WIDESEA_IBasicService; using WIDESEA_IOutboundRepository; using WIDESEA_IOutboundService; using WIDESEA_IStockService; using WIDESEA_Model.Models; +using WIDESEAWCS_DTO.WCSInfo; namespace WIDESEA_OutboundService { public partial class OutboundOrderService : ServiceBase<Dt_OutboundOrder, IOutboundOrderRepository>, IOutboundOrderService { + /// <summary> + /// 绌烘墭鍑哄簱 + /// </summary> + /// <returns></returns> + /// <exception cref="NotImplementedException"></exception> + public WebResponseContent PdaOutEmpty() + { + try + { + ISugarQueryable<Dt_StockInfo> sugarQueryable1 = _dbBase.Queryable<Dt_StockInfo>(); + ISugarQueryable<Dt_StockInfoDetail> sugarQueryable2 = _dbBase.Queryable<Dt_StockInfoDetail>(); + List<StockViewDTO1> list = sugarQueryable1.InnerJoin(sugarQueryable2, (a, b) => a.Id == b.StockId && b.MaterielName.Contains("绌烘墭") && a.StockStatus == StockStatusEmun.宸插叆搴�.ObjToInt()).Select((a, b) => new StockViewDTO1 + { + LocationCode = a.LocationCode, + PalletCode = a.PalletCode, + MaterielCode = b.MaterielCode, + MaterielName = b.MaterielName, + InDate = a.InDate, + StockId = a.Id + }).ToList(); + StockViewDTO1? stockViewDTO = list.OrderByDescending(x => x.InDate).FirstOrDefault(); + if (stockViewDTO == null) throw new Exception("鏈壘鍒板彲鍑哄簱绌烘墭"); + Dt_LocationInfo locationInfo = _dbBase.Queryable<Dt_LocationInfo>().Where(x => x.LocationCode == stockViewDTO.LocationCode).First(); + if (locationInfo == null) throw new Exception($"鏈壘鍒拌揣浣嶃�恵stockViewDTO.LocationCode}銆戜俊鎭�"); + Dt_StockInfo stockInfo = sugarQueryable1.Where(x => x.Id == stockViewDTO.StockId).Includes(x => x.Details).First(); + if (stockInfo == null) throw new Exception($"鏈壘鍒扮┖鎵樺簱瀛樹俊鎭�"); + stockInfo.StockStatus = StockStatusEmun.鍑哄簱涓�.ObjToInt(); + stockInfo.Details.ForEach(x => + { + x.Status = StockStatusEmun.鍑哄簱涓�.ObjToInt(); + }); + locationInfo.CurrentQty--; + Dt_Task _Task = new Dt_Task() + { + CurrentAddress = locationInfo.LocationCode, + NextAddress = "SC01", + SourceAddress = locationInfo.LocationCode, + TargetAddress = "SC01", + CreateDate = DateTime.Now, + Creater = "System", + PalletCode = stockViewDTO.PalletCode, + Roadway = locationInfo.RoadwayNo, + OrderNo = "", + TaskNum = _taskRepository.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), + TaskState = OutTaskStatusEnum.OutNew.ObjToInt(), + TaskType = TaskTypeEnum.PalletOutbound.ObjToInt(), + Dispatchertime = DateTime.Now, + }; + List<WMSTaskDTO> wMSTaskDTOs = _mapper.Map<List<WMSTaskDTO>>(_Task); + Db.Ado.BeginTran(); + _dbBase.Updateable(locationInfo); + _stockService.UpdateData(stockInfo); + _stockDetailService.UpdateData(stockInfo.Details); + _taskRepository.AddData(_Task); + var ResultData = HttpHelper.PostAsync(WCSInterfaceAddress.ReceiveTask, wMSTaskDTOs.ToJson(), headers: new Dictionary<string, string>()); + if (ResultData.Result == null) throw new Exception($"鍚慦CS涓嬪彂绌烘墭鍑哄簱浠诲姟瓒呮椂"); + WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(ResultData.Result); + if (content == null) throw new Exception($"涓嬪彂绌烘墭鍑哄簱浠诲姟WCS鏃犲搷搴�"); + if (!content.Status) throw new Exception(content.Message); + Db.Ado.CommitTran(); + return WebResponseContent.Instance.OK(); + } + catch (Exception ex) + { + Db.Ado.RollbackTran(); + return WebResponseContent.Instance.Error(ex.Message); + } + } } } -- Gitblit v1.9.3