From 96258536e0b40f0e7ee5c36549921d7ce3674ab1 Mon Sep 17 00:00:00 2001
From: 陈勇 <chenyong@hnkhzn.com>
Date: 星期二, 12 三月 2024 14:47:54 +0800
Subject: [PATCH] 后端PDA程序代码

---
 代码管理/WMS/WMS_Server/WIDESEA_Comm/MES_Info/BasicSN.cs                         |    3 
 .gitignore                                                                   |   14 +
 代码管理/WMS/WMS_Server/WIDESEA_WMS/ToMes/SendEpmtyTask.cs                       |  110 +++++++++++
 代码管理/WMS/WMS_Server/WIDESEA_Comm/MES_Info/Request/agvTransferListPara.cs     |   18 +
 代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_MES_Info.cs         |  234 +++++++++++++++++++++++
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask_Mes.cs             |    2 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs                    |   75 +++++++
 代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/partial/VV_MES_Info.cs |   12 +
 代码管理/WMS/WMS_Server/WIDESEA_WMS/ToMes/agvTransferList.cs                     |   83 ++++++++
 代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/ToWms/ToWMSController.cs      |   35 +++
 10 files changed, 581 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index f79b0c7..21e7224 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,17 @@
 浠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
+浠g爜绠$悊/WMS/WMS_Server/.editorconfig
+浠g爜绠$悊/PCS/WCS_Server/.editorconfig
+浠g爜绠$悊/PCS/WCS_Server/WIDESEA_System/WIDESEA_System.csproj
+*.sln
+浠g爜绠$悊/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json
+浠g爜绠$悊/WMS/WMS_Server/WIDESEA_Comm/StateEnum/LocationStateEnum.cs
+浠g爜绠$悊/WMS/WMS_Server/WIDESEA_Entity/DomainModels/System/dt_materielinfo.cs
+浠g爜绠$悊/WMS/WMS_Server/WIDESEA_System/WIDESEA_System.csproj
+浠g爜绠$悊/WMS/WMS_Server/WIDESEA_WebApi/appsettings.json
+浠g爜绠$悊/WMS/WMS_Server/WIDESEA_WMS/WIDESEA_WMS.csproj
+浠g爜绠$悊/WMS/WMS_Server/WIDESEA_WMSServe.sln
+浠g爜绠$悊/PCS/WCS_Server/WIDESEA_System/WIDESEA_System.csproj
+浠g爜绠$悊/PCS/WCS_Server/WIDESEA_System/WIDESEA_System.csproj
+*.csproj
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"
index 843d6ce..f47ad93 100644
--- "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"
@@ -6,6 +6,9 @@
 
 namespace WIDESEA_Comm.MES_Info
 {
+    /// <summary>
+    /// 鐢ㄤ簬涓婁紶MES淇℃伅鐨勮溅杞俊鎭�
+    /// </summary>
     public class BasicSN
     {
         public class detail
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"
index 7a412cc..420ee9c 100644
--- "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"
@@ -6,36 +6,46 @@
 
 namespace WIDESEA_Comm.MES_Info.Request
 {
+    /// <summary>
+    /// 杞﹁疆绉诲簱浜ゆ帴锛岀敱AGV搴撲氦鎺ョ粰姣涜疆搴撴垨鑰呭叾浠栧簱鎴�
+    /// </summary>
     public class agvTransferListPara : BasicSN
     {
         /// <summary>
-        /// 杞Щ鍗曞彿
+        /// 绉诲簱浜ゆ帴鍗曞彿
         /// </summary>
         public string transferListID { get; set; }
+
         /// <summary>
-        /// 杞﹁疆鐗╂枡缂栫爜
+        /// 杞﹁疆鐗╂枡缂栧彿
         /// </summary>
         public string materialCode { get; set; }
+
         /// <summary>
         /// 鎶�鏈姸鎬�
         /// </summary>
         public string drawingNoVer { get; set; }
+
         /// <summary>
-        /// 婧愬簱鎴垮悕绉�
+        /// 鍘熷簱鎴垮悕绉�
         /// </summary>
         public string fromWarehouse { get; set; }
+
         /// <summary>
         /// 鐩爣搴撴埧鍚嶇О
         /// </summary>
         public string toWarehouse { get; set; }
+        
         /// <summary>
         /// 鎿嶄綔浜哄憳
         /// </summary>
         public string Operator { get; set; }
+        
         /// <summary>
         /// 鎿嶄綔鏃堕棿
         /// </summary>
-        public DateTime updateTime { get; set; }
+        public string updateTime { get; set; }
+
         /// <summary>
         /// 杞﹁疆淇℃伅
         /// </summary>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_MES_Info.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_MES_Info.cs"
new file mode 100644
index 0000000..ada96fe
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/VV_MES_Info.cs"
@@ -0,0 +1,234 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Entity.DomainModels
+{
+    public partial class VV_MES_Info
+    {
+        /// <summary>
+        ///ID
+        /// </summary>
+        [Key]
+        [Display(Name = "mes_id")]
+        [Column(TypeName = "uniqueidentifier")]
+        [Required(AllowEmptyStrings = false)]
+        public Guid mes_id { get; set; }
+
+        /// <summary>
+        ///宸ヤ綔浠ゅ彿
+        /// </summary>
+        [Display(Name = "宸ヤ綔浠ゅ彿")]
+        [MaxLength(50)]
+        [Column(TypeName = "nvarchar(50)")]
+        [Editable(true)]
+        public string workOrder { get; set; }
+
+        /// <summary>
+        ///宸ュ崟缂栧彿
+        /// </summary>
+        [Display(Name = "宸ュ崟缂栧彿")]
+        [MaxLength(40)]
+        [Column(TypeName = "nvarchar(40)")]
+        [Editable(true)]
+        public string jobID { get; set; }
+
+        /// <summary>
+        ///闇�姹傚崟鍙�
+        /// </summary>
+        [Display(Name = "闇�姹傚崟鍙�")]
+        [MaxLength(40)]
+        [Column(TypeName = "nvarchar(40)")]
+        [Editable(true)]
+        public string reqID { get; set; }
+
+        /// <summary>
+        ///闇�姹傚崟鍙疯鍙�
+        /// </summary>
+        [Display(Name = "闇�姹傚崟鍙疯鍙�")]
+        [MaxLength(20)]
+        [Column(TypeName = "nvarchar(20)")]
+        [Editable(true)]
+        public string reqIDLineNo { get; set; }
+
+        /// <summary>
+        ///宸ュ崟绫诲瀷 (17-鏈哄姞宸� 28-妫�娴嬬嚎)
+        /// </summary>
+        [Display(Name = "宸ュ崟绫诲瀷")]
+        [MaxLength(20)]
+        [Column(TypeName = "nvarchar(20)")]
+        [Editable(true)]
+        public string processCode { get; set; }
+
+        /// <summary>
+        ///瀹屾垚鏁伴噺
+        /// </summary>
+        [Display(Name = "瀹屾垚鏁伴噺")]
+        [Column(TypeName = "int")]
+        [Editable(true)]
+        public int? finishNum { get; set; }
+
+        /// <summary>
+        ///鐗╂枡缂栫爜
+        /// </summary>
+        [Display(Name = "鐗╂枡缂栫爜")]
+        [MaxLength(20)]
+        [Column(TypeName = "nvarchar(20)")]
+        [Editable(true)]
+        public string materialCode { get; set; }
+
+        /// <summary>
+        ///鍥惧彿
+        /// </summary>
+        [Display(Name = "鍥惧彿")]
+        [MaxLength(20)]
+        [Column(TypeName = "nvarchar(20)")]
+        [Editable(true)]
+        public string drawingNo { get; set; }
+
+        /// <summary>
+        ///鎶�鏈姸鎬�
+        /// </summary>
+        [Display(Name = "鎶�鏈姸鎬�")]
+        [MaxLength(10)]
+        [Column(TypeName = "nvarchar(10)")]
+        [Editable(true)]
+        public string drawingNoVer { get; set; }
+
+        /// <summary>
+        ///浜у搧鍚嶇О
+        /// </summary>
+        [Display(Name = "浜у搧鍚嶇О")]
+        [MaxLength(40)]
+        [Column(TypeName = "nvarchar(40)")]
+        [Editable(true)]
+        public string productName { get; set; }
+
+        /// <summary>
+        ///浜у搧鎻忚堪
+        /// </summary>
+        [Display(Name = "浜у搧鎻忚堪")]
+        [Column(TypeName = "nvarchar(200)")]
+        [Editable(true)]
+        [MaxLength(200)]
+        public string productDesc { get; set; }
+
+        /// <summary>
+        ///宸ュ崟鏁伴噺
+        /// </summary>
+        [Display(Name = "宸ュ崟鏁伴噺")]
+        [Column(TypeName = "int")]
+        [Editable(true)]
+        public int? quantity { get; set; }
+
+        /// <summary>
+        ///杞瀷浠g爜
+        /// </summary>
+        [Display(Name = "杞瀷浠g爜")]
+        [MaxLength(20)]
+        [Column(TypeName = "nvarchar(20)")]
+        [Editable(true)]
+        public string typeID { get; set; }
+
+        /// <summary>
+        ///鎵撳寘鏁伴噺
+        /// </summary>
+        [Display(Name = "鎵撳寘鏁伴噺")]
+        [Column(TypeName = "int")]
+        [Editable(true)]
+        public int? stackNoRange { get; set; }
+
+        /// <summary>
+        ///杞緞鍋忓樊
+        /// </summary>
+        [Display(Name = "杞緞鍋忓樊")]
+        [Column(TypeName = "nmberic(18,2)")]
+        [Editable(true)]
+        public decimal? maxDiameterDiff { get; set; }
+
+        /// <summary>
+        ///宸ュ崟寮�濮嬫椂闂�
+        /// </summary>
+        [Display(Name = "宸ュ崟寮�濮嬫椂闂�")]
+        [Column(TypeName = "datetime")]
+        public DateTime? expectedStartTime { get; set; }
+
+        /// <summary>
+        ///宸ュ崟缁撴潫鏃堕棿
+        /// </summary>
+        [Display(Name = "宸ュ崟缁撴潫鏃堕棿")]
+        [Column(TypeName = "datetime")]
+        public DateTime? expectedFinishTime { get; set; }
+
+        /// <summary>
+        ///鍒涘缓鏃堕棿
+        /// </summary>
+        [Display(Name = "鍒涘缓鏃堕棿")]
+        [Column(TypeName = "datetime")]
+        public DateTime CreateTime { get; set; }
+
+        /// <summary>
+        ///鍒涘缓鑰�
+        /// </summary>
+        [Display(Name = "鍒涘缓鑰�")]
+        [MaxLength(40)]
+        [Column(TypeName = "nvarchar(40)")]
+        public string creator { get; set; }
+
+        ///// <summary>
+        /////宸ュ崟鏄庣粏ID
+        ///// </summary>
+        //[Key]
+        //[Display(Name = "mes_detail_id")]
+        //[Column(TypeName = "uniqueidentifier")]
+        //[Required(AllowEmptyStrings = false)]
+        //public Guid mes_detail_id { get; set; }
+
+        ///// <summary>
+        /////宸ュ崟澶磋〃ID
+        ///// </summary>
+        //[Display(Name = "mes_headID")]
+        //[Column(TypeName = "uniqueidentifier")]
+        //[Required(AllowEmptyStrings = false)]
+        //public Guid mes_headID { get; set; }
+
+        /// <summary>
+        ///鐐変唬鍙�
+        /// </summary>
+        [Display(Name = "鐐変唬鍙�")]
+        [MaxLength(50)]
+        [Column(TypeName = "nvarchar(50)")]
+        [Editable(true)]
+        public string heatID { get; set; }
+
+        /// <summary>
+        ///閽㈠澂鍙�
+        /// </summary>
+        [Display(Name = "閽㈠澂鍙�")]
+        [Column(TypeName = "int")]
+        [Editable(true)]
+        public int? billetID { get; set; }
+
+        /// <summary>
+        ///杞﹁疆SN鍙�
+        /// </summary>
+        [Display(Name = "杞﹁疆SN鍙�")]
+        [MaxLength(50)]
+        [Column(TypeName = "nvarchar(50)")]
+        [Editable(true)]
+        public string SN { get; set; }
+
+        /// <summary>
+        ///鐑鐞嗘壒娆�
+        /// </summary>
+        [Display(Name = "鐑鐞嗘壒娆�")]
+        [MaxLength(30)]
+        [Column(TypeName = "varchar(30)")]
+        [Editable(true)]
+        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/ToMES/partial/VV_MES_Info.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/partial/VV_MES_Info.cs"
new file mode 100644
index 0000000..b60bbe2
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/ToMES/partial/VV_MES_Info.cs"
@@ -0,0 +1,12 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Entity.DomainModels
+{
+    public partial class VV_MES_Info
+    {
+    }
+}
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"
index 69994bc..35b8dcb 100644
--- "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"
@@ -102,7 +102,7 @@
                         fromWarehouse = "AGV搴�",
                         toWarehouse = "姣涜疆搴�",
                         Operator = task.agv_userid,
-                        updateTime = task.agv_createtime
+                        updateTime = task.agv_createtime.ToString(),
                     };
                     obj = agvTransferListPara;
                     ActionName = "agvTransferList";
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs"
new file mode 100644
index 0000000..c2252b6
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/OutsourceInbound.cs"
@@ -0,0 +1,75 @@
+锘縰sing Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using WIDESEA_Comm;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Comm.MES_Info;
+using WIDESEA_Comm.MES_Info.Request;
+using WIDESEA_Common;
+using WIDESEA_Core.EFDbContext;
+using WIDESEA_Core.ManageUser;
+using WIDESEA_Core.Utilities;
+using WIDESEA_Entity.DomainModels;
+using WIDESEA_Entity.DomainModels.Mes;
+using WIDESEA_WMS.Common;
+using WIDESEA_WMS.IRepositories;
+using WIDESEA_WMS.Repositories;
+using static WIDESEA_Comm.MES_Info.BasicSN;
+
+namespace WIDESEA_WMS
+{
+    public partial class ToMesServer
+    {
+        /// <summary>
+        /// 澶栧崗鍏ュ簱(妫�娴嬩笂鏂�)
+        /// </summary>
+        /// <param name="saveModel"></param>
+        /// <returns></returns>
+        public WebResponseContent OutsourceInbound(SaveModel saveModel)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                string stationNo = saveModel.MainData["stationNo"].ToString();  //缂撳瓨鏋剁紪鍙�
+                string user = saveModel.MainData["creator"].ToString();
+                string sn = saveModel.MainData["dataSN"].ToString();   //杞﹁疆SN鍙�
+
+                int i = 1;  //杞﹁疆鏁伴噺
+                foreach (var item in sn.Split(","))
+                {
+                    if(item!= null)
+                    {
+                        var info = freeDB.Select<VV_MES_Info>().Where(x => x.SN == item).First();
+                        if (info == null)
+                        {
+                            return content.Error($"绗瑊i}涓溅杞棤妫�娴嬩笂鏂欏伐鍗曚俊鎭紝璇锋牳鏌ュ伐鍗曞悗鍦ㄦ壂鎻忥紒");
+                        }
+                        i++;
+                    }
+                    
+                }
+                
+
+                dt_agvtask agvtask = new dt_agvtask
+                {
+                    agv_barcode = stationNo,
+                    agv_code = user,
+                    agv_createtime = DateTime.Now,
+                    agv_fromaddress = stationNo,
+                    agv_qty = i,
+                    agv_grade = 1,
+                    agv_tasktype = AGVTaskTypeEnum.TaskType_Inbound.ToString(),
+                    agv_taskstate = AGVTaskStateEnum.Create.ToString(),
+                    agv_toaddress = "",
+                };
+                freeDB.Add(agvtask);
+                return content.OK();
+            }
+            catch (Exception ex)
+            {
+                return content.Error($"鍛煎彨AGV澶辫触:{ex.Message}");
+            }
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/SendEpmtyTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/SendEpmtyTask.cs"
new file mode 100644
index 0000000..53bb1da
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/SendEpmtyTask.cs"
@@ -0,0 +1,110 @@
+锘縰sing Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using WIDESEA_Comm;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Comm.MES_Info;
+using WIDESEA_Comm.MES_Info.Request;
+using WIDESEA_Common;
+using WIDESEA_Core.EFDbContext;
+using WIDESEA_Core.ManageUser;
+using WIDESEA_Core.Utilities;
+using WIDESEA_Entity.DomainModels;
+using WIDESEA_Entity.DomainModels.Mes;
+using WIDESEA_WMS.Common;
+using WIDESEA_WMS.IRepositories;
+using WIDESEA_WMS.Repositories;
+using static WIDESEA_Comm.MES_Info.BasicSN;
+
+namespace WIDESEA_WMS
+{
+    public partial class ToMesServer
+    {
+        /// <summary>
+        /// 绌虹洏鎿嶄綔  (澶栧崗绌虹洏鍏ュ簱锛岀┖鐩樿ˉ閫�)
+        /// </summary>
+        /// <param name="saveModel"></param>
+        /// <returns></returns>
+        public WebResponseContent SendEpmtyTask(SaveModel saveModel)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                string cacheNo = saveModel.MainData["cacheNo"].ToString();  //缂撳瓨鏋剁紪鍙�
+                string user = saveModel.MainData["creator"].ToString();
+                string type = saveModel.MainData["radio"].ToString();   //1涓虹┖鐩樺叆搴� 2涓虹┖鐩樺嚭搴�
+                int number = Convert.ToInt32(saveModel.MainData["number"].ToString());
+
+                if (type == "1")  //绌虹洏鍏ュ簱
+                {
+                    //瀵绘壘绌虹洏搴撲綅
+                    dt_stationinfo emptyLocation = GetEmptyLocation();
+
+                    dt_agvtask agvtask = new dt_agvtask
+                    {
+                        agv_barcode = cacheNo,
+                        agv_code = user,
+                        agv_createtime = DateTime.Now,
+                        agv_fromaddress = cacheNo,
+                        agv_qty = number,
+                        agv_grade = 1,
+                        agv_tasktype = AGVTaskTypeEnum.TaskType_Inbound.ToString(),
+                        agv_taskstate = AGVTaskStateEnum.Create.ToString(),
+                        agv_toaddress = emptyLocation.stationCode,
+                    };
+                    freeDB.Add(agvtask);
+                }
+                else
+                {
+                    //鏍规嵁搴撳瓨鏌ヨ绌虹洏搴撳瓨淇℃伅
+                    dt_inventory inventory = freeDB.Select<dt_inventory>().Where(x => x.area == "11").OrderByDescending(x => x.OnlineTime).First(); //鍙栨渶鏅氱殑鍏ュ簱杞﹁疆
+
+                    //鏁伴噺锛�
+                    //var stationinfo = freeDB.Select<dt_stationinfo>().Where(x => x.stationCode == inventory.stationCode).First();
+                    //int num = Convert.ToInt16(stationinfo.quantity);
+
+
+                    dt_agvtask agvtask = new dt_agvtask
+                    {
+                        agv_barcode = cacheNo,
+                        agv_code = user,
+                        agv_createtime = DateTime.Now,
+                        agv_fromaddress = inventory.stationCode,
+                        agv_qty = 5,   //inventory.,   //鍛婅瘔AGV鍙栫鍑犱釜杞﹁疆锛�
+                        agv_grade = 1,
+                        agv_tasktype = AGVTaskTypeEnum.TaskType_Inbound.ToString(),
+                        agv_taskstate = AGVTaskStateEnum.Create.ToString(),
+                        agv_toaddress = cacheNo,
+                    };
+                    freeDB.Add(agvtask);
+                }
+
+                return content.OK();
+            }
+            catch (Exception ex)
+            {
+                return content.Error($"鍛煎彨AGV澶辫触:{ ex.Message}");
+            }
+        }
+
+        private dt_stationinfo GetEmptyLocation()
+        {
+            VOLContext context = new VOLContext();
+            Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
+            var station = stationinfoRepository.Find(x => x.line == 9 && x.location_state == LocationStateEnum.Empty.ToString() && x.area == "11").FirstOrDefault();
+
+            //  todo鍖哄垎澶у皬鎵樼洏
+
+            if (station != null)
+            {
+                return station;
+            }
+            else
+            {
+                throw new Exception("绌虹洏搴撲綅宸叉弧,鏃犳硶鍏ュ簱!");
+            }
+
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/agvTransferList.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/agvTransferList.cs"
new file mode 100644
index 0000000..ba82d00
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/agvTransferList.cs"
@@ -0,0 +1,83 @@
+锘縰sing Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using WIDESEA_Comm;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Comm.MES_Info;
+using WIDESEA_Comm.MES_Info.Request;
+using WIDESEA_Common;
+using WIDESEA_Core.ManageUser;
+using WIDESEA_Core.Utilities;
+using WIDESEA_Entity.DomainModels;
+using WIDESEA_Entity.DomainModels.Mes;
+using WIDESEA_WMS.Common;
+using static WIDESEA_Comm.MES_Info.BasicSN;
+
+namespace WIDESEA_WMS
+{
+    public partial class ToMesServer
+    {
+        /// <summary>
+        /// PDA绉诲簱浜ゆ帴
+        /// </summary>
+        /// <param name="requestTemp"></param>
+        /// <returns></returns>
+        public WebResponseContent agvTransferList(SaveModel saveModel)
+        {
+
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                string sn = saveModel.MainData["sn"].ToString();
+                string user = saveModel.MainData["creator"].ToString();
+
+                //宸ュ崟鍙风敓鎴�
+                string jobID = "TW" + DateTime.Now.ToString("HH-mm-ss-ff");
+
+                //鏍规嵁搴撳瓨鏌ヨ杞﹁疆淇℃伅
+                dt_inventory inventory = freeDB.Select<dt_inventory>().Where(x => x.SN.Contains(sn)).First();
+                if (inventory == null)
+                {
+                    return content.Error($"鏃犳杞﹁疆{sn}SN鍙�,璇锋牳鏌ュ簱瀛樿褰�!");
+                }
+
+                List<detail> list = new List<detail>(); //杞﹁疆淇℃伅
+                foreach (var item in inventory.SN.Split(","))
+                {
+                    detail detail = new detail();
+                    detail.sn = item;
+                    list.Add(detail);
+                }
+
+                agvTransferListPara listPara = new agvTransferListPara
+                {
+                    details = list,
+                    transferListID = jobID,
+                    toWarehouse = "姣涜疆搴�",
+                    fromWarehouse = "AGV搴�",
+                    updateTime = DateTime.Now.ToString(),
+                    drawingNoVer = "",
+                    materialCode = "",
+                    Operator = user == null ? "admin" : user
+                };
+
+                var postJson = JsonConvert.SerializeObject(listPara);
+                string mesData = Request.RequestData(postJson, MESAPIAddress.IPAddress_MES + "agvTransferList");
+                var requestMes = JsonConvert.DeserializeObject<MES_Response>(mesData);
+
+                if (requestMes.code == "200" && requestMes.Type == "success")
+                {
+                    return content.OK("绉诲簱浜ゆ帴鎴愬姛锛�");
+                    //鏃ュ織璁板綍涓婁紶鏁版嵁鎴愬姛
+                }
+
+            }
+            catch (Exception ex)
+            {
+                content.Error(ex.Message);
+            }
+            return content;
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/ToWms/ToWMSController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/ToWms/ToWMSController.cs"
index ed5be07..757cd40 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/ToWms/ToWMSController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/ToWms/ToWMSController.cs"
@@ -1,6 +1,7 @@
 锘縰sing Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 using WIDESEA_Core.Utilities;
+using WIDESEA_Entity.DomainModels;
 using WIDESEA_Entity.DomainModels.Mes;
 using WIDESEA_WMS;
 
@@ -21,5 +22,39 @@
             return new ToMesServer().AddToFloat3(request);
         }
 
+
+        /// <summary>
+        /// 澶栧崗绉诲簱
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost, Route("agvTransferList")]
+        public WebResponseContent agvTransferList([FromBody] SaveModel saveModel)
+        {
+            return new ToMesServer().agvTransferList(saveModel);
+        }
+
+        /// <summary>
+        /// 澶栧崗鍏ュ簱(妫�娴嬩笂鏂�)
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost, Route("OutsourceInbound")]
+        public WebResponseContent OutsourceInbound([FromBody] SaveModel saveModel)
+        {
+            return new ToMesServer().OutsourceInbound(saveModel);
+        }
+
+        /// <summary>
+        /// 绌虹洏
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost, Route("SendEpmtyTask")]
+        public WebResponseContent SendEpmtyTask([FromBody] SaveModel saveModel)
+        {
+            return new ToMesServer().SendEpmtyTask(saveModel);
+        }
+
     }
 }

--
Gitblit v1.9.3