Browse Source

添加唛头打印

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

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

@@ -44,9 +44,9 @@ namespace UAS_LabelMachine
         /// </summary>
         Report OutReport = new Report();
         /// <summary>
-        /// 唛头文件
+        /// 唛头文件打印
         /// </summary>
-        Document FootDoc;
+        Report FootReport = new Report();
         /// <summary>
         /// Loading窗口
         /// </summary>
@@ -179,8 +179,6 @@ namespace UAS_LabelMachine
         {
             客户标签维护 form = new 客户标签维护();
             BaseUtil.SetFormCenter(form);
-            if (FootDoc != null)
-                FootDoc.Close();
             form.FormClosed += LabelFormClose;
             form.ShowDialog();
         }
@@ -348,9 +346,9 @@ namespace UAS_LabelMachine
             }
             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) ");
+            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) ");
             sql.Append("select :PIB_ID,pd_prodcode,sysdate,pi_inoutno,pi_id,pd_pdno,pd_id,pi_class,");
-            sql.Append("'" + pib_barcode + "',:PIB_CUSTBARCODE,'" + CurrentZXBZ + "',pjd_brand,'" + Data["DATECODE"] + "','" + Data["LOTNO"] + "','" + pib_outboxcode2 + "','" + User.UserCode + "','" + (EnablePrint && SingleLabelAutoPrint.Checked ? 1 : 0).ToString() + "',pd_ordercode,pd_pocode ");
+            sql.Append("'" + pib_barcode + "',:PIB_CUSTBARCODE,'" + CurrentZXBZ + "',pjd_brand,'" + Data["DATECODE"] + "','" + Data["LOTNO"] + "','" + pib_outboxcode2 + "','" + User.UserCode + "','" + (EnablePrint && SingleLabelAutoPrint.Checked ? 1 : 0).ToString() + "',pd_ordercode,pd_pocode,pd_remark ");
             sql.Append("from prodinout left join prodiodetail on pi_id=pd_piid left join PRODJOINVENDDETAIL on pjd_brand =pd_brand and pjd_prodcode=pd_prodcode where pi_id='" + PI_ID + "' and pd_prodcode='" + CurrentPrCode + "' and pd_pdno='" + CurrentPDNO + "'");
             dh.BatchInsert(sql.ToString(), new string[] { "PIB_ID", "PIB_CUSTBARCODE" }, PIBID, CustBarCode.ToArray());
             //更新流水号
@@ -523,19 +521,8 @@ namespace UAS_LabelMachine
             {
                 OutReport.Load(ftpOperater.DownLoadTo + OutBoxCombox.Text);
             }
-            //if (!File.Exists(ftpOperater.DownLoadTo + "唛头.lab"))
-            //{
-            //    BaseUtil.GetLabelUrl(DataHelper.FTPAdress, "唛头.lab", System.DateTime.Now);
-            //    if (FootDoc != null)
-            //        FootDoc.Close();
-            //    FootDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + "唛头.lab");
-            //}
-            //else
-            //{
-            //    if (FootDoc != null)
-            //        FootDoc.Close();
-            //    FootDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + "唛头.lab");
-            //}
+            BaseUtil.GetLabelUrl(DataHelper.FTPAdress, "唛头.frx", System.DateTime.Now);
+            FootReport.Load(ftpOperater.DownLoadTo + "唛头.frx");
             //缓存外箱参数
             ComBoxClickChangeLabelDoc = true;
         }
@@ -644,7 +631,7 @@ namespace UAS_LabelMachine
                             //保存参数打印
                             SingleReport.PrintSettings.ShowDialog = false;
                             SingleReport.PrintSettings.Printer = SingleLabelPrinter.Text;
-                            SingleReport.Print();
+                            SingleReport.Show();
                             Properties.Settings.Default.SPrinter = SingleLabelPrinter.Text;
                             Properties.Settings.Default.Save();
                             LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
@@ -1426,13 +1413,14 @@ namespace UAS_LabelMachine
         private void PrintFooter_Click(object sender, EventArgs e)
         {
             DataTable dt = (DataTable)dh.ExecuteSql("select pib_outboxcode2,max(pib_id) pib_id from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' group by pib_outboxcode2 order by pib_outboxcode2", "select");
-            string SQL = "select pib_outboxcode2||'/'||(select max(pib_outboxcode2) from prodiobarcode where pib_inoutno={pib_inoutno}) from prodiobarcode  where pib_id={pib_id}";
+            string SQL = "select pib_outboxcode2||'/'||(select max(pib_outboxcode2) from prodiobarcode where pib_inoutno='"+pi_inoutno.Text+"') from prodiobarcode  where pib_id=";
             for (int i = 0; i < dt.Rows.Count; i++)
             {
-                DataTable dt1 = (DataTable)dh.ExecuteSql(SQL.Replace("{pib_inoutno}", "'" + pi_inoutno.Text + "'").Replace("{pib_id}", dt.Rows[i]["pib_id"].ToString()), "select");
-                FootDoc.Variables.FreeVariables.Item("唛头").Value = dt1.Rows[0][0].ToString();
-                FootDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
-                FootDoc.PrintDocument();
+                DataTable dt1 = (DataTable)dh.ExecuteSql(SQL+dt.Rows[i]["pib_id"].ToString(), "select");
+                FootReport.SetParameterValue("唛头", dt1.Rows[0][0].ToString());
+                FootReport.PrintSettings.ShowDialog = false;
+                FootReport.PrintSettings.Printer= SingleLabelPrinter.Text;
+                FootReport.Show();
             }
             LogManager.DoCommandLog(pi_inoutno.Text, User.UserCode, "打印唛头", "成功");
         }