dengjunjie
2025-04-19 9e579eda4601ed7b492b9d19a24e8146f6ebdf8d
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs
@@ -47,24 +47,24 @@
        /// </summary>
        /// <param name="materielGroupDTO"></param>
        /// <returns></returns>
        public WebResponseContent PdaAddEmptyStockInfo(PdaMaterielGroupDTO materielGroupDTO)
        public WebResponseContent PdaAddEmptyStockInfo(string barcode, string station)
        {
            try
            {
                #region æ·»åŠ ä¸€ä¸ªç©ºæ‰˜ç»„ç›˜ä¿¡æ¯åŠç©ºæ‰˜ä»»åŠ¡å¹¶ä¸‹å‘ç»™WCS
                Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(materielGroupDTO.PalletCode);
                Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(barcode);
                if (stockInfo != null) throw new Exception($"托盘号【{stockInfo.PalletCode}】已存在组盘信息");
                Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == materielGroupDTO.PalletCode && x.TaskType == TaskTypeEnum.PalletInbound.ObjToInt());
                Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == barcode && x.TaskType == TaskTypeEnum.PalletInbound.ObjToInt());
                if (task == null)
                {
                    task = new Dt_Task()
                    {
                        CurrentAddress = "",
                        NextAddress = "SC01",
                        SourceAddress = "",
                        CurrentAddress = station,
                        NextAddress = "1001",
                        SourceAddress = station,
                        TargetAddress = "SC01",
                        Creater = "System",
                        PalletCode = materielGroupDTO.PalletCode,
                        PalletCode = barcode,
                        Roadway = "SC01",
                        OrderNo = DateTime.Now.ToString("yyMMdd"),
                        TaskNum = _taskRepository.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
@@ -74,16 +74,19 @@
                        Dispatchertime = DateTime.Now,
                    };
                    Db.Ado.BeginTran();
                    _stockService.StockInfoService.AddStockEmpty(materielGroupDTO.PalletCode);
                    WebResponseContent content = _stockService.StockInfoService.AddStockEmpty(barcode);
                    if (!content.Status) throw new Exception(content.Message);
                    _taskRepository.AddData(task);
                    List<WMSTaskDTO> wMSTaskDTOs = _mapper.Map<List<WMSTaskDTO>>(new List<Dt_Task> { task });
                    var ResultData = HttpHelper.PostAsync(WCSInterfaceAddress.ReceiveTask, wMSTaskDTOs.ToJson(), headers: new Dictionary<string, string>());
                    if (ResultData.Result == null) throw new Exception($"向WCS下发空托入库任务超时");
                    content = JsonConvert.DeserializeObject<WebResponseContent>(ResultData.Result);
                    if (content == null) throw new Exception($"下发空托入库任务WCS无响应");
                    if (!content.Status) throw new Exception(content.Message);
                    Db.Ado.CommitTran();
                }
                List<WMSTaskDTO> wMSTaskDTOs = _mapper.Map<List<WMSTaskDTO>>(task);
                var ResultData = HttpHelper.PostAsync(WCSInterfaceAddress.ReceiveTask, 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);
                else
                    throw new Exception($"托盘号【{barcode}】已存在任务");
                #endregion
                return WebResponseContent.Instance.OK();
            }