Browse Source

添加提示

章政 7 years ago
parent
commit
b8c41f92ce
1 changed files with 40 additions and 45 deletions
  1. 40 45
      UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

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

@@ -189,7 +189,7 @@ namespace UAS_LabelMachine
             }
             catch (Exception)
             {
-                MessageBox.Show("未安装CodeSoft软件或者版本不正确");
+                MessageBox.Show("未安装CodeSoft软件或者版本不正确", "提示");
             }
             RefreshDBConnect.Interval = 60000;
             RefreshDBConnect.Start();
@@ -206,14 +206,6 @@ namespace UAS_LabelMachine
             }
         }
 
-        private void GenerateBarCode_Click(object sender, EventArgs e)
-        {
-            生成条码 form = new 生成条码(pi_inoutno.Text);
-            form.FormClosed += LoadGridData;
-            BaseUtil.SetFormCenter(form);
-            form.ShowDialog();
-        }
-
         private void LabelMaintain_Click(object sender, EventArgs e)
         {
             客户标签维护 form = new 客户标签维护();
@@ -251,8 +243,8 @@ namespace UAS_LabelMachine
                     return;
                 }
                 CollectInputData();
+                Input.Text = "";
             }
-            Input.Text = "";
         }
 
         /// <summary>
@@ -264,7 +256,7 @@ namespace UAS_LabelMachine
             string[] SplitData = Input.Text.Split('*');
             if (SplitData.Length < 6)
             {
-                MessageBox.Show("数据格式错误,无法解析");
+                MessageBox.Show("数据格式错误,无法解析", "提示");
                 return;
             }
             for (int i = 0; i < SplitData.Length; i++)
@@ -298,12 +290,12 @@ namespace UAS_LabelMachine
             }
             if (Data["PRCODE"] != CurrentPrCode)
             {
-                MessageBox.Show("当前采集物料编号不对应,请重新采集");
+                MessageBox.Show("当前采集物料编号不对应,请重新采集", "提示");
                 return;
             }
             if (Data["BRAND"] != CurrentBrand)
             {
-                MessageBox.Show("当前采集品牌不对应,请重新采集");
+                MessageBox.Show("当前采集品牌不对应,请重新采集", "提示");
                 return;
             }
             int CodeCount = 0;
@@ -323,13 +315,12 @@ namespace UAS_LabelMachine
             {
                 if (int.Parse(Data["QTY"]) % int.Parse(CurrentZXBZ) != 0)
                 {
-                    MessageBox.Show("采集数量无法按照最小包装数拆分");
+                    MessageBox.Show("采集数量无法按照最小包装数拆分", "提示");
                     return;
                 }
                 CodeCount = int.Parse(Data["QTY"]) / int.Parse(CurrentZXBZ);
                 CollectNum = int.Parse(Data["QTY"]);
             }
-
             string pib_barcode = Data.ContainsKey("SERIAL") ? Data["SERIAL"] : "";
             //获取ID
             string[] PIBID = dh.GetSEQ("prodiobarcode_seq", CodeCount);
@@ -356,7 +347,7 @@ namespace UAS_LabelMachine
             int CollectQty = (collectqty == "" ? 0 : int.Parse(collectqty));
             if (CollectQty + CollectNum > int.Parse(CurrentPrCount))
             {
-                MessageBox.Show("采集后超出数量");
+                MessageBox.Show("采集后超出数量", "提示");
                 return;
             }
             List<string> CustBarCode = new List<string>();
@@ -399,7 +390,7 @@ namespace UAS_LabelMachine
             //加载完数据之后进行容量的判断
             if (LabelInfDataTable.Select("pib_outboxcode2='" + OutBoxNum.Text + "'").Length > OutboxCapacity.Value)
             {
-                MessageBox.Show("箱号" + OutBoxNum.Text + "超出容量");
+                MessageBox.Show("箱号" + OutBoxNum.Text + "超出容量", "提示");
             }
             if (SingleLabelAutoPrint.Checked)
             {
@@ -411,10 +402,13 @@ namespace UAS_LabelMachine
             if (CollectQty == int.Parse(CurrentPrCount))
             {
                 DataGridViewSelectedRowCollection dsc = GridPrcode.SelectedRows;
-                GridPrcode.Rows[dsc[0].Index + 1].Selected = true;
-                for (int i = 0; i < dsc.Count; i++)
+                if (dsc[0].Index + 1 < GridPrcode.Rows.Count)
                 {
-                    dsc[i].Selected = false;
+                    GridPrcode.Rows[dsc[0].Index + 1].Selected = true;
+                    for (int i = 0; i < dsc.Count; i++)
+                    {
+                        dsc[i].Selected = false;
+                    }
                 }
             }
         }
@@ -599,6 +593,7 @@ namespace UAS_LabelMachine
                     BaseUtil.CleanDataTable(SingleBoxCacheData);
                     MidIDAndOutboxcode.Clear();
                     SingleID.Clear();
+                    Input.Focus();
                     //获取外箱数据
                     OutBoxNum_Click(sender, new EventArgs());
                     thread = new Thread(GetInOutInfAndLabelFile);
@@ -608,7 +603,7 @@ namespace UAS_LabelMachine
                     LogManager.DoLog("输入单号【" + pi_inoutno.Text + "】");
                 }
                 else
-                    MessageBox.Show("当前出入库单号不存在!");
+                    MessageBox.Show("当前出入库单号不存在!", "提示");
             }
         }
 
@@ -620,7 +615,7 @@ namespace UAS_LabelMachine
             }
             catch (Exception)
             {
-                MessageBox.Show("单盘标签未维护参数");
+                MessageBox.Show("单盘标签未维护参数", "提示");
             }
             if (MidLabelAutoPrint.Checked)
             {
@@ -630,7 +625,7 @@ namespace UAS_LabelMachine
                 }
                 catch (Exception)
                 {
-                    MessageBox.Show("中盘标签未维护参数");
+                    MessageBox.Show("中盘标签未维护参数", "提示");
                 }
             }
             string la_id = SingleLabelCombox.SelectedValue.ToString().Split('#')[0];
@@ -662,7 +657,7 @@ namespace UAS_LabelMachine
                 }
                 if (SingleID.ToArray().Length == 0)
                 {
-                    MessageBox.Show("选择的行未勾选采集或者已打印");
+                    MessageBox.Show("选择的行未勾选采集或者已打印", "提示");
                     return;
                 }
                 //打印的时候如果不存在数据开始缓存
@@ -742,14 +737,14 @@ namespace UAS_LabelMachine
                 MidBoxCacheData.Clear();
                 BaseUtil.CleanDataTable(MidBoxCacheData);
                 if (CheckedRowCount == 0)
-                    MessageBox.Show("未勾选打印明细!");
+                    MessageBox.Show("未勾选打印明细!", "提示");
                 else if (CurrentRowIndex + 1 < LabelInf.Rows.Count)
                     CurrentRowIndex = CurrentRowIndex + 1;
                 outboxcode1.Clear();
             }
             else
             {
-                MessageBox.Show("此模板尚未维护参数或不存在打印明细");
+                MessageBox.Show("此模板尚未维护参数或不存在打印明细", "提示");
                 return;
             }
         }
@@ -836,7 +831,7 @@ namespace UAS_LabelMachine
             string[] pib_outbox_arr = MidIDAndOutboxcode.Values.ToArray();
             if (pib_id_arr.Length == 0)
             {
-                MessageBox.Show("未勾选打印明细");
+                MessageBox.Show("未勾选打印明细", "提示");
                 return;
             }
             //记录一个ID用来取中盒的数量
@@ -926,13 +921,13 @@ namespace UAS_LabelMachine
                         }
                         else
                         {
-                            MessageBox.Show("单盘打印范围错误");
+                            MessageBox.Show("单盘打印范围错误", "提示");
                             return;
                         }
                     }
                     catch (Exception)
                     {
-                        MessageBox.Show("单盘打印范围错误");
+                        MessageBox.Show("单盘打印范围错误", "提示");
                         return;
                     }
                 }
@@ -942,7 +937,7 @@ namespace UAS_LabelMachine
                 stw.ShowDialog();
             }
             else
-                MessageBox.Show("未维护单盘标签");
+                MessageBox.Show("未维护单盘标签", "提示");
         }
 
         private void MidBoxLabelPrint()
@@ -977,13 +972,13 @@ namespace UAS_LabelMachine
                         }
                         else
                         {
-                            MessageBox.Show("中盒打印范围错误");
+                            MessageBox.Show("中盒打印范围错误", "提示");
                             return;
                         }
                     }
                     catch (Exception)
                     {
-                        MessageBox.Show("中盒打印范围错误");
+                        MessageBox.Show("中盒打印范围错误", "提示");
                         return;
                     }
                 }
@@ -1038,10 +1033,10 @@ namespace UAS_LabelMachine
                 if (FindMidLabel)
                     MidBoxCodePrint(la_id, MidLabelRowIndex, MidRowIndex.ToArray());
                 else
-                    MessageBox.Show("该出入库单未找到该中盒号!");
+                    MessageBox.Show("该出入库单未找到该中盒号!", "提示");
             }
             else
-                MessageBox.Show("未维护中盒模板");
+                MessageBox.Show("未维护中盒模板", "提示");
         }
 
         private void MidLabelPrint_Click(object sender, EventArgs e)
@@ -1054,7 +1049,7 @@ namespace UAS_LabelMachine
                 stw.ShowDialog();
             }
             else
-                MessageBox.Show("未维护中盒标签");
+                MessageBox.Show("未维护中盒标签", "提示");
         }
 
         private void OutBoxPrint()
@@ -1099,7 +1094,7 @@ namespace UAS_LabelMachine
                 }
                 else
                 {
-                    MessageBox.Show("请勾选需要打印的外箱");
+                    MessageBox.Show("请勾选需要打印的外箱", "提示");
                 }
             }
             else
@@ -1123,7 +1118,7 @@ namespace UAS_LabelMachine
                     if (FindMidLabel)
                         OutBoxCodePrint(la_id, OutBoxLabelRowIndex);
                     else
-                        MessageBox.Show("该出入库单未找到该外箱号!");
+                        MessageBox.Show("该出入库单未找到该外箱号!", "提示");
                 }
                 catch (Exception) { }
             }
@@ -1319,7 +1314,7 @@ namespace UAS_LabelMachine
                             catch (Exception)
                             {
                                 LogManager.DoLog("SQL维护不正确,请检查SQL语句" + sql);
-                                MessageBox.Show("SQL维护不正确,请检查SQL语句\n" + sql);
+                                MessageBox.Show("SQL维护不正确,请检查SQL语句\n" + sql, "提示");
                                 return;
                             }
                         }
@@ -1340,7 +1335,7 @@ namespace UAS_LabelMachine
                 }
                 LogManager.DoLog("执行打印外箱,pib_id:" + LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString());
             }
-            catch (Exception ex) { MessageBox.Show(ex.Message); }
+            catch (Exception ex) { MessageBox.Show(ex.Message, "提示"); }
         }
 
         private void CleanDetail_Click(object sender, EventArgs e)
@@ -1358,12 +1353,12 @@ namespace UAS_LabelMachine
                 if (close.ToString() == "Yes")
                 {
                     dh.BatchInsert("delete from prodiobarcode where pib_id=:pib_id", new string[] { "pib_id" }, DeleteID.ToArray());
-                    MessageBox.Show("删除成功");
+                    MessageBox.Show("删除成功", "提示");
                     LoadGridData(sender, e);
                 }
             }
             else
-                MessageBox.Show("尚未勾选需要删除的明细");
+                MessageBox.Show("尚未勾选需要删除的明细", "提示");
         }
 
         private void OutBoxLabelPrint_Click(object sender, EventArgs e)
@@ -1376,7 +1371,7 @@ namespace UAS_LabelMachine
                 stw.ShowDialog();
             }
             else
-                MessageBox.Show("未维护外箱标签");
+                MessageBox.Show("未维护外箱标签", "提示");
         }
 
         private void LoadGridData()
@@ -1440,7 +1435,7 @@ namespace UAS_LabelMachine
                 }
                 if (!FindDetno)
                 {
-                    MessageBox.Show("不存在未采集的明细序号" + griddetno.Text);
+                    MessageBox.Show("不存在未采集的明细序号" + griddetno.Text, "提示");
                     return;
                 }
             }
@@ -1467,7 +1462,7 @@ namespace UAS_LabelMachine
                     MidBoxCodePrint(la_id, CurrentRowIndex);
                 }
                 else
-                    MessageBox.Show("未维护中盒模板");
+                    MessageBox.Show("未维护中盒模板", "提示");
             }
         }
 
@@ -1651,7 +1646,7 @@ namespace UAS_LabelMachine
                 附件内容打印 att = new 附件内容打印(pi_cardcode.Text);
                 att.ShowDialog();
             }
-            else MessageBox.Show("请先获取出库单信息");
+            else MessageBox.Show("请先获取出库单信息", "提示");
         }
 
         private void MidBoxCapacity_Leave(object sender, EventArgs e)