فهرست منبع

修改中盒号重复问题

callm 3 سال پیش
والد
کامیت
fc8314940d

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

@@ -122,6 +122,42 @@ namespace UAS_LabelMachine
             }
         }
 
+        /// <summary>
+        /// 获取第一行第一列的信息
+        /// </summary>
+        public object getFieldDataByConditionForUpdate(string TableName, string Field, string Condition ,string Wait)
+        {
+            DataTable dt = new DataTable();
+            string sql = "select " + Field + " from " + TableName + " where " + Condition + "  for "+ Wait;
+            command = new OracleCommand(sql, connection);
+            Reconnect(command);
+            OracleDataAdapter ad = new OracleDataAdapter();
+            ad.SelectCommand = command;
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                connection = new OracleConnection(DBConnectionString);
+                connection.Open();
+                command = new OracleCommand(sql, connection);
+                ad = new OracleDataAdapter();
+                ad.SelectCommand = command;
+                ad.Fill(dt);
+            }
+            ad.Dispose();
+
+            if (dt.Rows.Count > 0)
+            {
+                return dt.Rows[0][0];
+            }
+            else
+            {
+                return "";
+            }
+        }
+
         /// <summary>
         /// 执行打印的SQL
         /// </summary>

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 476 - 396
UAS-出货标签管理(泽天)/UAS_出货标签管理.Designer.cs


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

@@ -140,6 +140,7 @@ namespace UAS_LabelMachine
 
         void bindingsource(DataGridView dgv, DataTable dt)
         {
+            dgv.AutoGenerateColumns = false;
             dgv.DataSource = null;
             dgv.DataSource = dt;
             //if (dgv.InvokeRequired)
@@ -400,7 +401,7 @@ namespace UAS_LabelMachine
             string pib_outboxcode2 = "";
 
             int BoxNum = LabelInfDataTable.Select("pib_outboxcode2='" + OutBoxNum.Text + "'").Length;
-            //if (!ConnectToMachine)
+            if (ConnectToMachine)
             {
                 if (BoxNum + CodeCount > OutboxCapacity.Value && AutoSetOutBox.Checked)
                 {
@@ -422,9 +423,8 @@ namespace UAS_LabelMachine
                     io = new ItemObject("全部", "全部");
                     OutBoxNum.Items.Add(io);
                     io = new ItemObject(pib_outboxcode2, pib_outboxcode2);
-                    PassSixTenCount = 1;
                     OutBoxNum.Items.Add(io);
-
+                    PassSixTenCount = 1;
                     for (int i = 0; i < dt.Rows.Count; i++)
                     {
                         string piboutboxcode2 = dt.Rows[i]["pib_outboxcode2"].ToString();
@@ -450,7 +450,6 @@ namespace UAS_LabelMachine
                             pib_outboxcode2 = (int.Parse(maxoutbox) + 1).ToString();
                         }
                         OutBoxNum.Items.Clear();
-                        PassSixTenCount = 1;
                         DataTable dt = (DataTable)dh.ExecuteSql("select distinct pib_outboxcode2 from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by to_number(pib_outboxcode2) desc", "select");
                         ItemObject io = new ItemObject("新增", "新增");
                         OutBoxNum.Items.Add(io);
@@ -458,6 +457,7 @@ namespace UAS_LabelMachine
                         OutBoxNum.Items.Add(io);
                         io = new ItemObject(pib_outboxcode2, pib_outboxcode2);
                         OutBoxNum.Items.Add(io);
+                        PassSixTenCount = 1;
                         for (int i = 0; i < dt.Rows.Count; i++)
                         {
                             string piboutboxcode2 = dt.Rows[i]["pib_outboxcode2"].ToString();
@@ -474,38 +474,38 @@ namespace UAS_LabelMachine
                     }
                 }
             }
-            //else
-            //{
-            //    if (OutBoxNum.Text == "新增")
-            //    {
-            //        string maxoutbox = dh.getFieldDataByCondition("prodiobarcode", "max(to_number(pib_outboxcode2))", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
-            //        //如果没有则从开始插入
-            //        if (maxoutbox == "")
-            //        {
-            //            pib_outboxcode2 = "1";
-            //        }
-            //        else
-            //        {
-            //            pib_outboxcode2 = (int.Parse(maxoutbox) + 1).ToString();
-            //        }
-            //    }
-            //    else
-            //    {
-            //        pib_outboxcode2 = OutBoxNum.Text;
-            //    }
-            //    if (!AutoPrintOutBox.Checked)
-            //    {
-            //        if (BoxNum + CodeCount > OutboxCapacity.Value)
-            //        {
-            //            string close = MessageBox.Show(this.ParentForm, "箱号【" + OutBoxNum.Text + "】后超数量为" + (BoxNum + CodeCount) + ",超出容量" + OutboxCapacity.Value + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
-            //            if (close != "Yes")
-            //            {
-            //                Input.SelectAll();
-            //                return;
-            //            }
-            //        }
-            //    }
-            //}
+            else
+            {
+                if (OutBoxNum.Text == "新增")
+                {
+                    string maxoutbox = dh.getFieldDataByCondition("prodiobarcode", "max(to_number(pib_outboxcode2))", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
+                    //如果没有则从开始插入
+                    if (maxoutbox == "")
+                    {
+                        pib_outboxcode2 = "1";
+                    }
+                    else
+                    {
+                        pib_outboxcode2 = (int.Parse(maxoutbox) + 1).ToString();
+                    }
+                }
+                else
+                {
+                    pib_outboxcode2 = OutBoxNum.Text;
+                }
+                if (!AutoPrintOutBox.Checked)
+                {
+                    if (BoxNum + CodeCount > OutboxCapacity.Value)
+                    {
+                        string close = MessageBox.Show(this.ParentForm, "箱号【" + OutBoxNum.Text + "】后超数量为" + (BoxNum + CodeCount) + ",超出容量" + OutboxCapacity.Value + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                        if (close != "Yes")
+                        {
+                            Input.SelectAll();
+                            return;
+                        }
+                    }
+                }
+            }
             if (OutBoxNum.Text == "全部")
             {
                 MessageBox.Show("请选择指定箱号或者新增");
@@ -1101,45 +1101,54 @@ namespace UAS_LabelMachine
                         return;
                     }
                 }
-                //如果有选中行
-                if (SelectRowIndex >= 0 && LabelInf.Rows.Count > SelectRowIndex)
+                try
                 {
-                    MidOutBoxCode.Clear();
-                    MidOutBoxCodeIndex.Clear();
-                    SelectProdcode = LabelInf.Rows[SelectRowIndex].Cells["pib_prodcode"].Value.ToString();
-                    for (int i = SelectRowIndex; i >= 0; i--)
+                    //如果有选中行
+                    if (SelectRowIndex >= 0 && LabelInf.Rows.Count > SelectRowIndex)
                     {
-                        if ((LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_midifprint"].FormattedValue.ToString().ToLower() != "true") || i == SelectRowIndex)
+                        MidOutBoxCode.Clear();
+                        MidOutBoxCodeIndex.Clear();
+                        SelectProdcode = LabelInf.Rows[SelectRowIndex].Cells["pib_prodcode"].Value.ToString();
+                        for (int i = SelectRowIndex; i >= 0; i--)
                         {
-                            LabelInf.Rows[i].Cells["pib_midifprint"].Value = true;
-                            if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
+                            if ((LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_midifprint"].FormattedValue.ToString().ToLower() != "true") || i == SelectRowIndex)
                             {
-                                MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
-                                MidOutBoxCodeIndex.Add(i);
+                                LabelInf.Rows[i].Cells["pib_midifprint"].Value = true;
+                                if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
+                                {
+                                    MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
+                                    MidOutBoxCodeIndex.Add(i);
+                                }
                             }
-                        }
-                        else
-                        {
-                            break;
-                        }
-                    }
-                    for (int i = SelectRowIndex; i < LabelInf.Rows.Count - 1; i++)
-                    {
-                        if ((LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_midifprint"].FormattedValue.ToString().ToLower() != "true") || i == SelectRowIndex)
-                        {
-                            LabelInf.Rows[i].Cells["pib_midifprint"].Value = true;
-                            if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
+                            else
                             {
-                                MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
-                                MidOutBoxCodeIndex.Add(i);
+                                break;
                             }
                         }
-                        else
+                        for (int i = SelectRowIndex; i < LabelInf.Rows.Count - 1; i++)
                         {
-                            break;
+                            if ((LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_midifprint"].FormattedValue.ToString().ToLower() != "true") || i == SelectRowIndex)
+                            {
+                                LabelInf.Rows[i].Cells["pib_midifprint"].Value = true;
+                                if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
+                                {
+                                    MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
+                                    MidOutBoxCodeIndex.Add(i);
+                                }
+                            }
+                            else
+                            {
+                                break;
+                            }
                         }
                     }
                 }
+                catch (Exception e)
+                {
+                    MessageBox.Show(e.Message);
+                    LogManager.DoLog(e.Message + e.StackTrace);
+                    return;
+                }
                 try
                 {
                     MidBoxCodePrint(MidOutBoxCodeIndex.ToArray());
@@ -1147,6 +1156,7 @@ namespace UAS_LabelMachine
                 catch (Exception e)
                 {
                     MessageBox.Show(e.Message);
+                    LogManager.DoLog(e.Message + e.StackTrace);
                     return;
                 }
                 return;
@@ -1963,22 +1973,22 @@ namespace UAS_LabelMachine
                         string maxnum = "";
                         if (ReSetType != " ")
                         {
-                            maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and nvl(rmn_type,' ')='" + ReSetType + "'").ToString();
+                            maxnum = dh.getFieldDataByConditionForUpdate("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and nvl(rmn_type,' ')='" + ReSetType + "'", "update of rmn_maxnumber  nowait").ToString();
                         }
                         else
                         {
-                            maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and rmn_prefix='" + Prefix + "' ").ToString();
+                            maxnum = dh.getFieldDataByConditionForUpdate("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and rmn_prefix='" + Prefix + "' ", "update of rmn_maxnumber  nowait").ToString();
                         }
                         //设置当前流水
                         if (maxnum == "")
                         {
                             if (ReSetType != " ")
                             {
-                                maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and nvl(rmn_type,' ')='" + ReSetType + "'").ToString();
+                                maxnum = dh.getFieldDataByConditionForUpdate("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and nvl(rmn_type,' ')='" + ReSetType + "'", "update of rmn_maxnumber  nowait").ToString();
                             }
                             else
                             {
-                                maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and rmn_prefix='" + Prefix + "' ").ToString();
+                                maxnum = dh.getFieldDataByConditionForUpdate("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and rmn_prefix='" + Prefix + "' ", "update of rmn_maxnumber  nowait").ToString();
                             }
                             if (maxnum == "")
                             {

+ 24 - 0
UAS-出货标签管理(泽天)/UAS_出货标签管理.resx

@@ -180,6 +180,30 @@
   <metadata name="checknum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="pib_datecode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pr_custprodspec.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pib_madein.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pib_piid.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pib_barcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pr_unit1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pr_vendprodcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="pib_pdid.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="pib_midifprint.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است