From c455612b03e6ecac994884dde5b5f4bc4909c181 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 11 三月 2025 17:12:52 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs"
index 1614660..4e165fe 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs"
@@ -1,4 +1,5 @@
 锘縰sing AutoMapper;
+using Newtonsoft.Json;
 using SqlSugar;
 using System;
 using System.Collections.Generic;
@@ -14,12 +15,14 @@
 using WIDESEA_Core.Utilities;
 using WIDESEA_DTO;
 using WIDESEA_DTO.Inbound;
+using WIDESEA_DTO.WCSInfo;
 using WIDESEA_IBasicService;
 using WIDESEA_IInboundRepository;
 using WIDESEA_IInboundService;
 using WIDESEA_IStockService;
 using WIDESEA_ITaskInfoRepository;
 using WIDESEA_Model.Models;
+using WIDESEAWCS_DTO.WCSInfo;
 
 namespace WIDESEA_InboundService
 {
@@ -40,6 +43,57 @@
             return Db.UpdateNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
         }
         /// <summary>
+        /// 绌烘墭缁勭洏鍏ュ簱
+        /// </summary>
+        /// <param name="materielGroupDTO"></param>
+        /// <returns></returns>
+        public WebResponseContent PdaAddEmptyStockInfo(PdaMaterielGroupDTO materielGroupDTO)
+        {
+            try
+            {
+                #region 娣诲姞涓�涓┖鎵樼粍鐩樹俊鎭強绌烘墭浠诲姟骞朵笅鍙戠粰WCS
+                Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(materielGroupDTO.PalletCode);
+                if (stockInfo != null) throw new Exception($"鎵樼洏鍙枫�恵stockInfo.PalletCode}銆戝凡瀛樺湪缁勭洏淇℃伅");
+                Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == materielGroupDTO.PalletCode && x.TaskType == TaskTypeEnum.PalletInbound.ObjToInt());
+                if (task == null)
+                {
+                    task = new Dt_Task()
+                    {
+                        CurrentAddress = "",
+                        NextAddress = "SC01",
+                        SourceAddress = "",
+                        TargetAddress = "SC01",
+                        Creater = "System",
+                        PalletCode = materielGroupDTO.PalletCode,
+                        Roadway = "SC01",
+                        OrderNo = DateTime.Now.ToString("yyMMdd"),
+                        TaskNum = _taskRepository.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+                        TaskState = InTaskStatusEnum.InNew.ObjToInt(),
+                        TaskType = TaskTypeEnum.PalletInbound.ObjToInt(),
+                        CreateDate = DateTime.Now,
+                        Dispatchertime = DateTime.Now,
+                    };
+                    Db.Ado.BeginTran();
+                    _stockService.StockInfoService.AddStockEmpty(materielGroupDTO.PalletCode);
+                    _taskRepository.AddData(task);
+                    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($"鍚慦CS涓嬪彂绌烘墭鍏ュ簱浠诲姟瓒呮椂");
+                WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(ResultData.Result);
+                if (content == null) throw new Exception($"涓嬪彂绌烘墭鍏ュ簱浠诲姟WCS鏃犲搷搴�");
+                if (!content.Status) throw new Exception(content.Message);
+                #endregion
+                return WebResponseContent.Instance.OK();
+            }
+            catch (Exception ex)
+            {
+                Db.Ado.RollbackTran();
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
+        /// <summary>
         /// PDA缁勭洏
         /// 鍗曠鐗╂枡缁勭洏
         /// </summary>

--
Gitblit v1.9.3