From c9dd47185d603ccd09dd567f7eb5baeaf03b2746 Mon Sep 17 00:00:00 2001
From: 陈勇 <chenyong@hnkhzn.com>
Date: 星期五, 23 二月 2024 11:11:51 +0800
Subject: [PATCH] 上传MES及MES下发工单接口

---
 代码管理/WMS/WMS_Server/WIDESEA_Comm/MES_Info/BasicSN.cs                           |   17 +
 代码管理/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Response/Mes_WorkInfo.cs             |  121 +++++++
 .gitignore                                                                     |    3 
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs                 |  169 ++++++---
 代码管理/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvTransferListPara.cs       |   27 +
 代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs         |  182 +++++-----
 代码管理/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvMoveWarehousePara.cs      |   59 +++
 代码管理/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_head.cs           |   14 
 代码管理/WMS/WMS_Server/WIDESEA_Comm/MES_Info/MES_Response.cs                      |   46 ++
 代码管理/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/partial/dt_inventory.cs |   21 +
 代码管理/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvOutWarehousePara.cs       |   23 +
 代码管理/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs         |  125 +++++++
 代码管理/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvInWarehousePara.cs        |   42 ++
 代码管理/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs                           |    8 
 代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/Taskinfo/dt_agvtask.cs         |    8 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/MESAPIAddress.cs  |   16 
 代码管理/PCS/WCS_Server/WIDESEA_Comm/MES_Info/Response/Mes_WorkInfo.cs             |   10 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs               |   94 +++++
 18 files changed, 825 insertions(+), 160 deletions(-)

diff --git a/.gitignore b/.gitignore
index a270f71..f79b0c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,6 @@
 浠g爜绠$悊/WMS/WMS_Server/WIDESEA_WebApi/appsettings.json
 *.json
 浠g爜绠$悊/PCS/WCS_Server/WIDESEA_Comm/StateEnum/LocationStateEnum.cs
+浠g爜绠$悊/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_materielinfo.cs
+浠g爜绠$悊/WMS/WMS_Server/WIDESEA_Comm/StateEnum/LocationStateEnum.cs
+浠g爜绠$悊/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_materielinfo.cs
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/MES_Info/Response/Mes_WorkInfo.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/MES_Info/Response/Mes_WorkInfo.cs"
index 6dda51a..5505f75 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/MES_Info/Response/Mes_WorkInfo.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/MES_Info/Response/Mes_WorkInfo.cs"
@@ -14,6 +14,16 @@
         public string workOrder { get; set; } 
 
         /// <summary>
+        /// 宸ュ崟绫诲瀷
+        /// </summary>
+        public string processCode { get; set; }
+
+        /// <summary>
+        /// 瀹屾垚鏁伴噺
+        /// </summary>
+        public int finishNum { get; set; }
+
+        /// <summary>
         /// 宸ュ崟鍙�
         /// </summary>
         public string jobID { get; set; }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs"
new file mode 100644
index 0000000..80a7b11
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs"
@@ -0,0 +1,125 @@
+/*
+ *浠g爜鐢辨鏋剁敓鎴�,浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩�
+ *濡傛灉鏁版嵁搴撳瓧娈靛彂鐢熷彉鍖栵紝璇峰湪浠g爜鐢熷櫒閲嶆柊鐢熸垚姝odel
+ */
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Entity.SystemModels;
+
+namespace WIDESEA_Entity.DomainModels
+{
+    [Entity(TableCnName = "搴撳瓨鏌ヨ", TableName = "dt_inventory")]
+    public partial class dt_inventory : BaseEntity
+    {
+        /// <summary>
+        ///杞﹁疆SN鍙�
+        /// </summary>
+        [Display(Name = "杞﹁疆SN鍙�")]
+        [MaxLength(255)]
+        [Column(TypeName = "nvarchar(255)")]
+        [Editable(true)]
+        public string SN { get; set; }
+
+        /// <summary>
+        ///浜у搧鍚嶇О
+        /// </summary>
+        [Display(Name = "浜у搧鍚嶇О")]
+        [MaxLength(255)]
+        [Column(TypeName = "nvarchar(255)")]
+        [Editable(true)]
+        public string Name { get; set; }
+
+        /// <summary>
+        ///浜у搧鍥惧彿
+        /// </summary>
+        [Display(Name = "浜у搧鍥惧彿")]
+        [MaxLength(255)]
+        [Column(TypeName = "nvarchar(255)")]
+        [Editable(true)]
+        public string FigureNumber { get; set; }
+
+        /// <summary>
+        ///鐔旂偧鐐夊彿
+        /// </summary>
+        [Display(Name = "鐔旂偧鐐夊彿")]
+        [MaxLength(255)]
+        [Column(TypeName = "varchar(255)")]
+        [Editable(true)]
+        public string HearthNumber { get; set; }
+
+        /// <summary>
+        ///鐐変唬鍙�
+        /// </summary>
+        [Display(Name = "鐐変唬鍙�")]
+        [MaxLength(50)]
+        [Column(TypeName = "nvarchar(50)")]
+        [Editable(true)]
+        public string HeatNumber { get; set; }
+
+        /// <summary>
+        ///閽㈠澂鍙�
+        /// </summary>
+        [Display(Name = "閽㈠澂鍙�")]
+        [Column(TypeName = "int")]
+        [Editable(true)]
+        public int? BilletNumber { get; set; }
+
+        /// <summary>
+        ///鍏ュ簱鏃堕棿
+        /// </summary>
+        [Display(Name = "鍏ュ簱鏃堕棿")]
+        [Column(TypeName = "datetime")]
+        [Editable(true)]
+        public DateTime? OnlineTime { get; set; }
+
+        /// <summary>
+        ///鎿嶄綔浜哄憳
+        /// </summary>
+        [Display(Name = "鎿嶄綔浜哄憳")]
+        [MaxLength(50)]
+        [Column(TypeName = "nvarchar(50)")]
+        [Editable(true)]
+        public string Operator { get; set; }
+
+        /// <summary>
+        ///鎻忚堪
+        /// </summary>
+        [Display(Name = "鎻忚堪")]
+        [Column(TypeName = "nvarchar(max)")]
+        [Editable(true)]
+        public string remark { get; set; }
+
+        /// <summary>
+        ///ID
+        /// </summary>
+        [Key]
+        [Display(Name = "ID")]
+        [Column(TypeName = "int")]
+        [Editable(true)]
+        [Required(AllowEmptyStrings = false)]
+        public int ID { get; set; }
+
+        /// <summary>
+        ///璐т綅缂栧彿
+        /// </summary>
+        [Display(Name = "璐т綅缂栧彿")]
+        [MaxLength(30)]
+        [Column(TypeName = "nvarchar(30)")]
+        public string stationCode { get; set; }
+
+        [Display(Name = "鍖哄煙浠g爜")]
+        [Column(TypeName = "nvarchar(15)")]
+        [Editable(true)]
+        public string area { get; set; }
+
+        [Display(Name = "宸ュ崟缂栧彿")]
+        [Column(TypeName = "nvarchar(40)")]
+        [Editable(true)]
+        public string jobID { get; set; }
+    }
+}
\ No newline at end of file
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/partial/dt_inventory.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/partial/dt_inventory.cs"
new file mode 100644
index 0000000..3e9d13f
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/System/partial/dt_inventory.cs"
@@ -0,0 +1,21 @@
+/*
+ *浠g爜鐢辨鏋剁敓鎴�,浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩�
+ *濡傛灉鏁版嵁搴撳瓧娈靛彂鐢熷彉鍖栵紝璇峰湪浠g爜鐢熷櫒閲嶆柊鐢熸垚姝odel
+ */
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Entity.SystemModels;
+
+namespace WIDESEA_Entity.DomainModels
+{
+    
+    public partial class dt_inventory
+    {
+        //姝ゅ閰嶇疆瀛楁(瀛楁閰嶇疆瑙佹model鐨勫彟涓�涓猵artial),濡傛灉琛ㄤ腑娌℃湁姝ゅ瓧娈佃鍔犱笂 [NotMapped]灞炴�э紝鍚﹀垯浼氬紓甯�
+    }
+}
\ No newline at end of file
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_head.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_head.cs"
index 55a2356..d7b76e5 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_head.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Entity/DomainModels/ToMES/dt_mes_head.cs"
@@ -72,6 +72,14 @@
         public string processCode { get; set; }
 
         /// <summary>
+        ///瀹屾垚鏁伴噺
+        /// </summary>
+        [Display(Name = "瀹屾垚鏁伴噺")]
+        [Column(TypeName = "int")]
+        [Editable(true)]
+        public int? finishNum { get; set; }
+
+        /// <summary>
         ///鐗╂枡缂栫爜
         /// </summary>
         [Display(Name = "鐗╂枡缂栫爜")]
@@ -117,9 +125,9 @@
         public string productDesc { get; set; }
 
         /// <summary>
-        ///瀹屾垚鏁伴噺
+        ///宸ュ崟鏁伴噺
         /// </summary>
-        [Display(Name = "瀹屾垚鏁伴噺")]
+        [Display(Name = "宸ュ崟鏁伴噺")]
         [Column(TypeName = "int")]
         [Editable(true)]
         public int? quantity { get; set; }
@@ -177,5 +185,7 @@
         [MaxLength(40)]
         [Column(TypeName = "nvarchar(40)")]
         public string creator { get; set; }
+
+        //public string processCode { get; set; }
     }
 }
\ No newline at end of file
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs"
index e9ff5f8..04209b7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs"
@@ -9,6 +9,7 @@
 using WIDESEA_Core.FreeDB;
 using WIDESEA_Entity.DomainModels;
 using WIDESEA_Comm;
+using static System.Collections.Specialized.BitVector32;
 
 namespace WIDESEA_WCS.JobsPart.Common
 {
@@ -27,8 +28,9 @@
             foreach (var item in stationinfos)
             {
                 //鏍规嵁涓嬫枡鍙g殑缁戝畾淇℃伅鏌ヨ瀵瑰簲宸ュ崟锛屾娴嬫宸ュ崟鏄惁宸插畬鎴�  瀹屾垚鍗冲彲灏嗗叾閫佸叆搴�
-                dt_Workinfo workinfo = workinfoRepository.FindFirst(x => x.WorkNumber == item.Number);
-                int CompeletedNum = Convert.ToInt32(workinfo.PlannedQuantity) - Convert.ToInt32(workinfo.QuantityCompletion);
+
+                dt_mes_head mesinfo = freeDB.Select<dt_mes_head>().Where(x => x.jobID == item.Number).First();
+                int CompeletedNum = Convert.ToInt32(mesinfo.quantity) - Convert.ToInt32(mesinfo.finishNum);
 
                 //鍒ゅ畾浠诲姟鏄惁宸插垱寤�//濡傚凡瀛樺湪  
                 if (freeDB.Select<dt_agvtask>().Where(x => x.agv_fromaddress == item.stationCode).Count() > 0)
@@ -36,11 +38,9 @@
 
                 if (item.quantity == 5 || CompeletedNum == 0)  //寰幆璇诲彇杞﹁疆鏁颁负5鎴栬�呰鍗曞凡瀹屾垚鏁伴噺鐨勪笅鏂欏彛    鈫掑伐鍗曚汉宸ュ叧闂殑宸ュ崟
                 {
-                    dt_stationinfo TargetLocation = GetEmptyLocation(stationinfoRepository, workinfo, item);
-
-                    if (TargetLocation != null)
+                    if (mesinfo.quantity <= 50)    //灏忎簬50浠剁洿鎺ュ嚭搴�
                     {
-                        //todo:  璋冪敤WMS鎺ュ彛鍒涘缓浠诲姟
+                        //todo 瀵绘壘鍙斁璐у鍗忔斁璐у彴
                         dt_agvtask agvtask = new dt_agvtask()
                         {
                             agv_fromaddress = item.stationCode,
@@ -49,16 +49,35 @@
                             agv_barcode = "",
                             agv_createtime = DateTime.Now,
                             agv_taskstate = TaskStatus.Created.ToString(),
-                            agv_toaddress = TargetLocation.stationCode,
+                            //agv_toaddress = ,
 
                         };
-
                         freeDB.Add(agvtask);
-                        TargetLocation.location_state = LocationStateEnum.Busy.ToString();
-                        freeDB.Update(TargetLocation);
+                    }
+                    else
+                    {
+                        dt_stationinfo TargetLocation = GetEmptyLocation(stationinfoRepository, mesinfo, item);
+
+                        if (TargetLocation != null)
+                        {
+                            //todo:  璋冪敤WMS鎺ュ彛鍒涘缓浠诲姟
+                            dt_agvtask agvtask = new dt_agvtask()
+                            {
+                                agv_fromaddress = item.stationCode,
+                                agv_id = Guid.NewGuid(),
+                                agv_grade = 0,
+                                agv_barcode = "",
+                                agv_createtime = DateTime.Now,
+                                agv_taskstate = TaskStatus.Created.ToString(),
+                                agv_toaddress = TargetLocation.stationCode,
+                            };
+
+                            freeDB.Add(agvtask);
+                            TargetLocation.location_state = LocationStateEnum.Busy.ToString();
+                            freeDB.Update(TargetLocation);
+                        }
                     }
                 }
-
             }
         }
 
@@ -69,68 +88,67 @@
         /// <param name="workinfo">璁㈠崟</param>
         /// <param name="stationinfo">涓嬫枡鍙d俊鎭�</param>
         /// <returns></returns>
-        private dt_stationinfo GetEmptyLocation(Idt_stationinfoRepository stationinfoRepository, dt_Workinfo workinfo, dt_stationinfo stationinfo)
+        private dt_stationinfo GetEmptyLocation(Idt_stationinfoRepository stationinfoRepository, dt_mes_head mesinfo, dt_stationinfo stationinfo)
         {
             //鏀捐揣浣�
             dt_stationinfo TargetLocation = null;
 
-            //鏍规嵁璁㈠崟鏁伴噺鏉ュ鎵惧搴斿簱鍖轰笖鍚岀墿鏂欑被鍨嬪簱浣�
 
-            if (workinfo.PlannedQuantity < 50)    //搴撳尯1 鐗╂枡绫诲瀷澶�
-            {
-                dt_stationinfo station = stationinfoRepository.Find(x => x.stationType == stationinfo.stationType && x.area == "1").OrderByDescending(x => x.lastUpdateTime).FirstOrDefault();
-                if (station != null)
-                {
-                    //濡傚瓨鍦ㄥ悓鐗╂枡绫诲瀷涓斿湪1琛岀殑搴撳瓨鍒欐柊鍏ュ簱鐨勭墿鏂欐斁鑷冲悓鍒� 涓嶅瓨鍦ㄥ垯瀵绘壘鏂拌搴撲綅
-                    if (station.line == 1)
-                    {
-                        TargetLocation = stationinfoRepository.Find(x => x.area == station.area && x.location_state == LocationStateEnum.Empty.ToString() && x.column == station.column && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
-                    }
-                    TargetLocation = stationinfoRepository.Find(x => x.area == station.area && x.location_state == LocationStateEnum.Empty.ToString() && x.line == 1 && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
-                }
-                else
-                {
-                    TargetLocation = stationinfoRepository.Find(x => x.area == "1" && x.location_state == LocationStateEnum.Empty.ToString() && x.line == 1 && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
-                }
-            }
-            else
-            {
-                //int quantity = Convert.ToInt32(workinfo.PlannedQuantity);
-                //string area = GetArea(quantity);
+            #region 鏍规嵁璁㈠崟鏁伴噺鏉ュ鎵惧搴斿簱鍖轰笖鍚岀墿鏂欑被鍨嬪簱浣�
+            //if (workinfo.PlannedQuantity < 50)    //搴撳尯1 鐗╂枡绫诲瀷澶�
+            //{
+            //    dt_stationinfo station = stationinfoRepository.Find(x => x.stationType == stationinfo.stationType && x.area == "1").OrderByDescending(x => x.lastUpdateTime).FirstOrDefault();
+            //    if (station != null)
+            //    {
+            //        //濡傚瓨鍦ㄥ悓鐗╂枡绫诲瀷涓斿湪1琛岀殑搴撳瓨鍒欐柊鍏ュ簱鐨勭墿鏂欐斁鑷冲悓鍒� 涓嶅瓨鍦ㄥ垯瀵绘壘鏂拌搴撲綅
+            //        if (station.line == 1)
+            //        {
+            //            TargetLocation = stationinfoRepository.Find(x => x.area == station.area && x.location_state == LocationStateEnum.Empty.ToString() && x.column == station.column && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
+            //        }
+            //        TargetLocation = stationinfoRepository.Find(x => x.area == station.area && x.location_state == LocationStateEnum.Empty.ToString() && x.line == 1 && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
+            //    }
+            //    else
+            //    {
+            //        TargetLocation = stationinfoRepository.Find(x => x.area == "1" && x.location_state == LocationStateEnum.Empty.ToString() && x.line == 1 && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
+            //    }
+            //}
+            //else
+            //{
+            //int quantity = Convert.ToInt32(workinfo.PlannedQuantity);
+            //string area = GetArea(quantity);
 
-                dt_materielinfo materielinfo = freeDB.Select<dt_materielinfo>().Where(x => x.materiel_id == stationinfo.stationType).First();
+            //dt_materielinfo materielinfo = freeDB.Select<dt_materielinfo>().Where(x => x.materiel_id == stationinfo.stationType).First();
 
-                if (materielinfo == null)
-                    throw new Exception($"鏃犳鐗╂枡绫诲瀷{stationinfo.stationType}搴撳尯");
+            //if (materielinfo == null)
+            //    throw new Exception($"鏃犳鐗╂枡绫诲瀷{stationinfo.stationType}搴撳尯");
 
-                string area = materielinfo.materiel_areaid.ToString();
+            //string area = materielinfo.materiel_areaid.ToString();
 
-                //濡傚瓨鍦ㄥ悓绫诲瀷鐗╂枡鍒欐斁缃悓琛屽簱浣� 涓嶅瓨鍦ㄥ垯鏀剧疆鏂拌鐨勭涓�鍒椾腑
-                dt_stationinfo station = stationinfoRepository.Find(x => x.stationType == stationinfo.stationType && x.area == area).OrderBy(x => x.lastUpdateTime).FirstOrDefault();
-                if (station != null)
-                {
-                    TargetLocation = stationinfoRepository.Find(x => x.area == station.area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.line == station.line).OrderBy(x => x.column).FirstOrDefault();
-                    if (TargetLocation == null)
-                    {
-                        TargetLocation = stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.column == '1').OrderBy(x => x.line).FirstOrDefault();
-                    }
-                }
-                else
-                {
-                    TargetLocation = stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.column == '1').OrderBy(x => x.line).FirstOrDefault();
-                }
+            //濡傚瓨鍦ㄥ悓绫诲瀷鐗╂枡鍒欐斁缃悓琛屽簱浣� 涓嶅瓨鍦ㄥ垯鏀剧疆鏂拌鐨勭涓�鍒椾腑
+            //dt_stationinfo station = stationinfoRepository.Find(x => x.stationType == stationinfo.stationType && x.area == area).OrderBy(x => x.lastUpdateTime).FirstOrDefault();
+            //if (station != null)
+            //{
+            //    TargetLocation = stationinfoRepository.Find(x => x.area == station.area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.line == station.line).OrderBy(x => x.column).FirstOrDefault();
+            //    if (TargetLocation == null)
+            //    {
+            //        TargetLocation = stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.column == '1').OrderBy(x => x.line).FirstOrDefault();
+            //    }
+            //}
+            //else
+            //{
+            //    TargetLocation = stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.column == '1').OrderBy(x => x.line).FirstOrDefault();
+            //}
 
-                //todo  濡傜墿鏂欏凡婊″垯鏀剧疆鍏朵粬搴撳尯
-                //if (TargetLocation == null)
-                //{
-                //    stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.column == '1').OrderBy(x => x.line).FirstOrDefault();
-                //}
-            }
-
-            if (TargetLocation == null)
-            {
-                throw new Exception("搴撲綅宸叉弧");
-            }
+            //todo  濡傜墿鏂欏凡婊″垯鏀剧疆鍏朵粬搴撳尯
+            //if (TargetLocation == null)
+            //{
+            //    stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.column == '1').OrderBy(x => x.line).FirstOrDefault();
+            //}
+            //}
+            //if (TargetLocation == null)
+            //{
+            //    throw new Exception("搴撲綅宸叉弧");
+            //}
 
             //else if (workinfo.PlannedQuantity >= 50 && workinfo.PlannedQuantity < 110)  //搴撳尯2 
             //{
@@ -148,7 +166,30 @@
             //else if(workinfo.PlannedQuantity >= 110 && workinfo.PlannedQuantity < 180)
             //{
 
-            //}
+            //} 
+            #endregion
+
+            //鏍规嵁璁㈠崟鐐夊彿/宸ュ崟鍙�/绫诲瀷
+            if (mesinfo.quantity >= 180)
+            {
+                //鏌ヨ搴撳瓨璁板綍涓槸鍚﹀瓨鍦ㄥ悓绫诲瀷/宸ュ崟/鐐夊彿鐨勮褰�  濡傛湁鍒欐斁缃悓涓�琛岋紝鏃犲垯瀵绘壘鏂板簱浣�
+                var detail = freeDB.Select<dt_mes_detail>().Where(x => x.jobID == mesinfo.jobID).First();
+                var inventory = freeDB.Select<dt_inventory>().Where(x => x.HeatNumber == detail.heatID /*&& x.*/).First();
+                if (inventory != null)
+                {
+                    int line = Convert.ToInt16(inventory.stationCode.Split("-")[0]);
+                    TargetLocation = stationinfoRepository.Find(x => x.line == line && x.location_state == LocationStateEnum.Empty.ToString() && x.area == inventory.area).FirstOrDefault();
+                }
+                else
+                {
+                    TargetLocation = stationinfoRepository.Find(x => x.area == "2" && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
+                }
+            }
+
+            if (TargetLocation == null)
+            {
+                throw new Exception("搴撲綅宸叉弧");
+            }
             return TargetLocation;
         }
 
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs"
index ae1022e..32b03ed 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs"
@@ -58,7 +58,7 @@
                 var mesinfo = freeDB.Select<dt_mes_head>().Where(x => x.jobID == workInfo.jobID).First();
                 if (mesinfo != null)
                 {
-                    return content.Error($"宸ュ崟鍙穥mesinfo.jobID}宸插瓨鍦�,璇锋牳瀹炲悗鍦ㄥ彂閫侊紒");
+                    return content.Error($"宸ュ崟鍙穥mesinfo.jobID}宸插瓨鍦�,璇锋牳瀹炲悗閲嶆柊鍙戦�侊紒");
                 }
 
                 Guid head = Guid.NewGuid();
@@ -81,7 +81,9 @@
                     reqIDLineNo = workInfo.reqIDLineNo,
                     stackNoRange = workInfo.stackNoRange,
                     typeID = workInfo.typeID,
-                    workOrder = workInfo.workOrder
+                    workOrder = workInfo.workOrder,
+                    processCode = workInfo.processCode,
+                    finishNum = 0
                 };
                 freeDB.Add(mes_Head);
 
@@ -103,7 +105,7 @@
             }
             catch (Exception ex)
             {
-                return content.Error(ex.Message); 
+                return content.Error(ex.Message);
             }
         }
     }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/BasicSN.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/BasicSN.cs"
new file mode 100644
index 0000000..843d6ce
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/BasicSN.cs"
@@ -0,0 +1,17 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Comm.MES_Info
+{
+    public class BasicSN
+    {
+        public class detail
+        {
+            public string sn { get; set; }
+        }
+    }
+   
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/MES_Response.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/MES_Response.cs"
new file mode 100644
index 0000000..06317ac
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/MES_Response.cs"
@@ -0,0 +1,46 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Comm.MES_Info
+{
+    public class MES_Response
+    {
+        /// <summary>
+        /// 鐘舵�佺爜
+        /// </summary>
+        public string code { get; set; }
+
+        /// <summary>
+        /// 娑堟伅
+        /// </summary>
+        public string message { get; set; }
+
+        /// <summary>
+        /// 鍝嶅簲鏁版嵁
+        /// </summary>
+        public string data { get; set; }
+
+        /// <summary>
+        /// 鍫嗘爤娑堟伅
+        /// </summary>
+        public string stackMsg { get; set; }
+
+        /// <summary>
+        /// 鎵╁睍
+        /// </summary>
+        public string Extras { get; set; }
+
+        /// <summary>
+        /// 绫诲瀷
+        /// </summary>
+        public string Type { get; set; }
+
+        /// <summary>
+        /// 鏃堕棿
+        /// </summary>
+        public DateTime Time { get; set; }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvInWarehousePara.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvInWarehousePara.cs"
new file mode 100644
index 0000000..c0dbb10
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvInWarehousePara.cs"
@@ -0,0 +1,42 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Comm.MES_Info.Request
+{
+    public class agvInWarehousePara:BasicSN
+    {
+        /// <summary>
+        /// 宸ュ崟缂栧彿
+        /// </summary>
+        public string JobID { get; set; }
+
+        /// <summary>
+        /// 杞﹁疆淇℃伅
+        /// </summary>
+        public List<detail> details { get; set; }
+
+        /// <summary>
+        /// 搴撴埧鍚嶇О
+        /// </summary>
+        public string warehouseName { get; set; }
+
+        /// <summary>
+        /// 鍖轰綅鍚嶇О
+        /// </summary>
+        public string zoneID { get; set; }
+
+        /// <summary>
+        /// 鍨涗綅鍚嶇О
+        /// </summary>
+        public string stackID { get; set; }
+
+        /// <summary>
+        /// 灞傚彿
+        /// </summary>
+        public int? layerNo { get; set; }
+
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvMoveWarehousePara.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvMoveWarehousePara.cs"
new file mode 100644
index 0000000..018e7ce
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvMoveWarehousePara.cs"
@@ -0,0 +1,59 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Comm.MES_Info.Request
+{
+    /// <summary>
+    /// 杞﹁疆绉诲簱鍙傛暟(搴撳唴绉诲簱)
+    /// </summary>
+    public class agvMoveWarehousePara : BasicSN
+    {
+        /// <summary>
+        /// 杞﹁疆SN
+        /// </summary>
+        public List<detail> details { get; set; }
+
+        /// <summary>
+        /// 婧愬簱鎴垮悕绉�
+        /// </summary>
+        public string fromWarehouseName { get; set; }
+
+        /// <summary>
+        /// 婧愬尯浣嶅悕绉�
+        /// </summary>
+        public string fromZoneID { get; set; }
+
+        /// <summary>
+        /// 婧愬灈浣嶅悕绉�
+        /// </summary>
+        public string fromStackID { get; set; }
+
+        /// <summary>
+        /// 婧愬眰鍙�
+        /// </summary>
+        public string fromLayerNo { get; set; }
+
+        /// <summary>
+        /// 鐩爣搴撴埧鍚嶇О
+        /// </summary>
+        public string toWarehouseName { get; set;}
+
+        /// <summary>
+        /// 鐩爣鍖轰綅鍚嶇О
+        /// </summary>
+        public string toZoneID { get; set;}
+
+        /// <summary>
+        /// 鐩爣鍨涗綅鍚嶇О
+        /// </summary>
+        public string toStackID { get; set;}
+
+        /// <summary>
+        /// 鐩爣灞傚彿
+        /// </summary>
+        public string toLayerNo { get; set;}
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvOutWarehousePara.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvOutWarehousePara.cs"
new file mode 100644
index 0000000..ca20fd7
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvOutWarehousePara.cs"
@@ -0,0 +1,23 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Comm.MES_Info
+{
+    public class agvOutWarehousePara : BasicSN
+    {
+        /// <summary>
+        /// 宸ュ崟鍙�
+        /// </summary>
+        public string JobID { get; set; }
+
+        /// <summary>
+        /// 杞﹁疆
+        /// </summary>
+        public List<detail> details { get; set; }
+    }
+
+    
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvTransferListPara.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvTransferListPara.cs"
new file mode 100644
index 0000000..a643e3e
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvTransferListPara.cs"
@@ -0,0 +1,27 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Comm.MES_Info.Request
+{
+    public class agvTransferListPara : BasicSN
+    {
+        public string transferListID { get; set; }
+
+        public string materialCode { get; set; }
+
+        public string drawingNoVer { get; set; }
+
+        public string fromWarehouse { get; set; }
+        public string toWarehouse { get; set; }
+        public string Operator { get; set; }
+        public string updateTime { get; set; }
+        /// <summary>
+        /// 杞﹁疆淇℃伅
+        /// </summary>
+        public List<detail> details { get; set; }
+
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Response/Mes_WorkInfo.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Response/Mes_WorkInfo.cs"
new file mode 100644
index 0000000..d8e5971
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Response/Mes_WorkInfo.cs"
@@ -0,0 +1,121 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Runtime.CompilerServices;
+using System.Text;
+
+namespace WIDESEA_Common.Response
+{
+    public class Mes_WorkInfo
+    {
+        /// <summary>
+        /// 宸ヤ綔浠ゅ彿
+        /// </summary>
+        public string workOrder { get; set; } 
+
+        /// <summary>
+        /// 宸ュ崟鍙�
+        /// </summary>
+        public string jobID { get; set; }
+
+        /// <summary>
+        /// 闇�姹傚崟鍙�
+        /// </summary>
+        public string reqID { get; set; }
+
+        /// <summary>
+        /// 闇�姹傚崟鍙�
+        /// </summary>
+        public string reqIDLineNo { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡缂栫爜
+        /// </summary>
+        public string materialCode { get; set; }
+
+        /// <summary>
+        /// 鍥惧彿
+        /// </summary>
+        public string drawingNo { get; set; }
+
+        /// <summary>
+        /// 鎶�鏈姸鎬�
+        /// </summary>
+        public string drawingNoVer { get; set; }
+
+        /// <summary>
+        /// 浜у搧鍚�
+        /// </summary>
+        public string productName { get; set; }
+
+        /// <summary>
+        /// 浜у搧鎻忚堪
+        /// </summary>
+        public string productDesc { get; set; }
+
+        /// <summary>
+        /// 璁″垝鏁伴噺
+        /// </summary>
+        public int? quantity { get; set; }
+
+        /// <summary>
+        /// 杞瀷浠g爜
+        /// </summary>
+        //[AllowNull]
+        public string typeID { get; set; }
+
+        /// <summary>
+        /// 鎵撳寘鏁伴噺
+        /// </summary>
+        public int? stackNoRange { get; set; }
+
+        /// <summary>
+        /// 杞緞鍋忓樊
+        /// </summary>
+        public decimal? maxDiameterDiff { get; set; }
+
+        /// <summary>
+        /// 璁″垝寮�濮嬫椂闂�
+        /// </summary>
+        public DateTime? expectedStartTime { get; set; }
+
+        /// <summary>
+        /// 璁″垝缁撴潫鏃堕棿
+        /// </summary>
+        public DateTime? expectedFinishTime { get; set; }
+
+        /// <summary>
+        /// 杞﹁疆淇℃伅闆嗗悎
+        /// </summary>
+        public List<detail> details { get; set; }
+    }
+
+    public class detail
+    {
+        /// <summary>
+        /// 宸ュ崟缂栧彿
+        /// </summary>
+        public string jobID { get; set; }
+
+        /// <summary>
+        /// 鐐変唬鍙�
+        /// </summary>
+        public string heatID { get; set; }
+
+        /// <summary>
+        ///閽㈠澂鍙�
+        /// </summary>
+        public int? billetID { get; set; }
+
+        /// <summary>
+        /// 杞﹁疆SN鍙�
+        /// </summary>
+        public string SN { get; set; }
+
+        /// <summary>
+        /// 鐑鐞嗘壒娆�
+        /// </summary>
+        public string heatBatchID { get; set; }
+    }
+
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs"
index 39d05f2..80a7b11 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_inventory.cs"
@@ -13,105 +13,113 @@
 
 namespace WIDESEA_Entity.DomainModels
 {
-    [Entity(TableCnName = "搴撳瓨鏌ヨ",TableName = "dt_inventory")]
-    public partial class dt_inventory:BaseEntity
+    [Entity(TableCnName = "搴撳瓨鏌ヨ", TableName = "dt_inventory")]
+    public partial class dt_inventory : BaseEntity
     {
         /// <summary>
-       ///杞﹁疆SN鍙�
-       /// </summary>
-       [Display(Name ="杞﹁疆SN鍙�")]
-       [MaxLength(255)]
-       [Column(TypeName="nvarchar(255)")]
-       [Editable(true)]
-       public string SN { get; set; }
+        ///杞﹁疆SN鍙�
+        /// </summary>
+        [Display(Name = "杞﹁疆SN鍙�")]
+        [MaxLength(255)]
+        [Column(TypeName = "nvarchar(255)")]
+        [Editable(true)]
+        public string SN { get; set; }
 
-       /// <summary>
-       ///浜у搧鍚嶇О
-       /// </summary>
-       [Display(Name ="浜у搧鍚嶇О")]
-       [MaxLength(255)]
-       [Column(TypeName="nvarchar(255)")]
-       [Editable(true)]
-       public string Name { get; set; }
+        /// <summary>
+        ///浜у搧鍚嶇О
+        /// </summary>
+        [Display(Name = "浜у搧鍚嶇О")]
+        [MaxLength(255)]
+        [Column(TypeName = "nvarchar(255)")]
+        [Editable(true)]
+        public string Name { get; set; }
 
-       /// <summary>
-       ///浜у搧鍥惧彿
-       /// </summary>
-       [Display(Name ="浜у搧鍥惧彿")]
-       [MaxLength(255)]
-       [Column(TypeName="nvarchar(255)")]
-       [Editable(true)]
-       public string FigureNumber { get; set; }
+        /// <summary>
+        ///浜у搧鍥惧彿
+        /// </summary>
+        [Display(Name = "浜у搧鍥惧彿")]
+        [MaxLength(255)]
+        [Column(TypeName = "nvarchar(255)")]
+        [Editable(true)]
+        public string FigureNumber { get; set; }
 
-       /// <summary>
-       ///鐔旂偧鐐夊彿
-       /// </summary>
-       [Display(Name ="鐔旂偧鐐夊彿")]
-       [MaxLength(255)]
-       [Column(TypeName="varchar(255)")]
-       [Editable(true)]
-       public string HearthNumber { get; set; }
+        /// <summary>
+        ///鐔旂偧鐐夊彿
+        /// </summary>
+        [Display(Name = "鐔旂偧鐐夊彿")]
+        [MaxLength(255)]
+        [Column(TypeName = "varchar(255)")]
+        [Editable(true)]
+        public string HearthNumber { get; set; }
 
-       /// <summary>
-       ///鐐変唬鍙�
-       /// </summary>
-       [Display(Name ="鐐変唬鍙�")]
-       [MaxLength(50)]
-       [Column(TypeName="nvarchar(50)")]
-       [Editable(true)]
-       public string HeatNumber { get; set; }
+        /// <summary>
+        ///鐐変唬鍙�
+        /// </summary>
+        [Display(Name = "鐐変唬鍙�")]
+        [MaxLength(50)]
+        [Column(TypeName = "nvarchar(50)")]
+        [Editable(true)]
+        public string HeatNumber { get; set; }
 
-       /// <summary>
-       ///閽㈠澂鍙�
-       /// </summary>
-       [Display(Name ="閽㈠澂鍙�")]
-       [Column(TypeName="int")]
-       [Editable(true)]
-       public int? BilletNumber { get; set; }
+        /// <summary>
+        ///閽㈠澂鍙�
+        /// </summary>
+        [Display(Name = "閽㈠澂鍙�")]
+        [Column(TypeName = "int")]
+        [Editable(true)]
+        public int? BilletNumber { get; set; }
 
-       /// <summary>
-       ///鍏ュ簱鏃堕棿
-       /// </summary>
-       [Display(Name ="鍏ュ簱鏃堕棿")]
-       [Column(TypeName="datetime")]
-       [Editable(true)]
-       public DateTime? OnlineTime { get; set; }
+        /// <summary>
+        ///鍏ュ簱鏃堕棿
+        /// </summary>
+        [Display(Name = "鍏ュ簱鏃堕棿")]
+        [Column(TypeName = "datetime")]
+        [Editable(true)]
+        public DateTime? OnlineTime { get; set; }
 
-       /// <summary>
-       ///鎿嶄綔浜哄憳
-       /// </summary>
-       [Display(Name ="鎿嶄綔浜哄憳")]
-       [MaxLength(50)]
-       [Column(TypeName="nvarchar(50)")]
-       [Editable(true)]
-       public string Operator { get; set; }
+        /// <summary>
+        ///鎿嶄綔浜哄憳
+        /// </summary>
+        [Display(Name = "鎿嶄綔浜哄憳")]
+        [MaxLength(50)]
+        [Column(TypeName = "nvarchar(50)")]
+        [Editable(true)]
+        public string Operator { get; set; }
 
-       /// <summary>
-       ///鎻忚堪
-       /// </summary>
-       [Display(Name ="鎻忚堪")]
-       [Column(TypeName="nvarchar(max)")]
-       [Editable(true)]
-       public string remark { get; set; }
+        /// <summary>
+        ///鎻忚堪
+        /// </summary>
+        [Display(Name = "鎻忚堪")]
+        [Column(TypeName = "nvarchar(max)")]
+        [Editable(true)]
+        public string remark { get; set; }
 
-       /// <summary>
-       ///ID
-       /// </summary>
-       [Key]
-       [Display(Name ="ID")]
-       [Column(TypeName="int")]
-       [Editable(true)]
-       [Required(AllowEmptyStrings=false)]
-       public int ID { get; set; }
+        /// <summary>
+        ///ID
+        /// </summary>
+        [Key]
+        [Display(Name = "ID")]
+        [Column(TypeName = "int")]
+        [Editable(true)]
+        [Required(AllowEmptyStrings = false)]
+        public int ID { get; set; }
 
-       /// <summary>
-       ///璐т綅缂栧彿
-       /// </summary>
-       [Display(Name ="璐т綅缂栧彿")]
-       [MaxLength(30)]
-       [Column(TypeName="nvarchar(30)")]
-       public string stationCode { get; set; }
+        /// <summary>
+        ///璐т綅缂栧彿
+        /// </summary>
+        [Display(Name = "璐т綅缂栧彿")]
+        [MaxLength(30)]
+        [Column(TypeName = "nvarchar(30)")]
+        public string stationCode { get; set; }
 
-       
+        [Display(Name = "鍖哄煙浠g爜")]
+        [Column(TypeName = "nvarchar(15)")]
+        [Editable(true)]
+        public string area { get; set; }
+
+        [Display(Name = "宸ュ崟缂栧彿")]
+        [Column(TypeName = "nvarchar(40)")]
+        [Editable(true)]
+        public string jobID { get; set; }
     }
 }
\ No newline at end of file
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/Taskinfo/dt_agvtask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/Taskinfo/dt_agvtask.cs"
index 9d4b5ba..3255702 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/Taskinfo/dt_agvtask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/Taskinfo/dt_agvtask.cs"
@@ -206,12 +206,12 @@
         public DateTime? agv_completeBeginTime { get; set; }
 
         /// <summary>
-        ///
+        ///宸ュ崟鍙�
         /// </summary>
-        [Display(Name = "unitag")]
-        [Column(TypeName = "uniqueidentifier")]
+        [Display(Name = "宸ュ崟鍙�")]
+        [Column(TypeName = "nvarchar(40)")]
         [Editable(true)]
-        public Guid? unitag { get; set; }
+        public string jobID { get; set; }
 
         /// <summary>
         ///杞﹁疆SN鍙�
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs"
new file mode 100644
index 0000000..1d8a2e8
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs"
@@ -0,0 +1,94 @@
+锘縰sing Newtonsoft.Json;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using WIDESEA_Comm.MES_Info;
+using WIDESEA_Comm.MES_Info.Request;
+using WIDESEA_Common;
+using WIDESEA_Entity.DomainModels;
+using WIDESEA_Entity.ToAGV;
+using static WIDESEA_Comm.MES_Info.BasicSN;
+
+namespace WIDESEA_WMS.Common.AGVTask
+{
+    public class HandleTask_Mes
+    {
+        public void UploadMESInfo(dt_agvtask task)
+        {
+            try
+            {
+                object obj = new object();  //涓婁紶MES鏁版嵁
+                string ActionName = "";  //璋冪敤MES鏂规硶鍚�
+                List<detail> list = new List<detail>(); //杞﹁疆淇℃伅
+                if (task == null)
+                {
+                    throw new Exception("鏃犱换鍔℃暟鎹�");
+                }
+                foreach (var item in task.bindSN.Split(","))
+                {
+                    detail detail = new detail();
+                    detail.sn = item;
+                    list.Add(detail);
+                }
+
+                if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Outbound.ToString() || task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceOutbound.ToString())
+                {
+                    agvOutWarehousePara outWarehousePara = new agvOutWarehousePara()
+                    {
+                        JobID = task.jobID,
+                        details = list
+                    };
+                    obj = outWarehousePara;
+                    ActionName = "agvOutWarehouse";
+                }
+                else if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Inbound.ToString() || task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceInbound.ToString())
+                {
+                    agvInWarehousePara inWarehousePara = new agvInWarehousePara()
+                    {
+                        details = list,
+                        JobID = task.jobID,
+                        layerNo = 1,
+                        stackID = task.agv_barcode,
+                        warehouseName = "Agv搴�",
+                        zoneID = task.agv_toaddress,
+                    };
+                    obj = inWarehousePara;
+                    ActionName = "agvInWarehouse";
+                }
+                else if (task.agv_tasktype == "Transfer")  //绉诲簱鍖哄垎  搴撳唴绉诲簱/澶栧崗绉诲簱
+                {
+                    agvMoveWarehousePara moveWarehousePara = new agvMoveWarehousePara()
+                    {
+                        details = list,
+                        fromLayerNo = "1",
+                        fromStackID = "",
+                        fromWarehouseName = "Agv搴�",
+                        fromZoneID = task.agv_fromaddress,
+                        toLayerNo = "1",
+                        toStackID = "",
+                        toWarehouseName = "Agv搴�",
+                        toZoneID = task.agv_toaddress,
+                    };
+                    obj = moveWarehousePara;
+                    ActionName = "agvMoveWarehouse";
+                }
+                //else if (task.agv_tasktype == "Transfer")
+                //{
+
+                //}
+
+                var postJson = JsonConvert.SerializeObject(obj);
+                string mesData = Request.RequestData(postJson, MESAPIAddress.IPAddress_MES + ActionName);
+                var requestMes = JsonConvert.DeserializeObject<MES_Response>(mesData);
+
+                if (requestMes.code == "200" && requestMes.Type == "success")
+                {
+                    //鏃ュ織璁板綍涓婁紶鏁版嵁鎴愬姛
+                }
+
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/MESAPIAddress.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/MESAPIAddress.cs"
new file mode 100644
index 0000000..727cb5b
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/MESAPIAddress.cs"
@@ -0,0 +1,16 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_WMS.Common
+{
+    public class MESAPIAddress
+    {
+        public const string IPAddress_MES = "http://10.13.3.102:80/api/agv/";
+
+
+
+    }
+}

--
Gitblit v1.9.3