From b08bfd050511ed27e0bde0bd4095eed1fdb5ddeb Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周一, 01 9月 2025 11:43:32 +0800
Subject: [PATCH] 暂时提交

---
 wcs/yunneiWCS/yunneiWCS/App - 本地.config                                                                  |    2 
 wcs/yunneiWCS/yunneiWCS/Properties/Resources.Designer.cs                                                 |    6 
 wcs/yunneiWCS/yunneiWCS/App -生产.config                                                                   |    2 
 wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.MsgData.datasource                |    2 
 wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/PushMesHandler.cs                                         |   48 ++++
 wcs/yunneiWCS/yunneiWCS/ORM/Wms_outInStockRecord_V2_Mes.cs                                               |   74 ++++++
 wcs/yunneiWCS/yunneiWCS/yunneiWCS.csproj                                                                 |   13 +
 wcs/yunneiWCS/yunneiWCS/ORM/dbmodel.cs                                                                   |    4 
 wcs/yunneiWCS/yunneiWCS/App.config                                                                       |   24 +-
 wcs/yunneiWCS/yunneiWCS/ORM/Wms_outInStockRecord_Details_V2_Mes.cs                                       |   25 ++
 wcs/yunneiWCS/yunneiWCS/Program.cs                                                                       |    2 
 wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/dto/ApiResponse.cs                                        |   35 +++
 wcs/yunneiWCS/yunneiWCS/Properties/Settings.Designer.cs                                                  |   30 +-
 wcs/yunneiWCS/yunneiWCS/wcf/yunneiWcf.cs                                                                 |   10 
 wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.safetySignalResponse.datasource   |    2 
 wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.GToutStockResponse.datasource     |    2 
 wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/dto/InboundStockInfoToMes.cs                              |   59 +++++
 wcs/yunneiWCS/yunneiWCS/DataAccess/OutInStockRecord_V2_MesHandler.cs                                     |  177 ++++++++++++++++
 wcs/yunneiWCS/CommonDll/Yitter.IdGenerator.Net45.dll                                                     |    0 
 wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.GGoutStockResponse.datasource     |    2 
 wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.EmptyBackResponse.datasource      |    2 
 wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.OnLowdPartCallResponse.datasource |    2 
 wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/dto/MesRequest.cs                                         |   28 ++
 wcs/yunneiWCS/yunneiWCS/ExtendFunction/MyExtend.cs                                                       |   63 ++++-
 24 files changed, 555 insertions(+), 59 deletions(-)

diff --git a/wcs/yunneiWCS/CommonDll/Yitter.IdGenerator.Net45.dll b/wcs/yunneiWCS/CommonDll/Yitter.IdGenerator.Net45.dll
new file mode 100644
index 0000000..6c614bd
--- /dev/null
+++ b/wcs/yunneiWCS/CommonDll/Yitter.IdGenerator.Net45.dll
Binary files differ
diff --git "a/wcs/yunneiWCS/yunneiWCS/App - \346\234\254\345\234\260.config" "b/wcs/yunneiWCS/yunneiWCS/App - \346\234\254\345\234\260.config"
index 86bf0cd..7d3a8f8 100644
--- "a/wcs/yunneiWCS/yunneiWCS/App - \346\234\254\345\234\260.config"
+++ "b/wcs/yunneiWCS/yunneiWCS/App - \346\234\254\345\234\260.config"
@@ -10,6 +10,8 @@
   <appSettings>
     <!--鏄惁鏄櫄鎷熶豢鐪熸ā寮�,true:鏄紝false锛氬惁銆傜敓浜х幆澧冭閰嶇疆涓篺alse 銆怑ditBy shaocx,2022-01-27銆�-->
     <add key="IsVirtualMode" value="true"/>
+    <!--MES鍦板潃 銆怑ditBy shaocx,2025-08-27銆�-->
+    <add key="MesUrl" value="http://192.168.6.47:8000/api/Save/"/>
   </appSettings>
   
   <system.serviceModel>
diff --git "a/wcs/yunneiWCS/yunneiWCS/App -\347\224\237\344\272\247.config" "b/wcs/yunneiWCS/yunneiWCS/App -\347\224\237\344\272\247.config"
index 5b8e842..980e0e1 100644
--- "a/wcs/yunneiWCS/yunneiWCS/App -\347\224\237\344\272\247.config"
+++ "b/wcs/yunneiWCS/yunneiWCS/App -\347\224\237\344\272\247.config"
@@ -11,6 +11,8 @@
   <appSettings>
     <!--鏄惁鏄櫄鎷熶豢鐪熸ā寮�,true:鏄紝false锛氬惁銆傜敓浜х幆澧冭閰嶇疆涓篺alse 銆怑ditBy shaocx,2022-01-27銆�-->
     <add key="IsVirtualMode" value="false"/>
+    <!--MES鍦板潃 銆怑ditBy shaocx,2025-08-27銆�-->
+    <add key="MesUrl" value="http://192.168.6.47:8000/api/Save/"/>
   </appSettings>
   <system.serviceModel>
         
diff --git a/wcs/yunneiWCS/yunneiWCS/App.config b/wcs/yunneiWCS/yunneiWCS/App.config
index 030eed0..95ce365 100644
--- a/wcs/yunneiWCS/yunneiWCS/App.config
+++ b/wcs/yunneiWCS/yunneiWCS/App.config
@@ -1,33 +1,35 @@
-锘�<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
   <startup>
-    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
   </startup>
   <connectionStrings>
 
 
-    <add name="dbmodel" connectionString="data source=.;initial catalog=LA20025;persist security info=True;user id=sa;password=123abc.com;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
+    <add name="dbmodel" connectionString="data source=.;initial catalog=LA20025;persist security info=True;user id=sa;password=123abc.com;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient"/>
   </connectionStrings>
   <appSettings>
     <!--鏄惁鏄櫄鎷熶豢鐪熸ā寮�,true:鏄紝false锛氬惁銆傜敓浜х幆澧冭閰嶇疆涓篺alse 銆怑ditBy shaocx,2022-01-27銆�-->
     <add key="IsVirtualMode" value="true"/>
+    <!--MES鍦板潃 銆怑ditBy shaocx,2025-08-27銆�-->
+    <add key="MesUrl" value="http://192.168.6.47:8000/api/Save/"/>
   </appSettings>
 
   <system.serviceModel>
 
     <bindings>
       <basicHttpBinding>
-        <binding name="AutoServiceSoap" />
+        <binding name="AutoServiceSoap"/>
       </basicHttpBinding>
     </bindings>
     <client>
-      <endpoint address="http://localhost:8082/AutoService.asmx" binding="basicHttpBinding" bindingConfiguration="AutoServiceSoap" contract="tianyong.AutoServiceSoap" name="AutoServiceSoap" />
+      <endpoint address="http://localhost:8082/AutoService.asmx" binding="basicHttpBinding" bindingConfiguration="AutoServiceSoap" contract="tianyong.AutoServiceSoap" name="AutoServiceSoap"/>
     </client>
     <behaviors>
       <serviceBehaviors>
         <behavior name="">
-          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
-          <serviceDebug includeExceptionDetailInFaults="false" />
+          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
+          <serviceDebug includeExceptionDetailInFaults="false"/>
         </behavior>
       </serviceBehaviors>
     </behaviors>
@@ -35,16 +37,16 @@
       <service name="yunneiWCS.wcf.yunneiWcf">
         <endpoint address="" binding="basicHttpBinding" contract="yunneiWCS.wcf.IyunneiWcf">
           <identity>
-            <dns value="localhost" />
+            <dns value="localhost"/>
           </identity>
         </endpoint>
-        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
+        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
         <host>
           <baseAddresses>
-            <add baseAddress="http://localhost:8733/Design_Time_Addresses/yunneiWCS.wcf/yunneiWcf/" />
+            <add baseAddress="http://localhost:8733/Design_Time_Addresses/yunneiWCS.wcf/yunneiWcf/"/>
           </baseAddresses>
         </host>
       </service>
     </services>
   </system.serviceModel>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/wcs/yunneiWCS/yunneiWCS/DataAccess/OutInStockRecord_V2_MesHandler.cs b/wcs/yunneiWCS/yunneiWCS/DataAccess/OutInStockRecord_V2_MesHandler.cs
new file mode 100644
index 0000000..2fc7319
--- /dev/null
+++ b/wcs/yunneiWCS/yunneiWCS/DataAccess/OutInStockRecord_V2_MesHandler.cs
@@ -0,0 +1,177 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WZ.Useful.Commons.Collections;
+using yunneiWCS.EnumDefine;
+using yunneiWCS.ExtendFunction;
+using yunneiWCS.ORM;
+
+namespace yunneiWCS.DataAccess
+{
+    /// <summary>
+    /// 鍑哄叆搴撹褰�(涓烘帹閫丮ES)	
+    /// </summary>
+    public class OutInStockRecord_V2_MesHandler
+    {
+        /// <summary>
+        /// 浜哄伐鍒犻櫎鐨勫満鏅�
+        /// </summary>
+        /// <param name="mod"></param>
+        /// <param name="_outInFlag"></param>
+        /// <param name="sourcePlace"></param>
+        /// <param name="toPlace"></param>
+        /// <param name="_task"></param>
+        /// <param name="remark"></param>
+        /// <param name="productStocks"></param>
+        /// <param name="currentTaskType"></param>
+        public static void AddRecordForPersonDelete(dbmodel mod, OutInFlag _outInFlag, string remark,
+          System.Collections.Generic.List<productStockList> productStocks, productStock modfiyStock)
+        {
+            try
+            {
+                //var isMaterilStockMove = MyExtend.IsMaterilStockMove(currentTaskType);
+                //if (isMaterilStockMove == false)
+                //{
+                //    return;
+                //}
+                //if (string.IsNullOrEmpty(modfiyStock.materialCode))
+                //{
+                //    return;//璁や负鏄┖鎷�
+                //}
+                Wms_outInStockRecord_V2_Mes log = new Wms_outInStockRecord_V2_Mes()
+                {
+                    ID = Yitter.IdGenerator.YitIdHelper.NextId(),
+                    sourcePlace = "",
+                    toPlace = "",
+                    containerCode = modfiyStock.containerCode,
+
+                    LastModifier = modfiyStock.creator,
+                    LastModifyTime = DateTime.Now,
+
+
+                    outInFlag = (int)_outInFlag,
+                    outInFlagName = _outInFlag.ToString(),
+
+                    CreateTime = DateTime.Now,
+                    // Creator = _task.creator,
+                    Remark = remark,
+
+                    materialCode = productStocks.First().productCode,
+                    materialName = productStocks.First().productName,
+                    qty = productStocks.Count(),
+                    supplier = modfiyStock.supplier,
+
+                    isSendToMes = 0,
+
+
+                    //version = modfiyStock.version,
+
+                    //taskId = _task.taskId.ToString(),
+                    //taskType = (int)_task.taskType,
+                    //taskTypeName = _task.taskTypeName,
+                    //taskName = _task.taskName,
+                };
+                mod.Wms_outInStockRecord_V2_Mes.Add(log);
+
+                //鍚屾椂鎶婃槑缁嗕篃鏂板杩涘幓
+                foreach (var item in productStocks)
+                {
+                    var d_id = Yitter.IdGenerator.YitIdHelper.NextId();
+                    Wms_outInStockRecord_Details_V2_Mes wms_OutInStockRecord_Details_V2_Mes = new Wms_outInStockRecord_Details_V2_Mes()
+                    {
+                        ID = d_id,
+                        mainId = log.ID,
+                        productCode = item.productCode,
+                        productName = item.productName,
+                        serialNumber = item.serialNumber
+                    };
+                    mod.Wms_outInStockRecord_Details_V2_Mes.Add(wms_OutInStockRecord_Details_V2_Mes);
+                }
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+        private static void AddRecord(dbmodel mod, OutInFlag _outInFlag, string sourcePlace, string toPlace, task _task, string remark,
+            System.Collections.Generic.List<productStockList> productStocks, taskType currentTaskType)
+        {
+            try
+            {
+                //var isMaterilStockMove = MyExtend.IsMaterilStockMove(currentTaskType);
+                //if (isMaterilStockMove == false)
+                //{
+                //    return;
+                //}
+                if (string.IsNullOrEmpty(_task.materialCode))
+                {
+                    return;//璁や负鏄┖鎷�
+                }
+                Wms_outInStockRecord_V2_Mes log = new Wms_outInStockRecord_V2_Mes()
+                {
+                    ID = Yitter.IdGenerator.YitIdHelper.NextId(),
+                    sourcePlace = sourcePlace,
+                    toPlace = toPlace,
+                    containerCode = _task.containerCode,
+
+                    LastModifier = _task.creator,
+                    LastModifyTime = DateTime.Now,
+
+
+                    outInFlag = (int)_outInFlag,
+                    outInFlagName = _outInFlag.ToString(),
+
+                    CreateTime = DateTime.Now,
+                    Creator = _task.creator,
+                    Remark = remark,
+
+                    materialCode = _task.materialCode,
+                    materialName = _task.materialName,
+                    qty = _task.quantity,
+                    supplier = _task.supplier,
+                    version = _task.version,
+
+                    taskId = _task.taskId.ToString(),
+                    taskType = (int)_task.taskType,
+                    taskTypeName = _task.taskTypeName,
+                    taskName = _task.taskName,
+
+                    isSendToMes = 0,
+                };
+                mod.Wms_outInStockRecord_V2_Mes.Add(log);
+
+                //鍚屾椂鎶婃槑缁嗕篃鏂板杩涘幓
+                foreach (var item in productStocks)
+                {
+                    Wms_outInStockRecord_Details_V2_Mes wms_OutInStockRecord_Details_V2_Mes = new Wms_outInStockRecord_Details_V2_Mes()
+                    {
+                        ID = Yitter.IdGenerator.YitIdHelper.NextId(),
+                        mainId = log.ID,
+                        productCode = item.productCode,
+                        productName = item.productName,
+                        serialNumber = item.serialNumber
+                    };
+                    mod.Wms_outInStockRecord_Details_V2_Mes.Add(wms_OutInStockRecord_Details_V2_Mes);
+                }
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+
+        public static void AddRecord(dbmodel mod, OutInFlag _outInFlag, string sourcePlace, string toPlace, task _task, string remark,
+         taskType currentTaskType)
+        {
+            var stock = mod.productStock.Where(a => a.containerCode == _task.containerCode).FirstOrDefault();
+            if (stock != null)
+            {
+                System.Collections.Generic.List<productStockList> productStocks = mod.productStockList.Where(a => a.stockId == stock.stockId).ToList();
+                AddRecord(mod, _outInFlag, sourcePlace, toPlace, _task, remark,
+                productStocks, currentTaskType);
+            }
+        }
+    }
+}
diff --git a/wcs/yunneiWCS/yunneiWCS/ExtendFunction/MyExtend.cs b/wcs/yunneiWCS/yunneiWCS/ExtendFunction/MyExtend.cs
index 1c19bbf..3c25fe8 100644
--- a/wcs/yunneiWCS/yunneiWCS/ExtendFunction/MyExtend.cs
+++ b/wcs/yunneiWCS/yunneiWCS/ExtendFunction/MyExtend.cs
@@ -19,6 +19,26 @@
     /// </summary>
     public class MyExtend
     {
+        /// <summary>
+        /// 鏄惁鏄� 鐗╂枡搴撳瓨鐨勮浆绉�
+        /// </summary>
+        /// <param name="taskType"></param>
+        /// <returns></returns>
+        public static bool IsMaterilStockMove(taskType currentTaskType)
+        {
+            if (currentTaskType == taskType.绌哄簱浣�
+                || currentTaskType == taskType.鍛煎彨绌烘墭
+                 || currentTaskType == taskType.绌烘墭鍥炲簱
+                  || currentTaskType == taskType.绌烘墭涓嬬嚎鍏ュ簱
+                   || currentTaskType == taskType.绌烘墭鎵嬪姩鍏ュ簱
+                    || currentTaskType == taskType.绌烘墭浜哄伐鍑哄簱
+                     || currentTaskType == taskType.鏃佽矾宸ヤ綅缂镐綋绌烘墭鍥炲簱
+                  )
+            {
+                return false;
+            }
+            return true;
+        }
 
         public static string HandlerNoIssuedTaskFor鏃佽矾宸ヤ綅缂镐綋绌烘墭鎴栦綑鏂欏洖搴�(dbmodel mod, string convPlace, task item, string[] agvSendStatus)
         {
@@ -476,6 +496,7 @@
                                 throw new Exception("鍏ュ簱浠诲姟锛岀洰鏍囩珯鐐规壘涓嶅埌锛宼oPlace锛�" + finishTask.toPlace);
                             }
                             OutInStockRecordHandler.AddOutInStockRecord(mod, OutInFlag.鍏ュ簱, finishTask.sourcePlace, finishTask.toPlace, finishTask, "鍏ュ簱绫诲瀷鐨勪换鍔�");
+                            OutInStockRecord_V2_MesHandler.AddRecord(mod, OutInFlag.鍏ュ簱, finishTask.sourcePlace, finishTask.toPlace, finishTask, "鍏ュ簱绫诲瀷鐨勪换鍔�", currentTaskType);//鍫嗗灈鏈轰换鍔″畬鎴愬悗鐨勫叆搴�
                             #endregion
                             break;
                         case taskType.缂镐綋涓嬬嚎:
@@ -566,6 +587,7 @@
                                 #endregion
 
                                 OutInStockRecordHandler.AddOutInStockRecord(mod, OutInFlag.鍏ュ簱, finishTask.sourcePlace, finishTask.toPlace, finishTask, "鍏ュ簱绫诲瀷鐨勪换鍔�");
+                                OutInStockRecord_V2_MesHandler.AddRecord(mod, OutInFlag.鍏ュ簱, finishTask.sourcePlace, finishTask.toPlace, finishTask, "鍏ュ簱绫诲瀷鐨勪换鍔�", currentTaskType);//鍫嗗灈鏈轰换鍔″畬鎴愬悗鐨勫叆搴�
                             }
                             else
                             {
@@ -592,7 +614,9 @@
                             finishTask.remark = "瀹屾垚";
                             finishTask.finishTime = DateTime.Now;
 
-                            var result = deleteProduct(false, "sys", mod, finishTask.sourcePlace, finishTask, ref errMsg);//鍒犻櫎搴撳瓨
+
+
+                            var result = deleteProduct(false, "sys", mod, finishTask.sourcePlace, finishTask, ref errMsg, "鍫嗗灈鏈轰换鍔″畬鎴�-鎵嬪姩鍑哄簱");//鍒犻櫎搴撳瓨
                             if (result == false) throw new Exception(errMsg);
 
                             OutInStockRecordHandler.AddOutInStockRecord(mod, OutInFlag.鍑哄簱, finishTask.sourcePlace, finishTask.toPlace, finishTask, "鍑哄簱绫诲瀷鐨勪换鍔�");
@@ -647,6 +671,7 @@
                                 errMsg = "缂哥洊涓婄嚎/缂镐綋涓婄嚎浠诲姟锛屼腑杞綅涓虹┖锛屾殏涓嶅鐞�";
                                 return false;
                             }
+                            OutInStockRecord_V2_MesHandler.AddRecord(mod, OutInFlag.鍑哄簱, finishTask.sourcePlace, finishTask.toPlace, finishTask, "鍑哄簱绫诲瀷鐨勪换鍔�", currentTaskType);//鍫嗗灈鏈轰换鍔″畬鎴愬悗鐨勫嚭搴�
                             break;
                         default://鍏朵粬锛屽嚭搴撶‘璁�
                             //finishTask.taskStatus = 3;
@@ -769,6 +794,7 @@
             //璁剧疆鐩爣浣嶆湁璐�
             PositionHandler.Free(true, to_positionStation, "澶勭悊 缂镐綋涓婄嚎鍒版梺璺伐浣嶇殑澶勭悊 鐨勪换鍔�", SysGloble.WCSNAME, item);
 
+            OutInStockRecord_V2_MesHandler.AddRecord(mod, OutInFlag.鍑哄簱, item.sourcePlace, item.toPlace, item, "鍑哄簱绫诲瀷鐨勪换鍔�", _taskType);//鍫嗗灈鏈轰换鍔″畬鎴愬悗鐨勫嚭搴�
             OutInStockRecordHandler.AddOutInStockRecord(mod, OutInFlag.鍑哄簱, item.sourcePlace, item.toPlace, item, "鍑哄簱绫诲瀷鐨勪换鍔�");
 
             //閫氱煡澶╂案,缁欏ぉ姘稿彂淇″彿
@@ -948,7 +974,7 @@
         /// <param name="positionName"></param>
         /// <param name="res"></param>
         /// <returns></returns>
-        public static bool deleteProduct(bool isPerson, string user, dbmodel mod, string positionName, task _task, ref string res)
+        public static bool deleteProduct(bool isPerson, string user, dbmodel mod, string positionName, task _task, ref string res, string preLog)
         {
             res = "";
             string[] stations = { "GTU1", "GTU2", "GTU3", "GGU1", "GGU2", "GGU3" };
@@ -979,6 +1005,7 @@
                         List<productStockList> delteStockDatalist = mod.productStockList.Where(x => x.stockId == delteData.positionId).ToList();
                         if (delteStockDatalist.Count > 0)
                         {
+                            OutInStockRecord_V2_MesHandler.AddRecordForPersonDelete(mod, OutInFlag.鍑哄簱, "鍒犻櫎搴撳瓨:" + preLog, delteStockDatalist, delteStockData.First());//鍫嗗灈鏈轰换鍔″畬鎴愬悗鐨勫嚭搴�
                             foreach (var itemList in delteStockDatalist)
                             {
                                 mod.productStockList.Remove(itemList);
@@ -1039,27 +1066,27 @@
                     //var queryTask6 = (int)taskType.浣欐枡鍥炲簱;
 
                     var queryStats = (int)taskStatus.瀹屾垚;
-                    var allQty = mod.task.Where(x => 
+                    var allQty = mod.task.Where(x =>
                         //(
-                            //x.taskType == queryTask1
-                            //|| x.taskType == queryTask2
-                            //|| x.taskType == queryTask3
-                            //|| x.taskType == queryTask4
-                            //|| x.taskType == queryTask5
-                            //|| x.taskType == queryTask6
+                        //x.taskType == queryTask1
+                        //|| x.taskType == queryTask2
+                        //|| x.taskType == queryTask3
+                        //|| x.taskType == queryTask4
+                        //|| x.taskType == queryTask5
+                        //|| x.taskType == queryTask6
                         //) &&
                         x.taskStatus == queryStats).Count();
 
                     var nowDateTimeStr_1 = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
                     var nowDateTimeStr_2 = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59");
-                    var todayQty = mod.task.Where(x => 
-                        //(
-                           //x.taskType == queryTask1
-                           //|| x.taskType == queryTask2
-                           //|| x.taskType == queryTask3
-                           //|| x.taskType == queryTask4
-                           //|| x.taskType == queryTask5
-                           //|| x.taskType == queryTask6
+                    var todayQty = mod.task.Where(x =>
+                       //(
+                       //x.taskType == queryTask1
+                       //|| x.taskType == queryTask2
+                       //|| x.taskType == queryTask3
+                       //|| x.taskType == queryTask4
+                       //|| x.taskType == queryTask5
+                       //|| x.taskType == queryTask6
                        //) &&
                        x.taskStatus == queryStats
                        && x.finishTime != null && x.finishTime >= nowDateTimeStr_1 && x.finishTime <= nowDateTimeStr_2
@@ -1067,7 +1094,7 @@
 
                     var nowDateTimeStr_3 = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM") + "-01 00:00:00");
                     var nowDateTimeStr_4 = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM") + "-30 23:59:59");
-                    var monthQty = mod.task.Where(x => 
+                    var monthQty = mod.task.Where(x =>
                       //  (
                       //     x.taskType == queryTask1
                       //    || x.taskType == queryTask2
diff --git a/wcs/yunneiWCS/yunneiWCS/ORM/Wms_outInStockRecord_Details_V2_Mes.cs b/wcs/yunneiWCS/yunneiWCS/ORM/Wms_outInStockRecord_Details_V2_Mes.cs
new file mode 100644
index 0000000..80dc544
--- /dev/null
+++ b/wcs/yunneiWCS/yunneiWCS/ORM/Wms_outInStockRecord_Details_V2_Mes.cs
@@ -0,0 +1,25 @@
+namespace yunneiWCS.ORM
+{
+    using System;
+    using System.Collections.Generic;
+    using System.ComponentModel.DataAnnotations;
+    using System.ComponentModel.DataAnnotations.Schema;
+    using System.Data.Entity.Spatial;
+
+    [Table("Wms_outInStockRecord_Details_V2_Mes")]
+    public partial class Wms_outInStockRecord_Details_V2_Mes
+    {
+        public long ID { get; set; }
+
+        public long? mainId { get; set; }
+
+        [StringLength(50)]
+        public string productCode { get; set; }
+
+        [StringLength(50)]
+        public string productName { get; set; }
+
+        [StringLength(50)]
+        public string serialNumber { get; set; }
+    }
+}
diff --git a/wcs/yunneiWCS/yunneiWCS/ORM/Wms_outInStockRecord_V2_Mes.cs b/wcs/yunneiWCS/yunneiWCS/ORM/Wms_outInStockRecord_V2_Mes.cs
new file mode 100644
index 0000000..e2f80a9
--- /dev/null
+++ b/wcs/yunneiWCS/yunneiWCS/ORM/Wms_outInStockRecord_V2_Mes.cs
@@ -0,0 +1,74 @@
+namespace yunneiWCS.ORM
+{
+    using System;
+    using System.Collections.Generic;
+    using System.ComponentModel.DataAnnotations;
+    using System.ComponentModel.DataAnnotations.Schema;
+    using System.Data.Entity.Spatial;
+
+    public partial class Wms_outInStockRecord_V2_Mes
+    {
+        public long ID { get; set; }
+
+        public int? outInFlag { get; set; }
+
+        [StringLength(100)]
+        public string outInFlagName { get; set; }
+
+        [StringLength(128)]
+        public string taskId { get; set; }
+
+        public int? taskType { get; set; }
+
+        [StringLength(128)]
+        public string taskTypeName { get; set; }
+
+        [StringLength(128)]
+        public string taskName { get; set; }
+
+      
+        [StringLength(128)]
+        public string sourcePlace { get; set; }
+
+       
+        [StringLength(128)]
+        public string toPlace { get; set; }
+
+        [StringLength(100)]
+        public string materialCode { get; set; }
+
+        [StringLength(100)]
+        public string materialName { get; set; }
+
+        [StringLength(100)]
+        public string version { get; set; }
+
+        [StringLength(100)]
+        public string supplier { get; set; }
+
+        [StringLength(100)]
+        public string containerCode { get; set; }
+
+        public int? qty { get; set; }
+
+        public int? isSendToMes { get; set; }
+
+        public DateTime? SendToMesTime { get; set; }
+
+        [StringLength(128)]
+        public string MesRet { get; set; }
+
+        [StringLength(128)]
+        public string Remark { get; set; }
+
+        [StringLength(128)]
+        public string Creator { get; set; }
+
+        public DateTime? CreateTime { get; set; }
+
+        [StringLength(128)]
+        public string LastModifier { get; set; }
+
+        public DateTime? LastModifyTime { get; set; }
+    }
+}
diff --git a/wcs/yunneiWCS/yunneiWCS/ORM/dbmodel.cs b/wcs/yunneiWCS/yunneiWCS/ORM/dbmodel.cs
index a5fd54d..c3e41ba 100644
--- a/wcs/yunneiWCS/yunneiWCS/ORM/dbmodel.cs
+++ b/wcs/yunneiWCS/yunneiWCS/ORM/dbmodel.cs
@@ -39,6 +39,10 @@
         public virtual DbSet<v_outStockList> v_outStockList { get; set; }
         public virtual DbSet<VproductStock> VproductStock { get; set; }
 
+        public virtual DbSet<Wms_outInStockRecord_V2_Mes> Wms_outInStockRecord_V2_Mes { get; set; }
+
+        public virtual DbSet<Wms_outInStockRecord_Details_V2_Mes> Wms_outInStockRecord_Details_V2_Mes { get; set; }
+
         protected override void OnModelCreating(DbModelBuilder modelBuilder)
         {
             modelBuilder.Entity<BasicDataSet>()
diff --git a/wcs/yunneiWCS/yunneiWCS/Program.cs b/wcs/yunneiWCS/yunneiWCS/Program.cs
index 3cbf617..18010ed 100644
--- a/wcs/yunneiWCS/yunneiWCS/Program.cs
+++ b/wcs/yunneiWCS/yunneiWCS/Program.cs
@@ -16,6 +16,8 @@
         {
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
+            Yitter.IdGenerator.IdGeneratorOptions options = new Yitter.IdGenerator.IdGeneratorOptions(1);
+            Yitter.IdGenerator.YitIdHelper.SetIdGenerator(options);
             Application.Run(new Form1());
             //Application.Run(new TestForm());
         }
diff --git a/wcs/yunneiWCS/yunneiWCS/Properties/Resources.Designer.cs b/wcs/yunneiWCS/yunneiWCS/Properties/Resources.Designer.cs
index 13807ae..28b527f 100644
--- a/wcs/yunneiWCS/yunneiWCS/Properties/Resources.Designer.cs
+++ b/wcs/yunneiWCS/yunneiWCS/Properties/Resources.Designer.cs
@@ -19,7 +19,7 @@
     // 绫婚�氳繃绫讳技浜� ResGen 鎴� Visual Studio 鐨勫伐鍏疯嚜鍔ㄧ敓鎴愮殑銆�
     // 鑻ヨ娣诲姞鎴栫Щ闄ゆ垚鍛橈紝璇风紪杈� .ResX 鏂囦欢锛岀劧鍚庨噸鏂拌繍琛� ResGen
     // (浠� /str 浣滀负鍛戒护閫夐」)锛屾垨閲嶆柊鐢熸垚 VS 椤圭洰銆�
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     internal class Resources {
@@ -47,8 +47,8 @@
         }
         
         /// <summary>
-        ///   浣跨敤姝ゅ己绫诲瀷璧勬簮绫伙紝涓烘墍鏈夎祫婧愭煡鎵�
-        ///   閲嶅啓褰撳墠绾跨▼鐨� CurrentUICulture 灞炴�с��
+        ///   閲嶅啓褰撳墠绾跨▼鐨� CurrentUICulture 灞炴�э紝瀵�
+        ///   浣跨敤姝ゅ己绫诲瀷璧勬簮绫荤殑鎵�鏈夎祫婧愭煡鎵炬墽琛岄噸鍐欍��
         /// </summary>
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
         internal static global::System.Globalization.CultureInfo Culture {
diff --git a/wcs/yunneiWCS/yunneiWCS/Properties/Settings.Designer.cs b/wcs/yunneiWCS/yunneiWCS/Properties/Settings.Designer.cs
index 537144e..49a5137 100644
--- a/wcs/yunneiWCS/yunneiWCS/Properties/Settings.Designer.cs
+++ b/wcs/yunneiWCS/yunneiWCS/Properties/Settings.Designer.cs
@@ -1,28 +1,24 @@
 锘�//------------------------------------------------------------------------------
 // <auto-generated>
-//     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
+//     姝や唬鐮佺敱宸ュ叿鐢熸垚銆�
+//     杩愯鏃剁増鏈�:4.0.30319.42000
 //
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
+//     瀵规鏂囦欢鐨勬洿鏀瑰彲鑳戒細瀵艰嚧涓嶆纭殑琛屼负锛屽苟涓斿鏋�
+//     閲嶆柊鐢熸垚浠g爜锛岃繖浜涙洿鏀瑰皢浼氫涪澶便��
 // </auto-generated>
 //------------------------------------------------------------------------------
 
-namespace yunneiWCS.Properties
-{
-
-
+namespace yunneiWCS.Properties {
+    
+    
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
-    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
-    {
-
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+        
         private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
-        public static Settings Default
-        {
-            get
-            {
+        
+        public static Settings Default {
+            get {
                 return defaultInstance;
             }
         }
diff --git a/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.EmptyBackResponse.datasource b/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.EmptyBackResponse.datasource
index d8ae1be..6653c96 100644
--- a/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.EmptyBackResponse.datasource
+++ b/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.EmptyBackResponse.datasource
@@ -6,5 +6,5 @@
     cause the file to be unrecognizable by the program.
 -->
 <GenericObjectDataSource DisplayName="EmptyBackResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
-   <TypeInfo>yunneiWCS.tianyong.EmptyBackResponse, Service References.tianyong.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
+   <TypeInfo>yunneiWCS.tianyong.EmptyBackResponse, Service References.tianyong.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
 </GenericObjectDataSource>
\ No newline at end of file
diff --git a/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.GGoutStockResponse.datasource b/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.GGoutStockResponse.datasource
index 4993d73..ba698ef 100644
--- a/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.GGoutStockResponse.datasource
+++ b/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.GGoutStockResponse.datasource
@@ -6,5 +6,5 @@
     cause the file to be unrecognizable by the program.
 -->
 <GenericObjectDataSource DisplayName="GGoutStockResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
-   <TypeInfo>yunneiWCS.tianyong.GGoutStockResponse, Service References.tianyong.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
+   <TypeInfo>yunneiWCS.tianyong.GGoutStockResponse, Service References.tianyong.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
 </GenericObjectDataSource>
\ No newline at end of file
diff --git a/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.GToutStockResponse.datasource b/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.GToutStockResponse.datasource
index 640f820..2b59292 100644
--- a/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.GToutStockResponse.datasource
+++ b/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.GToutStockResponse.datasource
@@ -6,5 +6,5 @@
     cause the file to be unrecognizable by the program.
 -->
 <GenericObjectDataSource DisplayName="GToutStockResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
-   <TypeInfo>yunneiWCS.tianyong.GToutStockResponse, Service References.tianyong.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
+   <TypeInfo>yunneiWCS.tianyong.GToutStockResponse, Service References.tianyong.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
 </GenericObjectDataSource>
\ No newline at end of file
diff --git a/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.MsgData.datasource b/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.MsgData.datasource
index 141a7f2..faac2b4 100644
--- a/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.MsgData.datasource
+++ b/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.MsgData.datasource
@@ -6,5 +6,5 @@
     cause the file to be unrecognizable by the program.
 -->
 <GenericObjectDataSource DisplayName="MsgData" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
-   <TypeInfo>yunneiWCS.tianyong.MsgData, Service References.tianyong.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
+   <TypeInfo>yunneiWCS.tianyong.MsgData, Service References.tianyong.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
 </GenericObjectDataSource>
\ No newline at end of file
diff --git a/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.OnLowdPartCallResponse.datasource b/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.OnLowdPartCallResponse.datasource
index 95e0422..d1d6580 100644
--- a/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.OnLowdPartCallResponse.datasource
+++ b/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.OnLowdPartCallResponse.datasource
@@ -6,5 +6,5 @@
     cause the file to be unrecognizable by the program.
 -->
 <GenericObjectDataSource DisplayName="OnLowdPartCallResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
-   <TypeInfo>yunneiWCS.tianyong.OnLowdPartCallResponse, Service References.tianyong.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
+   <TypeInfo>yunneiWCS.tianyong.OnLowdPartCallResponse, Service References.tianyong.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
 </GenericObjectDataSource>
\ No newline at end of file
diff --git a/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.safetySignalResponse.datasource b/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.safetySignalResponse.datasource
index cb76413..71f1b39 100644
--- a/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.safetySignalResponse.datasource
+++ b/wcs/yunneiWCS/yunneiWCS/Service References/tianyong/yunneiWCS.tianyong.safetySignalResponse.datasource
@@ -6,5 +6,5 @@
     cause the file to be unrecognizable by the program.
 -->
 <GenericObjectDataSource DisplayName="safetySignalResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
-   <TypeInfo>yunneiWCS.tianyong.safetySignalResponse, Service References.tianyong.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
+   <TypeInfo>yunneiWCS.tianyong.safetySignalResponse, Service References.tianyong.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
 </GenericObjectDataSource>
\ No newline at end of file
diff --git a/wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/PushMesHandler.cs b/wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/PushMesHandler.cs
new file mode 100644
index 0000000..40821d8
--- /dev/null
+++ b/wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/PushMesHandler.cs
@@ -0,0 +1,48 @@
+锘縰sing Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+using yunneiWCS.EnumDefine;
+using yunneiWCS.SystemInteraction.mes2.dto;
+
+namespace yunneiWCS.mes
+{
+    /// <summary>
+    /// MES鎺ㄩ�佹帴鍙�
+    /// </summary>
+    public class PushMesHandler
+    {
+        public static string mes_api_url = ConfigHelper.GetConfigString("MesUrl");//淇敼涓洪厤缃枃浠� 銆怑ditBy shaocx,2022-01-27銆�
+        static HTTPService mes_api = new HTTPService(mes_api_url);//mes鍩哄湴鍧�
+
+        /// <summary>
+        /// 缁橫ES鎺ㄩ�佸叆搴撲俊鎭�
+        /// </summary>
+        /// <param name="pushData"></param>
+        /// <returns></returns>
+        public static ApiResponse<object> Mes_InStockSend(List<InboundStockInfoToMes> pushData)
+        {
+            ApiResponse<object> res = null;
+            try
+            {
+                MesRequest<List<InboundStockInfoToMes>> mesRequest = new MesRequest<List<InboundStockInfoToMes>>();
+                mesRequest.data = pushData;
+
+                string paprm = JsonConvert.SerializeObject(mesRequest);
+                Guid guid = System.Guid.NewGuid();
+                res = JsonConvert.DeserializeObject<ApiResponse<object>>(mes_api.postContentForString("T_WMS_Inbound_Record", paprm, guid));
+                WZ.Useful.Commons.LogTextHelper.WriteLine("PushMesHandler", "Mes_InStockSend 杩斿洖鐘舵�佺爜:", res.Code + " 杩斿洖淇℃伅:" + res.Message);
+            }
+            catch (Exception ex)
+            {
+                WZ.Useful.Commons.LogTextHelper.WriteLine("PushMesHandler", "Mes_InStockSend ", " 鍙戦�佸紓甯�:" + JsonConvert.SerializeObject(ex));
+                res.Message = "鍙戦�佸紓甯�:" + ex.Message;
+            }
+            return res;
+
+        }
+    }
+}
diff --git a/wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/dto/ApiResponse.cs b/wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/dto/ApiResponse.cs
new file mode 100644
index 0000000..79fedea
--- /dev/null
+++ b/wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/dto/ApiResponse.cs
@@ -0,0 +1,35 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace yunneiWCS.SystemInteraction.mes2.dto
+{
+    /// <summary>
+    /// 閫氱敤娉涘瀷鎺ュ彛鍝嶅簲妯″瀷
+    /// </summary>
+    /// <typeparam name="T">Data 瀛楁鐨勭被鍨嬶紝鍙互鏄换鎰忕被鍨嬶紝濡� string銆乮nt銆佽嚜瀹氫箟绫荤瓑</typeparam>
+    public class ApiResponse<T>
+    {
+        /// <summary>
+        /// 鐘舵�佺爜锛屼緥濡� 200 琛ㄧず鎴愬姛
+        /// </summary>
+        public int Code { get; set; }
+
+        /// <summary>
+        /// 鏄惁鎴愬姛锛宼rue 琛ㄧず鎴愬姛锛宖alse 琛ㄧず澶辫触
+        /// </summary>
+        public bool Success { get; set; }
+
+        /// <summary>
+        /// 杩斿洖娑堟伅锛屼緥濡傦細"鎴愬姛" 鎴栭敊璇俊鎭�
+        /// </summary>
+        public string Message { get; set; }
+
+        /// <summary>
+        /// 杩斿洖鐨勬暟鎹唴瀹癸紝绫诲瀷涓烘硾鍨� T
+        /// </summary>
+        public T Data { get; set; }
+    }
+}
diff --git a/wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/dto/InboundStockInfoToMes.cs b/wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/dto/InboundStockInfoToMes.cs
new file mode 100644
index 0000000..5bbdcbd
--- /dev/null
+++ b/wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/dto/InboundStockInfoToMes.cs
@@ -0,0 +1,59 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace yunneiWCS.SystemInteraction.mes2.dto
+{
+    /// <summary>
+    /// 鎺ㄩ�佸叆搴撴帴鍙� - 璇锋眰鍙傛暟涓殑鍗曚釜鍏ュ簱璁板綍椤�
+    /// </summary>
+    public class InboundStockInfoToMes
+    {
+        /// <summary>
+        /// 浜у搧鍚嶇О
+        /// </summary>
+        public string productName { get; set; }
+
+        /// <summary>
+        /// 娴佹按鍙�
+        /// </summary>
+        public string serialNumber { get; set; }
+
+        /// <summary>
+        /// 搴撲綅鍙�
+        /// </summary>
+        public string positionName { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡缂栫爜
+        /// </summary>
+        public string materialCode { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡鍚嶇О
+        /// </summary>
+        public string materialName { get; set; }
+
+        /// <summary>
+        /// 鏃堕棿
+        /// </summary>
+        public string createTime { get; set; }
+
+        /// <summary>
+        /// 鎵樼洏鍙�
+        /// </summary>
+        public string containerCode { get; set; }
+
+        /// <summary>
+        /// 渚涘簲鍟�
+        /// </summary>
+        public string supplier { get; set; }
+
+        /// <summary>
+        /// 鏈哄瀷
+        /// </summary>
+        public string version { get; set; }
+    }
+}
diff --git a/wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/dto/MesRequest.cs b/wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/dto/MesRequest.cs
new file mode 100644
index 0000000..ce1db29
--- /dev/null
+++ b/wcs/yunneiWCS/yunneiWCS/SystemInteraction/mes2/dto/MesRequest.cs
@@ -0,0 +1,28 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace yunneiWCS.SystemInteraction.mes2.dto
+{
+    /// <summary>
+    /// 鎺ㄩ�佷俊鎭�
+    /// </summary>
+    public class MesRequest<T>
+    {
+        /// <summary>
+        /// 鏁版嵁
+        /// </summary>
+        public T data { get; set; }
+        /// <summary>
+        /// 鎺ㄩ�佷汉
+        /// </summary>
+        public string Creator { get; set; } = "wms";                // 鍒涘缓浜猴紝濡� "wms"
+
+        /// <summary>
+        /// 鎺ㄩ�佹椂闂�
+        /// </summary>
+        public string Timestamp { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");               // 鏃堕棿鎴筹紝濡� "2022-03-15 06:43:15"
+    }
+}
diff --git a/wcs/yunneiWCS/yunneiWCS/wcf/yunneiWcf.cs b/wcs/yunneiWCS/yunneiWCS/wcf/yunneiWcf.cs
index 214b050..2fdd92a 100644
--- a/wcs/yunneiWCS/yunneiWCS/wcf/yunneiWcf.cs
+++ b/wcs/yunneiWCS/yunneiWCS/wcf/yunneiWcf.cs
@@ -2015,12 +2015,13 @@
                             mod.productStockList.Add(newList);
 
                         }
-
+                        List<productStockList> record_delteList = new List<productStockList>();
                         var realDeleteList = all_serialNumberList.Where(x => !now_serialNumberList.Contains(x)).ToList();
                         foreach (var item in deleteList)
                         {
                             if (realDeleteList.Contains(item.serialNumber))
                             {
+                                record_delteList.Add(item);
                                 //璁板綍鏃ュ織 [EditBy shaocx,2022-03-16]
                                 StockClearLog _StockClearLog = new StockClearLog()
                                 {
@@ -2042,7 +2043,7 @@
                                 mod.StockClearLog.Add(_StockClearLog);
                             }
                         }
-
+                        var preLog = "鏅�氬垹闄�";
                         if (taskId > 0)
                         {//璇存槑鏄� 鍑哄簱鍒嗘嫞 銆怑ditby shaocx,2022-03-02銆�
                             var task = mod.task.Where(x => x.taskId == taskId).FirstOrDefault();
@@ -2057,7 +2058,10 @@
                                 return msg;
                             }
                             task.taskStatus = (int)taskStatus.鍒嗘嫞瀹屾垚;
+                            preLog = "浜哄伐鍒嗘嫞";
                         }
+
+                        OutInStockRecord_V2_MesHandler.AddRecordForPersonDelete(mod, OutInFlag.鍑哄簱, "浜哄伐鍒犻櫎搴撳瓨:" + preLog, record_delteList, modfiyStock);//鍫嗗灈鏈轰换鍔″畬鎴愬悗鐨勫嚭搴�
 
                         int res = mod.SaveChanges();
                         if (res > 0)
@@ -2828,7 +2832,7 @@
             {
                 using (dbmodel mod = new dbmodel())
                 {
-                    var b_result = MyExtend.deleteProduct(true, user, mod, positionName, null, ref res);
+                    var b_result = MyExtend.deleteProduct(true, user, mod, positionName, null, ref res, "浜哄伐鐩存帴鍒犻櫎搴撳瓨");
                     if (b_result == false)
                     {
                         return FunctionReturnEntity<bool>.Fail("鍒犻櫎澶辫触:" + res);
diff --git a/wcs/yunneiWCS/yunneiWCS/yunneiWCS.csproj b/wcs/yunneiWCS/yunneiWCS/yunneiWCS.csproj
index e4f6a97..59d0450 100644
--- a/wcs/yunneiWCS/yunneiWCS/yunneiWCS.csproj
+++ b/wcs/yunneiWCS/yunneiWCS/yunneiWCS.csproj
@@ -9,7 +9,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>yunneiWCS</RootNamespace>
     <AssemblyName>yunneiWCS</AssemblyName>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <WcfConfigValidationEnabled>True</WcfConfigValidationEnabled>
     <PublishUrl>鍙戝竷\</PublishUrl>
@@ -27,6 +27,7 @@
     <IsWebBootstrapper>false</IsWebBootstrapper>
     <UseApplicationTrust>false</UseApplicationTrust>
     <BootstrapperEnabled>true</BootstrapperEnabled>
+    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -87,11 +88,15 @@
     <Reference Include="WZ.Useful.Commons">
       <HintPath>..\CommonDll\WZ.Useful.Commons.dll</HintPath>
     </Reference>
+    <Reference Include="Yitter.IdGenerator.Net45">
+      <HintPath>..\CommonDll\Yitter.IdGenerator.Net45.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Common\SysGloble.cs" />
     <Compile Include="DataAccess\BasicDataSetHandler.cs" />
     <Compile Include="DataAccess\ClearDataHandler.cs" />
+    <Compile Include="DataAccess\OutInStockRecord_V2_MesHandler.cs" />
     <Compile Include="DataAccess\PositionHandler.cs" />
     <Compile Include="DataAccess\OutInStockRecordHandler.cs" />
     <Compile Include="DataAccess\TianYongLogHandler.cs" />
@@ -109,6 +114,8 @@
     <Compile Include="ORM\BasicDataSet.cs" />
     <Compile Include="ORM\dbmodel.cs" />
     <Compile Include="ORM\inStockOrder.cs" />
+    <Compile Include="ORM\Wms_outInStockRecord_V2_Mes.cs" />
+    <Compile Include="ORM\Wms_outInStockRecord_Details_V2_Mes.cs" />
     <Compile Include="ORM\inStockOrderList.cs" />
     <Compile Include="ORM\material.cs" />
     <Compile Include="ORM\module.cs" />
@@ -139,6 +146,10 @@
     <Compile Include="PLC\Trans\convDB.cs" />
     <Compile Include="PLC\Trans\convEntity.cs" />
     <Compile Include="EnumDefine\Device\TransEnum.cs" />
+    <Compile Include="SystemInteraction\mes2\dto\ApiResponse.cs" />
+    <Compile Include="SystemInteraction\mes2\dto\MesRequest.cs" />
+    <Compile Include="SystemInteraction\mes2\dto\InboundStockInfoToMes.cs" />
+    <Compile Include="SystemInteraction\mes2\PushMesHandler.cs" />
     <Compile Include="SystemInteraction\tianyong\TianYongSystem.cs" />
     <Compile Include="TestForm.cs">
       <SubType>Form</SubType>

--
Gitblit v1.9.3