Browse Source

原来改的代码提交

callm 4 years ago
parent
commit
f57317bfb0
26 changed files with 2138 additions and 227 deletions
  1. 1 0
      MES_ODLF/MES_ODLF.csproj
  2. 22 3
      MES_ODLF/MesHelper.cs
  3. 13 0
      UAS-出货标签管理(泽天)/PublicMethod/BaseUtil.cs
  4. 61 0
      UAS-出货标签管理(泽天)/PublicMethod/IPTool.cs
  5. 1 0
      UAS-出货标签管理(泽天)/UAS-出货标签管理(泽天).csproj
  6. 49 34
      UAS-出货标签管理(泽天)/UAS_出货标签管理.Designer.cs
  7. 106 4
      UAS-出货标签管理(泽天)/UAS_出货标签管理.cs
  8. 16 23
      UAS-出货标签管理(贸易版)/PublicMethod/DataHelper.cs
  9. 1 0
      UAS-出货标签管理(贸易版)/PublicMethod/ExcelHandler.cs
  10. 1 1
      UAS-出货标签管理(贸易版)/UAS-出货标签管理(贸易版).csproj
  11. 1 1
      UAS_MES_ODLF/DataOperate/DataHelper.cs
  12. 79 24
      UAS_MES_ODLF/DataOperate/ExcelHandler.cs
  13. 786 0
      UAS_MES_ODLF/FunctionCode/Make/Make_ColorBoxLoadPrintBZ.Designer.cs
  14. 575 0
      UAS_MES_ODLF/FunctionCode/Make/Make_ColorBoxLoadPrintBZ.cs
  15. 197 0
      UAS_MES_ODLF/FunctionCode/Make/Make_ColorBoxLoadPrintBZ.resx
  16. 9 9
      UAS_MES_ODLF/FunctionCode/Packing/Packing_PackageCollection.cs
  17. 74 32
      UAS_MES_ODLF/FunctionCode/Query/Query_DateRate.Designer.cs
  18. 18 5
      UAS_MES_ODLF/FunctionCode/Query/Query_DateRate.cs
  19. 19 18
      UAS_MES_ODLF/FunctionCode/Special/Special_CancelCollection.Designer.cs
  20. 64 59
      UAS_MES_ODLF/FunctionCode/Special/Special_CancelCollection.cs
  21. 10 0
      UAS_MES_ODLF/PublicMethod/LogicHandler.cs
  22. 3 3
      UAS_MES_ODLF/PublicMethod/Print.cs
  23. 9 0
      UAS_MES_ODLF/UAS_MES_ODLF.csproj
  24. 4 4
      UAS_MesInterface(4.0)/MesHelper.cs
  25. 18 7
      UAS_MesInterface(ODLF)/MesHelper.cs
  26. 1 0
      UAS_MesInterface(ODLF)/UAS_MesInterface(ODLF).csproj

+ 1 - 0
MES_ODLF/MES_ODLF.csproj

@@ -39,6 +39,7 @@
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Web.Extensions" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />

+ 22 - 3
MES_ODLF/MesHelper.cs

@@ -4,6 +4,7 @@ using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
 using System.Text;
+using System.Web.Script.Serialization;
 
 namespace UMES.DllService
 {
@@ -327,17 +328,34 @@ namespace UMES.DllService
         /// <param name="oErrMessage"></param>
         /// <returns></returns>
         [Description("查询已分配的信息")]
-        public bool GetMobileAllInfo(string iSN, out Dictionary<string, string> oInfo, out string oErrMessage)
+        public bool GetMobileAllInfo(string iSN, out string oJson, out string oErrMessage)
         {
-            oInfo = new Dictionary<string, string>();
+            JavaScriptSerializer jss = new JavaScriptSerializer();
+            Dictionary<string, string> oInfo = new Dictionary<string, string>();
             oErrMessage = "";
+            oJson = "";
             if (iSN == "")
             {
                 oErrMessage = "SN不能为空";
                 return false;
             }
+            Dictionary<string, string> MacInfo = new Dictionary<string, string>();
+            if (!GetAddressRangeByMO(iSN, out MacInfo, out oErrMessage))
+            {
+                if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                    return true;
+                else
+                    return false;
+            }
+            if (!SetAddressInfo(iSN, MacInfo["MAC"] == "null" ? "" : MacInfo["MAC"], MacInfo["BT"] == "null" ? "" : MacInfo["BT"], MacInfo["Code1"] == "null" ? "" : MacInfo["Code1"], MacInfo["Code2"] == "null" ? "" : MacInfo["Code2"], MacInfo["Code3"] == "null" ? "" : MacInfo["Code3"], out oErrMessage))
+            {
+                if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
+                    return true;
+                else
+                    return false;
+            }
             //通过序列号获取最近操作的工单号
-            string ms_id = getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode='" + iSN + "'").ToString();
+            string ms_id = getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode='" + iSN + "' or ms_firstsn='" + iSN + "'").ToString();
             if (ms_id != "")
             {
                 DataTable dt = getFieldsDataByCondition("MakeSerial", new string[] { "ms_id", "ms_mac", "ms_bt", "ms_meid", "ms_netcode", "ms_psn", "ms_imei1", "ms_imei2", "ms_imei3", "ms_othcode1", "ms_othcode2", "ms_othcode3", "ms_othid1", "ms_othid2", "ms_othid3" }, "ms_id='" + ms_id + "'");
@@ -369,6 +387,7 @@ namespace UMES.DllService
                             oInfo.Add(param[i].Split('^')[0], param[i].Split('^')[1]);
                         }
                     }
+                    oJson = jss.Serialize(oInfo);
                     oErrMessage = "";
                     return true;
                 }

+ 13 - 0
UAS-出货标签管理(泽天)/PublicMethod/BaseUtil.cs

@@ -16,6 +16,19 @@ namespace UAS_LabelMachine
 
         static string SysDisc;
 
+        public static string ByteToHexadecimalString(byte[] b, int length)
+        {
+            string returnStr = "";
+            if (b != null)
+            {
+                for (int i = 0; i < length; i++)
+                {
+                    returnStr += Convert.ToString(b[i], 16);//ToString("X2") 为C#中的字符串格式控制符
+                }
+            }
+            return returnStr.ToUpper();
+        }
+
         public static string SysDisc1
         {
             get

+ 61 - 0
UAS-出货标签管理(泽天)/PublicMethod/IPTool.cs

@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace UAS_LabelMachine.PublicMethod
+{
+    class IPTool
+    {
+        private Socket socket;
+
+        private IPEndPoint serverFullAddr;//完整终端地址
+
+        public IPTool(string IP, string Port)
+        {
+            try
+            {
+                socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+                serverFullAddr = new IPEndPoint(IPAddress.Parse(IP), int.Parse(Port));//设置IP,端口
+                socket.ReceiveTimeout = 2000;
+                socket.Connect(serverFullAddr);
+                Task.Factory.StartNew(WatchConnecting, TaskCreationOptions.LongRunning);
+            }
+            catch (Exception ex)
+            {
+                LogManager.DoLog(ex.Message + ex.StackTrace);
+            }
+        }
+
+        public void SendCommand()
+        {
+            try
+            {
+                if (!socket.Connected)
+                {
+                    socket.Close();
+                    socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+                    socket.ReceiveTimeout = 2000;
+                    socket.Connect(serverFullAddr);
+                }
+                byte[] receive = new byte[1024 * 10];
+                int length = socket.Receive(receive);
+                string str = BaseUtil.ByteToHexadecimalString(receive, length);
+                Console.WriteLine(str);
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine(ex.Message + ex.StackTrace);
+            }
+        }
+
+        private void WatchConnecting()
+        {
+            SendCommand();
+        }
+    }
+}

+ 1 - 0
UAS-出货标签管理(泽天)/UAS-出货标签管理(泽天).csproj

@@ -276,6 +276,7 @@
     <Compile Include="PublicMethod\ftpOperater.cs" />
     <Compile Include="PublicMethod\GlobalEventsHandler.cs" />
     <Compile Include="PublicMethod\HttpHandler.cs" />
+    <Compile Include="PublicMethod\IPTool.cs" />
     <Compile Include="PublicMethod\LogicHandler.cs" />
     <Compile Include="PublicMethod\LogManager.cs" />
     <Compile Include="PublicMethod\SqliteDBHelper.cs" />

+ 49 - 34
UAS-出货标签管理(泽天)/UAS_出货标签管理.Designer.cs

@@ -103,6 +103,7 @@
             this.标签自定义ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.重置单据ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.同步出货数据ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.贴标机参数设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.groupBoxWithBorder2 = new UAS_LabelMachine.CustomControl.GroupBoxWithBorder.GroupBoxWithBorder();
             this.CloseSerialPort = new System.Windows.Forms.Button();
             this.ConnectCom = new System.Windows.Forms.Button();
@@ -199,7 +200,7 @@
             this.OutBoxLabelPrint = new System.Windows.Forms.Button();
             this.OutBoxCombox = new System.Windows.Forms.ComboBox();
             this.MenuManage = new System.Windows.Forms.Button();
-            this.贴标机参数设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.Connect = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.MidSource)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
             this.ShowMenu_Total.SuspendLayout();
@@ -239,7 +240,7 @@
             // LabelMainTain
             // 
             this.LabelMainTain.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.LabelMainTain.Location = new System.Drawing.Point(970, 10);
+            this.LabelMainTain.Location = new System.Drawing.Point(292, 108);
             this.LabelMainTain.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.LabelMainTain.Name = "LabelMainTain";
             this.LabelMainTain.Size = new System.Drawing.Size(128, 52);
@@ -252,7 +253,7 @@
             // CleanDetail
             // 
             this.CleanDetail.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CleanDetail.Location = new System.Drawing.Point(970, 10);
+            this.CleanDetail.Location = new System.Drawing.Point(292, 108);
             this.CleanDetail.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.CleanDetail.Name = "CleanDetail";
             this.CleanDetail.Size = new System.Drawing.Size(128, 52);
@@ -521,7 +522,7 @@
             // AttachInfo
             // 
             this.AttachInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.AttachInfo.Location = new System.Drawing.Point(970, 76);
+            this.AttachInfo.Location = new System.Drawing.Point(292, 102);
             this.AttachInfo.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.AttachInfo.Name = "AttachInfo";
             this.AttachInfo.Size = new System.Drawing.Size(128, 52);
@@ -568,7 +569,7 @@
             // PrintFooter
             // 
             this.PrintFooter.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PrintFooter.Location = new System.Drawing.Point(970, 12);
+            this.PrintFooter.Location = new System.Drawing.Point(292, 110);
             this.PrintFooter.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.PrintFooter.Name = "PrintFooter";
             this.PrintFooter.Size = new System.Drawing.Size(128, 52);
@@ -615,7 +616,7 @@
             // PrintStatus
             // 
             this.PrintStatus.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PrintStatus.Location = new System.Drawing.Point(970, 82);
+            this.PrintStatus.Location = new System.Drawing.Point(292, 108);
             this.PrintStatus.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.PrintStatus.Name = "PrintStatus";
             this.PrintStatus.Size = new System.Drawing.Size(128, 52);
@@ -671,7 +672,7 @@
             // 
             this.CustomerLabel.Enabled = false;
             this.CustomerLabel.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CustomerLabel.Location = new System.Drawing.Point(970, 142);
+            this.CustomerLabel.Location = new System.Drawing.Point(279, 106);
             this.CustomerLabel.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.CustomerLabel.Name = "CustomerLabel";
             this.CustomerLabel.Size = new System.Drawing.Size(168, 52);
@@ -753,7 +754,7 @@
             // Reset
             // 
             this.Reset.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Reset.Location = new System.Drawing.Point(970, 142);
+            this.Reset.Location = new System.Drawing.Point(279, 106);
             this.Reset.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.Reset.Name = "Reset";
             this.Reset.Size = new System.Drawing.Size(128, 52);
@@ -766,7 +767,7 @@
             // GetPDdata
             // 
             this.GetPDdata.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.GetPDdata.Location = new System.Drawing.Point(950, 144);
+            this.GetPDdata.Location = new System.Drawing.Point(259, 108);
             this.GetPDdata.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.GetPDdata.Name = "GetPDdata";
             this.GetPDdata.Size = new System.Drawing.Size(186, 52);
@@ -869,6 +870,12 @@
             this.同步出货数据ToolStripMenuItem.Size = new System.Drawing.Size(256, 36);
             this.同步出货数据ToolStripMenuItem.Text = "同步出货数据";
             // 
+            // 贴标机参数设置ToolStripMenuItem
+            // 
+            this.贴标机参数设置ToolStripMenuItem.Name = "贴标机参数设置ToolStripMenuItem";
+            this.贴标机参数设置ToolStripMenuItem.Size = new System.Drawing.Size(256, 36);
+            this.贴标机参数设置ToolStripMenuItem.Text = "贴标机参数设置";
+            // 
             // groupBoxWithBorder2
             // 
             this.groupBoxWithBorder2.Controls.Add(this.CloseSerialPort);
@@ -925,7 +932,7 @@
             this.Weight.AutoSize = true;
             this.Weight.Font = new System.Drawing.Font("微软雅黑", 30F);
             this.Weight.ForeColor = System.Drawing.Color.Red;
-            this.Weight.Location = new System.Drawing.Point(16, 64);
+            this.Weight.Location = new System.Drawing.Point(18, 66);
             this.Weight.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.Weight.Name = "Weight";
             this.Weight.Size = new System.Drawing.Size(0, 104);
@@ -1164,7 +1171,7 @@
             // 
             this.label18.AutoSize = true;
             this.label18.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label18.Location = new System.Drawing.Point(132, 248);
+            this.label18.Location = new System.Drawing.Point(134, 250);
             this.label18.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label18.Name = "label18";
             this.label18.Size = new System.Drawing.Size(24, 31);
@@ -1199,7 +1206,7 @@
             // 
             this.label16.AutoSize = true;
             this.label16.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label16.Location = new System.Drawing.Point(128, 120);
+            this.label16.Location = new System.Drawing.Point(130, 122);
             this.label16.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label16.Name = "label16";
             this.label16.Size = new System.Drawing.Size(24, 31);
@@ -1234,7 +1241,7 @@
             // 
             this.label12.AutoSize = true;
             this.label12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label12.Location = new System.Drawing.Point(16, 180);
+            this.label12.Location = new System.Drawing.Point(18, 182);
             this.label12.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label12.Name = "label12";
             this.label12.Size = new System.Drawing.Size(110, 31);
@@ -1245,7 +1252,7 @@
             // 
             this.label7.AutoSize = true;
             this.label7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label7.Location = new System.Drawing.Point(12, 56);
+            this.label7.Location = new System.Drawing.Point(14, 58);
             this.label7.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label7.Name = "label7";
             this.label7.Size = new System.Drawing.Size(110, 31);
@@ -1597,7 +1604,7 @@
             // 
             this.SingleLabelPrint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.SingleLabelPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SingleLabelPrint.Location = new System.Drawing.Point(276, 355);
+            this.SingleLabelPrint.Location = new System.Drawing.Point(538, 357);
             this.SingleLabelPrint.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.SingleLabelPrint.Name = "SingleLabelPrint";
             this.SingleLabelPrint.Size = new System.Drawing.Size(136, 52);
@@ -1612,7 +1619,7 @@
             this.SingleLabelAutoPrint.Checked = true;
             this.SingleLabelAutoPrint.CheckState = System.Windows.Forms.CheckState.Checked;
             this.SingleLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(24, 192);
+            this.SingleLabelAutoPrint.Location = new System.Drawing.Point(26, 194);
             this.SingleLabelAutoPrint.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.SingleLabelAutoPrint.Name = "SingleLabelAutoPrint";
             this.SingleLabelAutoPrint.Size = new System.Drawing.Size(142, 35);
@@ -1659,7 +1666,7 @@
             this.CurrentRowOnly.Checked = true;
             this.CurrentRowOnly.CheckState = System.Windows.Forms.CheckState.Checked;
             this.CurrentRowOnly.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.CurrentRowOnly.Location = new System.Drawing.Point(168, 196);
+            this.CurrentRowOnly.Location = new System.Drawing.Point(170, 198);
             this.CurrentRowOnly.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.CurrentRowOnly.Name = "CurrentRowOnly";
             this.CurrentRowOnly.Size = new System.Drawing.Size(166, 35);
@@ -1685,7 +1692,7 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(16, 248);
+            this.label2.Location = new System.Drawing.Point(18, 250);
             this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(62, 31);
@@ -1709,7 +1716,7 @@
             // 
             this.label5.AutoSize = true;
             this.label5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label5.Location = new System.Drawing.Point(16, 312);
+            this.label5.Location = new System.Drawing.Point(18, 314);
             this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(62, 31);
@@ -1743,7 +1750,7 @@
             this.MidLabelAutoPrint.Checked = true;
             this.MidLabelAutoPrint.CheckState = System.Windows.Forms.CheckState.Checked;
             this.MidLabelAutoPrint.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.MidLabelAutoPrint.Location = new System.Drawing.Point(12, 192);
+            this.MidLabelAutoPrint.Location = new System.Drawing.Point(14, 194);
             this.MidLabelAutoPrint.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.MidLabelAutoPrint.Name = "MidLabelAutoPrint";
             this.MidLabelAutoPrint.Size = new System.Drawing.Size(142, 35);
@@ -1795,7 +1802,7 @@
             // 
             this.DiffDetno.AutoSize = true;
             this.DiffDetno.Font = new System.Drawing.Font("微软雅黑", 8F);
-            this.DiffDetno.Location = new System.Drawing.Point(252, 380);
+            this.DiffDetno.Location = new System.Drawing.Point(254, 382);
             this.DiffDetno.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.DiffDetno.Name = "DiffDetno";
             this.DiffDetno.Size = new System.Drawing.Size(133, 34);
@@ -1807,7 +1814,7 @@
             // 
             this.DiffCPN.AutoSize = true;
             this.DiffCPN.Font = new System.Drawing.Font("微软雅黑", 8F);
-            this.DiffCPN.Location = new System.Drawing.Point(252, 336);
+            this.DiffCPN.Location = new System.Drawing.Point(254, 338);
             this.DiffCPN.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.DiffCPN.Name = "DiffCPN";
             this.DiffCPN.Size = new System.Drawing.Size(135, 34);
@@ -1819,7 +1826,7 @@
             // 
             this.BoxCount.AutoSize = true;
             this.BoxCount.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.BoxCount.Location = new System.Drawing.Point(264, 376);
+            this.BoxCount.Location = new System.Drawing.Point(266, 378);
             this.BoxCount.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.BoxCount.Name = "BoxCount";
             this.BoxCount.Size = new System.Drawing.Size(0, 31);
@@ -1829,7 +1836,7 @@
             // 
             this.DiffLotNo.AutoSize = true;
             this.DiffLotNo.Font = new System.Drawing.Font("微软雅黑", 8F);
-            this.DiffLotNo.Location = new System.Drawing.Point(252, 288);
+            this.DiffLotNo.Location = new System.Drawing.Point(254, 290);
             this.DiffLotNo.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.DiffLotNo.Name = "DiffLotNo";
             this.DiffLotNo.Size = new System.Drawing.Size(118, 34);
@@ -1841,7 +1848,7 @@
             // 
             this.DiffDC.AutoSize = true;
             this.DiffDC.Font = new System.Drawing.Font("微软雅黑", 8F);
-            this.DiffDC.Location = new System.Drawing.Point(252, 236);
+            this.DiffDC.Location = new System.Drawing.Point(254, 238);
             this.DiffDC.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.DiffDC.Name = "DiffDC";
             this.DiffDC.Size = new System.Drawing.Size(121, 34);
@@ -1853,7 +1860,7 @@
             // 
             this.OnlyOneRow.AutoSize = true;
             this.OnlyOneRow.Font = new System.Drawing.Font("微软雅黑", 8F);
-            this.OnlyOneRow.Location = new System.Drawing.Point(252, 188);
+            this.OnlyOneRow.Location = new System.Drawing.Point(254, 190);
             this.OnlyOneRow.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.OnlyOneRow.Name = "OnlyOneRow";
             this.OnlyOneRow.Size = new System.Drawing.Size(111, 34);
@@ -1865,7 +1872,7 @@
             // 
             this.AllLabel.AutoSize = true;
             this.AllLabel.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.AllLabel.Location = new System.Drawing.Point(20, 192);
+            this.AllLabel.Location = new System.Drawing.Point(22, 194);
             this.AllLabel.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
             this.AllLabel.Name = "AllLabel";
             this.AllLabel.Size = new System.Drawing.Size(190, 35);
@@ -1888,7 +1895,7 @@
             // LogingOut
             // 
             this.LogingOut.AutoSize = true;
-            this.LogingOut.Location = new System.Drawing.Point(228, 16);
+            this.LogingOut.Location = new System.Drawing.Point(230, 18);
             this.LogingOut.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.LogingOut.Name = "LogingOut";
             this.LogingOut.Size = new System.Drawing.Size(82, 41);
@@ -1916,7 +1923,7 @@
             // 
             this.label10.AutoSize = true;
             this.label10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label10.Location = new System.Drawing.Point(32, 308);
+            this.label10.Location = new System.Drawing.Point(34, 310);
             this.label10.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label10.Name = "label10";
             this.label10.Size = new System.Drawing.Size(62, 31);
@@ -1927,7 +1934,7 @@
             // 
             this.label6.AutoSize = true;
             this.label6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label6.Location = new System.Drawing.Point(32, 248);
+            this.label6.Location = new System.Drawing.Point(34, 250);
             this.label6.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label6.Name = "label6";
             this.label6.Size = new System.Drawing.Size(62, 31);
@@ -1994,11 +2001,17 @@
             this.MenuManage.UseVisualStyleBackColor = true;
             this.MenuManage.Click += new System.EventHandler(this.MenuManage_Click);
             // 
-            // 贴标机参数设置ToolStripMenuItem
+            // Connect
             // 
-            this.贴标机参数设置ToolStripMenuItem.Name = "贴标机参数设置ToolStripMenuItem";
-            this.贴标机参数设置ToolStripMenuItem.Size = new System.Drawing.Size(256, 36);
-            this.贴标机参数设置ToolStripMenuItem.Text = "贴标机参数设置";
+            this.Connect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Connect.Location = new System.Drawing.Point(916, 24);
+            this.Connect.Margin = new System.Windows.Forms.Padding(6, 4, 6, 4);
+            this.Connect.Name = "Connect";
+            this.Connect.Size = new System.Drawing.Size(144, 52);
+            this.Connect.TabIndex = 118;
+            this.Connect.Text = "连接贴标机";
+            this.Connect.UseVisualStyleBackColor = true;
+            this.Connect.Click += new System.EventHandler(this.Connect_Click);
             // 
             // UAS_出货标签打印
             // 
@@ -2006,6 +2019,7 @@
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(233)))), ((int)(((byte)(206)))));
             this.ClientSize = new System.Drawing.Size(2548, 1464);
+            this.Controls.Add(this.Connect);
             this.Controls.Add(this.MenuManage);
             this.Controls.Add(this.pib_indate);
             this.Controls.Add(this.label11);
@@ -2250,5 +2264,6 @@
         private System.Windows.Forms.ToolStripMenuItem 同步出货数据ToolStripMenuItem;
         private System.Windows.Forms.Button MenuManage;
         private System.Windows.Forms.ToolStripMenuItem 贴标机参数设置ToolStripMenuItem;
+        private System.Windows.Forms.Button Connect;
     }
 }

+ 106 - 4
UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

@@ -14,12 +14,14 @@ using FastReport;
 using System.Linq;
 using System.Reflection;
 using UAS_LabelMachine.CustomControl;
+using System.Net.Sockets;
 
 namespace UAS_LabelMachine
 {
     public partial class UAS_出货标签打印 : Form
     {
 
+        bool ConnectToMachine = false;
 
         //自适应屏幕
         AutoSizeFormClass asc = new AutoSizeFormClass();
@@ -232,6 +234,10 @@ namespace UAS_LabelMachine
             if (SplitData.Length < 5)
             {
                 MessageBox.Show("数据格式错误,无法解析", "提示");
+                if (ConnectToMachine)
+                {
+                    receiveClient.Client.Send(Encoding.ASCII.GetBytes("NG"));
+                }
                 Input.SelectAll();
                 return;
             }
@@ -303,6 +309,8 @@ namespace UAS_LabelMachine
                     MessageBox.Show("请检查最小包装数");
                 }
                 //如果单位是KPCS则必须是1000的整数倍
+                Console.WriteLine(Convert.ToDouble((double.Parse(Data["QTY"]) / 1000).ToString("0.000")));
+                Console.WriteLine(Convert.ToDouble(double.Parse(CurrentZXBZ).ToString("0.000")));
                 if (int.Parse((Convert.ToDouble((double.Parse(Data["QTY"]) / 1000).ToString("0.000")) / Convert.ToDouble(double.Parse(CurrentZXBZ).ToString("0.000"))).ToString()) % 1 != 0)
                 {
                     MessageBox.Show("物料" + Data["PRCODE"] + "采集数量无法按照最小包装数拆分", "提示");
@@ -433,10 +441,10 @@ namespace UAS_LabelMachine
             }
             if (SingleLabelAutoPrint.Checked)
             {
-                thread = new Thread(AutoPrintSingleLabel);
-                stw = new SetLoadingWindow(thread, "正在打印单盘标签");
-                BaseUtil.SetFormCenter(stw);
-                stw.ShowDialog();
+                //thread = new Thread(AutoPrintSingleLabel);
+                //stw = new SetLoadingWindow(thread, "正在打印单盘标签");
+                //BaseUtil.SetFormCenter(stw);
+                //stw.ShowDialog();
             }
             //采集后重新计数,自动跳到下一行
             collectqty = (SumQty.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
@@ -2305,5 +2313,99 @@ namespace UAS_LabelMachine
         {
             ShowMenu_Total.Show(new Point(MenuManage.Location.X, MenuManage.Location.Y + 20));
         }
+
+        SqliteDBHelper sdh = SystemInf.sdh;
+        //接受数据客户端
+        TcpClient receiveClient;
+        //发送指令客户端
+        TcpClient sendClient;
+        //复核数据客户端
+        TcpClient resetClient;
+        NetworkStream ns;
+        Thread receiveThread;
+
+        private void Connect_Click(object sender, EventArgs e)
+        {
+            receiveClient = new TcpClient();
+            sendClient = new TcpClient();
+            resetClient = new TcpClient();
+            DataTable dt = (DataTable)sdh.ExecuteSql("select * from ParamSetting", "select");
+            if (dt.Rows.Count > 0)
+            {
+                try
+                {
+                    //发起TCP连接  
+                    receiveClient.Connect(dt.Rows[0]["ps_ip"].ToString(), int.Parse(dt.Rows[0]["ps_receiveport"].ToString()));
+                    sendClient.Connect(dt.Rows[0]["ps_ip"].ToString(), int.Parse(dt.Rows[0]["ps_sendport"].ToString()));
+                    resetClient.Connect(dt.Rows[0]["ps_ip"].ToString(), int.Parse(dt.Rows[0]["ps_resetport"].ToString()));
+                    if (receiveClient != null)
+                    {
+                        MessageBox.Show("连接服务器成功");
+                        ConnectToMachine = true;
+                        //获得绑定的网络数据流  
+                        ns = receiveClient.GetStream();
+                        Control.CheckForIllegalCrossThreadCalls = false;
+                        //实例化并启动接受消息线程  
+                        receiveThread = new Thread(receive_message);
+                        receiveThread.Start();
+                    }
+                    else
+                    {
+                        MessageBox.Show("连接服务器失败");
+                    }
+                }
+                catch (Exception ex)
+                {
+                    MessageBox.Show(ex.Message);
+                }
+            }
+        }
+
+        private void receive_message()
+        {
+            while (IsOnline(receiveClient))
+            {
+                try
+                {
+                    //创建接收数据的字节流  
+                    byte[] getData = new byte[1024];
+                    //从网络流中读取数据  
+                    ns.Read(getData, 0, getData.Length);
+                    //将字节数组转换成文本形式  
+                    string getMsg = Encoding.Default.GetString(getData);
+                    string msgStr = getMsg.Trim('\0');
+                    Console.WriteLine(msgStr);
+                    Input.Text = msgStr;
+                    Input_KeyDown(Input, new KeyEventArgs(Keys.Enter));
+                }
+                catch (ThreadAbortException)
+                {
+                    //捕捉到线程被终止异常则表示是人为的断开TCP连接  
+                    //不弹出错误提示
+                    break;
+                }
+                catch (Exception e)
+                {
+                    //接受消息发生异常  
+                    MessageBox.Show(e.Message);
+                    receiveClient.Client.Send(Encoding.ASCII.GetBytes("NG"));
+                    //并释放相关资源  
+                    //if (ns != null)
+                    //    ns.Dispose();
+                    //break;
+                }
+            }
+            MessageBox.Show("网络中断");
+        }
+
+        /// <summary>
+        ///  检测TCP连接是否存在还是已经中断
+        /// </summary>
+        /// <param name="c"></param>
+        /// <returns></returns>
+        public bool IsOnline(TcpClient c)
+        {
+            return !((c.Client.Poll(1000, SelectMode.SelectRead) && (c.Client.Available == 0)) || !c.Client.Connected);
+        }
     }
 }

+ 16 - 23
UAS-出货标签管理(贸易版)/PublicMethod/DataHelper.cs

@@ -12,7 +12,7 @@ namespace UAS_LabelMachine
     {
 
         ////深爱地址
-        //private readonly string ConnectionStrings = "Data Source=172.16.0.22/orcl;User ID=SZSI_P;PassWord=select!#%*(";
+        //private readonly string ConnectionStrings = "Data Source=10.8.0.12/orcl;User ID=SZSI_P;PassWord=select!#%*(";
 
         //private readonly string IPConnectionStrings = "Data Source=172.16.0.22/orcl;User ID=SZSI_P;PassWord=select!#%*(";
         ////深爱ERP地址
@@ -46,34 +46,27 @@ namespace UAS_LabelMachine
         ////Oracle端口
         //public static readonly string OraclePort = "1521";
 
-        ////高登地址
-        //private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DATACENTER;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=183.238.39.179)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
-        ////高登ERP地址
-        //public static readonly string ERPAddesss = "http://183.238.39.179:8099/ERP/";
-        ////高登TP
-        //public static readonly string InnerFTPAddress = "ftp://192.168.0.158:21|GOLDENMES|Admin1@#";
-        //public static readonly string FTPAddress = "ftp://183.238.39.179:21|GOLDENMES|Admin1@#";
-        ////Oracle端口
-        //public static readonly string OraclePort = "1521";
+        //private readonly string ConnectionStrings = "Data Source=10.8.0.51/orcl;User ID=ZJT_T;PassWord=select!#%*(";
+
+        //private readonly string IPConnectionStrings = "Data Source=10.8.0.51/orcl;User ID=ZJT_T;PassWord=select!#%*(";
+        ////中聚泰地址
+        //public static readonly string ERPAddesss = "http://10.8.0.51:8090/ERP/";
+        ////中聚泰FTP
+        //public static readonly string FTPAddress = "ftp://10.8.0.51|vsftpd|vsftpd";
 
-        ////怡海能达外网地址
-        //private readonly string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DATACENTER;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=sz.hi-mantech.com)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
-        ////怡海能达ERP地址
-        //public static readonly string ERPAddesss = "http://sz.hi-mantech.com:8099/ERP/";
-        ////怡海能达FTP
-        //public static readonly string FTPAddress = "ftp://sz.hi-mantech.com:46688|yhndftp|Stga28ytG8";
+        //public static readonly string InnerFTPAddress = "ftp://192.168.101.88|vsftpd|vsftpd";
         ////Oracle端口
         //public static readonly string OraclePort = "1521";
 
-        //private readonly string ConnectionStrings = "Data Source=192.168.101.88/orcl;User ID=ZJT_T;PassWord=select!#%*(";
+        //private readonly string ConnectionStrings = "Data Source=14.21.31.39/orcl;User ID=DATACENTER_P;PassWord=select!#%*(";
 
-        //private readonly string IPConnectionStrings = "Data Source=192.168.101.88/orcl;User ID=ZJT_T;PassWord=select!#%*(";
-        ////海创ERP地址
-        //public static readonly string ERPAddesss = "http://192.168.101.88:8090/ERP/";
-        ////海创FTP
-        //public static readonly string FTPAddress = "ftp://192.168.101.88|vsftpd|vsftpd";
+        //private readonly string IPConnectionStrings = "Data Source=14.21.31.39/orcl;User ID=DATACENTER_P;PassWord=select!#%*(";
+        ////博思达地址
+        //public static readonly string ERPAddesss = "http://14.21.31.39:8099/ERP/";
+        ////博思达FTP
+        //public static readonly string FTPAddress = "ftp://14.21.31.39|vsftpd|vsftpd";
 
-        //public static readonly string InnerFTPAddress = "ftp://192.168.101.88|vsftpd|vsftpd";
+        //public static readonly string InnerFTPAddress = "ftp://14.21.31.39|vsftpd|vsftpd";
         ////Oracle端口
         //public static readonly string OraclePort = "1521";
 

+ 1 - 0
UAS-出货标签管理(贸易版)/PublicMethod/ExcelHandler.cs

@@ -3638,6 +3638,7 @@ namespace UAS_LabelMachine
                         //每次到了页数开始分页
                         if (LastBatchCode == "" || (LastBatchCode != "" && LastBatchCode != DataTable.Rows[i]["ch_splitbatch"].ToString()) || (i == rowNum - 1 && (LastBatchCode != "" && LastBatchCode != DataTable.Rows[i]["ch_splitbatch"].ToString())))
                         {
+                            Console.WriteLine(DataTable.Rows[i]["ch_splitbatch"].ToString());
                             LastBatchCode = DataTable.Rows[i]["ch_splitbatch"].ToString();
                             //第一行添加客户信息
                             //if (i != rowNum - 1)

+ 1 - 1
UAS-出货标签管理(贸易版)/UAS-出货标签管理(贸易版).csproj

@@ -130,7 +130,7 @@
     <Reference Include="System.configuration" />
     <Reference Include="System.Core" />
     <Reference Include="System.Data.Linq" />
-    <Reference Include="System.Data.SQLite, Version=1.0.82.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
+    <Reference Include="System.Data.SQLite, Version=1.0.106.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>tool\System.Data.SQLite.dll</HintPath>
     </Reference>

+ 1 - 1
UAS_MES_ODLF/DataOperate/DataHelper.cs

@@ -952,7 +952,7 @@ namespace UAS_MES_NEW.DataOperate
             command.CommandText = ProcedureName;
             command.CommandType = CommandType.StoredProcedure;
             for (int i = 0; i < param.Length; i++)
-                command.Parameters.Add(new OracleParameter(param[i].ToString(), OracleDbType.Varchar2, 200, param[i], ParameterDirection.InputOutput));
+                command.Parameters.Add(new OracleParameter(param[i].ToString(), OracleDbType.Varchar2, 4000, param[i], ParameterDirection.InputOutput));
             try
             {
                 command.ExecuteNonQuery();

+ 79 - 24
UAS_MES_ODLF/DataOperate/ExcelHandler.cs

@@ -268,11 +268,15 @@ namespace UAS_MES_NEW.DataOperate
         /// <returns></returns>
         public MemoryStream DataTableToExcel_BAIDU(DataTable DataTable, DateTime begindate, int DateNum)
         {
-            string[] Step = new[] { "1-MT1", "2-MT2", "3-MMI", "4-RSA(耦合)", "5-AUD(曲线)", "6-THD(自播自录)", "7-SCK(验号)" };
-            string[] StepCode = new[] { "B_MT1", "B_MT2", "B_MMI", "B_RSA", "B_AUD", "B_THD", "B_SN", "B_OUTLOOK" };
-            string[] Kind = new[] { "测试数", "不良数", "误测数", "FPY", "RPY" };
+            string[] Step = new[] { "1-MT1", "2-MT2", "3-MMI", "4-RSA(耦合)", "5-AUD(曲线)", "6-SCW(写号)", "7-SCK(验号)" };
+            string[] StepCode = new[] { "B_MT1", "B_MT2", "B_MMI", "B_RSA", "B_AUD", "B_WRITE", "B_SN", "B_OUTLOOK" };
+            string[] Kind = new[] { "测试数", "通过数", "不良数", "误测通过数", "误测数", "FPY", "RPY" };
             string[] TotalKind = new[] { "总投入数", "总不良数", "FPY", "RPY" };
             string[] OutLook = new[] { "测试数", "不良数", "FPY" };
+            //每行的内容
+            int ContentRow = 7;
+            //外观的展示的行
+            int OutLookRow = 55;
             MemoryStream ms = new MemoryStream();
             //创建一个Book,相当于一个Excel文件
             HSSFWorkbook book = new HSSFWorkbook();
@@ -324,6 +328,8 @@ namespace UAS_MES_NEW.DataOperate
             LEMON_CHIFFON.BorderLeft = BorderStyle.THIN;
             LEMON_CHIFFON.BorderRight = BorderStyle.THIN;
             LEMON_CHIFFON.BorderTop = BorderStyle.THIN;
+            LEMON_CHIFFON.DataFormat = HSSFDataFormat.GetBuiltinFormat("0.00%");
+
 
             ICellStyle GOLD = book.CreateCellStyle();
             GOLD.VerticalAlignment = VerticalAlignment.CENTER;
@@ -344,7 +350,18 @@ namespace UAS_MES_NEW.DataOperate
             LIGHT_GREEN.BorderLeft = BorderStyle.THIN;
             LIGHT_GREEN.BorderRight = BorderStyle.THIN;
             LIGHT_GREEN.BorderTop = BorderStyle.THIN;
-            LIGHT_GREEN.DataFormat = HSSFDataFormat.GetBuiltinFormat("0.00%");
+            //LIGHT_GREEN.DataFormat = HSSFDataFormat.GetBuiltinFormat("0.00%");
+
+            ICellStyle DARK_BLUE = book.CreateCellStyle();
+            DARK_BLUE.VerticalAlignment = VerticalAlignment.CENTER;
+            DARK_BLUE.Alignment = HorizontalAlignment.CENTER;
+            DARK_BLUE.FillForegroundColor = HSSFColor.LIGHT_BLUE.index;
+            DARK_BLUE.FillPattern = FillPatternType.SOLID_FOREGROUND;
+            DARK_BLUE.BorderBottom = BorderStyle.THIN;
+            DARK_BLUE.BorderLeft = BorderStyle.THIN;
+            DARK_BLUE.BorderRight = BorderStyle.THIN;
+            DARK_BLUE.BorderTop = BorderStyle.THIN;
+            DARK_BLUE.DataFormat = HSSFDataFormat.GetBuiltinFormat("0.00%");
 
             ICellStyle LIGHT_CORNFLOWER_BLUE = book.CreateCellStyle();
             LIGHT_CORNFLOWER_BLUE.VerticalAlignment = VerticalAlignment.CENTER;
@@ -368,6 +385,16 @@ namespace UAS_MES_NEW.DataOperate
             GREY_25_PERCENT.BorderRight = BorderStyle.THIN;
             GREY_25_PERCENT.BorderTop = BorderStyle.THIN;
 
+            ICellStyle PINK = book.CreateCellStyle();
+            PINK.VerticalAlignment = VerticalAlignment.CENTER;
+            PINK.Alignment = HorizontalAlignment.CENTER;
+            PINK.FillForegroundColor = HSSFColor.LIGHT_ORANGE.index;
+            PINK.FillPattern = FillPatternType.SOLID_FOREGROUND;
+            PINK.BorderBottom = BorderStyle.THIN;
+            PINK.BorderLeft = BorderStyle.THIN;
+            PINK.BorderRight = BorderStyle.THIN;
+            PINK.BorderTop = BorderStyle.THIN;
+
             //Excel中的Sheet
             ISheet sheet = book.CreateSheet("sheet1");
             IRow row = sheet.CreateRow(0);
@@ -419,7 +446,7 @@ namespace UAS_MES_NEW.DataOperate
                         cell.CellStyle = TAN;
                         break;
                     case 2:
-                        cell.CellStyle = LIGHT_GREEN;
+                        cell.CellStyle = DARK_BLUE;
                         break;
                     case 3:
                         cell.CellStyle = LIGHT_CORNFLOWER_BLUE;
@@ -433,14 +460,14 @@ namespace UAS_MES_NEW.DataOperate
             for (int i = 0; i < Step.Length; i++)
             {
                 //除去前面6行
-                int rowindex = 6 + i * 5;
+                int rowindex = 6 + i * ContentRow;
                 row = sheet.CreateRow(rowindex);
                 cell = row.CreateCell(0);
                 cell.SetCellValue(Step[i]);
                 cell.CellStyle = PALE_BLUE;
-                region = new CellRangeAddress(rowindex, rowindex + 4, 0, 0);
+                region = new CellRangeAddress(rowindex, rowindex + ContentRow - 1, 0, 0);
                 sheet.AddMergedRegion(region);
-                for (int j = rowindex; j < rowindex + 5; j++)
+                for (int j = rowindex; j < rowindex + ContentRow; j++)
                 {
                     row = sheet.GetRow(j);
                     if (row == null)
@@ -455,37 +482,43 @@ namespace UAS_MES_NEW.DataOperate
                             cell.CellStyle = GREY_25_PERCENT;
                             break;
                         case 1:
-                            cell.CellStyle = TAN;
+                            cell.CellStyle = PINK;
                             break;
                         case 2:
-                            cell.CellStyle = GOLD;
+                            cell.CellStyle = TAN;
                             break;
                         case 3:
-                            cell.CellStyle = LIGHT_GREEN;
+                            cell.CellStyle = GOLD;
                             break;
                         case 4:
+                            cell.CellStyle = LIGHT_GREEN;
+                            break;
+                        case 5:
                             cell.CellStyle = LIGHT_CORNFLOWER_BLUE;
                             break;
+                        case 6:
+                            cell.CellStyle = LEMON_CHIFFON;
+                            break;
                         default:
                             break;
                     }
                 }
             }
             //最后一行外观数据
-            row = sheet.CreateRow(41);
+            row = sheet.CreateRow(OutLookRow);
             cell = row.CreateCell(0);
             cell.SetCellValue("8-外观");
             cell.CellStyle = PALE_BLUE;
-            region = new CellRangeAddress(41, 43, 0, 0);
+            region = new CellRangeAddress(OutLookRow, OutLookRow + 2, 0, 0);
             sheet.AddMergedRegion(region);
 
             //外观的统计数据
             for (int i = 0; i < OutLook.Length; i++)
             {
-                row = sheet.GetRow(41 + i);
+                row = sheet.GetRow(OutLookRow + i);
                 if (row == null)
                 {
-                    row = sheet.CreateRow(41 + i);
+                    row = sheet.CreateRow(OutLookRow + i);
                 }
                 cell = row.CreateCell(1);
                 cell.SetCellValue(OutLook[i]);
@@ -515,11 +548,11 @@ namespace UAS_MES_NEW.DataOperate
                 double TotalIN = 0;
                 for (int j = 0; j < StepCode.Length; j++)
                 {
-                    int rowindex = 6 + j * 5;
+                    int rowindex = 6 + j * ContentRow;
                     DataTable dt = PublicMethod.BaseUtil.filterDataTable(DataTable, "sp_date='" + begindate.AddDays(i).ToString("yyyy-MM-dd") + "' and 工序编号='" + StepCode[j] + "'");
                     if (StepCode[j] != "B_OUTLOOK")
                     {
-                        for (int k = rowindex; k < rowindex + 5; k++)
+                        for (int k = rowindex; k < rowindex + ContentRow; k++)
                         {
                             row = sheet.GetRow(k);
                             if (row == null)
@@ -541,6 +574,17 @@ namespace UAS_MES_NEW.DataOperate
                                     cell.CellStyle = GREY_25_PERCENT;
                                     break;
                                 case 1:
+                                    double 通过数;
+                                    if (dt.Rows.Count > 0)
+                                    {
+                                        if (double.TryParse(dt.Rows[0]["通过总数"].ToString(), out 通过数))
+                                        {
+                                            cell.SetCellValue(通过数);
+                                        }
+                                    }
+                                    cell.CellStyle = PINK;
+                                    break;
+                                case 2:
                                     double 不良数;
                                     if (dt.Rows.Count > 0)
                                     {
@@ -552,7 +596,18 @@ namespace UAS_MES_NEW.DataOperate
                                     }
                                     cell.CellStyle = TAN;
                                     break;
-                                case 2:
+                                case 3:
+                                    double 误测通过数;
+                                    if (dt.Rows.Count > 0)
+                                    {
+                                        if (double.TryParse(dt.Rows[0]["误测通过数"].ToString(), out 误测通过数))
+                                        {
+                                            cell.SetCellValue(误测通过数);
+                                        }
+                                    }
+                                    cell.CellStyle = GOLD;
+                                    break;
+                                case 4:
                                     double 误测数;
                                     if (dt.Rows.Count > 0)
                                     {
@@ -561,9 +616,9 @@ namespace UAS_MES_NEW.DataOperate
                                             cell.SetCellValue(误测数);
                                         }
                                     }
-                                    cell.CellStyle = GOLD;
+                                    cell.CellStyle = LIGHT_GREEN;
                                     break;
-                                case 3:
+                                case 5:
                                     double FPY;
                                     if (dt.Rows.Count > 0)
                                     {
@@ -581,9 +636,9 @@ namespace UAS_MES_NEW.DataOperate
                                             }
                                         }
                                     }
-                                    cell.CellStyle = LIGHT_GREEN;
+                                    cell.CellStyle = LIGHT_CORNFLOWER_BLUE;
                                     break;
-                                case 4:
+                                case 6:
                                     double RPY;
                                     if (dt.Rows.Count > 0)
                                     {
@@ -601,7 +656,7 @@ namespace UAS_MES_NEW.DataOperate
                                             }
                                         }
                                     }
-                                    cell.CellStyle = LIGHT_CORNFLOWER_BLUE;
+                                    cell.CellStyle = LEMON_CHIFFON;
                                     break;
                                 default:
                                     break;
@@ -692,7 +747,7 @@ namespace UAS_MES_NEW.DataOperate
 
                 row = sheet.GetRow(4);
                 cell = row.CreateCell(i + 2);
-                cell.CellStyle = LIGHT_GREEN;
+                cell.CellStyle = DARK_BLUE;
                 cell.SetCellValue(TotalFPY == -1 ? 0 : TotalFPY);
 
                 row = sheet.GetRow(5);

+ 786 - 0
UAS_MES_ODLF/FunctionCode/Make/Make_ColorBoxLoadPrintBZ.Designer.cs

@@ -0,0 +1,786 @@
+namespace UAS_MES_NEW.Make
+{
+    partial class Make_ColorBoxLoadPrintBZ
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.components = new System.ComponentModel.Container();
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Make_ColorBoxLoadPrint));
+            this.mcd_restqty_label = new System.Windows.Forms.Label();
+            this.mcd_inqty_label = new System.Windows.Forms.Label();
+            this.ma_qty_label = new System.Windows.Forms.Label();
+            this.ms_makecode_label = new System.Windows.Forms.Label();
+            this.pr_detail_label = new System.Windows.Forms.Label();
+            this.ma_prodcode_label = new System.Windows.Forms.Label();
+            this.Loading = new System.Windows.Forms.RadioButton();
+            this.UnLoading = new System.Windows.Forms.RadioButton();
+            this.sn_code_label = new System.Windows.Forms.Label();
+            this.code_label = new System.Windows.Forms.Label();
+            this.iflastsn = new System.Windows.Forms.CheckBox();
+            this.ClearSn_code = new System.Windows.Forms.PictureBox();
+            this.ms_craftcode = new System.Windows.Forms.Label();
+            this.ma_craftcode = new System.Windows.Forms.Label();
+            this.NoteForChange = new System.Windows.Forms.CheckBox();
+            this.LabelDataGridView = new System.Windows.Forms.DataGridView();
+            this.ma_bomversion = new System.Windows.Forms.Label();
+            this.ma_bomversion_label = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.PrintLabel_label = new System.Windows.Forms.Label();
+            this.label4 = new System.Windows.Forms.Label();
+            this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.PrintNum = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.PrintLabel = new UAS_MES_NEW.CustomControl.ComBoxWithFocus.ComboxWithTip(this.components);
+            this.Printer = new UAS_MES_NEW.CustomControl.ComBoxWithFocus.PrinterCombox();
+            this.序号 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.cm_makecode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.pr_detail_ = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.cm_soncode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.cm_barcode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.StepCount = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SourceStepCount();
+            this.ma_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.MaCodeSearchTextBox();
+            this.LockMakeCode = new UAS_MES_NEW.CustomControl.CustomCheckBox.LockCheckBox();
+            this.ma_prodcode = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
+            this.pr_detail = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
+            this.mcd_remainqty = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
+            this.mcd_inqty = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
+            this.ma_qty = new UAS_MES_NEW.CustomControl.ValueLabel.ValueLabel();
+            this.OperateResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
+            this.Clean = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
+            this.Confirm = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
+            this.code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SnCollectionBox();
+            this.sn_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.EnterTextBox();
+            ((System.ComponentModel.ISupportInitialize)(this.ClearSn_code)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.LabelDataGridView)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // mcd_restqty_label
+            // 
+            this.mcd_restqty_label.AutoSize = true;
+            this.mcd_restqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.mcd_restqty_label.Location = new System.Drawing.Point(1170, 122);
+            this.mcd_restqty_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.mcd_restqty_label.Name = "mcd_restqty_label";
+            this.mcd_restqty_label.Size = new System.Drawing.Size(146, 41);
+            this.mcd_restqty_label.TabIndex = 59;
+            this.mcd_restqty_label.Text = "待采集数";
+            // 
+            // mcd_inqty_label
+            // 
+            this.mcd_inqty_label.AutoSize = true;
+            this.mcd_inqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.mcd_inqty_label.Location = new System.Drawing.Point(622, 122);
+            this.mcd_inqty_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.mcd_inqty_label.Name = "mcd_inqty_label";
+            this.mcd_inqty_label.Size = new System.Drawing.Size(146, 41);
+            this.mcd_inqty_label.TabIndex = 56;
+            this.mcd_inqty_label.Text = "已采集数";
+            // 
+            // ma_qty_label
+            // 
+            this.ma_qty_label.AutoSize = true;
+            this.ma_qty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ma_qty_label.Location = new System.Drawing.Point(18, 122);
+            this.ma_qty_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ma_qty_label.Name = "ma_qty_label";
+            this.ma_qty_label.Size = new System.Drawing.Size(146, 41);
+            this.ma_qty_label.TabIndex = 53;
+            this.ma_qty_label.Text = "工单数量";
+            // 
+            // ms_makecode_label
+            // 
+            this.ms_makecode_label.AutoSize = true;
+            this.ms_makecode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ms_makecode_label.Location = new System.Drawing.Point(18, 24);
+            this.ms_makecode_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ms_makecode_label.Name = "ms_makecode_label";
+            this.ms_makecode_label.Size = new System.Drawing.Size(146, 41);
+            this.ms_makecode_label.TabIndex = 49;
+            this.ms_makecode_label.Text = "归属工单";
+            // 
+            // pr_detail_label
+            // 
+            this.pr_detail_label.AutoSize = true;
+            this.pr_detail_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pr_detail_label.Location = new System.Drawing.Point(1170, 24);
+            this.pr_detail_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.pr_detail_label.Name = "pr_detail_label";
+            this.pr_detail_label.Size = new System.Drawing.Size(146, 41);
+            this.pr_detail_label.TabIndex = 50;
+            this.pr_detail_label.Text = "产品规格";
+            // 
+            // ma_prodcode_label
+            // 
+            this.ma_prodcode_label.AutoSize = true;
+            this.ma_prodcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ma_prodcode_label.Location = new System.Drawing.Point(622, 24);
+            this.ma_prodcode_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ma_prodcode_label.Name = "ma_prodcode_label";
+            this.ma_prodcode_label.Size = new System.Drawing.Size(146, 41);
+            this.ma_prodcode_label.TabIndex = 51;
+            this.ma_prodcode_label.Text = "产品代码";
+            // 
+            // Loading
+            // 
+            this.Loading.AutoSize = true;
+            this.Loading.Checked = true;
+            this.Loading.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Loading.ForeColor = System.Drawing.Color.Blue;
+            this.Loading.Location = new System.Drawing.Point(36, 720);
+            this.Loading.Margin = new System.Windows.Forms.Padding(6);
+            this.Loading.Name = "Loading";
+            this.Loading.Size = new System.Drawing.Size(113, 45);
+            this.Loading.TabIndex = 62;
+            this.Loading.TabStop = true;
+            this.Loading.Text = "上料";
+            this.Loading.UseVisualStyleBackColor = true;
+            // 
+            // UnLoading
+            // 
+            this.UnLoading.AutoSize = true;
+            this.UnLoading.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.UnLoading.ForeColor = System.Drawing.Color.Blue;
+            this.UnLoading.Location = new System.Drawing.Point(196, 720);
+            this.UnLoading.Margin = new System.Windows.Forms.Padding(6);
+            this.UnLoading.Name = "UnLoading";
+            this.UnLoading.Size = new System.Drawing.Size(113, 45);
+            this.UnLoading.TabIndex = 63;
+            this.UnLoading.Text = "下料";
+            this.UnLoading.UseVisualStyleBackColor = true;
+            // 
+            // sn_code_label
+            // 
+            this.sn_code_label.AutoSize = true;
+            this.sn_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.sn_code_label.Location = new System.Drawing.Point(28, 796);
+            this.sn_code_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.sn_code_label.Name = "sn_code_label";
+            this.sn_code_label.Size = new System.Drawing.Size(114, 41);
+            this.sn_code_label.TabIndex = 64;
+            this.sn_code_label.Text = "序列号";
+            // 
+            // code_label
+            // 
+            this.code_label.AutoSize = true;
+            this.code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.code_label.Location = new System.Drawing.Point(28, 884);
+            this.code_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.code_label.Name = "code_label";
+            this.code_label.Size = new System.Drawing.Size(114, 41);
+            this.code_label.TabIndex = 66;
+            this.code_label.Text = "录入框";
+            // 
+            // iflastsn
+            // 
+            this.iflastsn.AutoSize = true;
+            this.iflastsn.Enabled = false;
+            this.iflastsn.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.iflastsn.Location = new System.Drawing.Point(578, 796);
+            this.iflastsn.Margin = new System.Windows.Forms.Padding(6);
+            this.iflastsn.Name = "iflastsn";
+            this.iflastsn.Size = new System.Drawing.Size(222, 45);
+            this.iflastsn.TabIndex = 72;
+            this.iflastsn.Text = "前一工单SN";
+            this.iflastsn.UseVisualStyleBackColor = true;
+            // 
+            // ClearSn_code
+            // 
+            this.ClearSn_code.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.ClearSn_code.Image = global::UAS_MES_NEW.Properties.Resources.bindingNavigatorDeleteItem_Image;
+            this.ClearSn_code.Location = new System.Drawing.Point(526, 802);
+            this.ClearSn_code.Margin = new System.Windows.Forms.Padding(6);
+            this.ClearSn_code.Name = "ClearSn_code";
+            this.ClearSn_code.Size = new System.Drawing.Size(32, 32);
+            this.ClearSn_code.TabIndex = 138;
+            this.ClearSn_code.TabStop = false;
+            this.ClearSn_code.Click += new System.EventHandler(this.ClearSn_code_Click);
+            // 
+            // ms_craftcode
+            // 
+            this.ms_craftcode.AutoSize = true;
+            this.ms_craftcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ms_craftcode.Location = new System.Drawing.Point(1536, 30);
+            this.ms_craftcode.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ms_craftcode.Name = "ms_craftcode";
+            this.ms_craftcode.Size = new System.Drawing.Size(0, 41);
+            this.ms_craftcode.TabIndex = 142;
+            this.ms_craftcode.Visible = false;
+            // 
+            // ma_craftcode
+            // 
+            this.ma_craftcode.AutoSize = true;
+            this.ma_craftcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ma_craftcode.Location = new System.Drawing.Point(1508, 122);
+            this.ma_craftcode.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ma_craftcode.Name = "ma_craftcode";
+            this.ma_craftcode.Size = new System.Drawing.Size(0, 41);
+            this.ma_craftcode.TabIndex = 145;
+            this.ma_craftcode.Visible = false;
+            // 
+            // NoteForChange
+            // 
+            this.NoteForChange.AutoSize = true;
+            this.NoteForChange.Checked = true;
+            this.NoteForChange.CheckState = System.Windows.Forms.CheckState.Checked;
+            this.NoteForChange.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.NoteForChange.Location = new System.Drawing.Point(22, 78);
+            this.NoteForChange.Margin = new System.Windows.Forms.Padding(4);
+            this.NoteForChange.Name = "NoteForChange";
+            this.NoteForChange.Size = new System.Drawing.Size(190, 35);
+            this.NoteForChange.TabIndex = 192;
+            this.NoteForChange.Text = "切换工单提示";
+            this.NoteForChange.UseVisualStyleBackColor = true;
+            // 
+            // LabelDataGridView
+            // 
+            this.LabelDataGridView.AllowUserToAddRows = false;
+            this.LabelDataGridView.AllowUserToResizeRows = false;
+            this.LabelDataGridView.BackgroundColor = System.Drawing.SystemColors.ButtonFace;
+            this.LabelDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+            this.序号,
+            this.cm_makecode,
+            this.pr_detail_,
+            this.cm_soncode,
+            this.cm_barcode,
+            this.BarCode});
+            this.LabelDataGridView.Location = new System.Drawing.Point(36, 216);
+            this.LabelDataGridView.Margin = new System.Windows.Forms.Padding(6);
+            this.LabelDataGridView.Name = "LabelDataGridView";
+            this.LabelDataGridView.RowHeadersVisible = false;
+            this.LabelDataGridView.RowTemplate.Height = 23;
+            this.LabelDataGridView.Size = new System.Drawing.Size(1282, 454);
+            this.LabelDataGridView.TabIndex = 193;
+            // 
+            // ma_bomversion
+            // 
+            this.ma_bomversion.AutoSize = true;
+            this.ma_bomversion.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ma_bomversion.Location = new System.Drawing.Point(1528, 242);
+            this.ma_bomversion.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ma_bomversion.Name = "ma_bomversion";
+            this.ma_bomversion.Size = new System.Drawing.Size(0, 41);
+            this.ma_bomversion.TabIndex = 143;
+            // 
+            // ma_bomversion_label
+            // 
+            this.ma_bomversion_label.AutoSize = true;
+            this.ma_bomversion_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ma_bomversion_label.Location = new System.Drawing.Point(1356, 242);
+            this.ma_bomversion_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ma_bomversion_label.Name = "ma_bomversion_label";
+            this.ma_bomversion_label.Size = new System.Drawing.Size(152, 41);
+            this.ma_bomversion_label.TabIndex = 144;
+            this.ma_bomversion_label.Text = "Bom版本";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label2.Location = new System.Drawing.Point(1359, 326);
+            this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(114, 41);
+            this.label2.TabIndex = 196;
+            this.label2.Text = "打印机";
+            // 
+            // PrintLabel_label
+            // 
+            this.PrintLabel_label.AutoSize = true;
+            this.PrintLabel_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.PrintLabel_label.Location = new System.Drawing.Point(1359, 413);
+            this.PrintLabel_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.PrintLabel_label.Name = "PrintLabel_label";
+            this.PrintLabel_label.Size = new System.Drawing.Size(82, 41);
+            this.PrintLabel_label.TabIndex = 195;
+            this.PrintLabel_label.Text = "标签";
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label4.Location = new System.Drawing.Point(1359, 498);
+            this.label4.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(82, 41);
+            this.label4.TabIndex = 198;
+            this.label4.Text = "份数";
+            // 
+            // dataGridViewTextBoxColumn1
+            // 
+            this.dataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.dataGridViewTextBoxColumn1.DataPropertyName = "cm_makecode";
+            this.dataGridViewTextBoxColumn1.HeaderText = "上料料号";
+            this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
+            this.dataGridViewTextBoxColumn1.ReadOnly = true;
+            this.dataGridViewTextBoxColumn1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+            this.dataGridViewTextBoxColumn1.Width = 50;
+            // 
+            // dataGridViewTextBoxColumn2
+            // 
+            this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
+            this.dataGridViewTextBoxColumn2.DataPropertyName = "pr_detail";
+            this.dataGridViewTextBoxColumn2.HeaderText = "上料名称";
+            this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
+            this.dataGridViewTextBoxColumn2.ReadOnly = true;
+            this.dataGridViewTextBoxColumn2.Width = 5;
+            // 
+            // dataGridViewTextBoxColumn3
+            // 
+            this.dataGridViewTextBoxColumn3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
+            this.dataGridViewTextBoxColumn3.DataPropertyName = "cm_soncode";
+            this.dataGridViewTextBoxColumn3.HeaderText = "前缀";
+            this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
+            this.dataGridViewTextBoxColumn3.ReadOnly = true;
+            this.dataGridViewTextBoxColumn3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+            this.dataGridViewTextBoxColumn3.Width = 5;
+            // 
+            // dataGridViewTextBoxColumn4
+            // 
+            this.dataGridViewTextBoxColumn4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
+            this.dataGridViewTextBoxColumn4.DataPropertyName = "cm_barcode";
+            this.dataGridViewTextBoxColumn4.HeaderText = "长度";
+            this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
+            this.dataGridViewTextBoxColumn4.ReadOnly = true;
+            this.dataGridViewTextBoxColumn4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+            this.dataGridViewTextBoxColumn4.Width = 5;
+            // 
+            // dataGridViewTextBoxColumn5
+            // 
+            this.dataGridViewTextBoxColumn5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
+            this.dataGridViewTextBoxColumn5.DataPropertyName = "sp_length";
+            this.dataGridViewTextBoxColumn5.HeaderText = "条码号";
+            this.dataGridViewTextBoxColumn5.MinimumWidth = 300;
+            this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
+            this.dataGridViewTextBoxColumn5.ReadOnly = true;
+            this.dataGridViewTextBoxColumn5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+            this.dataGridViewTextBoxColumn5.Width = 64;
+            // 
+            // dataGridViewTextBoxColumn6
+            // 
+            this.dataGridViewTextBoxColumn6.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
+            this.dataGridViewTextBoxColumn6.HeaderText = "条码号";
+            this.dataGridViewTextBoxColumn6.MinimumWidth = 300;
+            this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
+            this.dataGridViewTextBoxColumn6.ReadOnly = true;
+            this.dataGridViewTextBoxColumn6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+            this.dataGridViewTextBoxColumn6.Width = 300;
+            // 
+            // PrintNum
+            // 
+            this.PrintNum.AllPower = null;
+            this.PrintNum.BackColor = System.Drawing.Color.White;
+            this.PrintNum.Enabled = false;
+            this.PrintNum.ID = null;
+            this.PrintNum.Location = new System.Drawing.Point(1515, 498);
+            this.PrintNum.Margin = new System.Windows.Forms.Padding(6);
+            this.PrintNum.Name = "PrintNum";
+            this.PrintNum.Power = null;
+            this.PrintNum.Size = new System.Drawing.Size(260, 35);
+            this.PrintNum.Str = null;
+            this.PrintNum.Str1 = null;
+            this.PrintNum.Str2 = null;
+            this.PrintNum.TabIndex = 199;
+            // 
+            // PrintLabel
+            // 
+            this.PrintLabel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.PrintLabel.FormattingEnabled = true;
+            this.PrintLabel.Location = new System.Drawing.Point(1515, 422);
+            this.PrintLabel.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
+            this.PrintLabel.Name = "PrintLabel";
+            this.PrintLabel.Size = new System.Drawing.Size(260, 32);
+            this.PrintLabel.TabIndex = 197;
+            this.PrintLabel.SelectedValueChanged += new System.EventHandler(this.PrintLabel_SelectedValueChanged);
+            // 
+            // Printer
+            // 
+            this.Printer.Location = new System.Drawing.Point(1515, 326);
+            this.Printer.Margin = new System.Windows.Forms.Padding(8);
+            this.Printer.Name = "Printer";
+            this.Printer.Size = new System.Drawing.Size(262, 50);
+            this.Printer.TabIndex = 194;
+            // 
+            // 序号
+            // 
+            this.序号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+            this.序号.DataPropertyName = "sp_detno";
+            this.序号.HeaderText = "序号";
+            this.序号.Name = "序号";
+            this.序号.ReadOnly = true;
+            this.序号.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+            this.序号.Width = 70;
+            // 
+            // cm_makecode
+            // 
+            this.cm_makecode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCellsExceptHeader;
+            this.cm_makecode.DataPropertyName = "sp_fsoncode";
+            this.cm_makecode.HeaderText = "上料料号";
+            this.cm_makecode.Name = "cm_makecode";
+            this.cm_makecode.ReadOnly = true;
+            this.cm_makecode.Width = 5;
+            // 
+            // pr_detail_
+            // 
+            this.pr_detail_.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
+            this.pr_detail_.DataPropertyName = "pr_spec";
+            this.pr_detail_.HeaderText = "上料名称";
+            this.pr_detail_.Name = "pr_detail_";
+            this.pr_detail_.ReadOnly = true;
+            this.pr_detail_.Width = 5;
+            // 
+            // cm_soncode
+            // 
+            this.cm_soncode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
+            this.cm_soncode.DataPropertyName = "sp_prefix";
+            this.cm_soncode.HeaderText = "前缀";
+            this.cm_soncode.Name = "cm_soncode";
+            this.cm_soncode.ReadOnly = true;
+            this.cm_soncode.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+            this.cm_soncode.Width = 5;
+            // 
+            // cm_barcode
+            // 
+            this.cm_barcode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
+            this.cm_barcode.DataPropertyName = "sp_length";
+            this.cm_barcode.HeaderText = "长度";
+            this.cm_barcode.Name = "cm_barcode";
+            this.cm_barcode.ReadOnly = true;
+            this.cm_barcode.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+            this.cm_barcode.Width = 64;
+            // 
+            // BarCode
+            // 
+            this.BarCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
+            this.BarCode.HeaderText = "条码号";
+            this.BarCode.MinimumWidth = 300;
+            this.BarCode.Name = "BarCode";
+            this.BarCode.ReadOnly = true;
+            this.BarCode.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
+            this.BarCode.Width = 300;
+            // 
+            // StepCount
+            // 
+            this.StepCount.LineCode = null;
+            this.StepCount.Location = new System.Drawing.Point(920, 688);
+            this.StepCount.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.StepCount.Name = "StepCount";
+            this.StepCount.Size = new System.Drawing.Size(160, 44);
+            this.StepCount.Source = null;
+            this.StepCount.StepCode = null;
+            this.StepCount.TabIndex = 189;
+            // 
+            // ma_code
+            // 
+            this.ma_code.AllPower = null;
+            this.ma_code.Caller = null;
+            this.ma_code.Condition = null;
+            this.ma_code.DBTitle = null;
+            this.ma_code.FormName = null;
+            this.ma_code.Location = new System.Drawing.Point(192, 26);
+            this.ma_code.Margin = new System.Windows.Forms.Padding(4);
+            this.ma_code.Name = "ma_code";
+            this.ma_code.Power = null;
+            this.ma_code.ReturnData = null;
+            this.ma_code.SelectField = null;
+            this.ma_code.SetValueField = null;
+            this.ma_code.Size = new System.Drawing.Size(296, 42);
+            this.ma_code.TabIndex = 141;
+            this.ma_code.TableName = null;
+            this.ma_code.Tag = "ma_code";
+            this.ma_code.TextBoxEnable = true;
+            this.ma_code.UserControlTextChanged += new UAS_MES_NEW.CustomControl.TextBoxWithIcon.MaCodeSearchTextBox.OnTextChange(this.ma_code_UserControlTextChanged);
+            // 
+            // LockMakeCode
+            // 
+            this.LockMakeCode.AutoSize = true;
+            this.LockMakeCode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.LockMakeCode.LeaveEvent = false;
+            this.LockMakeCode.Location = new System.Drawing.Point(496, 30);
+            this.LockMakeCode.Margin = new System.Windows.Forms.Padding(4);
+            this.LockMakeCode.Name = "LockMakeCode";
+            this.LockMakeCode.Size = new System.Drawing.Size(94, 35);
+            this.LockMakeCode.TabIndex = 140;
+            this.LockMakeCode.Text = "锁定";
+            this.LockMakeCode.UseVisualStyleBackColor = true;
+            // 
+            // ma_prodcode
+            // 
+            this.ma_prodcode.AutoSize = true;
+            this.ma_prodcode.CutLength = null;
+            this.ma_prodcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ma_prodcode.Location = new System.Drawing.Point(802, 24);
+            this.ma_prodcode.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ma_prodcode.MaximumSize = new System.Drawing.Size(300, 0);
+            this.ma_prodcode.Name = "ma_prodcode";
+            this.ma_prodcode.Size = new System.Drawing.Size(0, 41);
+            this.ma_prodcode.TabIndex = 99;
+            this.ma_prodcode.TextChanged += new System.EventHandler(this.ma_prodcode_TextChanged);
+            // 
+            // pr_detail
+            // 
+            this.pr_detail.AutoSize = true;
+            this.pr_detail.CutLength = null;
+            this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.pr_detail.Location = new System.Drawing.Point(1350, 24);
+            this.pr_detail.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.pr_detail.MaximumSize = new System.Drawing.Size(300, 0);
+            this.pr_detail.Name = "pr_detail";
+            this.pr_detail.Size = new System.Drawing.Size(0, 41);
+            this.pr_detail.TabIndex = 98;
+            // 
+            // mcd_remainqty
+            // 
+            this.mcd_remainqty.AutoSize = true;
+            this.mcd_remainqty.CutLength = null;
+            this.mcd_remainqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.mcd_remainqty.Location = new System.Drawing.Point(1348, 122);
+            this.mcd_remainqty.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.mcd_remainqty.MaximumSize = new System.Drawing.Size(300, 0);
+            this.mcd_remainqty.Name = "mcd_remainqty";
+            this.mcd_remainqty.Size = new System.Drawing.Size(0, 41);
+            this.mcd_remainqty.TabIndex = 97;
+            this.mcd_remainqty.Tag = "mcd_remainqty";
+            // 
+            // mcd_inqty
+            // 
+            this.mcd_inqty.AutoSize = true;
+            this.mcd_inqty.CutLength = null;
+            this.mcd_inqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.mcd_inqty.Location = new System.Drawing.Point(802, 122);
+            this.mcd_inqty.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.mcd_inqty.MaximumSize = new System.Drawing.Size(300, 0);
+            this.mcd_inqty.Name = "mcd_inqty";
+            this.mcd_inqty.Size = new System.Drawing.Size(0, 41);
+            this.mcd_inqty.TabIndex = 96;
+            // 
+            // ma_qty
+            // 
+            this.ma_qty.AutoSize = true;
+            this.ma_qty.CutLength = null;
+            this.ma_qty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ma_qty.Location = new System.Drawing.Point(192, 122);
+            this.ma_qty.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ma_qty.MaximumSize = new System.Drawing.Size(300, 0);
+            this.ma_qty.Name = "ma_qty";
+            this.ma_qty.Size = new System.Drawing.Size(0, 41);
+            this.ma_qty.TabIndex = 95;
+            // 
+            // OperateResult
+            // 
+            this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.OperateResult.Location = new System.Drawing.Point(1090, 688);
+            this.OperateResult.Margin = new System.Windows.Forms.Padding(6);
+            this.OperateResult.Name = "OperateResult";
+            this.OperateResult.Size = new System.Drawing.Size(696, 238);
+            this.OperateResult.TabIndex = 94;
+            this.OperateResult.Text = "";
+            // 
+            // Clean
+            // 
+            this.Clean.AllPower = null;
+            this.Clean.BackColor = System.Drawing.Color.Transparent;
+            this.Clean.DownImage = ((System.Drawing.Image)(resources.GetObject("Clean.DownImage")));
+            this.Clean.Image = null;
+            this.Clean.IsShowBorder = true;
+            this.Clean.Location = new System.Drawing.Point(920, 878);
+            this.Clean.Margin = new System.Windows.Forms.Padding(6);
+            this.Clean.MoveImage = ((System.Drawing.Image)(resources.GetObject("Clean.MoveImage")));
+            this.Clean.Name = "Clean";
+            this.Clean.NormalImage = ((System.Drawing.Image)(resources.GetObject("Clean.NormalImage")));
+            this.Clean.Power = null;
+            this.Clean.Size = new System.Drawing.Size(120, 48);
+            this.Clean.TabIndex = 80;
+            this.Clean.Text = "清除";
+            this.Clean.UseVisualStyleBackColor = true;
+            this.Clean.Click += new System.EventHandler(this.Clean_Click);
+            // 
+            // Confirm
+            // 
+            this.Confirm.AllPower = "ifall";
+            this.Confirm.BackColor = System.Drawing.Color.Transparent;
+            this.Confirm.DownImage = ((System.Drawing.Image)(resources.GetObject("Confirm.DownImage")));
+            this.Confirm.Image = null;
+            this.Confirm.IsShowBorder = true;
+            this.Confirm.Location = new System.Drawing.Point(578, 880);
+            this.Confirm.Margin = new System.Windows.Forms.Padding(6);
+            this.Confirm.MoveImage = ((System.Drawing.Image)(resources.GetObject("Confirm.MoveImage")));
+            this.Confirm.Name = "Confirm";
+            this.Confirm.NormalImage = ((System.Drawing.Image)(resources.GetObject("Confirm.NormalImage")));
+            this.Confirm.Power = null;
+            this.Confirm.Size = new System.Drawing.Size(120, 48);
+            this.Confirm.TabIndex = 73;
+            this.Confirm.Tag = "IfRead";
+            this.Confirm.Text = "确认";
+            this.Confirm.UseVisualStyleBackColor = true;
+            this.Confirm.Click += new System.EventHandler(this.Confirm_Click);
+            // 
+            // code
+            // 
+            this.code.AllPower = "ifall";
+            this.code.BackColor = System.Drawing.Color.White;
+            this.code.ID = null;
+            this.code.Location = new System.Drawing.Point(196, 884);
+            this.code.Margin = new System.Windows.Forms.Padding(6);
+            this.code.Name = "code";
+            this.code.Power = null;
+            this.code.Size = new System.Drawing.Size(316, 35);
+            this.code.Str = null;
+            this.code.Str1 = null;
+            this.code.Str2 = null;
+            this.code.TabIndex = 0;
+            this.code.Tag = "IfRead";
+            this.code.KeyDown += new System.Windows.Forms.KeyEventHandler(this.code_KeyDown);
+            // 
+            // sn_code
+            // 
+            this.sn_code.AllPower = null;
+            this.sn_code.BackColor = System.Drawing.Color.White;
+            this.sn_code.Enabled = false;
+            this.sn_code.ID = null;
+            this.sn_code.Location = new System.Drawing.Point(196, 796);
+            this.sn_code.Margin = new System.Windows.Forms.Padding(6);
+            this.sn_code.Name = "sn_code";
+            this.sn_code.Power = null;
+            this.sn_code.Size = new System.Drawing.Size(316, 35);
+            this.sn_code.Str = null;
+            this.sn_code.Str1 = null;
+            this.sn_code.Str2 = null;
+            this.sn_code.TabIndex = 65;
+            // 
+            // Make_ColorBoxLoadPrint
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(1796, 974);
+            this.Controls.Add(this.PrintNum);
+            this.Controls.Add(this.label4);
+            this.Controls.Add(this.PrintLabel);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.PrintLabel_label);
+            this.Controls.Add(this.Printer);
+            this.Controls.Add(this.LabelDataGridView);
+            this.Controls.Add(this.NoteForChange);
+            this.Controls.Add(this.StepCount);
+            this.Controls.Add(this.ma_craftcode);
+            this.Controls.Add(this.ma_bomversion_label);
+            this.Controls.Add(this.ma_bomversion);
+            this.Controls.Add(this.ms_craftcode);
+            this.Controls.Add(this.ma_code);
+            this.Controls.Add(this.LockMakeCode);
+            this.Controls.Add(this.ClearSn_code);
+            this.Controls.Add(this.ma_prodcode);
+            this.Controls.Add(this.pr_detail);
+            this.Controls.Add(this.mcd_remainqty);
+            this.Controls.Add(this.mcd_inqty);
+            this.Controls.Add(this.ma_qty);
+            this.Controls.Add(this.OperateResult);
+            this.Controls.Add(this.Clean);
+            this.Controls.Add(this.Confirm);
+            this.Controls.Add(this.iflastsn);
+            this.Controls.Add(this.code);
+            this.Controls.Add(this.code_label);
+            this.Controls.Add(this.sn_code);
+            this.Controls.Add(this.sn_code_label);
+            this.Controls.Add(this.UnLoading);
+            this.Controls.Add(this.Loading);
+            this.Controls.Add(this.mcd_restqty_label);
+            this.Controls.Add(this.mcd_inqty_label);
+            this.Controls.Add(this.ma_qty_label);
+            this.Controls.Add(this.ms_makecode_label);
+            this.Controls.Add(this.pr_detail_label);
+            this.Controls.Add(this.ma_prodcode_label);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Margin = new System.Windows.Forms.Padding(6);
+            this.Name = "Make_ColorBoxLoadPrint";
+            this.Tag = "Make!FeedingCollection";
+            this.Text = "上料采集";
+            this.Load += new System.EventHandler(this.Make_FeedingCollection_Load);
+            this.SizeChanged += new System.EventHandler(this.Make_FeedingCollection_SizeChanged);
+            ((System.ComponentModel.ISupportInitialize)(this.ClearSn_code)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.LabelDataGridView)).EndInit();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+        private System.Windows.Forms.Label mcd_restqty_label;
+        private System.Windows.Forms.Label mcd_inqty_label;
+        private System.Windows.Forms.Label ma_qty_label;
+        private System.Windows.Forms.Label ms_makecode_label;
+        private System.Windows.Forms.Label pr_detail_label;
+        private System.Windows.Forms.Label ma_prodcode_label;
+        private System.Windows.Forms.RadioButton Loading;
+        private System.Windows.Forms.RadioButton UnLoading;
+        private CustomControl.TextBoxWithIcon.EnterTextBox sn_code;
+        private System.Windows.Forms.Label sn_code_label;
+        private System.Windows.Forms.Label code_label;
+        private CustomControl.TextBoxWithIcon.SnCollectionBox code;
+        private System.Windows.Forms.CheckBox iflastsn;
+        private CustomControl.ButtonUtil.NormalButton Confirm;
+        private CustomControl.ButtonUtil.NormalButton Clean;
+        private CustomControl.RichText.RichTextAutoBottom OperateResult;
+        private CustomControl.ValueLabel.ValueLabel ma_qty;
+        private CustomControl.ValueLabel.ValueLabel mcd_inqty;
+        private CustomControl.ValueLabel.ValueLabel mcd_remainqty;
+        private CustomControl.ValueLabel.ValueLabel pr_detail;
+        private CustomControl.ValueLabel.ValueLabel ma_prodcode;
+        private System.Windows.Forms.PictureBox ClearSn_code;
+        private CustomControl.CustomCheckBox.LockCheckBox LockMakeCode;
+        private CustomControl.TextBoxWithIcon.MaCodeSearchTextBox ma_code;
+        private System.Windows.Forms.Label ms_craftcode;
+        private System.Windows.Forms.Label ma_craftcode;
+        private CustomControl.TextBoxWithIcon.SourceStepCount StepCount;
+        private System.Windows.Forms.CheckBox NoteForChange;
+        private System.Windows.Forms.DataGridView LabelDataGridView;
+        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
+        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
+        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
+        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
+        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
+        private System.Windows.Forms.DataGridViewTextBoxColumn 序号;
+        private System.Windows.Forms.DataGridViewTextBoxColumn cm_makecode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn pr_detail_;
+        private System.Windows.Forms.DataGridViewTextBoxColumn cm_soncode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn cm_barcode;
+        private System.Windows.Forms.DataGridViewTextBoxColumn BarCode;
+        private System.Windows.Forms.Label ma_bomversion;
+        private System.Windows.Forms.Label ma_bomversion_label;
+        private CustomControl.ComBoxWithFocus.ComboxWithTip PrintLabel;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Label PrintLabel_label;
+        private CustomControl.ComBoxWithFocus.PrinterCombox Printer;
+        private CustomControl.TextBoxWithIcon.EnterTextBox PrintNum;
+        private System.Windows.Forms.Label label4;
+    }
+}

+ 575 - 0
UAS_MES_ODLF/FunctionCode/Make/Make_ColorBoxLoadPrintBZ.cs

@@ -0,0 +1,575 @@
+using System;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+using UAS_MES_NEW.CustomControl.TextBoxWithIcon;
+using UAS_MES_NEW.DataOperate;
+using UAS_MES_NEW.Entity;
+using UAS_MES_NEW.PublicMethod;
+using System.Drawing;
+using System.Text.RegularExpressions;
+using System.Collections.Generic;
+using UAS_MES_NEW.PublicForm;
+using LabelManager2;
+using System.Threading;
+
+namespace UAS_MES_NEW.Make
+{
+    public partial class Make_ColorBoxLoadPrintBZ : Form
+    {
+        ApplicationClass lbl;
+        //MakeSerial表主键
+        string ms_id;
+        //制造单号                                                                             
+        string make_code;
+        //产品编号
+        string make_prodcode;
+        //工序编号
+        string nextstepcode;
+        //完工状态
+        string ms_status;
+        //工艺路线编号
+        //Bom版本
+        string mabomversion;
+        string ErrorMessage = "";
+
+        List<string> TSN = new List<string>();
+
+        Dictionary<string, string> CheckBarcode = new Dictionary<string, string>();
+
+        //用于提醒的序列B
+        string[] RemainList = new string[0];
+        //提醒序列的索引
+        int RemainIndex = 0;
+
+        string oMakeCode = "";
+        string oMsid = "";
+
+        string ms_firstsn = "";
+
+        DataHelper dh;
+        LogStringBuilder sql = new LogStringBuilder();
+        DataTable DBFind;
+        DataTable dt;
+        //保存ListB中的数据
+        DataTable dt1;
+
+        Thread InitPrint;
+
+        AutoSizeFormClass asc = new AutoSizeFormClass();
+
+        List<string> CollectData = new List<string>();
+
+        List<string> CollectDataSonCode = new List<string>();
+
+        List<string> SPID = new List<string>();
+
+        public Make_ColorBoxLoadPrintBZ()
+        {
+            InitializeComponent();
+        }
+
+        private void InPrint()
+        {
+            try
+            {
+                lbl = new ApplicationClass();
+                BaseUtil.WriteLbl();
+            }
+            catch (Exception)
+            {
+                OperateResult.AppendText("未正确安装CodeSoft软件\n", Color.Red);
+            }
+        }
+
+        private void Make_FeedingCollection_Load(object sender, EventArgs e)
+        {
+            asc.controllInitializeSize(this);
+            InitPrint = new Thread(InPrint);
+            SetLoadingWindow stw = new SetLoadingWindow(InitPrint, "初始化打印程序");
+            BaseUtil.SetFormCenter(stw);
+            stw.ShowDialog();
+            LockMakeCode.GetMakeCodeCtl(ma_code);
+            ma_code.SetLockCheckBox(LockMakeCode);
+            //工单号放大镜配置
+            ma_code.TableName = "make left join product on ma_prodcode=pr_code";
+            ma_code.SelectField = "ma_code # 工单号,ma_prodcode # 产品编号,ma_qty # 工单数量,ma_craftcode # 途程编号,pr_spec # 产品名称,ma_bomversion # Bom版本,ma_softversion # 软件版本,ma_ecncode # ECN号";
+            ma_code.FormName = Name;
+            ma_code.DBTitle = "工单查询";
+            ma_code.SetValueField = new string[] { "ma_code", "ma_prodcode", "ma_qty", "pr_spec", "ma_craftcode", "ma_bomversion", "ma_softversion", "ma_ecncode" };
+            ma_code.Condition = "ma_statuscode='STARTED'";
+            ma_code.DbChange += Ma_code_DBChange;
+            code.Focus();
+            dh = SystemInf.dh;
+            StepCount.StepCode = User.CurrentStepCode;
+            StepCount.Source = User.UserSourceCode;
+            StepCount.LineCode = User.UserLineCode;
+            StepCount.Dh = dh;
+            StepCount.Start();
+        }
+
+        private void Ma_code_DBChange(object sender, EventArgs e)
+        {
+            DBFind = ma_code.ReturnData;
+            BaseUtil.SetFormValue(this.Controls, DBFind);
+        }
+
+        private void Make_FeedingCollection_SizeChanged(object sender, EventArgs e)
+        {
+            asc.controlAutoSize(this);
+        }
+
+        private void Clean_Click(object sender, EventArgs e)
+        {
+            OperateResult.Clear();
+        }
+
+        private void Confirm_Click(object sender, EventArgs e)
+        {
+            KeyEventArgs e2 = new KeyEventArgs(Keys.Enter);
+            code_KeyDown(sender, e2);
+        }
+
+        private void code_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
+            {
+                if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
+                {
+                    if (Loading.Checked)
+                    {
+                        if (code.Text.Replace(" ", "") == "")
+                        {
+                            OperateResult.AppendText(">>采集数据不可为空\n", Color.Red);
+                            return;
+                        }
+                        //如果录入框和工单号均有输入
+                        if (code.Text != "" && ma_code.Text != "" && sn_code.Text == "")
+                        {
+                            GetCollectItem();
+                            BaseUtil.FillDgvWithDataTable(LabelDataGridView, dt1);
+                        }
+                        //输入框有值但未选择工单号
+                        else if (code.Text != "" && ma_code.Text == "" && sn_code.Text == "")
+                        {
+                            GetCollectItem();
+                            BaseUtil.FillDgvWithDataTable(LabelDataGridView, dt1);
+                        }
+                        else if (sn_code.Text != "")
+                        {
+                            //索引超出长度表示内容均已提醒
+                            if (RemainIndex >= RemainList.Length)
+                            {
+                                OperateResult.AppendText(">>当前序列号" + sn_code.Text + "不在本道工序,请采集其它序列号\n", Color.Black);
+                                sn_code.Text = "";
+                                code.Text = "";
+                                return;
+                            }
+                            string sp_soncode = dt1.Rows[RemainIndex]["sp_soncode"].ToString();
+                            string sp_fsoncode = dt1.Rows[RemainIndex]["sp_fsoncode"].ToString();
+                            string sp_prefix = dt1.Rows[RemainIndex]["sp_prefix"].ToString();
+                            string sp_regex = dt1.Rows[RemainIndex]["sp_regex"].ToString();
+                            string length = dt1.Rows[RemainIndex]["sp_length"].ToString();
+                            string sp_id = dt1.Rows[RemainIndex]["sp_id"].ToString();
+                            string sp_ifrepeat = dt1.Rows[RemainIndex]["sp_ifrepeat"].ToString();
+                            string sp_ifforsn = dt1.Rows[RemainIndex]["sp_ifforsn"].ToString();
+                            string sp_barcoderule = dt1.Rows[RemainIndex]["sp_barcoderule"].ToString();
+                            string sp_checkbarcode = dt1.Rows[RemainIndex]["sp_checkbarcode"].ToString();
+                            string sp_checksalecode = dt1.Rows[RemainIndex]["sp_checksalecode"].ToString();
+                            if (LogicHandler.CheckSNBeforeLoad(ma_code.Text, code.Text, sp_fsoncode, sp_soncode, sp_barcoderule, sp_prefix, length, sp_ifrepeat, sp_checksalecode, out ErrorMessage))
+                            {
+                                //判断采集的条码和本次采集的也不能重复
+                                if (CollectData.Contains(code.Text) && sp_ifrepeat != "-1")
+                                {
+                                    OperateResult.AppendText(">>条码" + code.Text + "已经上料\n", Color.Red, code);
+                                    return;
+                                }
+                                if (sp_checkbarcode != "")
+                                {
+                                    if (CheckBarcode.ContainsKey(sp_checkbarcode))
+                                    {
+                                        if (CheckBarcode[sp_checkbarcode] != code.Text)
+                                        {
+                                            OperateResult.AppendText(">>条码" + code.Text + "需要检查物料,未匹配到之前上料数据\n", Color.Red, code);
+                                            return;
+                                        }
+                                    }
+                                    else
+                                    {
+                                        OperateResult.AppendText(">>条码" + code.Text + "需要检查物料,未匹配到之前上料数据\n", Color.Red, code);
+                                        return;
+                                    }
+                                }
+                                TSN.Add(code.Text.Substring(0, code.Text.Length > 80 ? 80 : code.Text.Length));
+                                if (sp_barcoderule == "BARCODE")
+                                {
+                                    sp_soncode = ErrorMessage;
+                                }
+                                Save_OtherCode(sp_fsoncode, sp_soncode, make_code, sn_code.Text, sp_id);
+                            }
+                            else
+                            {
+                                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
+                                SetCheck set = new SetCheck("NG", Color.Red);
+                                BaseUtil.SetFormCenter(set);
+                                set.ShowDialog();
+                            }
+                        }
+                    }
+                    //勾选了下料的时候
+                    else if (UnLoading.Checked)
+                    {
+                        if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsid, out ErrorMessage))
+                        {
+                            sql.Clear();
+                            sql.Append("select ms_firstsn,cm_makecode,cm_craftcode,nvl(cm_status,0)cm_status,cm_id,cm_stepcode,");
+                            sql.Append("ms_makecode,cm_mccode,cm_materialtype from craftmaterial left join makeserial on cm_makecode");
+                            sql.Append("=ms_makecode and cm_sncode=ms_sncode where cm_sncode='" + code.Text + "' and cm_makecode='" + oMakeCode + "'");
+                            sql.Append("and cm_materialtype=1");
+                            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                            if (dt.Rows.Count > 0)
+                            {
+                                string ms_macode = dt.Rows[0]["ms_makecode"].ToString();
+                                string ms_firstsn = dt.Rows[0]["ms_firstsn"].ToString();
+                                string cm_stepcode = dt.Rows[0]["cm_stepcode"].ToString();
+                                string cm_mccode = dt.Rows[0]["cm_mccode"].ToString();
+                                string cm_materialtype = dt.Rows[0]["cm_materialtype"].ToString();
+                                string cm_status = dt.Rows[0]["cm_status"].ToString();
+                                string cm_makecode = dt.Rows[0]["cm_makecode"].ToString();
+                                string cm_craftcode = dt.Rows[0]["cm_craftcode"].ToString();
+                                //清除已被使用的序列号
+                                sql.Clear();
+                                sql.Append("update makeserial set ms_nextmacode='' where ms_sncode in(select cm_barcode from craftmaterial where ");
+                                sql.Append("cm_makecode='" + cm_makecode + "' and cm_sncode='" + code.Text + "' and cm_stepcode='" + cm_stepcode + "' and cm_craftcode='" + cm_craftcode + "' ");
+                                sql.Append("and cm_materialtype=1 and nvl(cm_status,0) =0) and ms_nextmacode='" + oMakeCode + "'");
+                                dh.ExecuteSql(sql.GetString(), "update");
+                                //进行下料
+                                sql.Clear();
+                                sql.Append("delete from craftmaterial where (cm_sncode in (select sn from makesnrelation where firstsn");
+                                sql.Append("='" + ms_firstsn + "') or cm_sncode = '" + ms_firstsn + "') and cm_makecode = '" + oMakeCode + "' ");
+                                sql.Append("and cm_status = 0 and cm_stepcode='" + User.CurrentStepCode + "' and cm_materialtype=1");
+                                dh.ExecuteSql(sql.GetString(), "delete");
+                                LogicHandler.InsertMakeProcess(ms_macode, code.Text, User.UserSourceCode, "上料采集操作", "下料成功", User.UserCode);
+                                //刷新界面值
+                                sql.Clear();
+                                sql.Append("select mcd_inqty,ma_qty-mcd_inqty mcd_remainqty ");
+                                sql.Append("from make left join makecraftdetail on mcd_macode=ma_code where ");
+                                sql.Append("ma_code='" + oMakeCode + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
+                                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                                BaseUtil.SetFormValue(Controls, dt);
+                                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "上料采集", "下料成功", code.Text, "");
+                                OperateResult.AppendText(">>序列号" + code.Text + "下料成功\n", Color.Green, code);
+                            }
+                            else OperateResult.AppendText(">>序列号" + code.Text + "未上料,无需下料\n", Color.Red, code);
+                        }
+                        else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
+                    }
+                }
+                else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
+            }
+        }
+
+        //获取采集的项目
+        private void GetCollectItem()
+        {
+            bool NoteAlready = LogicHandler.CheckDiffMakeCodeBeforeStepCheck(code.Text, ma_code.Text, NoteForChange.Checked, out oMakeCode, out ErrorMessage);
+            if (!NoteAlready)
+            {
+                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
+                return;
+            }
+            if (LogicHandler.CheckStepSNAndMacode(oMakeCode, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsid, out ErrorMessage))
+            {
+                if (!LogicHandler.CheckDiffMakeCodeAfterStepCheck(code.Text, oMakeCode, NoteForChange.Checked, NoteAlready, ma_code, out ErrorMessage))
+                {
+                    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
+                    return;
+                }
+                //将录入框的值给序列号
+                sn_code.Text = code.Text;
+                sql.Clear();
+                sql.Append("select ma_prodcode,ma_ecncode,ma_softversion,ms_firstsn,ma_bomversion,ma_qty,ma_code,pr_spec,ms_status,ms_id,ms_craftcode,ms_nextstepcode");
+                sql.Append(",ms_prodcode,ms_makecode,ms_code,ms_stepname  from makeserial left join make on ma_code=ms_makecode ");
+                sql.Append("left join product on ms_prodcode=pr_code where ms_sncode='" + code.Text + "' order by ms_id desc");
+                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                if (dt.Rows.Count > 0)
+                {
+                    ms_id = dt.Rows[0]["ms_id"].ToString();
+                    make_code = dt.Rows[0]["ma_code"].ToString();
+                    mabomversion = dt.Rows[0]["ma_bomversion"].ToString();
+                    make_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
+                    nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
+                    ms_status = dt.Rows[0]["ms_status"].ToString();
+                    ms_firstsn = dt.Rows[0]["ms_firstsn"].ToString();
+                    BaseUtil.SetFormValue(this.Controls, dt);
+
+                    LockMakeCode.Checked = true;
+                    //勾选了前一工单
+                    if (iflastsn.Checked)
+                    {
+                        dt = (DataTable)dh.ExecuteSql("select ms_id,ms_makecode,ms_craftcode,ms_status,ms_nextstepcode,ms_prodcode,ms_code from makeserial where ms_sncode='" + code.Text + "' and ms_makecode<>'" + ma_code.Text + "' order by ms_id desc", "select");
+                        string make_code = "";
+                        string make_prodcode = "";
+                        string nextstepcode = "";
+                        string ms_status = "";
+                        if (dt.Rows.Count > 0)
+                        {
+                            ms_id = dt.Rows[0]["ms_id"].ToString();
+                            make_code = dt.Rows[0]["ms_makecode"].ToString();
+                            make_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
+                            nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
+                            ms_status = dt.Rows[0]["ms_status"].ToString();
+                            //判断序列号的前一工单是否已经完工
+                            if (dt.Rows[0]["ms_makecode"].ToString() != ma_code.Text && dt.Rows[0]["ms_status"].ToString() == "2")
+                            {
+                                sql.Clear();
+                                sql.Append("select sp_id,sp_soncode from make inner join stepbom on ma_prodcode=sb_prodcode and ma_bomversion=sb_bomversion left ");
+                                sql.Append("join stepproduct on sp_sbid=sb_id where ma_code='" + ma_code.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' ");
+                                sql.Append("and sp_stepcode='" + User.CurrentStepCode + "' and nvl(sp_ifforsn,0)<>0");
+                                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                                if (dt.Rows.Count > 0)
+                                {
+                                    string sp_id = dt.Rows[0]["sp_id"].ToString();
+                                    string sp_soncode = dt.Rows[0]["sp_soncode"].ToString();
+                                    if (!dh.CheckExist("Craftmaterial", "cm_makecode='" + ma_code.Text + "' and cm_soncode='" + make_prodcode + "' and cm_sncode='" + code.Text + "' and cm_status=0"))
+                                    {
+                                        CollectDataSonCode.Add(sp_soncode);
+                                        SPID.Add(sp_id);
+                                        CollectData.Add(code.Text.Substring(0, code.Text.Length > 80 ? 80 : code.Text.Length));
+                                        sn_code.Text = code.Text;
+                                        OperateResult.AppendText(">>序列号" + code.Text + ",物料" + sp_soncode + "上料成功\n", Color.Green);
+                                        RemainIndex = RemainIndex + 1;
+                                        GetItem();
+                                        return;
+                                    }
+                                    else
+                                    {
+                                        GetItem();
+                                    }
+                                }
+                                else OperateResult.AppendText(">>序列号" + code.Text + "无生产信息\n", Color.Red, code);
+                            }
+                            else OperateResult.AppendText(">>序列号" + code.Text + "已被工单" + dt.Rows[0]["ms_makecode"].ToString() + "绑定,尚未完工\n", Color.Red, code);
+                        }
+                        else OperateResult.AppendText(">>序列号" + code.Text + "无生产信息\n", Color.Red, code);
+                    }
+                    else
+                    {
+                        dt = (DataTable)dh.ExecuteSql("select ms_status,ms_stepcode,ms_nextstepcode from makeserial where ms_sncode='" + code.Text + "' and ms_makecode='" + ma_code.Text + "' order by ms_id desc", "select");
+                        nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
+                        ms_status = dt.Rows[0]["ms_status"].ToString();
+                        sn_code.Text = code.Text;
+                        sql.Clear();
+                        sql.Append("select ma_code,ma_softversion,ma_ecncode,ma_prodcode,pr_spec,ma_qty from makeserial left join product ");
+                        sql.Append(" on ms_prodcode=pr_code left join make on ms_makecode=ma_code left join ");
+                        sql.Append("makecraftdetail on mcd_macode=ms_makecode where ms_id='" + oMsid + "'");
+                        dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                        BaseUtil.SetFormValue(this.Controls, dt);
+                        OperateResult.AppendText(">>获取序列号" + code.Text + "成功\n", Color.Green);
+                        if (PrintLabel.SelectedValue == null)
+                        {
+                            OperateResult.AppendText(">>产品编号:" + ma_prodcode.Text + "未维护彩盒标签\n", Color.Red, code);
+                            return;
+                        }
+                        GetItem();
+                    }
+                }
+                else
+                {
+                    OperateResult.AppendText(">>序列号" + code.Text + "不存在\n", Color.Red, code);
+                    code.Text = "";
+                    sn_code.Text = "";
+                }
+            }
+            else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
+        }
+
+        private void GetItem()
+        {
+            //单独用一个DataTable存储一个
+            dt1 = new DataTable();
+            sql.Clear();
+            sql.Append("select max(sp_id)sp_id,max(sp_detno)sp_detno,min(sp_ifrepeat)sp_ifrepeat,max(sp_checkbarcode)sp_checkbarcode,min(sp_checksalecode)sp_checksalecode,");
+            sql.Append("sp_fsoncode,max(sp_barcoderule)sp_barcoderule,wm_concat(sp_soncode) sp_soncode,max(sp_ifuseregex)sp_ifuseregex,max(sp_ifforsn)");
+            sql.Append("sp_ifforsn,max(sp_length)sp_length,max(sp_type)sp_type,replace(wm_concat(sp_prefix),',','|')sp_prefix,max(sp_regex)");
+            sql.Append("sp_regex,max(pr_detail)pr_detail,max(substr(pr_spec,0,20))pr_spec from stepproduct left join product on pr_code=sp_fsoncode where ");
+            sql.Append("sp_bomversion='" + ma_bomversion.Text + "' and sp_craftcode='" + ms_craftcode.Text + "' and sp_stepcode='" + User.CurrentStepCode + "' ");
+            sql.Append("And sp_mothercode ='" + ma_prodcode.Text + "' and sp_tracekind=1 and not exists(select 1 from craftmaterial where ");
+            sql.Append("cm_sncode in (select '" + ms_firstsn + "' from dual union select sn from makesnrelation where firstsn='" + ms_firstsn + "') and cm_makecode='" + ma_code.Text + "' and cm_fsoncode=");
+            sql.Append("sp_fsoncode and cm_status=0) group by sp_fsoncode order by SP_DETNO asc");
+            dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+            code.Clear();
+            //用于记录提醒的数据长度
+            RemainList = new string[dt1.Rows.Count];
+            for (int i = 0; i < dt1.Rows.Count; i++)
+            {
+                string soncode = dt1.Rows[i]["sp_soncode"].ToString();
+                string prdetail = dt1.Rows[i]["pr_detail"].ToString();
+                RemainList[i] = soncode + "(" + prdetail + ")";
+            }
+            if (dt1.Rows.Count > 0)
+            {
+                try
+                {
+                    string soncode = dt1.Rows[RemainIndex]["sp_soncode"].ToString();
+                    string prdetail = dt1.Rows[RemainIndex]["pr_detail"].ToString();
+                    OperateResult.AppendText("<<请采集" + soncode + "(" + prdetail + ")的物料数据\n", Color.Black);
+                }
+                catch (Exception)
+                {
+                    OperateResult.AppendText(">>序列号" + sn_code.Text + "上料采集完成!\n", Color.Green);
+                    code.Text = "";
+                    sn_code.Text = "";
+                }
+            }
+            else
+            {
+                OperateResult.AppendText(">>序列号" + sn_code.Text + "不在本道工序,请采集其它序列号\n", Color.Black);
+                if (!LogicHandler.SetStepResult(ma_code.Text, User.UserSourceCode, sn_code.Text, "上料采集", "上料成功", User.UserCode, out ErrorMessage))
+                    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                else
+                {
+                    //提示正确返回时传递的信息
+                    if (ErrorMessage.Contains("AFTERSUCCESS"))
+                        OperateResult.AppendText(">>" + ErrorMessage + "\n");
+                    OperateResult.AppendText(">>序列号" + sn_code.Text + "采集成功!\n", Color.Green);
+                }
+                code.Text = "";
+                sn_code.Text = "";
+            }
+        }
+
+        //此类中通用的保存逻辑
+        private void Save_OtherCode(string sp_fsoncode, string sp_soncode, string ma_code, string ms_sncode, string sp_id)
+        {
+            CollectDataSonCode.Add(sp_soncode);
+            //采集成功提示
+
+            CollectData.Add(code.Text.Substring(0, code.Text.Length > 80 ? 80 : code.Text.Length));
+            if (!CheckBarcode.ContainsKey(sp_fsoncode))
+            {
+                CheckBarcode.Add(sp_fsoncode, code.Text.Substring(0, code.Text.Length > 80 ? 80 : code.Text.Length));
+            }
+            SPID.Add(sp_id);
+            OperateResult.AppendText(">>物料" + sp_soncode + "采集成功,条码" + code.Text + "\n", Color.Green);
+            LabelDataGridView.Rows[RemainIndex].Cells["BarCode"].Value = code.Text;
+            if (code.Text.Length > 80)
+                OperateResult.AppendText(">>采集条码" + code.Text + "程度超过长度限制80,内容截取前80位进行采集\n", Color.Red);
+            code.Clear();
+            RemainIndex = RemainIndex + 1;
+            //如果+1后不小于B序列的长度,则已采集完成,不需要进行提示了
+            if (RemainIndex < RemainList.Length)
+            {
+                OperateResult.AppendText("<<请采集" + RemainList[RemainIndex] + "的物料数据\n", Color.Black);
+            }
+            else
+            {
+                sql.Clear();
+                sql.Append("insert into Craftmaterial (cm_id ,cm_makecode,cm_maid,cm_maprodcode, cm_soncode, cm_mscode, cm_sncode, cm_stepcode, cm_stepname,cm_fsoncode,");
+                sql.Append("cm_craftcode,cm_craftname,cm_barcode,cm_inqty,cm_indate,cm_inman,cm_linecode,cm_wccode,cm_sourcecode,cm_spid,cm_status,cm_materialtype,cm_firstsn)");
+                sql.Append("select Craftmaterial_seq.nextval, ma_code, ma_id, ma_prodcode,:soncode,ms_code,ms_sncode,mcd_stepcode,");
+                sql.Append("mcd_stepname,sp_fsoncode,ms_craftcode,ms_craftname,:barcode,1,sysdate,'" + User.UserCode + "','" + User.UserLineCode + "',ma_wccode,");
+                sql.Append("'" + User.UserSourceCode + "',:sp_id,0,1,ms_firstsn from make left join makecraftdetail on mcd_macode=ma_code  left join stepproduct on sp_stepcode=mcd_stepcode ");
+                sql.Append(" and sp_mothercode = ma_prodcode left join makeserial on ms_makecode=ma_code and sp_craftcode=ms_craftcode ");
+                sql.Append("where ma_code='" + make_code + "'and sp_id=:sp_id1 and mcd_stepcode = '" + User.CurrentStepCode + "' and ms_sncode='" + ms_sncode + "'");
+                dh.BatchInsert(sql.GetString(), new string[] { "soncode", "barcode", "sp_id", "sp_id1" }, CollectDataSonCode.ToArray(), CollectData.ToArray(), SPID.ToArray(), SPID.ToArray());
+                try
+                {
+                    string Log = "";
+                    for (int i = 0; i < CollectDataSonCode.Count; i++)
+                    {
+                        Log += CollectDataSonCode.ToArray()[i] + " " + CollectData.ToArray()[i] + " " + SPID.ToArray()[i];
+                    }
+                    LogManager.DoLog(Log);
+                }
+                catch (Exception)
+                {
+
+                }
+                //更新序列号半成品已被使用
+                dh.BatchInsert("update makeserial set ms_nextmacode='" + ma_code + "' where ms_id=(select max(ms_id) from makeserial where ms_sncode=:sncode and ms_nextmacode is null and ms_makecode<>'" + ma_code + "')", new string[] { "sncode" }, TSN.ToArray());
+                CollectData.Clear();
+                TSN.Clear();
+                SPID.Clear();
+                CheckBarcode.Clear();
+                CollectDataSonCode.Clear();
+                //采集成功,设置序列号栏目为空
+                RemainIndex = 0;
+                OperateResult.AppendText(">>序列号" + sn_code.Text + "上料采集完成!\n", Color.Green);
+                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oMakeCode, User.UserLineCode, User.UserSourceCode, "上料采集", "上料成功", sn_code.Text, "");
+                if (LogicHandler.SetStepResult(ma_code, User.UserSourceCode, sn_code.Text, "上料采集", "上料成功", User.UserCode, out ErrorMessage))
+                {
+
+                    //提示正确返回时传递的信息
+                    if (ErrorMessage.Contains("AFTERSUCCESS"))
+                        OperateResult.AppendText(">>" + ErrorMessage + "\n");
+                    sn_code.Text = "";
+                    //刷新数据
+                    EventArgs e = new EventArgs();
+                    object sender = null;
+                    if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, ms_sncode, int.Parse(PrintNum.Text), ma_code, ma_prodcode.Text, "彩盒标", "0", out ErrorMessage))
+                    {
+                        OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
+                    }
+                    ma_code_UserControlTextChanged(sender, e);
+                }
+                else
+                {
+                    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);
+                }
+            }
+        }
+
+        private void ClearSn_code_Click(object sender, EventArgs e)
+        {
+            sn_code.Clear();
+            SPID.Clear();
+            TSN.Clear();
+            CheckBarcode.Clear();
+            CollectData.Clear();
+            CollectDataSonCode.Clear();
+            if (dt1 != null)
+                BaseUtil.CleanDataTableData(dt1);
+            RemainIndex = 0;
+            BaseUtil.CleanDGVData(LabelDataGridView);
+            OperateResult.AppendText(">>请采集序列号\n", Color.Black);
+        }
+
+        private void ma_code_UserControlTextChanged(object sender, EventArgs e)
+        {
+            if (ma_code.Text.Length > 5)
+            {
+                string ErrMessage = "";
+                if (LogicHandler.CheckMakeStatus(ma_code.Text, out ErrMessage))
+                {
+                    mcd_inqty.Text = "";
+                    mcd_remainqty.Text = "";
+                    sql.Clear();
+                    sql.Append("select mcd_inqty,ma_qty-mcd_inqty mcd_remainqty ");
+                    sql.Append("from make left join makecraftdetail on mcd_macode=ma_code where ");
+                    sql.Append("ma_code='" + ma_code.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
+                    DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                    if (dt.Rows.Count > 0)
+                        BaseUtil.SetFormValue(Controls, dt);
+                }
+            }
+        }
+
+        private void ma_prodcode_TextChanged(object sender, EventArgs e)
+        {
+            DataTable _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault from label where la_prodcode='" + ma_prodcode.Text + "' and la_templatetype='彩盒标' and la_statuscode='AUDITED' order by la_isdefault", "select");
+            PrintLabel.DataSource = _dt;
+            PrintLabel.DisplayMember = "la_url";
+            PrintLabel.ValueMember = "la_id";
+        }
+
+        private void PrintLabel_SelectedValueChanged(object sender, EventArgs e)
+        {
+            if (PrintLabel.SelectedValue != null && PrintLabel.SelectedValue.ToString() != "System.Data.DataRowView")
+            {
+                string PrintNums = dh.getFieldDataByCondition("label", "la_printnos", "la_id='" + PrintLabel.SelectedValue.ToString() + "'").ToString();
+                PrintNum.Text = (PrintNums == "" ? "1" : PrintNums);
+            }
+        }
+    }
+}

+ 197 - 0
UAS_MES_ODLF/FunctionCode/Make/Make_ColorBoxLoadPrintBZ.resx

@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="Clean.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFcSURBVFhH5di7UsJAFMbxtDT6QMI76IAFT0npIE0K
+        GcRORxHklpAIBHLfbILV8XxeNsMznJ35F5vu+82kWYuILD4N7oq75roCw27sb/x5WBdc27btntY64o/i
+        DnZjPxy4S6A0R6PHO1WUNHc9ep4uxIXd2D8eP/XZowWUThBG+n3p0stsKbbJ0qFDFFfscQuUbpzm9Pqx
+        Eh8c4PGLkuX0Nl+LDw4GJckUTRaO+OBQo+SKpitXfHAwKClfZuuN+OBgUDJV0NzxxAeHM5TFxhffGUpe
+        aFp5n+KDg0FRfHH8nfjgUKPoktztXnxwMCgFX7xdID441ChlRf7+ID44GBTNl21wFB8capSqot0xFB8c
+        /lE6Wa70IU5oH0Ziw/5cFebpoPUwHPbL04nCJKUgisWF3dgPB3gABc9v7fvBoBcnaVKdvkha2I39cPjx
+        oPrhusndcPinpIXd2N8gIusbTaFspKtR2SQAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="Clean.MoveImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFzSURBVFhH5djNSgJRGMZxL2P2gTfQFbZvHSEZFBEW
+        CEIQBEIgVFiS9qXWoDmp4/fHzDmjM2a+vU/QqUVX0DvwXxxn9fwYXJwYEcXWNzIWt83dcq7AsBv7LXgA
+        ZI0r71/aaqjCJf8o7sFu7IcDFwdK4vimrv1oSZXRnArdQFzYjf3pQkOzRxIoVWc6X5X6M7ruBGIr9mbU
+        9MIVe9hAcXvBO125WnxwgMcXSpcPF20tPjgYlI5eUK6lxAcHg9Lmw3nTFx8cDEpLLSjr+OKDg0FpqojO
+        Gp744GBQ3vyITutT8cHBoDheRCe1ifjgYFBe+ZCxJ+KDg0GpT0NKv4zFBweDUpuEdFQdiQ8OBsXmw2Fl
+        JD44/KCM53TwNBQfHAzKMx/2Hgfig8M3SrXYUasUfz67DwOxYf9dV5urg+RWzta4aEnxn83OfV9c2I39
+        cIAHUOJceTNbUfmW94GX0sJu7IcDPH5fXCe4EvfXxe5/D7ux3yKi2CfkPhTy27lqkwAAAABJRU5ErkJg
+        gg==
+</value>
+  </data>
+  <data name="Clean.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGVSURBVFhH5di7agJRFIXhDSKoYBQEC8FCECwEQRBE
+        4uUVEtTiPKVlom2wttM6IfF+15njXHRnL19jD/zFmanWV8zAEDNTp9OJS6/Sm2QUht3YH4cHtdvtF6k7
+        mUwG1tqd3FR3YTf2w0FKUVOu6XT68Xgw3+8PtWH/bDYbCkeLGo1Gz/d9JwzvrL0gCKx49KlerxtIBUGo
+        PjjAg2q1mqDc2fN99cEBHlStVk0oB+t56oMDPKhSqZggDNm1N/XBAR5ULpeNvGD46rrqgwM8qFQqGV8O
+        56ujPjjAg4rFosFL5ni5qA8O8KBCoWBuns/701l9cIAH5fN5QfF4dzipDw7woFwuZ+zN483+oD44wIOy
+        2azB52i13asPDvCgTCZjHGt5sdmqDw7woHQ6bRzX8ny1UR8c4EHJZNJc5fC7XKsPDvCgRCLR2x9Pzt9q
+        zT+Lpdqw/3A6W/HoUywWa32Nx8OL4zwffM8X6sJu7IcDPCgajaak7udoNNjsdgc81BZ2Yz8c4PH8cR2J
+        ROJSU3qXjMKwG/vjzEz/skOI3Zqgv7AAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="Confirm.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFcSURBVFhH5di7UsJAFMbxtDT6QMI76IAFT0npIE0K
+        GcRORxHklpAIBHLfbILV8XxeNsMznJ35F5vu+82kWYuILD4N7oq75roCw27sb/x5WBdc27btntY64o/i
+        DnZjPxy4S6A0R6PHO1WUNHc9ep4uxIXd2D8eP/XZowWUThBG+n3p0stsKbbJ0qFDFFfscQuUbpzm9Pqx
+        Eh8c4PGLkuX0Nl+LDw4GJckUTRaO+OBQo+SKpitXfHAwKClfZuuN+OBgUDJV0NzxxAeHM5TFxhffGUpe
+        aFp5n+KDg0FRfHH8nfjgUKPoktztXnxwMCgFX7xdID441ChlRf7+ID44GBTNl21wFB8capSqot0xFB8c
+        /lE6Wa70IU5oH0Ziw/5cFebpoPUwHPbL04nCJKUgisWF3dgPB3gABc9v7fvBoBcnaVKdvkha2I39cPjx
+        oPrhusndcPinpIXd2N8gIusbTaFspKtR2SQAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="Confirm.MoveImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFzSURBVFhH5djNSgJRGMZxL2P2gTfQFbZvHSEZFBEW
+        CEIQBEIgVFiS9qXWoDmp4/fHzDmjM2a+vU/QqUVX0DvwXxxn9fwYXJwYEcXWNzIWt83dcq7AsBv7LXgA
+        ZI0r71/aaqjCJf8o7sFu7IcDFwdK4vimrv1oSZXRnArdQFzYjf3pQkOzRxIoVWc6X5X6M7ruBGIr9mbU
+        9MIVe9hAcXvBO125WnxwgMcXSpcPF20tPjgYlI5eUK6lxAcHg9Lmw3nTFx8cDEpLLSjr+OKDg0FpqojO
+        Gp744GBQ3vyITutT8cHBoDheRCe1ifjgYFBe+ZCxJ+KDg0GpT0NKv4zFBweDUpuEdFQdiQ8OBsXmw2Fl
+        JD44/KCM53TwNBQfHAzKMx/2Hgfig8M3SrXYUasUfz67DwOxYf9dV5urg+RWzta4aEnxn83OfV9c2I39
+        cIAHUOJceTNbUfmW94GX0sJu7IcDPH5fXCe4EvfXxe5/D7ux3yKi2CfkPhTy27lqkwAAAABJRU5ErkJg
+        gg==
+</value>
+  </data>
+  <data name="Confirm.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGVSURBVFhH5di7agJRFIXhDSKoYBQEC8FCECwEQRBE
+        4uUVEtTiPKVlom2wttM6IfF+15njXHRnL19jD/zFmanWV8zAEDNTp9OJS6/Sm2QUht3YH4cHtdvtF6k7
+        mUwG1tqd3FR3YTf2w0FKUVOu6XT68Xgw3+8PtWH/bDYbCkeLGo1Gz/d9JwzvrL0gCKx49KlerxtIBUGo
+        PjjAg2q1mqDc2fN99cEBHlStVk0oB+t56oMDPKhSqZggDNm1N/XBAR5ULpeNvGD46rrqgwM8qFQqGV8O
+        56ujPjjAg4rFosFL5ni5qA8O8KBCoWBuns/701l9cIAH5fN5QfF4dzipDw7woFwuZ+zN483+oD44wIOy
+        2azB52i13asPDvCgTCZjHGt5sdmqDw7woHQ6bRzX8ny1UR8c4EHJZNJc5fC7XKsPDvCgRCLR2x9Pzt9q
+        zT+Lpdqw/3A6W/HoUywWa32Nx8OL4zwffM8X6sJu7IcDPCgajaak7udoNNjsdgc81BZ2Yz8c4PH8cR2J
+        ROJSU3qXjMKwG/vjzEz/skOI3Zqgv7AAAAAASUVORK5CYII=
+</value>
+  </data>
+</root>

+ 9 - 9
UAS_MES_ODLF/FunctionCode/Packing/Packing_PackageCollection.cs

@@ -156,7 +156,7 @@ namespace UAS_MES_NEW.Packing
                     dh.ExecuteSql("update package set pa_printcount=pa_printcount+1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
                     for (int i = 0; i < _dt.Rows.Count; i++)
                     {
-                        if (Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), oMakeCode == "" ? pa_makecode.Text : oMakeCode, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
+                        if (Print.CodeSoft(Tag.ToString(), ref lbl, _dt.Rows[i]["la_url"].ToString(), _dt.Rows[i]["la_id"].ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), oMakeCode == "" ? pa_makecode.Text : oMakeCode, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
                         {
                             OperateResult.AppendText(">>开始打印箱号" + pa_outboxcode.Text + "\n", Color.Black);
                         }
@@ -184,8 +184,8 @@ namespace UAS_MES_NEW.Packing
         //加载工单信息和装箱明细信息
         private void pa_code_KeyDown(object sender, KeyEventArgs e)
         {
-            try
-            {
+            //try
+            //{
                 if (e.KeyCode == Keys.Enter)
                 {
                     LoadData();
@@ -195,11 +195,11 @@ namespace UAS_MES_NEW.Packing
                         sn_code.Focus();
                     }
                 }
-            }
-            catch (Exception ex)
-            {
-                MessageBox.Show(ex.Message);
-            }
+            //}
+            //catch (Exception ex)
+            //{
+            //    MessageBox.Show(ex.Message);
+            //}
         }
 
         //输入序列号的回车事件
@@ -558,7 +558,7 @@ namespace UAS_MES_NEW.Packing
         {
             LoadCheckQTY();
             _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='卡通箱标' and la_statuscode='AUDITED' order by la_isdefault", "select");
-            PrintLabel.DataSource = dt;
+            PrintLabel.DataSource = _dt;
             PrintLabel.DisplayMember = "la_url";
             PrintLabel.ValueMember = "la_id";
         }

+ 74 - 32
UAS_MES_ODLF/FunctionCode/Query/Query_DateRate.Designer.cs

@@ -33,22 +33,28 @@
             this.BeginDate = new System.Windows.Forms.DateTimePicker();
             this.EndDate = new System.Windows.Forms.DateTimePicker();
             this.label3 = new System.Windows.Forms.Label();
-            this.Export = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
-            this.pr_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.ms_makecode_label = new System.Windows.Forms.Label();
+            this.label1 = new System.Windows.Forms.Label();
+            this.ma_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.pr_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.Export = new UAS_MES_NEW.CustomControl.ButtonUtil.NormalButton();
             this.SuspendLayout();
             // 
             // BeginDate
             // 
-            this.BeginDate.Location = new System.Drawing.Point(325, 173);
+            this.BeginDate.CustomFormat = "yyyy-MM-dd HH:mm:ss";
+            this.BeginDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+            this.BeginDate.Location = new System.Drawing.Point(325, 216);
             this.BeginDate.Name = "BeginDate";
             this.BeginDate.Size = new System.Drawing.Size(353, 35);
             this.BeginDate.TabIndex = 13;
-            this.BeginDate.Value = new System.DateTime(2020, 8, 24, 0, 0, 0, 0);
+            this.BeginDate.Value = new System.DateTime(2021, 2, 27, 13, 47, 0, 0);
             // 
             // EndDate
             // 
-            this.EndDate.Location = new System.Drawing.Point(684, 173);
+            this.EndDate.CustomFormat = "yyyy-MM-dd HH:mm:ss";
+            this.EndDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+            this.EndDate.Location = new System.Drawing.Point(684, 216);
             this.EndDate.Name = "EndDate";
             this.EndDate.Size = new System.Drawing.Size(353, 35);
             this.EndDate.TabIndex = 14;
@@ -57,31 +63,55 @@
             // 
             this.label3.AutoSize = true;
             this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(139, 168);
+            this.label3.Location = new System.Drawing.Point(139, 211);
             this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(82, 41);
             this.label3.TabIndex = 15;
             this.label3.Text = "日期";
             // 
-            // Export
+            // ms_makecode_label
             // 
-            this.Export.AllPower = null;
-            this.Export.BackColor = System.Drawing.Color.Transparent;
-            this.Export.DownImage = ((System.Drawing.Image)(resources.GetObject("Export.DownImage")));
-            this.Export.Image = null;
-            this.Export.IsShowBorder = true;
-            this.Export.Location = new System.Drawing.Point(325, 515);
-            this.Export.Margin = new System.Windows.Forms.Padding(6);
-            this.Export.MoveImage = ((System.Drawing.Image)(resources.GetObject("Export.MoveImage")));
-            this.Export.Name = "Export";
-            this.Export.NormalImage = ((System.Drawing.Image)(resources.GetObject("Export.NormalImage")));
-            this.Export.Power = null;
-            this.Export.Size = new System.Drawing.Size(150, 56);
-            this.Export.TabIndex = 0;
-            this.Export.Text = "导出";
-            this.Export.UseVisualStyleBackColor = false;
-            this.Export.Click += new System.EventHandler(this.Export_Click);
+            this.ms_makecode_label.AutoSize = true;
+            this.ms_makecode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ms_makecode_label.Location = new System.Drawing.Point(140, 91);
+            this.ms_makecode_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.ms_makecode_label.Name = "ms_makecode_label";
+            this.ms_makecode_label.Size = new System.Drawing.Size(146, 41);
+            this.ms_makecode_label.TabIndex = 212;
+            this.ms_makecode_label.Text = "产品编号";
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.Location = new System.Drawing.Point(140, 151);
+            this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(146, 41);
+            this.label1.TabIndex = 214;
+            this.label1.Text = "工单编号";
+            // 
+            // ma_code
+            // 
+            this.ma_code.AllPower = "IFALL";
+            this.ma_code.Caller = null;
+            this.ma_code.Condition = null;
+            this.ma_code.DBTitle = "";
+            this.ma_code.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.ma_code.FormName = null;
+            this.ma_code.Location = new System.Drawing.Point(325, 151);
+            this.ma_code.Margin = new System.Windows.Forms.Padding(6);
+            this.ma_code.Name = "ma_code";
+            this.ma_code.Power = "";
+            this.ma_code.ReturnData = null;
+            this.ma_code.SelectField = null;
+            this.ma_code.SetValueField = null;
+            this.ma_code.Size = new System.Drawing.Size(282, 46);
+            this.ma_code.TabIndex = 215;
+            this.ma_code.TableName = null;
+            this.ma_code.Tag = "makecode";
+            this.ma_code.TextBoxEnable = true;
             // 
             // pr_code
             // 
@@ -104,22 +134,32 @@
             this.pr_code.Tag = "makecode";
             this.pr_code.TextBoxEnable = true;
             // 
-            // ms_makecode_label
+            // Export
             // 
-            this.ms_makecode_label.AutoSize = true;
-            this.ms_makecode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_makecode_label.Location = new System.Drawing.Point(140, 91);
-            this.ms_makecode_label.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
-            this.ms_makecode_label.Name = "ms_makecode_label";
-            this.ms_makecode_label.Size = new System.Drawing.Size(146, 41);
-            this.ms_makecode_label.TabIndex = 212;
-            this.ms_makecode_label.Text = "产品编号";
+            this.Export.AllPower = null;
+            this.Export.BackColor = System.Drawing.Color.Transparent;
+            this.Export.DownImage = ((System.Drawing.Image)(resources.GetObject("Export.DownImage")));
+            this.Export.Image = null;
+            this.Export.IsShowBorder = true;
+            this.Export.Location = new System.Drawing.Point(325, 515);
+            this.Export.Margin = new System.Windows.Forms.Padding(6);
+            this.Export.MoveImage = ((System.Drawing.Image)(resources.GetObject("Export.MoveImage")));
+            this.Export.Name = "Export";
+            this.Export.NormalImage = ((System.Drawing.Image)(resources.GetObject("Export.NormalImage")));
+            this.Export.Power = null;
+            this.Export.Size = new System.Drawing.Size(150, 56);
+            this.Export.TabIndex = 0;
+            this.Export.Text = "导出";
+            this.Export.UseVisualStyleBackColor = false;
+            this.Export.Click += new System.EventHandler(this.Export_Click);
             // 
             // Query_DateRate
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1494, 1075);
+            this.Controls.Add(this.ma_code);
+            this.Controls.Add(this.label1);
             this.Controls.Add(this.pr_code);
             this.Controls.Add(this.ms_makecode_label);
             this.Controls.Add(this.label3);
@@ -146,5 +186,7 @@
         private System.Windows.Forms.Label label3;
         private CustomControl.TextBoxWithIcon.SearchTextBox pr_code;
         private System.Windows.Forms.Label ms_makecode_label;
+        private CustomControl.TextBoxWithIcon.SearchTextBox ma_code;
+        private System.Windows.Forms.Label label1;
     }
 }

+ 18 - 5
UAS_MES_ODLF/FunctionCode/Query/Query_DateRate.cs

@@ -15,6 +15,9 @@ namespace UAS_MES_NEW.Query
     public partial class Query_DateRate : Form
     {
 
+
+        string querysql = "";
+
         DataHelper dh = SystemInf.dh;
 
         DataTable Dbfind;
@@ -45,13 +48,16 @@ namespace UAS_MES_NEW.Query
             DialogResult result = folderBrowserDialog1.ShowDialog();
             if (result == DialogResult.OK)
             {
-                LogStringBuilder sql = new LogStringBuilder();
-                sql.Append("select * from MES_OKNG_DATE where sp_date between ");
-                sql.Append("to_date('" + BeginDate.Value.ToString("yyyy-MM-dd") + "','yyyy-mm-dd') and ");
-                sql.Append("to_date('" + EndDate.Value.ToString("yyyy-MM-dd") + "','yyyy-mm-dd') and sp_prodcode='" + pr_code.Text + "' order by sp_date");
-                DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                string v_sql = "";
+                string v_sql1 = "";
+                string condition= "sp_date between to_date('" + BeginDate.Value.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss') and to_date('" + EndDate.Value.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss') and sp_prodcode = '" + pr_code.Text + "' ";
+
+                LogicHandler.GetQuerySql(condition,out v_sql,out v_sql1);
+         
+                DataTable dt = (DataTable)dh.ExecuteSql(v_sql+v_sql1, "select");
                 string FolderPath = folderBrowserDialog1.SelectedPath;
                 ExcelHandler eh = new ExcelHandler();
+
                 string begindate = BeginDate.Value.ToString("yyyy-mm-dd");
                 string enddate = EndDate.Value.ToString("yyyy-mm-dd");
                 string path = eh.ExportExcel_BAIDU(dt, BeginDate.Value, (EndDate.Value - BeginDate.Value).Days + 1, FolderPath);
@@ -70,6 +76,13 @@ namespace UAS_MES_NEW.Query
             pr_code.SetValueField = new string[] { "pr_code" };
             pr_code.Condition = "pr_statuscode='AUDITED'";
             pr_code.DbChange += pr_code_DbChange;
+
+            ma_code.TableName = " make left join product on ma_prodcode=pr_code";
+            ma_code.SelectField = "ma_code # 工单编号,ma_prodcode # 产品编号,pr_spec # 型号";
+            ma_code.FormName = Name;
+            ma_code.SetValueField = new string[] { "ma_code" };
+            ma_code.Condition = "ma_statuscode='STARTED'";
+            ma_code.DbChange += pr_code_DbChange;
         }
 
         private void pr_code_DbChange(object sender, EventArgs e)

+ 19 - 18
UAS_MES_ODLF/FunctionCode/Special/Special_CancelCollection.Designer.cs

@@ -40,10 +40,10 @@
             // 
             this.sn_code_label.AutoSize = true;
             this.sn_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.sn_code_label.Location = new System.Drawing.Point(45, 162);
-            this.sn_code_label.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
+            this.sn_code_label.Location = new System.Drawing.Point(68, 259);
+            this.sn_code_label.Margin = new System.Windows.Forms.Padding(8, 0, 8, 0);
             this.sn_code_label.Name = "sn_code_label";
-            this.sn_code_label.Size = new System.Drawing.Size(72, 27);
+            this.sn_code_label.Size = new System.Drawing.Size(114, 41);
             this.sn_code_label.TabIndex = 104;
             this.sn_code_label.Text = "序列号";
             // 
@@ -52,11 +52,11 @@
             this.sn_code.AllPower = null;
             this.sn_code.BackColor = System.Drawing.Color.White;
             this.sn_code.ID = null;
-            this.sn_code.Location = new System.Drawing.Point(151, 164);
-            this.sn_code.Margin = new System.Windows.Forms.Padding(5);
+            this.sn_code.Location = new System.Drawing.Point(226, 262);
+            this.sn_code.Margin = new System.Windows.Forms.Padding(8, 8, 8, 8);
             this.sn_code.Name = "sn_code";
             this.sn_code.Power = null;
-            this.sn_code.Size = new System.Drawing.Size(233, 25);
+            this.sn_code.Size = new System.Drawing.Size(348, 35);
             this.sn_code.Str = null;
             this.sn_code.Str1 = null;
             this.sn_code.Str2 = null;
@@ -69,13 +69,13 @@
             this.Confirm.DownImage = ((System.Drawing.Image)(resources.GetObject("Confirm.DownImage")));
             this.Confirm.Image = ((System.Drawing.Image)(resources.GetObject("Confirm.Image")));
             this.Confirm.IsShowBorder = true;
-            this.Confirm.Location = new System.Drawing.Point(440, 161);
-            this.Confirm.Margin = new System.Windows.Forms.Padding(5);
+            this.Confirm.Location = new System.Drawing.Point(660, 258);
+            this.Confirm.Margin = new System.Windows.Forms.Padding(8, 8, 8, 8);
             this.Confirm.MoveImage = ((System.Drawing.Image)(resources.GetObject("Confirm.MoveImage")));
             this.Confirm.Name = "Confirm";
             this.Confirm.NormalImage = ((System.Drawing.Image)(resources.GetObject("Confirm.NormalImage")));
             this.Confirm.Power = null;
-            this.Confirm.Size = new System.Drawing.Size(80, 31);
+            this.Confirm.Size = new System.Drawing.Size(120, 50);
             this.Confirm.TabIndex = 141;
             this.Confirm.Text = "确认";
             this.Confirm.UseVisualStyleBackColor = true;
@@ -84,10 +84,10 @@
             // OperateResult
             // 
             this.OperateResult.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OperateResult.Location = new System.Drawing.Point(555, 16);
-            this.OperateResult.Margin = new System.Windows.Forms.Padding(5);
+            this.OperateResult.Location = new System.Drawing.Point(832, 26);
+            this.OperateResult.Margin = new System.Windows.Forms.Padding(8, 8, 8, 8);
             this.OperateResult.Name = "OperateResult";
-            this.OperateResult.Size = new System.Drawing.Size(308, 385);
+            this.OperateResult.Size = new System.Drawing.Size(460, 614);
             this.OperateResult.TabIndex = 142;
             this.OperateResult.Text = "";
             // 
@@ -98,13 +98,13 @@
             this.Clean.DownImage = ((System.Drawing.Image)(resources.GetObject("Clean.DownImage")));
             this.Clean.Image = ((System.Drawing.Image)(resources.GetObject("Clean.Image")));
             this.Clean.IsShowBorder = true;
-            this.Clean.Location = new System.Drawing.Point(668, 412);
-            this.Clean.Margin = new System.Windows.Forms.Padding(5);
+            this.Clean.Location = new System.Drawing.Point(1002, 659);
+            this.Clean.Margin = new System.Windows.Forms.Padding(8, 8, 8, 8);
             this.Clean.MoveImage = ((System.Drawing.Image)(resources.GetObject("Clean.MoveImage")));
             this.Clean.Name = "Clean";
             this.Clean.NormalImage = ((System.Drawing.Image)(resources.GetObject("Clean.NormalImage")));
             this.Clean.Power = null;
-            this.Clean.Size = new System.Drawing.Size(80, 31);
+            this.Clean.Size = new System.Drawing.Size(120, 50);
             this.Clean.TabIndex = 143;
             this.Clean.Text = "清除";
             this.Clean.UseVisualStyleBackColor = true;
@@ -112,19 +112,20 @@
             // 
             // Special_CancelCollection
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1044, 501);
+            this.ClientSize = new System.Drawing.Size(1566, 802);
             this.Controls.Add(this.Clean);
             this.Controls.Add(this.OperateResult);
             this.Controls.Add(this.Confirm);
             this.Controls.Add(this.sn_code);
             this.Controls.Add(this.sn_code_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
-            this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.Name = "Special_CancelCollection";
             this.Tag = "Special!CancelCollection";
             this.Text = "取消采集";
+            this.Load += new System.EventHandler(this.Special_CancelCollection_Load);
             this.ResumeLayout(false);
             this.PerformLayout();
 

+ 64 - 59
UAS_MES_ODLF/FunctionCode/Special/Special_CancelCollection.cs

@@ -42,69 +42,69 @@ namespace UAS_MES_NEW.Special
                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 //if (ms_stepcode == dt.Rows[0]["cd_stepcode"].ToString() || (ms_stepcode == "" && ms_nextstepcode == User.CurrentStepCode))
                 //{
-                    List<string> sqls = new List<string>();
-                    //存在不良删除不良记录
-                    if (ms_status == "3")
+                List<string> sqls = new List<string>();
+                //存在不良删除不良记录
+                if (ms_status == "3")
+                {
+                    sqls.Add("delete from makebad where mb_sncode='" + sn_code.Text + "' and mb_makecode='" + ms_makecode + "'");
+                    //更新MakeCraftDetail表记录
+                    sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty-1 where mcd_macode='" + ms_makecode + "' and instr((select ms_paststep from makeserial where ms_sncode='" + sn_code.Text + "'),mcd_stepcode)>0 ");
+                }
+                else
+                {
+                    sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1,mcd_okqty=mcd_okqty-1 where mcd_macode='" + ms_makecode + "' and instr((select ms_paststep from makeserial where ms_sncode='" + sn_code.Text + "'),mcd_stepcode)>0 ");
+                }
+                if (ms_checkno != "")
+                {
+                    //删除送检明细
+                    sqls.Add("delete from oqcbatchdetail where obd_sncode='" + sn_code.Text + "' and obd_makecode='" + ms_makecode + "'");
+                    //送检数量-1
+                    sqls.Add("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno='" + ms_checkno + "'");
+                }
+                //清除上料数据
+                dt = (DataTable)dh.ExecuteSql("select cm_barcode,cm_materialtype,cm_makecode,cm_stepcode from craftmaterial where cm_sncode='" + sn_code.Text + "' and cm_makecode='" + ms_makecode + "'", "select");
+                if (dt.Rows.Count > 0)
+                {
+                    List<string> barcode = new List<string>();
+                    for (int i = 0; i < dt.Rows.Count; i++)
                     {
-                        sqls.Add("delete from makebad where mb_sncode='" + sn_code.Text + "' and mb_makecode='" + ms_makecode + "'");
-                        //更新MakeCraftDetail表记录
-                        sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty-1 where mcd_macode='" + ms_makecode + "' and mcd_stepcode='" + ms_stepcode + "'");
-                    }
-                    else
-                    {
-                        sqls.Add("update makecraftdetail set mcd_inqty=mcd_inqty-1,mcd_outqty=mcd_outqty-1,mcd_okqty=mcd_okqty-1 where mcd_macode='" + ms_makecode + "' and mcd_stepcode='" + ms_stepcode + "'");
-                    }
-                    if (ms_checkno != "")
-                    {
-                        //删除送检明细
-                        sqls.Add("delete from oqcbatchdetail where obd_sncode='" + sn_code.Text + "' and obd_makecode='" + ms_makecode + "'");
-                        //送检数量-1
-                        sqls.Add("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno='" + ms_checkno + "'");
-                    }
-                    //清除上料数据
-                    dt = (DataTable)dh.ExecuteSql("select cm_barcode,cm_materialtype,cm_makecode,cm_stepcode from craftmaterial where cm_sncode='" + sn_code.Text + "' and cm_makecode='" + ms_makecode + "'", "select");
-                    if (dt.Rows.Count > 0)
-                    {
-                        List<string> barcode = new List<string>();
-                        for (int i = 0; i < dt.Rows.Count; i++)
+                        barcode.Add(dt.Rows[i]["cm_barcode"].ToString());
+                        //存在批管控的物料
+                        if (dt.Rows[i]["cm_materialtype"].ToString() == "2")
                         {
-                            barcode.Add(dt.Rows[i]["cm_barcode"].ToString());
-                            //存在批管控的物料
-                            if (dt.Rows[i]["cm_materialtype"].ToString() == "2")
-                            {
-                                string mss_id = dh.getFieldDataByCondition("makesourcestock", "mss_id", "mss_makecode='" + dt.Rows[i]["cm_makecode"].ToString() + "' and mss_barcode='" + dt.Rows[i]["cm_barcode"].ToString() + "' and mss_stepcode='" + dt.Rows[i]["cm_stepcode"].ToString() + "' and mss_validtime is not null and mss_invalidtime is null").ToString();
-                                dh.UpdateByCondition("makesourcestock", "mss_remain=mss_remain+mss_baseqty,mss_useqty=mss_useqty-mss_baseqty", "mss_id='" + mss_id + "'");
-                            }
+                            string mss_id = dh.getFieldDataByCondition("makesourcestock", "mss_id", "mss_makecode='" + dt.Rows[i]["cm_makecode"].ToString() + "' and mss_barcode='" + dt.Rows[i]["cm_barcode"].ToString() + "' and mss_stepcode='" + dt.Rows[i]["cm_stepcode"].ToString() + "' and mss_validtime is not null and mss_invalidtime is null").ToString();
+                            dh.UpdateByCondition("makesourcestock", "mss_remain=mss_remain+mss_baseqty,mss_useqty=mss_useqty-mss_baseqty", "mss_id='" + mss_id + "'");
                         }
-                        sql.Clear();
-                        sql.Append("update makeserial set ms_nextmacode='' where ms_sncode=:barcode and ms_nextmacode='" + ms_makecode + "'");
-                        dh.BatchInsert(sql.GetString(), new string[] { "barcode" }, barcode.ToArray());
-                        sqls.Add("delete from craftmaterial where cm_sncode='" + sn_code.Text + "' and cm_makecode='" + ms_makecode + "'");
                     }
-                    sqls.Add("delete from sninfo where si_sn='"+sn_code.Text+"'");
-                    sqls.Add("update makeaddresslist set mal_sncode='',mal_status=0 where mal_sncode='"+sn_code.Text+"'");
-                    //删除打印日志
-                    sqls.Add("delete from labelprintlog where lpl_value='" + sn_code.Text + "' and lpl_makecode='" + ms_makecode + "'");
-                    //删除老化记录
-                    sqls.Add("delete from AGINGRECORD where ar_sncode='" + sn_code.Text + "' and ar_macode='" + ms_makecode + "'");
-                    //解除前一工单板的使用
-                    sqls.Add("update makeserial set ms_nextmacode='' where ms_sncode='" + sn_code.Text + "' and ms_nextmacode='" + ms_makecode + "'");
-                    //初始化导入数据状态
-                    sqls.Add("update makesnlist set msl_status=0 where msl_sncode='" + sn_code.Text + "' and msl_makecode='" + ms_makecode + "' and msl_type='before'");
-                    ////初始化号段状态
-                    sqls.Add("update MAKESNRULEDETAIL set msd_status=0 where msd_sncode='" + sn_code.Text + "' and msd_makecode='" + ms_makecode + "'  and msd_type='before'");
-                    //清除操作日志
-                    //sqls.Add("delete from commandlog where cl_makecode='" + ms_makecode + "' and cl_sncode='" + sn_code.Text + "'");
-                    //删除过站记录
-                    //sqls.Add("delete from makeprocess where mp_sncode='" + sn_code.Text + "' and mp_makecode='" + ms_makecode + "'");
-                    //投入数-1
-                    sqls.Add("update make set ma_inqty=ma_inqty-1 where ma_code='" + ms_makecode + "'");
-                    //删除StepPass
-                    sqls.Add("delete from steppassed where sp_sncode='" + sn_code.Text + "' and sp_makecode='" + ms_makecode + "'");
-                    sqls.Add("delete from makeserial where ms_id='" + ms_id + "'");
-                    dh.ExecuteSQLTran(sqls.ToArray());
-                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "取消采集", "取消采集成功", sn_code.Text, "");
-                    OperateResult.AppendText(">>序列号" + sn_code.Text + "成功解除绑定\n", Color.Green, sn_code);
+                    sql.Clear();
+                    sql.Append("update makeserial set ms_nextmacode='' where ms_sncode=:barcode and ms_nextmacode='" + ms_makecode + "'");
+                    dh.BatchInsert(sql.GetString(), new string[] { "barcode" }, barcode.ToArray());
+                    sqls.Add("delete from craftmaterial where cm_sncode='" + sn_code.Text + "' and cm_makecode='" + ms_makecode + "'");
+                }
+                sqls.Add("delete from sninfo where si_sn='" + sn_code.Text + "'");
+                sqls.Add("update makeaddresslist set mal_sncode='',mal_status=0 where mal_sncode='" + sn_code.Text + "'");
+                //删除打印日志
+                sqls.Add("delete from labelprintlog where lpl_value='" + sn_code.Text + "' and lpl_makecode='" + ms_makecode + "'");
+                //删除老化记录
+                sqls.Add("delete from AGINGRECORD where ar_sncode='" + sn_code.Text + "' and ar_macode='" + ms_makecode + "'");
+                //解除前一工单板的使用
+                sqls.Add("update makeserial set ms_nextmacode='' where ms_sncode='" + sn_code.Text + "' and ms_nextmacode='" + ms_makecode + "'");
+                //初始化导入数据状态
+                sqls.Add("update makesnlist set msl_status=0 where msl_sncode='" + sn_code.Text + "' and msl_makecode='" + ms_makecode + "' and msl_type='before'");
+                ////初始化号段状态
+                sqls.Add("update MAKESNRULEDETAIL set msd_status=0 where msd_sncode='" + sn_code.Text + "' and msd_makecode='" + ms_makecode + "'  and msd_type='before'");
+                //清除操作日志
+                //sqls.Add("delete from commandlog where cl_makecode='" + ms_makecode + "' and cl_sncode='" + sn_code.Text + "'");
+                //删除过站记录
+                //sqls.Add("delete from makeprocess where mp_sncode='" + sn_code.Text + "' and mp_makecode='" + ms_makecode + "'");
+                //投入数-1
+                sqls.Add("update make set ma_inqty=ma_inqty-1 where ma_code='" + ms_makecode + "'");
+                //删除StepPass
+                sqls.Add("delete from steppassed where sp_sncode='" + sn_code.Text + "' and sp_makecode='" + ms_makecode + "'");
+                sqls.Add("delete from makeserial where ms_id='" + ms_id + "'");
+                dh.ExecuteSQLTran(sqls.ToArray());
+                LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "取消采集", "取消采集成功", sn_code.Text, "");
+                OperateResult.AppendText(">>序列号" + sn_code.Text + "成功解除绑定\n", Color.Green, sn_code);
                 //}
                 //else OperateResult.AppendText(">>序列号" + sn_code.Text + "不处于第一道工序,不允许取消采集\n", Color.Red, sn_code);
             }
@@ -115,5 +115,10 @@ namespace UAS_MES_NEW.Special
         {
             OperateResult.Clear();
         }
+
+        private void Special_CancelCollection_Load(object sender, EventArgs e)
+        {
+
+        }
     }
 }

+ 10 - 0
UAS_MES_ODLF/PublicMethod/LogicHandler.cs

@@ -192,6 +192,16 @@ namespace UAS_MES_NEW.PublicMethod
             }
         }
 
+        public static void GetQuerySql(string iCondition, out string v_sql, out string v_sql1)
+        {
+            v_sql = "";
+            v_sql1 = "";
+            string[] param = new string[] { iCondition, v_sql, v_sql1 };
+            dh.CallProcedure("GetQuerySQL", ref param);
+            v_sql = param[1];
+            v_sql1 = param[2];
+        }
+
         public static void DoCommandLog(string iCaller, string iUserCode, string iMakeCode, string iLineCode, string iSourceCode, string iOperate, string iResult, string iSncode, string iCheckno)
         {
             sql.Clear();

+ 3 - 3
UAS_MES_ODLF/PublicMethod/Print.cs

@@ -114,11 +114,11 @@ namespace UAS_MES_NEW.PublicMethod
             {
                 if (LabelType == "卡通箱标" || LabelType == "大箱标" || LabelType == "栈板标")
                 {
-                    dt = (DataTable)dh.ExecuteSql("select lpl_id from labelprintlog where lpl_value='" + SnCode + "' and lpl_type='" + LabelType+ LabelName + "' and lpl_stepcode='" + User.CurrentStepCode + "'", "select");
+                    dt = (DataTable)dh.ExecuteSql("select lpl_id from labelprintlog where lpl_value='" + SnCode + "' and lpl_type='" + LabelType + LabelName + "' and lpl_stepcode='" + User.CurrentStepCode + "'", "select");
                 }
                 else
                 {
-                    dt = (DataTable)dh.ExecuteSql("select lpl_id from labelprintlog where lpl_value='" + SnCode + "' and lpl_makecode='" + MakeCode + "' and lpl_type='" + LabelType+ LabelName + "' and lpl_stepcode='" + User.CurrentStepCode + "'", "select");
+                    dt = (DataTable)dh.ExecuteSql("select lpl_id from labelprintlog where lpl_value='" + SnCode + "' and lpl_makecode='" + MakeCode + "' and lpl_type='" + LabelType + LabelName + "' and lpl_stepcode='" + User.CurrentStepCode + "'", "select");
                 }
                 ////如果已经打印过了,则不允许再打印
                 if (dt.Rows.Count > 0)
@@ -204,7 +204,7 @@ namespace UAS_MES_NEW.PublicMethod
             {
                 doc.Variables.FormVariables.Item(k + 1).Value = null;
             }
-            LogicHandler.doLabelPrintLog(SnCode, LabelType+ LabelName, MakeCode, ProdCode, User.UserSourceCode, User.CurrentStepCode, IfRePrint, User.UserCode);
+            LogicHandler.doLabelPrintLog(SnCode, LabelType + LabelName, MakeCode, ProdCode, User.UserSourceCode, User.CurrentStepCode, IfRePrint, User.UserCode);
             return true;
         }
     }

+ 9 - 0
UAS_MES_ODLF/UAS_MES_ODLF.csproj

@@ -532,6 +532,12 @@
     <Compile Include="FunctionCode\Make\Make_CollectElec.Designer.cs">
       <DependentUpon>Make_CollectElec.cs</DependentUpon>
     </Compile>
+    <Compile Include="FunctionCode\Make\Make_ColorBoxLoadPrintBZ.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FunctionCode\Make\Make_ColorBoxLoadPrintBZ.Designer.cs">
+      <DependentUpon>Make_ColorBoxLoadPrintBZ.cs</DependentUpon>
+    </Compile>
     <Compile Include="FunctionCode\Make\Make_FeedingCollectionCombineFix.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -1264,6 +1270,9 @@
     <EmbeddedResource Include="FunctionCode\Make\Make_CollectElec.resx">
       <DependentUpon>Make_CollectElec.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="FunctionCode\Make\Make_ColorBoxLoadPrintBZ.resx">
+      <DependentUpon>Make_ColorBoxLoadPrintBZ.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="FunctionCode\Make\Make_FeedingCollectionCombineFix.resx">
       <DependentUpon>Make_FeedingCollectionCombineFix.cs</DependentUpon>
     </EmbeddedResource>

+ 4 - 4
UAS_MesInterface(4.0)/MesHelper.cs

@@ -43,7 +43,7 @@ namespace BenQGuru.eMES.DLLService
         //用于存放批量执行的SQL
         List<string> sqls = new List<string>();
         //系统默认的的连接字符串
-        private string ConnectionStrings = "Data Source=192.168.230.200/orcl;User ID=MES_ZZ;PassWord=select!#%*(;";
+        private string ConnectionStrings = "Data Source=117.25.180.218/orcl;User ID=MES_ZZ;PassWord=select!#%*(;";
         //用户选择的数据库的连接字符串
         private OracleConnection connection;
         //用户选择的数据库的连接字符串
@@ -606,7 +606,7 @@ namespace BenQGuru.eMES.DLLService
         [Description("获取账套信息")]
         public bool GetMaster(out string oMaster)
         {
-            MasterDB = (DataTable)ExecuteSql("select ms_pwd,ma_user,ma_inneraddress from master", "select");
+            MasterDB = (DataTable)ExecuteSql("select ms_pwd,ma_user,ma_address from master", "select");
             oMaster = "";
             for (int i = 0; i < MasterDB.Rows.Count; i++)
             {
@@ -621,10 +621,10 @@ namespace BenQGuru.eMES.DLLService
         [Description("设置账套信息")]
         public bool SetMaster(string iMaster)
         {
-            DataTable dt = (DataTable)ExecuteSql("select ms_pwd,ma_user,ma_inneraddress from master where ma_user='" + iMaster + "'", "select");
+            DataTable dt = (DataTable)ExecuteSql("select ms_pwd,ma_user,ma_address from master where ma_user='" + iMaster + "'", "select");
             if (dt.Rows.Count > 0)
             {
-                ConnectionStrings = "Data Source=" + dt.Rows[0]["ma_inneraddress"].ToString() + "/orcl;User ID=" + iMaster + ";PassWord=" + dt.Rows[0]["ms_pwd"].ToString() + ";";
+                ConnectionStrings = "Data Source=" + dt.Rows[0]["ma_address"].ToString() + "/orcl;User ID=" + iMaster + ";PassWord=" + dt.Rows[0]["ms_pwd"].ToString() + ";";
                 try
                 {
                     connection = new OracleConnection(ConnectionStrings);

+ 18 - 7
UAS_MesInterface(ODLF)/MesHelper.cs

@@ -5,6 +5,7 @@ using System.ComponentModel;
 using System.Data;
 using System.Runtime.InteropServices;
 using System.Text;
+using System.Web.Script.Serialization;
 
 namespace UMES.DLLService
 {
@@ -22,7 +23,7 @@ namespace UMES.DLLService
         bool SetTestDetail(string iSN, string iTestResult, string iResCode, string[,] iTestDetail, out string oErrMessage);
         bool GetMEIOrNetCodeRange(string iSnCode, string iIMEI1, string iNetCode, out Dictionary<string, string> oInfo, out string oErrMessage);
         bool SetIMEIInfo(string iSnCode, string iIMEI1, out string oErrMessage);
-        bool GetMobileAllInfo(string iSnCode, out Dictionary<string, string> oInfo, out string oErrorMessage);
+        bool GetMobileAllInfo(string iSnCode, out string oInfo, out string oErrorMessage);
         bool SetMobileData(string iTSN, string iSN, string iSourceCode, string iOperator, string iResult, string iErrCode, string flag, out string oErrorMessage);
         bool SetPcbaData(string iSN, string iResCode, string iOperator, string iResult, string iErrCode, out string oErrMessage);
         bool GoMo(string iMO, string iSN, string iResCode, out string oErrMessage);
@@ -88,8 +89,7 @@ namespace UMES.DLLService
             string stepcode = GetStepCodeBySource(iResCode);
             if (ms_nextstepcode != "" && ms_nextstepcode != stepcode)
             {
-                string step = GetStepName(ms_nextstepcode);
-                oErrMessage = "当前序列号下一工序" + step;
+                oErrMessage = "当前序列号下一工序" + ms_nextstepcode;
                 return false;
             }
             if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null" || (ms_status == "3" && stepcode == ms_stepcode))
@@ -98,6 +98,14 @@ namespace UMES.DLLService
                 {
                     oErrMessage = "";
                 }
+                DataTable dt1 = (DataTable)ExecuteSql("select 1 from makebadcount where mbc_sncode='" + iSN + "' and mbc_stepcode='" + stepcode + "' and mbc_status=0", "select");
+                int BadCount = dt1.Rows.Count;
+                //测试不良3次不允许再测试,必须先维修
+                if (BadCount == 3)
+                {
+                    oErrMessage = stepcode + "连续三次测试不良,请进行维修";
+                    return false;
+                }
                 return true;
             }
             else
@@ -345,10 +353,12 @@ namespace UMES.DLLService
         /// <param name="oErrMessage"></param>
         /// <returns></returns>
         [Description("查询已分配的信息")]
-        public bool GetMobileAllInfo(string iSN, out Dictionary<string, string> oInfo, out string oErrMessage)
+        public bool GetMobileAllInfo(string iSN, out string oJson, out string oErrMessage)
         {
-            oInfo = new Dictionary<string, string>();
+            JavaScriptSerializer jss = new JavaScriptSerializer();
+            Dictionary<string, string> oInfo = new Dictionary<string, string>();
             oErrMessage = "";
+            oJson = "";
             if (iSN == "")
             {
                 oErrMessage = "SN不能为空";
@@ -362,7 +372,7 @@ namespace UMES.DLLService
                 else
                     return false;
             }
-            if (!SetAddressInfo(iSN, MacInfo["MAC"] == "null" ? "" : MacInfo["MAC"], MacInfo["BT"] == "null" ? "" : MacInfo["BT"], MacInfo["Code1"]=="null"?"": MacInfo["Code1"], MacInfo["Code2"] == "null" ? "" : MacInfo["Code2"], MacInfo["Code3"] == "null" ? "" : MacInfo["Code3"], out oErrMessage))
+            if (!SetAddressInfo(iSN, MacInfo["MAC"] == "null" ? "" : MacInfo["MAC"], MacInfo["BT"] == "null" ? "" : MacInfo["BT"], MacInfo["Code1"] == "null" ? "" : MacInfo["Code1"], MacInfo["Code2"] == "null" ? "" : MacInfo["Code2"], MacInfo["Code3"] == "null" ? "" : MacInfo["Code3"], out oErrMessage))
             {
                 if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
                     return true;
@@ -370,7 +380,7 @@ namespace UMES.DLLService
                     return false;
             }
             //通过序列号获取最近操作的工单号
-            string ms_id = getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode='" + iSN + "'").ToString();
+            string ms_id = getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode='" + iSN + "' or ms_firstsn='" + iSN + "'").ToString();
             if (ms_id != "")
             {
                 DataTable dt = getFieldsDataByCondition("MakeSerial", new string[] { "ms_id", "ms_mac", "ms_bt", "ms_meid", "ms_netcode", "ms_psn", "ms_imei1", "ms_imei2", "ms_imei3", "ms_othcode1", "ms_othcode2", "ms_othcode3", "ms_othid1", "ms_othid2", "ms_othid3" }, "ms_id='" + ms_id + "'");
@@ -402,6 +412,7 @@ namespace UMES.DLLService
                             oInfo.Add(param[i].Split('^')[0], param[i].Split('^')[1]);
                         }
                     }
+                    oJson = jss.Serialize(oInfo);
                     oErrMessage = "";
                     return true;
                 }

+ 1 - 0
UAS_MesInterface(ODLF)/UAS_MesInterface(ODLF).csproj

@@ -38,6 +38,7 @@
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Data.OracleClient" />
+    <Reference Include="System.Web.Extensions" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="System.Data" />