From 27428ddcd208e10c15adead9d6b48d6843b0a0b6 Mon Sep 17 00:00:00 2001
From: xiaoyang <xiaoyang@hnkhzn.com>
Date: 星期四, 07 十一月 2024 16:15:36 +0800
Subject: [PATCH] MOM对接代码更改

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs                        |   36 ++++++++++++------
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/DB/Models/BaseEntity.cs                                      |    2 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResultTrayCellsStatus.cs                                  |   29 +++++++++++---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/MOM/RequestEqptRunDto.cs                                   |   21 ++++++++++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs |    4 +-
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/HttpHelper.cs                                      |    8 ++-
 6 files changed, 76 insertions(+), 24 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/HttpHelper.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/HttpHelper.cs
index dd89d76..7e1206a 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/HttpHelper.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/HttpHelper.cs
@@ -41,9 +41,11 @@
                     using HttpClient httpClient = new HttpClient();
                     httpClient.Timeout = new TimeSpan(0, 0, 60);
 
-                    foreach (var header in headers)
-                        httpClient.DefaultRequestHeaders.Add(header.Key, header.Value);
-
+                    if (headers != null)
+                    {
+                        foreach (var header in headers)
+                            httpClient.DefaultRequestHeaders.Add(header.Key, header.Value);
+                    }
                     result = await httpClient.PostAsync(serviceAddress, httpContent).Result.Content.ReadAsStringAsync();
                 }
                 return result;
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/MOM/RequestEqptRunDto.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/MOM/RequestEqptRunDto.cs
new file mode 100644
index 0000000..0cac9cd
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/MOM/RequestEqptRunDto.cs
@@ -0,0 +1,21 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_DTO.MOM
+{
+    public class RequestEqptRunDto : BasicDto
+    {
+        /// <summary>
+        /// 浜哄憳瀵嗙爜
+        /// </summary>
+        public string Password { get; set; }
+
+        /// <summary>
+        /// 璁惧妯″紡
+        /// </summary>
+        public string EquipmentModel { get; set; }
+    }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/DB/Models/BaseEntity.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/DB/Models/BaseEntity.cs
index 3436324..81bb1a4 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/DB/Models/BaseEntity.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/DB/Models/BaseEntity.cs
@@ -50,7 +50,7 @@
         [ImporterHeader(Name = "鍒涘缓鑰�")]
         [ExporterHeader(DisplayName = "鍒涘缓鑰�")]
         [SugarColumn(IsNullable = false, IsOnlyIgnoreUpdate = true, ColumnDescription = "鍒涘缓鑰�")]
-        public string Creater { get; set; }
+        public string Creater { get; set; } = "Systeam";
 
         /// <summary>
         /// 鍒涘缓鏃堕棿
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResultTrayCellsStatus.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResultTrayCellsStatus.cs
index 841ba73..0f1ba4f 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResultTrayCellsStatus.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResultTrayCellsStatus.cs
@@ -12,11 +12,7 @@
         /// </summary>
         public List<SerialNoDto> SerialNos { get; set; } = new List<SerialNoDto>();
 
-        /// <summary>
-        /// 缁戝畾浠g爜
-        /// </summary>
-        public string BindCode { get; set; }
-
+        public string TrayStatus { get; set; }
         /// <summary>
         /// 鏂欐灞炴�у垪琛�
         /// </summary>
@@ -38,6 +34,8 @@
         /// </summary>
         public int PositionNo { get; set; }
 
+        public string BindCode { get; set; }
+
         /// <summary>
         /// 鐢佃姱鐘舵��
         /// </summary>
@@ -57,11 +55,30 @@
         /// <summary>
         /// 宸ュ簭
         /// </summary>
-        public string ProcessCode { get; set; }
+        public List<ProcessCodes> ProcessCodes { get; set; } = new List<ProcessCodes>();
+
+        public double Capacity { get; set; }
+
 
         /// <summary>
         /// 閫傜敤鐗╂枡缂栫爜/宸ヨ壓鍨嬪彿
         /// </summary>
+        public List<ProductTypes> ProductType { get; set; } = new List<ProductTypes>();
+    }
+
+    public class ProcessCodes
+    {
+
+        /// <summary>
+        /// 宸ュ簭
+        /// </summary>
+        public string ProcessCode { get; set; }
+    }
+
+    public class ProductTypes
+    {
+
         public string ProductType { get; set; }
+
     }
 }
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
index 5ed91fb..2a36c02 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
@@ -30,8 +30,8 @@
             var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/ProcessApply", inputIson);
             if (x != null)
             {
-                var ResultProcess = JsonConvert.DeserializeObject<ResultProcessApply>(x);
-                content.OK(data: ResultProcess);
+                //var ResultProcess = JsonConvert.DeserializeObject<ResultProcessApply>(x);
+                content.OK(data: x);
             }
             LogFactory.GetLog("宸ヨ壓璺嚎鐢宠").Info(true, $"\r\r--------------------------------------");
             LogFactory.GetLog("宸ヨ壓璺嚎鐢宠").Info(true, x);
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index 4529a37..db6dbf3 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -595,10 +595,20 @@
 
         try
         {
+
+            // 璋冪敤BaseDal.QueryFirstAsync鏂规硶锛屾煡璇换鍔�
+            var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == input.PalletCode);
+            if (task != null)
+            {
+                content =  await UpdateExistingTask(input, task);
+                return content;
+            }
             // 鍒涘缓涓�涓猅rayCellsStatusDto瀵硅薄锛屽苟璧嬪��
             TrayCellsStatusDto trayCells = new TrayCellsStatusDto()
             {
-                TrayBarcode = input.PalletCode
+                Software = "WMS",
+                TrayBarcode = input.PalletCode,
+                 EquipmentCode = "ECH001-B"
             };
 
             // 璋冪敤GetTrayCellStatusAsync鏂规硶锛岃幏鍙栨暣鐩樼數鑺�
@@ -608,7 +618,7 @@
 
             // 娣诲姞缁勭洏淇℃伅
             // 灏哻ontent.Data杞崲涓篟esultTrayCellsStatus瀵硅薄
-            var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.ToString());
+            var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
             var boxing = await CreateBoxingInfo(result, input.PalletCode);
 
             // 璋冪敤GetProcessApplyAsync鏂规硶锛岃幏鍙栧伐鑹鸿矾绾�
@@ -620,8 +630,6 @@
             // 璋冪敤GetProcessResponseAsync鏂规硶锛岃幏鍙栧伐鑹哄搷搴�
             var processResponse = await GetProcessResponseAsync(process, input.Position);
 
-            // 璋冪敤BaseDal.QueryFirstAsync鏂规硶锛屾煡璇换鍔�
-            var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == input.PalletCode);
             // 濡傛灉task涓嶄负null锛屽垯璋冪敤UpdateExistingTask鏂规硶锛屾洿鏂颁换鍔★紱鍚﹀垯璋冪敤CreateNewTask鏂规硶锛屽垱寤烘柊浠诲姟
             content = task != null ? await UpdateExistingTask(input, task) : await CreateNewTask(processResponse, input);
             if (content.Status)
@@ -659,7 +667,7 @@
                 SerialNumber = serialNoObj.SerialNo,
                 OrderNo = serialNoObj.PositionNo.ToString(),
                 Status = serialNoObj.SerialNoStatus,
-                MaterielCode = result.BindCode,
+                MaterielCode = serialNoObj.BindCode,
                 Remark = result.TrayBarcodePropertys.ToJsonString(),
             }).ToList()
         };
@@ -671,6 +679,8 @@
         // 鍒涘缓涓�涓狿rocessApplyDto瀵硅薄锛屽苟璧嬪��
         return new ProcessApplyDto()
         {
+             EquipmentCode = "ECH001-B",
+             Software = "WMS",
             //WipOrderNo = result.BindCode,
             SerialNos = content.SerialNos.Select(item => new SerialNos
             {
@@ -697,13 +707,13 @@
         {
             case "1088":
                 return SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>()
-                    .Where(x => x.EquipmentType == "闄堝寲" && x.WipOrderNo == apply.WipOrderNo && x.ProductDesc == apply.ProductNo)
+                    .Where(x => x.EquipmentType == "闄堝寲" && x.WipOrderNo == apply.WipOrderNo || x.ProductDesc == apply.ProductNo)
                     .ToList();
 
             case "1339":
             case "1406":
                 return SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>()
-                    .Where(x => x.EquipmentType == "闈欑疆" && x.WipOrderNo == apply.WipOrderNo && x.ProductDesc == apply.ProductNo)
+                    .Where(x => x.EquipmentType == "闈欑疆" && x.WipOrderNo == apply.WipOrderNo || x.ProductDesc == apply.ProductNo)
                     .ToList();
 
             default:
@@ -1235,6 +1245,8 @@
                 isUpdateStock = await _stockInfoRepository.AddDataNavAsync(stock);
             }
 
+
+
             // 娣诲姞鍘嗗彶浠诲姟
             var isTaskHtyAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0;
 
@@ -1387,15 +1399,15 @@
                 // 鍒涘缓WMS浠诲姟
                 WMSTaskDTO taskDTO = new WMSTaskDTO()
                 {
-                    TaskNum = 0,
+                    TaskNum = task.TaskNum.Value,
                     Grade = 1,
-                    PalletCode = DateTime.Now.ToString("MMddHHmmss"),
+                    PalletCode = task.PalletCode,
                     RoadWay = task.Roadway,
-                    SourceAddress = input.Position,
+                    SourceAddress = task.SourceAddress,
                     TargetAddress = task.Roadway,
-                    TaskState = (int)TaskInStatusEnum.InNew,
+                    TaskState = task.TaskState.Value,
                     Id = 0,
-                    TaskType = (int)TaskInboundTypeEnum.Inbound,
+                    TaskType = task.TaskType,
                 };
                 content.OK(data: taskDTO);
             }

--
Gitblit v1.9.3