Browse Source

优化出标速度,可以手工修改复核数量

callm 4 years ago
parent
commit
fd274833f1

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

@@ -406,6 +406,7 @@ namespace UAS_LabelMachine
                     CustBarCode.Add("");
                 }
             }
+            Console.WriteLine("1" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
             sql.Clear();
             sql.Append("insert into prodiobarcode(PIB_ID,PIB_PRODCODE,PIB_INDATE,PIB_INOUTNO,PIB_PIID,PIB_PDNO, PIB_PDID,PIB_PICLASS,");
             sql.Append("PIB_BARCODE,PIB_CUSTBARCODE,PIB_QTY,pib_brand,pib_datecode,pib_lotno,PIB_OUTBOXCODE2,pib_inman,PIB_IFPRINT,PIB_ORDERCODE,PIB_CUSTPO,pib_remark,pib_midcapatity,pib_custcode) ");
@@ -434,19 +435,21 @@ namespace UAS_LabelMachine
             {
                 MessageBox.Show("未成功插入数据,请核对出货单当前明细", "提示");
             }
+            Console.WriteLine("2" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
+
             //更新流水号
             LoadGridData(new object(), new EventArgs());
             if (LabelInf.Rows.Count > 0)
             {
                 LabelInf.Rows[LabelInf.Rows.Count - 1].Selected = true;
             }
-            //if (SingleLabelAutoPrint.Checked)
-            //{
-            //    thread = new Thread(AutoPrintSingleLabel);
-            //    stw = new SetLoadingWindow(thread, "正在打印单盘标签");
-            //    BaseUtil.SetFormCenter(stw);
-            //    stw.ShowDialog();
-            //}
+            if (SingleLabelAutoPrint.Checked)
+            {
+                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());
             CollectQty = (collectqty == "" ? 0 : double.Parse(collectqty));
@@ -472,7 +475,9 @@ namespace UAS_LabelMachine
             {
                 dh.UpdateByCondition("prodinout", "pi_user_packingstatus='Packed'", "pi_inoutno='" + pi_inoutno.Text + "'");
             }
-            receiveClient.Client.Send(Encoding.ASCII.GetBytes("ReadId1|,|OK|,|Y"));
+            Console.WriteLine("7" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
+
+            receiveClient.Client.Send(Encoding.ASCII.GetBytes(GetSendCode("ReadId1|,|OK|,|Y")));
             //采集达到了数量进行换行
             if (CollectQty == double.Parse(CurrentPrCount))
             {
@@ -526,7 +531,7 @@ namespace UAS_LabelMachine
                         pibid += PIBID[i];
                 }
                 if (!SingleLabelCombox.SelectedValue.ToString().Contains("System.Data.DataRowView"))
-                    SingleReport.Load(SingleLabelCombox.SelectedValue.ToString());
+                    SingleReport.Load(@"C:\打印标签\立景创新LP.frx");
                 for (int j = 0; j < SingleReport.Parameters.Count; j++)
                 {
                     SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, "");
@@ -538,14 +543,36 @@ namespace UAS_LabelMachine
                         }
                     }
                 }
-                DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiosingleinfo_view where 主键ID in (" + pibid + ")", "select");
+                Console.WriteLine("3" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
+
+                StringBuilder sql = new StringBuilder();
+                sql.Clear();
+                sql.Append("select * from (select to_char(pi_date,'yyiw')出库年周,to_char(sysdate,'yyiw')当前DateCode,pi_remark 单据备注,pi_date-1 出库前一天,pib_outboxcode2 外箱号,pd_orderdetno 订单序号,pib_totalweight 总重,pr_ywmc_user 英文名称,pib_boxweight 箱重,nvl(pib_totalweight,0)-nvl(pib_boxweight,0) 净重,pib_id 主键ID,pd_pdno 出货序号,pib_prodcode 物料编号,pr_detail 物料名称,to_char(pi_date,'yyyy-mm-dd') 送达日期,pd_custprodspec 客户型号,pd_custproddetail 客户物料名称,pi_title 客户全称,cu_shortname 客户简称,pr_spec 物料规格,pib_custbarcode 客户条码,pib_custmidboxcode 中盒条码,pib_custoutboxcode 外箱条码,pib_inoutno 出货单号,");
+                sql.Append("PD_HBSL_USER 出库数量,PD_HBSL_USER*1000 出库数量k,pjd_orispeccode 原厂型号,pib_datecode DateCode,(week_to_date(pib_datecode))DateCode1,pd_remark 备注,pd_remark2 备注2,pd_remark3 备注3,pib_lotno LotNo,");
+                sql.Append("nvl(nvl(pd_brand,pib_brand),pr_brand)品牌,pr_unit 单位, to_char(pi_date,'yyyy-mm-dd')出库日期,PIB_QTY 最小封装数量,PIB_QTY*1000 最小封装数量k,pd_pocode 客户PO,pd_custprodcode CPN客户料号,");
+                sql.Append("to_char(ADD_MONTHS(to_date(week_to_date(pib_datecode),'yyyy-mm-dd'),12),'yyyy-mm-dd') 有效期一年,");
+                sql.Append("to_char(ADD_MONTHS(to_date(week_to_date(pib_datecode),'yyyy-mm-dd'),24),'yyyy-mm-dd') 有效期两年,");
+                sql.Append("to_char(ADD_MONTHS(to_date(week_to_date(pib_datecode),'yyyy-mm-dd'),36),'yyyy-mm-dd') 有效期三年,");
+                sql.Append("to_char(ADD_MONTHS(to_date(week_to_date(pib_datecode),'yyyy-mm-dd'),12),'yyyy-iw')有效期一年_年周,");
+                sql.Append("to_char(ADD_MONTHS(to_date(week_to_date(pib_datecode),'yyyy-mm-dd'),24),'yyyy-iw')有效期两年_年周,");
+                sql.Append("to_char(ADD_MONTHS(to_date(week_to_date(pib_datecode),'yyyy-mm-dd'),36),'yyyy-iw')有效期三年_年周,");
+                sql.Append("wh_ppmc_user 中文品牌,em_code 装箱员编号,em_name 装箱员名称  from prodiobarcode left join prodinout on pib_piid=pi_id left join product on pib_prodcode=pr_code left join ProdIODetail on pd_id=PIB_PDID  ");
+                sql.Append("left join PRODJOINVENDDETAIL on pjd_brand=pib_brand and pjd_prodcode=pib_prodcode  left join customer on pi_cardcode=cu_code left join productcustomer on pc_custid=cu_id and pc_prodcode=pd_prodcode ");
+                sql.Append("and pc_custprodcode=pd_custprodcode left join WareHouse on wh_code=pd_whcode left join employee on em_code=pib_inman where pib_id='" + pibid + "' order by pib_custbarcode)");
+                //DataTable dt = (DataTable)dh.ExecuteSql("select * from PRODIOSINGLEINFO_VIEW where 主键ID in (" + pibid + ")", "select");
+                DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+                Console.WriteLine("4" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
+
                 SingleReport.RegisterData(dt, "prodiosingleinfo_view");
                 SingleReport.GetDataSource("prodiosingleinfo_view").Enabled = true;
                 SingleReport.PrintSettings.ShowDialog = false;
                 SingleReport.PrintSettings.Printer = SingleLabelPrinter.Text;
+
                 try
                 {
+                    Console.WriteLine("5" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
                     SingleReport.Print();
+                    Console.WriteLine("6" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
                 }
                 catch (Exception e)
                 {
@@ -1443,7 +1470,7 @@ namespace UAS_LabelMachine
         {
             if (pi_cardcode.Text != "")
             {
-                贴标角度设置 att = new 贴标角度设置(pi_cardcode.Text);
+                附件内容打印 att = new 附件内容打印(pi_cardcode.Text);
                 att.ShowDialog();
             }
             else MessageBox.Show("请先获取出库单信息", "提示");
@@ -1772,8 +1799,13 @@ namespace UAS_LabelMachine
         {
             string Value = GridPrcode.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
             string ID = GridPrcode.Rows[e.RowIndex].Cells["pjd_id"].Value.ToString();
+            string checknum = GridPrcode.Rows[e.RowIndex].Cells["checknum"].Value.ToString();
+            string pdno = GridPrcode.Rows[e.RowIndex].Cells["pd_pdno"].Value.ToString();
+
             dh.UpdateByCondition("PRODJOINVENDDETAIL", "pjd_zxbzs_user='" + Value + "'", "pjd_id='" + ID + "'");
             dh.UpdateByCondition("CS$INOUTPRCODE", "pjd_zxbzs_user='" + Value + "'", "pjd_id='" + ID + "' and pd_inoutno='" + pi_inoutno.Text + "'");
+            //更新复核数据
+            dh.UpdateByCondition("CS$InoutPrcode", "checknum='" + checknum + "'", "pd_inoutno='" + pi_inoutno.Text + "' and pd_pdno='" + pdno + "' and combined=" + combined);
             //删除对应物料的明细
             CurrentPrCode = GridPrcode.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString();
             CurrentZXBZ = GridPrcode.Rows[e.RowIndex].Cells["pjd_zxbzs_user"].Value.ToString();
@@ -2316,13 +2348,32 @@ namespace UAS_LabelMachine
                     ms.ShowDialog();
                     break;
                 case "贴标角度设置":
-                    贴标角度设置 ms1 = new 贴标角度设置(pi_cardcode.Text);
-                    BaseUtil.SetFormCenter(ms1);
-                    ms1.ShowDialog();
+                    if (pi_cardcode.Text != "")
+                    {
+                        贴标角度设置 ms1 = new 贴标角度设置(pi_cardcode.Text);
+                        ms1.FormClosed += Ms1_FormClosed;
+                        BaseUtil.SetFormCenter(ms1);
+                        ms1.ShowDialog();
+                    }
+                    else
+                    {
+                        MessageBox.Show("请先获取客户信息");
+                    }
                     break;
             }
         }
 
+        private void Ms1_FormClosed(object sender, FormClosedEventArgs e)
+        {
+            DataTable XY = (DataTable)dh.ExecuteSql("select * from PRINTXY where px_custcode='" + pi_cardcode.Text + "'", "select");
+            if (XY.Rows.Count > 0)
+            {
+                Angle = XY.Rows[0]["px_angle"].ToString();
+                X = XY.Rows[0]["px_x"].ToString();
+                Y = XY.Rows[0]["px_y"].ToString();
+            }
+        }
+
         private void MenuManage_Click(object sender, EventArgs e)
         {
             ShowMenu_Total.Show(new Point(MenuManage.Location.X, MenuManage.Location.Y + 20));
@@ -2406,9 +2457,8 @@ namespace UAS_LabelMachine
                     string getMsg = Encoding.Default.GetString(getData);
                     if (getMsg.Contains("ReadId"))
                     {
-                        string msgStr = getMsg.Trim('\0').Replace("ReadId1|,|", @"[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+");
-                        msgStr = Regex.Match(msgStr, "").Value;
-                        Console.WriteLine(msgStr);
+                        string msgStr = getMsg.Trim('\0').Replace("ReadId1|,|", "");
+                        msgStr = Regex.Match(msgStr, @"[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+").Value;
                         //设置索引和内容
                         // msgStr = msgStr.Split(ps_split.ToCharArray()[0])[dataindex];
                         Input.Text = msgStr;
@@ -2473,7 +2523,7 @@ namespace UAS_LabelMachine
                                 else if (checknum == outqty / zxbzs)
                                 {
                                     dh.UpdateByCondition("CS$InoutPrcode", "checknum=nvl(checknum,0)+1", "pd_inoutno='" + pi_inoutno.Text + "' and pd_pdno='" + pdno + "' and combined=" + combined);
-                                    sendClient.Client.Send(Encoding.ASCII.GetBytes(GetSendCode("ReadId3|,|OK|,|1")));
+                                    sendClient.Client.Send(Encoding.ASCII.GetBytes("ReadId3|,|OK|,|1"));
                                     checknum = 0;
                                     SendLast = true;
                                     PassTenCount = 0;
@@ -2484,7 +2534,7 @@ namespace UAS_LabelMachine
                         //达到了中盒容量之后
                         if (PassTenCount == MidboxCapacity.Value)
                         {
-                            sendClient.Client.Send(Encoding.ASCII.GetBytes(GetSendCode("ReadId3|,|OK|,|4")));
+                            sendClient.Client.Send(Encoding.ASCII.GetBytes("ReadId3|,|OK|,|4"));
                             PassTenCount = 0;
                         }
                         else
@@ -2492,7 +2542,7 @@ namespace UAS_LabelMachine
                             //如果发送了最后一盒,则不发送继续堆叠的指令
                             if (!SendLast)
                             {
-                                sendClient.Client.Send(Encoding.ASCII.GetBytes(GetSendCode("ReadId3|,|OK|,|0")));
+                                sendClient.Client.Send(Encoding.ASCII.GetBytes("ReadId3|,|OK|,|0"));
                             }
                         }
                         PassTenCount = PassTenCount + 1;

+ 9 - 3
UAS-出货标签管理(泽天)/贴标角度设置.cs

@@ -37,12 +37,18 @@ namespace UAS_LabelMachine
 
         private void Confirm_Click(object sender, EventArgs e)
         {
+            if (angle.Text == "" || X.Text == "" || Y.Text == "")
+            {
+                MessageBox.Show("参数必须都填写");
+                return;
+            }
             if (dh.CheckExist("PRINTXY", "px_custcode='" + custcode + "'"))
             {
-                dh.ExecuteSql("update PRINTXY set px_x='"+X.Text+"',px_y='"+Y.Text+"',px_angle='"+angle.Text+"' and px_custcode='"+custcode+"'", "update");
+                dh.ExecuteSql("update PRINTXY set px_x='" + X.Text + "',px_y='" + Y.Text + "',px_angle='" + angle.Text + "' where px_custcode='" + custcode + "'", "update");
             }
-            else {
-                dh.ExecuteSql("insert into PRINTXY (px_x,px_y,px_angle,px_custcode)values('" + X.Text + "','" + Y.Text + "','" + angle.Text + "','"+custcode+"')", "insert");
+            else
+            {
+                dh.ExecuteSql("insert into PRINTXY (px_x,px_y,px_angle,px_custcode)values('" + X.Text + "','" + Y.Text + "','" + angle.Text + "','" + custcode + "')", "insert");
             }
             LogManager.DoCommandLog(custcode, User.UserCode, "保持贴标角度成功", "成功");
             MessageBox.Show("保存成功");