callm 9 сар өмнө
parent
commit
79523ba3fb

+ 7 - 0
UAS_MES_YD/FunctionCode/Make/Make_FeedingCollection.cs

@@ -265,6 +265,13 @@ namespace UAS_MES_NEW.Make
             }
             if (LogicHandler.CheckStepSNAndMacode(oMakeCode, User.UserSourceCode, code.Text, User.UserCode, out oMakeCode, out oMsid, out ErrorMessage))
             {
+                 nextstepcode = dh.getFieldDataByCondition("makeserial", "ms_nextstepcode", "ms_id='" + oMsid + "'").ToString();
+                if (nextstepcode != User.CurrentStepCode)
+                {
+                    string stname = dh.getFieldDataByCondition("step", "st_name", "st_code='" + nextstepcode + "'").ToString();
+                    OperateResult.AppendText("<<序列号:" + code.Text + "下一工序是" + stname + ",不是当前岗位的工序\n", Color.Red, code);
+                    return;
+                }
                 if (!LogicHandler.CheckDiffMakeCodeAfterStepCheck(code.Text, oMakeCode, NoteForChange.Checked, NoteAlready, ma_code, out ErrorMessage))
                 {
                     OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, code);

+ 3 - 1
UAS_MES_YD/FunctionCode/Make/Make_TestCollection.cs

@@ -234,12 +234,14 @@ namespace UAS_MES_NEW.Make
                                 LockMakeCode.Checked = true;
                             }
                         }
-                        dt = (DataTable)dh.ExecuteSql("select ms_nextstepcode,ms_sncode,ms_reworkstatus,nvl(ms_ifrework,0)ms_ifrework,ms_stepcode,ms_status,nvl(st_ifrepair,0) st_ifrepair from makeserial left join step on ms_stepcode=st_code where ms_id='" + oMSID + "'", "select");
+                        dt = (DataTable)dh.ExecuteSql("select ms_nextstepcode,ms_prodcode,ms_craftcode,ms_sncode,ms_reworkstatus,nvl(ms_ifrework,0)ms_ifrework,ms_stepcode,ms_status,nvl(st_ifrepair,0) st_ifrepair from makeserial left join step on ms_stepcode=st_code where ms_id='" + oMSID + "'", "select");
                         string status = dt.Rows[0]["ms_status"].ToString();
                         reworkstatus = dt.Rows[0]["ms_reworkstatus"].ToString();
                         string stepcode = dt.Rows[0]["ms_stepcode"].ToString();
                         string ifrepair = dt.Rows[0]["st_ifrepair"].ToString();
                         string sncode = dt.Rows[0]["ms_sncode"].ToString();
+                        string ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
+                        string ms_craftcode = dt.Rows[0]["ms_craftcode"].ToString();
                         if (sncode != ms_sncode.Text)
                         {
                             OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过转号,不允许使用TSN采集\n", Color.Red, ms_sncode);

+ 6 - 6
UAS_MES_YD/FunctionCode/Packing/Packing_CartonBoxSNWeigh.cs

@@ -1,5 +1,6 @@
 using LabelManager2;
 using Microsoft.Win32;
+using Seagull.BarTender.Print;
 using System;
 using System.Data;
 using System.Drawing;
@@ -101,12 +102,11 @@ namespace UAS_MES_NEW.Packing
         {
             try
             {
-                lbl = new ApplicationClass();
-                BaseUtil.WriteLbl();
+                engine = new Engine(true);
             }
-            catch (Exception)
+            catch (Exception ex)
             {
-                OperateResult.AppendText("未正确安装BarTender软件\n", Color.Red);
+                OperateResult.AppendText("未正确安装BarTender软件\n" + ex.Message, Color.Red);
             }
         }
 
@@ -249,13 +249,13 @@ namespace UAS_MES_NEW.Packing
                 else OperateResult.AppendText(">>端口已被占用,请关闭其他窗口\n", Color.Red, sncode);
             }
         }
-
+        Engine engine;
         //确认打印
         private void Confirm_Click(object sender, EventArgs e)
         {
             //doc = lbl.Documents.Open(PrintLabel.Text);
             string ErrorMessage = "";
-            if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
+            if (!Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
             {
                 OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
             }

+ 6 - 7
UAS_MES_YD/FunctionCode/Packing/Packing_CartonBoxWeigh.cs

@@ -1,5 +1,6 @@
 using LabelManager2;
 using Microsoft.Win32;
+using Seagull.BarTender.Print;
 using System;
 using System.Data;
 using System.Drawing;
@@ -89,12 +90,11 @@ namespace UAS_MES_NEW.Packing
         {
             try
             {
-                lbl = new ApplicationClass();
-                BaseUtil.WriteLbl();
+                engine = new Engine(true);
             }
-            catch (Exception)
+            catch (Exception ex)
             {
-                OperateResult.AppendText("未正确安装BarTender软件\n", Color.Red);
+                OperateResult.AppendText("未正确安装BarTender软件\n" + ex.Message, Color.Red);
             }
         }
 
@@ -226,13 +226,12 @@ namespace UAS_MES_NEW.Packing
                 else OperateResult.AppendText(">>端口已被占用,请关闭其他窗口\n", Color.Red, outboxcode);
             }
         }
-
+        Engine engine;
         //确认打印
         private void Confirm_Click(object sender, EventArgs e)
         {
-            //doc = lbl.Documents.Open(PrintLabel.Text);
             string ErrorMessage = "";
-            if (!Print.CodeSoft(Tag.ToString(), ref lbl, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
+            if (!Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
             {
                 OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
             }

+ 5 - 5
UAS_MES_YD/FunctionCode/Packing/Packing_PackageCollection.cs

@@ -443,6 +443,11 @@ namespace UAS_MES_NEW.Packing
                                     }
                                     if (int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text) == int.Parse(pr_outboxinnerqty.Text))
                                     {
+                                        if (PR_CHECKCARTONW != "0")
+                                        {
+                                            OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "满箱处于称重工序,请在卡通箱称重界面进行称重打印\n", Color.Black, sn_code);
+                                            return;
+                                        }
                                         dh.UpdateByCondition("package", "pa_status=1,pa_packageqty=pa_currentqty,pa_totalqty=pa_currentqty", "pa_outboxcode='" + pa_outboxcode.Text + "'");
                                         OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "满箱采集完成,封箱成功\n", Color.Green);
                                         pa_status.Text = "1";
@@ -467,11 +472,6 @@ namespace UAS_MES_NEW.Packing
                                             pa_remark.SelectAll();
                                             pa_remark.Focus();
                                         }
-                                        if (PR_CHECKCARTONW != "0")
-                                        {
-                                            OperateResult.AppendText(">>卡通箱" + pa_outboxcode.Text + "满箱处于称重工序,请在卡通箱称重界面进行称重打印\n", Color.Black, sn_code);
-                                            return;
-                                        }
                                         if (LogicHandler.OutBoxStepPass(pa_outboxcode.Text, ms_makecode, User.UserSourceCode, User.UserCode, "卡通箱:" + pa_outboxcode.Text + "整箱过站", "卡通箱整箱过站", out ErrorMessage))
                                         {
                                             dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + pa_outboxcode.Text + "'").ToString() + "', PA_CURRENTSTEP = '' ", "pa_outboxcode='" + pa_outboxcode.Text + "'");

+ 6 - 3
UAS_MES_YD/FunctionCode/Query/Query_SN.cs

@@ -343,12 +343,15 @@ namespace UAS_MES_NEW.Query
             ArrayList<string> custbarcode = new ArrayList<string>();
             for (int i = 0; i < int.Parse(ma_qty); i++)
             {
-                custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
+                string data = BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix);
+                if (!custbarcode.Contains(data))
+                    custbarcode.Add(data);
             }
             //插入条码
             string sql = "insert into makesnlist(MSL_ID, MSL_INDATE, MSL_MAKECODE, MSL_SNCODE, MSL_TYPE)" +
-                "values(makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "',:custbarcode,'before')";
-            dh.BatchInsert(sql, new string[] { "custbarcode" }, custbarcode.ToArray(), custbarcode.ToArray());
+                "select makesnlist_seq.nextval,sysdate,'" + ma_code.Text + "',:custbarcode,'before' from dual where :custbarcode not in " +
+                "(select msl_sncode from makesnlist)";
+            dh.BatchInsert(sql, new string[] { "custbarcode", "custbarcode" }, custbarcode.ToArray(), custbarcode.ToArray());
             //更新最大流水号
             dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + pr_exbarcode + "' and rmn_prefix='" + Prefix + "'");
             MessageBox.Show("工单" + ma_code.Text + "生成SN清单成功");

+ 2 - 2
UAS_MES_YD/FunctionCode/Special/Special_CancelCollection.cs

@@ -82,8 +82,8 @@ namespace UAS_MES_NEW.Special
                     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("update makeaddresslist set mal_sncode='',mal_status=0 where mal_sncode='" + sn_code.Text + "' and mal_makecode='" + ms_makecode + "'");
-                sqls.Add("update makeimeilist set mil_sncode='',mil_status=0 where mil_sncode='" + sn_code.Text + "' and mil_makecode='" + ms_makecode + "'");
+                sqls.Add("update makeaddresslist set mal_sncode='',mal_status=0 where (mal_sncode='" + sn_code.Text + "' or mal_sncode='"+ ms_firstsn + "' )and mal_makecode='" + ms_makecode + "'");
+                sqls.Add("update makeimeilist set mil_sncode='',mil_status=0 where (mil_sncode='" + sn_code.Text + "' or mil_sncode='"+ ms_firstsn + "') and mil_makecode='" + ms_makecode + "'");
                 sqls.Add("delete from sninfo where si_sn='" + sn_code.Text + "' or si_sn='" + ms_firstsn + "'");
                 //sqls.Add("update makeaddresslist set mal_sncode='',mal_status=0 where mal_sncode='" + sn_code.Text + "'");
                 //删除打印日志

+ 0 - 10
UAS_MES_YD/Properties/Resources.Designer.cs

@@ -157,16 +157,6 @@ namespace UAS_MES_NEW.Properties {
             }
         }
         
-        /// <summary>
-        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
-        /// </summary>
-        internal static System.Drawing.Bitmap _5600c803afc2d {
-            get {
-                object obj = ResourceManager.GetObject("_5600c803afc2d", resourceCulture);
-                return ((System.Drawing.Bitmap)(obj));
-            }
-        }
-        
         /// <summary>
         ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>

+ 1 - 3
UAS_MES_YD/Properties/Resources.resx

@@ -382,9 +382,7 @@
   <data name="_46" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\Resources\46.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
-  <data name="_5600c803afc2d" type="System.Resources.ResXFileRef, System.Windows.Forms">
-    <value>..\Resources\5600c803afc2d.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
-  </data>
+
   <data name="_83" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\Resources\83.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>

+ 44 - 22
UAS_MES_YD/PublicMethod/BaseUtil.cs

@@ -1,5 +1,6 @@
 using LabelManager2;
 using Microsoft.Win32;
+using NPOI.SS.Formula.Functions;
 using Seagull.BarTender.Print;
 using System;
 using System.Collections;
@@ -51,37 +52,58 @@ namespace UAS_MES_NEW.PublicMethod
         public static string DToAny(double DB, int Type)
         {
             string H = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+            string H1 = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
             long D;
             double B;
             string tempD = "", tempB = "";
-            D = (long)DB;
-            B = DB - D;
-            if (D == 0)
+            if (Type == 32)
             {
-                tempD = "0";
+                return GetRandomChar(H1);
             }
-            while (D != 0)
-            {
-                tempD = H[(((int)D % Type))] + tempD;
-                D = D / Type;
-            }
-            for (int i = 0; i < 7; i++)
-            {
-                if (B == 0)
+            else {
+                D = (long)DB;
+                B = DB - D;
+                if (D == 0)
                 {
-                    break;
+                    tempD = "0";
+                }
+                while (D != 0)
+                {
+                    tempD = H[(((int)D % Type))] + tempD;
+                    D = D / Type;
+                }
+                for (int i = 0; i < 7; i++)
+                {
+                    if (B == 0)
+                    {
+                        break;
+                    }
+                    tempB += H[((int)(B * Type))];
+                    B = B * Type - (int)(B * Type);
+                }
+                if (tempB == "")
+                {
+                    return tempD;
+                }
+                else
+                {
+                    return tempD + "." + tempB;
                 }
-                tempB += H[((int)(B * Type))];
-                B = B * Type - (int)(B * Type);
-            }
-            if (tempB == "")
-            {
-                return tempD;
             }
-            else
+        }
+        
+        public static string GetRandomChar(string str)
+        {
+            byte[] buffer = Guid.NewGuid().ToByteArray();
+            int iSeed = BitConverter.ToInt32(buffer, 0);
+            Random random = new Random(iSeed);
+            string data = "";
+            for (int i = 0; i < 5; i++)
             {
-                return tempD + "." + tempB;
+                int index = random.Next(0, 31);
+                data += str[index];
             }
+            return data;
         }
 
 
@@ -1508,7 +1530,7 @@ namespace UAS_MES_NEW.PublicMethod
                     {
                         p.StandardInput.Close();
                         string IMEI = p.StandardOutput.ReadToEnd();
-                        foreach (Match item in Regex.Matches(IMEI, "'\\S+"))
+                        foreach (System.Text.RegularExpressions.Match item in Regex.Matches(IMEI, "'\\S+"))
                         {
                             value += item.Value.Replace(".", "").Replace("'", "").Replace(")", "");
                         }

BIN
UAS_MES_YD/Resources/5600c803afc2d.png


+ 0 - 16
UAS_MES_YD/UAS_MES_YD.csproj

@@ -1824,8 +1824,6 @@
     <EmbeddedResource Include="PublicForm\SetLoadingWindow.resx">
       <DependentUpon>SetLoadingWindow.cs</DependentUpon>
     </EmbeddedResource>
-    <None Include="adbtool\mke2fs.conf" />
-    <None Include="adbtool\source.properties" />
     <None Include="App.config">
       <SubType>Designer</SubType>
     </None>
@@ -1836,19 +1834,6 @@
     </None>
   </ItemGroup>
   <ItemGroup>
-    <Content Include="adbtool\adb.exe" />
-    <Content Include="adbtool\AdbWinApi.dll" />
-    <Content Include="adbtool\AdbWinUsbApi.dll" />
-    <Content Include="adbtool\dmtracedump.exe" />
-    <Content Include="adbtool\etc1tool.exe" />
-    <Content Include="adbtool\fastboot.exe" />
-    <Content Include="adbtool\hprof-conv.exe" />
-    <Content Include="adbtool\libwinpthread-1.dll" />
-    <Content Include="adbtool\make_f2fs.exe" />
-    <Content Include="adbtool\make_f2fs_casefold.exe" />
-    <Content Include="adbtool\mke2fs.exe" />
-    <Content Include="adbtool\NOTICE.txt" />
-    <Content Include="adbtool\sqlite3.exe" />
     <Content Include="Resources\07.gif" />
     <Content Include="Resources\0802192135.png" />
     <None Include="Resources\15aedb5b-a345-48b6-8b81-784e410d7fd1.png" />
@@ -1859,7 +1844,6 @@
     <None Include="Resources\20167c1d-d027-4366-95fb-6733ecc9dd80.png" />
     <Content Include="Resources\20170322091001575_easyicon_net_64.ico" />
     <Content Include="Resources\46.gif" />
-    <Content Include="Resources\5600c803afc2d.png" />
     <Content Include="Resources\83.gif" />
     <None Include="Resources\b171f6bb-7e96-43f5-afa4-894151fa85b7.png" />
     <None Include="Resources\b473847f-a85b-400e-807a-4875c4c07ff1.png" />

BIN
UAS_MES_YD/adbtool/adb.exe


BIN
UAS_MES_YD/adbtool/fastboot.exe


BIN
UAS_MES_YD/adbtool/sqlite3.exe