Przeglądaj źródła

5001 增加自动计件

chenxy 1 rok temu
rodzic
commit
8f6e1a0522

+ 20 - 0
PCLCommunication/ConnSetting.cs

@@ -836,5 +836,25 @@ namespace PCLCommunication
                 return "E0";
             }
         }
+        /// <summary>
+        /// 自动工序计件
+        /// </summary>
+        /// <param name="barcode"></param>
+        public static string AddWorkPieceByStatus1(string AccountCode, string UserCode, int procedureID,
+            string barcode, string text, string remarks)
+        {
+            try
+            {
+                string scode = SmartDeviceProxy.Instance.Invoke<string>(p => p.AddWorkPieceByStatus(AccountCode,
+                    UserCode, text, procedureID, barcode, remarks));
+
+                return scode;
+            }
+            catch (Exception ex)
+            {
+                LogOut.Error(SmartDeviceProxy.Instance.ServiceName, ex, "AddWorkPiece1");
+                return "E0";
+            }
+        }
     }
 }

+ 57 - 5
PCLCommunication/FrmMelsecA1EAscii.cs

@@ -1,16 +1,15 @@
-using System;
-using System.Collections.Generic;
+
+using System;
 using System.Data;
-using System.ServiceModel.Channels;
 using System.Text;
 using System.Windows.Forms;
+
 using Curtain.DataAccess;
 using Curtain.Framework.Utils;
 using Curtain.Framework.Windows;
-using Curtain.WCF.Proxy;
+
 using HslCommunication.Core.Net;
 using HslCommunication.Enthernet;
-using PLCCommunication.Proxy;
 
 namespace PCLCommunication
 {
@@ -511,6 +510,57 @@ namespace PCLCommunication
                             }
                             */
 
+                            // 增加自动计件,
+                            if (ConnSetting.AutoPost)
+                            {
+                                // 3 3-3线上施釉
+                                // 81 2-7线上施釉交接
+                                // 53 2-2精坯入库
+                                // 61 2-1二检
+                                string mmm = null;
+                                string scode1 = "OK";
+                                string accountcode = "dongke";
+                                string usercode = "091";
+                                int pid = 61;
+                                scode1 = ConnSetting.AddWorkPieceByStatus1(accountcode, usercode, pid, barcode, this.Text, "5001自动计件");
+                                mmm = string.Format("工序计件1:{0},{1},{2},{3},{4}", accountcode, usercode, pid, barcode, scode1);
+                                LogNet_BeforeSaveToFile(mmm);
+                                lbl.AppendLine(mmm);
+                                
+                                usercode = "SK203";
+                                pid = 53;
+                                scode1 = ConnSetting.AddWorkPieceByStatus1(accountcode, usercode, pid, barcode, this.Text, "5001自动计件");
+                                mmm = string.Format("工序计件2:{0},{1},{2},{3},{4}", accountcode, usercode, pid, barcode, scode1);
+                                LogNet_BeforeSaveToFile(mmm);
+                                lbl.AppendLine(mmm);
+                                
+                                /*usercode = "AAA";
+                                pid = 81;
+                                scode1 = ConnSetting.AddWorkPieceByStatus1(accountcode, usercode, pid, barcode, this.Text, "5001自动计件");
+                                mmm = string.Format("工序计件3:{0},{1},{2},{3},{4}", accountcode, usercode, pid, barcode, scode1);
+                                LogNet_BeforeSaveToFile(mmm);
+                                lbl.AppendLine(mmm);*/
+
+                                //if (string.IsNullOrEmpty(scode))
+                                if (scode1 != "OK")
+                                {
+                                    LogNet_BeforeSaveToFile("写入 D330 标识 2 ");
+                                    lbl.AppendLine("写入 D330 标识 2 ");
+                                    // 写入 D330 标识 1
+                                    result = m.SetData("D", 330, 1, "0002");
+                                    LogNet_BeforeSaveToFile(JsonUtil.FromObject(m));
+                                    lbl.AppendLine(JsonUtil.FromObject(m));
+                                    if (!result)
+                                    {
+                                        LogNet_BeforeSaveToFile("PLC操作失败");
+                                        lbl.AppendLine("PLC操作失败");
+                                        return;
+                                    }
+                                    simplifyServer.SendMessage(arg1, "0000");
+                                    return;
+                                }
+                            }
+
                             LogNet_BeforeSaveToFile("写入 D330 标识 1 ");
                             lbl.AppendLine("写入 D330 标识 1 ");
                             // 写入 D330 标识 1
@@ -526,6 +576,7 @@ namespace PCLCommunication
 
                             simplifyServer.SendMessage(arg1, "0100");
                         }
+                        return;
                     }
                     #endregion
 
@@ -989,6 +1040,7 @@ namespace PCLCommunication
                             }
                             simplifyServer.SendMessage(arg1, "0100");
                         }
+                        return;
                     }
                     #endregion
 

+ 4 - 4
PLCHegii5020.sln

@@ -17,8 +17,8 @@ Global
 		Release|x86 = Release|x86
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{035FF67C-B47C-4648-B207-3997C4C37622}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{035FF67C-B47C-4648-B207-3997C4C37622}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{035FF67C-B47C-4648-B207-3997C4C37622}.Debug|Any CPU.ActiveCfg = Debug|x86
+		{035FF67C-B47C-4648-B207-3997C4C37622}.Debug|Any CPU.Build.0 = Debug|x86
 		{035FF67C-B47C-4648-B207-3997C4C37622}.Debug|x64.ActiveCfg = Debug|Any CPU
 		{035FF67C-B47C-4648-B207-3997C4C37622}.Debug|x64.Build.0 = Debug|Any CPU
 		{035FF67C-B47C-4648-B207-3997C4C37622}.Debug|x86.ActiveCfg = Debug|x86
@@ -29,8 +29,8 @@ Global
 		{035FF67C-B47C-4648-B207-3997C4C37622}.Release|x64.Build.0 = Release|Any CPU
 		{035FF67C-B47C-4648-B207-3997C4C37622}.Release|x86.ActiveCfg = Release|x86
 		{035FF67C-B47C-4648-B207-3997C4C37622}.Release|x86.Build.0 = Release|x86
-		{D3710B78-1B32-4D53-9604-0451A795A2F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{D3710B78-1B32-4D53-9604-0451A795A2F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D3710B78-1B32-4D53-9604-0451A795A2F5}.Debug|Any CPU.ActiveCfg = Debug|x86
+		{D3710B78-1B32-4D53-9604-0451A795A2F5}.Debug|Any CPU.Build.0 = Debug|x86
 		{D3710B78-1B32-4D53-9604-0451A795A2F5}.Debug|x64.ActiveCfg = Debug|x64
 		{D3710B78-1B32-4D53-9604-0451A795A2F5}.Debug|x64.Build.0 = Debug|x64
 		{D3710B78-1B32-4D53-9604-0451A795A2F5}.Debug|x86.ActiveCfg = Debug|x86