Browse Source

Merge branch 'master' of ssh://10.10.100.21/source/mes-client

Hcsy 7 years ago
parent
commit
0b3b0cbdc6

+ 1 - 1
UAS-出货标签管理(吉利通)/PublicMethod/LogicHandler.cs

@@ -55,7 +55,7 @@ namespace UAS_LabelMachine.PublicMethod
         /// <param name="iInoutno"></param>
         public static bool CheckUploadData(string iInoutno, int iUploadNum)
         {
-            DataTable dt = (DataTable)adh.ExecuteSql("select pib_id,pib_lotno,pib_ifmodify,pib_datecode,pib_ifpick,-1 as pib_ifupload,pib_ifprint,pib_ifrecheck from prodiobarcode where pib_inoutno='" + iInoutno + "'  and pib_ifupload=0 and pib_ifrecheck=-1", "select");
+            DataTable dt = (DataTable)adh.ExecuteSql("select pib_id,pib_outboxcode1,pib_outboxcode2,pib_lotno,pib_ifmodify,pib_datecode,pib_ifpick,-1 as pib_ifupload,pib_ifprint,pib_ifrecheck from prodiobarcode where pib_inoutno='" + iInoutno + "'  and pib_ifupload=0 and pib_ifrecheck=-1", "select");
             //如果本地需要上传的数据已经达到了需要上传的条数
             if (iUploadNum <= dt.Rows.Count)
             {

+ 66 - 30
UAS-出货标签管理(吉利通)/UAS_出货标签管理.cs

@@ -245,16 +245,18 @@ namespace UAS_LabelMachine
             }
         }
 
-        private void FrontCheckFunction(string msg)
+        private bool FrontCheckFunction(string msg)
         {
             for (int i = 0; i < ScanGroup.Rows.Count; i++)
             {
                 string sg_name = ScanGroup.Rows[i]["sg_name"].ToString();
                 string sg_brand = ScanGroup.Rows[i]["sg_brand"].ToString();
                 reg = new Regex(ScanGroup.Rows[i]["sg_script"].ToString());
-                MatchCollection matchs = reg.Matches(msg);
+                Match matchs1 = reg.Match(msg);
                 int index = 0;
-                DataTable dt = BaseUtil.filterDataTable(ScanItem, "sg_name='" + sg_name + "' and sg_brand='" + sg_brand + "' and items_num=" + matchs.Count);
+                string[] arr = matchs1.Value.Split(',');
+                DataTable dt = BaseUtil.filterDataTable(ScanItem, "sg_name='" + sg_name + "' and sg_brand='" + sg_brand + "' and items_num=" + arr.Length);
+
                 if (dt.Rows.Count > 0)
                 {
                     for (int j = 0; j < dt.Rows.Count; j++)
@@ -267,37 +269,49 @@ namespace UAS_LabelMachine
                                 if (si_expression != "")
                                 {
                                     si_exp = new Regex(si_expression);
-                                    DateCode = si_exp.Match(matchs[index].Value).Value;
+                                    DateCode = si_exp.Match(arr[index]).Value;
                                 }
                                 else
                                 {
-                                    DateCode = matchs[index].Value;
+                                    DateCode = arr[index];
                                 }
                                 LabelInfDataTable.Rows[CurrentRowIndex]["pib_datecode"] = DateCode;
                                 break;
                             case "LotNo":
-                                LotNo = matchs[index].Value;
+                                LotNo = arr[index];
                                 LabelInfDataTable.Rows[CurrentRowIndex]["pib_lotno"] = LotNo;
                                 break;
                             case "PN":
-                                PN = matchs[index].Value;
+                                PN = arr[index];
+                                if (LabelInfDataTable.Rows[CurrentRowIndex]["pib_lotno"].ToString() != QTY.ToString())
+                                {
+                                    return false;
+                                }
                                 break;
                             case "Order":
-                                Order = matchs[index].Value;
+                                Order = arr[index];
+                                if (LabelInfDataTable.Rows[CurrentRowIndex]["pib_ordercode"].ToString() != QTY.ToString())
+                                {
+                                    return false;
+                                }
                                 break;
                             case "QTY":
                                 if (si_expression != "")
                                 {
                                     si_exp = new Regex(si_expression);
-                                    QTY = si_exp.Match(matchs[index].Value).Value;
+                                    QTY = si_exp.Match(arr[index]).Value;
                                 }
                                 else
                                 {
-                                    QTY = matchs[index].Value;
+                                    QTY = arr[index];
+                                }
+                                if (LabelInfDataTable.Rows[CurrentRowIndex]["pib_lotno"].ToString() != QTY.ToString())
+                                {
+                                    return false;
                                 }
                                 break;
                             case "OutBox":
-                                OutBox = matchs[index].Value;
+                                OutBox = arr[index];
                                 break;
                             default:
                                 break;
@@ -309,11 +323,11 @@ namespace UAS_LabelMachine
             }
             LabelInfDataTable.Rows[CurrentRowIndex]["pib_ifpick"] = true;
             LabelInf.Refresh();
+            return true;
         }
 
         private void BackendCheckFunction(string msg, string pib_id)
         {
-            Console.WriteLine(System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
             DataTable dtt = LabelInf.DataSource as DataTable;
             string[] msgArr = msg.Split('@');
             //需要校验2项数据,完成校验后此项的值需要为2则表示校验成功
@@ -369,16 +383,14 @@ namespace UAS_LabelMachine
             int outboxcode1 = int.Parse(boxcode == "" ? "1" : boxcode);
             boxcode = adh.getFieldDataByCondition("prodiobarcode", "max(pib_outboxcode2)", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
             int outboxcode2 = int.Parse(boxcode == "" ? "1" : boxcode);
+            //超过中盒容量中盒号+1
             if (adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + outboxcode1) >= MidBoxCapacity.Value)
             {
                 outboxcode1 = outboxcode1 + 1;
             }
-            if (adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2=" + outboxcode2) >= OutBoxCapacity.Value)
-            {
-                outboxcode2 = outboxcode2 + 1;
-            }
             else if (CurrentRowIndex - 1 >= 0)
             {
+                //或者不符合合并条件中盒号+1
                 if (cu_print_midlotno.Checked)
                 {
                     if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pib_lotno"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString())
@@ -400,6 +412,36 @@ namespace UAS_LabelMachine
                         outboxcode1 = outboxcode1 + 1;
                 }
             }
+            if (adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2=" + outboxcode2) >= OutBoxCapacity.Value)
+            {
+                outboxcode2 = outboxcode2 + 1;
+            }
+            else if (CurrentRowIndex - 1 >= 0)
+            {
+                //if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pib_outboxcode1"].Value.ToString() != outboxcode1.ToString())
+                //    outboxcode2 = outboxcode2 + 1;
+                //或者不符合合并条件中盒号+1
+                if (cu_print_outlotno.Checked)
+                {
+                    if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pib_lotno"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString())
+                        outboxcode2 = outboxcode2 + 1;
+                }
+                else if (cu_print_outpo.Checked)
+                {
+                    if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pd_pocode"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pd_pocode"].Value.ToString())
+                        outboxcode2 = outboxcode2 + 1;
+                }
+                else if (cu_print_outprod.Checked)
+                {
+                    if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pd_custprodcode"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString())
+                        outboxcode2 = outboxcode2 + 1;
+                }
+                else if (cu_print_outspec.Checked)
+                {
+                    if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pd_custprodspec"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodspec"].Value.ToString())
+                        outboxcode2 = outboxcode2 + 1;
+                }
+            }
             LabelInfDataTable.Rows[CurrentRowIndex]["pib_outboxcode1"] = outboxcode1;
             LabelInfDataTable.Rows[CurrentRowIndex]["pib_outboxcode2"] = outboxcode2;
             adh.ExecuteSql("update prodiobarcode set pib_outboxcode2=" + outboxcode2 + ",pib_outboxcode1=" + outboxcode1 + ",pib_lotno='" + LotNo + "',pib_datecode='" + DateCode + "',pib_ifpick=-1 where pib_id=" + pib_id, "update");
@@ -484,7 +526,6 @@ namespace UAS_LabelMachine
                 //如果按盒号采集,所有的此盒的均更新为
                 LabelInfDataTable.Rows[CurrentRowIndex]["pib_ifpick"] = true;
                 LogicHandler.UpdateRowPicked(LabelInf.Rows[CurrentRowIndex].Cells["pib_id"].Value);
-                LabelInfDataTable.Rows[CurrentRowIndex]["Choose"] = true;
                 //勾选了单盘自动打印
                 if (SingleLabelAutoPrint.Checked)
                 {
@@ -775,7 +816,7 @@ namespace UAS_LabelMachine
                 {
                     if (!SingleID.Contains(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString()))
                         SingleID.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString());
-                    if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString() != "True")
+                    if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString() != "True")
                     {
                         //如果不存在中盒号则进行添加
                         if (!MidIDAndOutboxcode.ContainsValue(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()))
@@ -812,7 +853,7 @@ namespace UAS_LabelMachine
                 for (int i = 0; i < LabelInf.RowCount; i++)
                 {
                     //勾选了并且未打印
-                    if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString() != "True")
+                    if (LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString() != "True")
                     {
                         CheckedRowCount = CheckedRowCount + 1;
                         CurrentRowIndex = i;
@@ -896,7 +937,6 @@ namespace UAS_LabelMachine
                         {
                             for (int i = begin - 1; i < end; i++)
                             {
-                                LabelInfDataTable.Rows[i]["Choose"] = true;
                                 LabelInfDataTable.Rows[i]["pib_ifpick"] = true;
                                 LabelInfDataTable.Rows[i]["pib_ifprint"] = false;
                             }
@@ -1031,14 +1071,10 @@ namespace UAS_LabelMachine
             {
                 for (int i = 0; i < LabelInf.RowCount; i++)
                 {
-                    if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True")
-                    {
-                        string outboxcode2 = LabelInf.Rows[i].Cells["pib_outboxcode2"].Value.ToString();
-                        //富为使用包装单的逻辑
-                        //如果不包含该箱号则进行添加
-                        if (!Outboxcode.Contains(outboxcode2))
-                            Outboxcode.Add(outboxcode2);
-                    }
+                    string outboxcode2 = LabelInf.Rows[i].Cells["pib_outboxcode2"].Value.ToString();
+                    //如果不包含该箱号则进行添加
+                    if (!Outboxcode.Contains(outboxcode2))
+                        Outboxcode.Add(outboxcode2);
                 }
                 //按获取到的箱号列表进行打印
                 if (Outboxcode.ToArray().Length > 0)
@@ -1208,7 +1244,7 @@ namespace UAS_LabelMachine
                 Process_midboxcode.Text = midboxcode;
                 Process_outboxcode.Text = outboxcode;
                 //设置当前总数和已采集数量
-                CollectedCount.Text = Count + "/" + PageNum.Text;
+                CollectedCount.Text = Count + "/" + PageNum.Text.Replace("总数", "");
             }
         }
 
@@ -1241,7 +1277,7 @@ namespace UAS_LabelMachine
             {
                 //嵌套查询重置RowNum
                 sql.Clear();
-                sql.Append("select t.*,rownum from (select pd_custprodcode,pib_inoutno,pd_custprodspec,nvl(pib_ifrecheck,0)pib_ifrecheck,nvl(pib_ifupload,0)pib_ifupload,nvl(pib_ifmodify,0)pib_ifmodify,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,");
+                sql.Append("select t.*,rownum from (select pd_custprodcode,pib_indate,pi_date,pib_inoutno,pd_custprodspec,nvl(pib_ifrecheck,0)pib_ifrecheck,nvl(pib_ifupload,0)pib_ifupload,nvl(pib_ifmodify,0)pib_ifmodify,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,");
                 sql.Append("pib_id,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,pib_lotno,pib_datecode,pib_qty,pr_spec,pi_title,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,");
                 sql.Append("pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint from prodiobarcode left join prodinout on pib_piid=pi_id left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and ");
                 sql.Append("pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode where pib_piid='" + PI_ID + "' order by to_number(pib_id))t");