From 3617a2224fe836bfa08b4eac59df819d6e2289e2 Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期六, 09 十月 2021 16:52:01 +0800
Subject: [PATCH] 条码生成模块、洗衣机条码生成模块界面新增试打印按钮,原打印功能取值改取条码档案列表,打印条码时更新条码打印次数表数值

---
 SCM/条码打印/Gy_BarCodeBill.cs |  120 +++++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 98 insertions(+), 22 deletions(-)

diff --git "a/SCM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs" "b/SCM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
index 8e5eda2..a44e8d2 100644
--- "a/SCM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
+++ "b/SCM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
@@ -1773,19 +1773,23 @@
                 oWeb.Timeout = 200000;
                 if (oWeb.getRunProcByMul_Back(sSQLMul, ref DBUtility.ClsPub.sExeReturnInfo))
                 {
-                    //鏌ヨ鏈�鍚庝竴琛屾潯鐮佹槸鍚﹀瓨鍦ㄤ簬鏉$爜妗f琛ㄤ腑
-                    int r = grdSub.Rows.Count - 1;
-                    DataSet DS2 = oWeb.getDataSetBySQL("Select top 1 1 from Gy_BarCodeBill with(nolock) where HBarCode='" + DBUtility.ClsPub.isStrNull(grdSub.Rows[r].Cells[HTMCol].Value) + "'", "Gy_BarCodeBill", ref DBUtility.ClsPub.sExeReturnInfo);
-                    if (DS2 == null || DS2.Tables[0].Rows.Count == 0)
-                    {
-                        MessageBox.Show("鏉$爜鐢熸垚澶辫触锛岃閲嶆柊鐢熸垚锛�" + DBUtility.ClsPub.sExeReturnInfo);
-                        grdSub.RowCount = 0;
-                        grdSub.RowCount = 20;
-                    }
-                    else
-                    {
-                        MessageBox.Show("鏉$爜鐢熸垚瀹屾瘯锛�");
-                    }
+                    //灏嗘潯鐮佸瓨鍏ユ潯鐮佹墦鍗版鏁拌褰曡〃涓�
+                    oWeb.getRunProc("insert into Gy_BarCodeBill_PrintQty (HBarCodeItemID,HBarCodeInterID,HBarCode,HPrintQty) select HItemID,HInterID,HBarCode,0 from Gy_BarCodeBill where HInterID=" + HInterID.ToString(), ref DBUtility.ClsPub.sExeReturnInfo);
+                    MessageBox.Show("鏉$爜鐢熸垚瀹屾瘯锛�");
+
+                    ////鏌ヨ鏈�鍚庝竴琛屾潯鐮佹槸鍚﹀瓨鍦ㄤ簬鏉$爜妗f琛ㄤ腑
+                    //int r = grdSub.Rows.Count - 1;
+                    //DataSet DS2 = oWeb.getDataSetBySQL("Select top 1 1 from Gy_BarCodeBill with(nolock) where HBarCode='" + DBUtility.ClsPub.isStrNull(grdSub.Rows[r].Cells[HTMCol].Value) + "'", "Gy_BarCodeBill", ref DBUtility.ClsPub.sExeReturnInfo);
+                    //if (DS2 == null || DS2.Tables[0].Rows.Count == 0)
+                    //{
+                    //    MessageBox.Show("鏉$爜鐢熸垚澶辫触锛岃閲嶆柊鐢熸垚锛�" + DBUtility.ClsPub.sExeReturnInfo);
+                    //    grdSub.RowCount = 0;
+                    //    grdSub.RowCount = 20;
+                    //}
+                    //else
+                    //{
+                    //    MessageBox.Show("鏉$爜鐢熸垚瀹屾瘯锛�");
+                    //}
                 }
                 else
                 {
@@ -1793,7 +1797,7 @@
                     grdSub.RowCount = 0;
                     grdSub.RowCount = 20;
                 }
-                tabControl1.SelectedIndex = 1;
+                tabControl1.SelectedIndex = 2;
             }
             catch (Exception e)
             {
@@ -3077,10 +3081,14 @@
         #region  //鎵撳嵃璁剧疆
 
         GridppReport Report;
-        string sBarCode = "";
+        string sBarCodeItemID = "";
 
         //棰勮
         int CurRows = 0;
+        private Int32 Fun_GetCol(string sCol)
+        {
+            return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdList);
+        }
         private void yl_Click(object sender, EventArgs e)
         {
             //鍒ゆ柇鏄惁宸茬粡鐢熸垚鏉$爜
@@ -3141,7 +3149,7 @@
 
                 //oWeb.getRunProc("exec h_p_Gy_BarCodePrintQty_Update '" + sBarCode + "'", ref DBUtility.ClsPub.sExeReturnInfo);
 
-                oWeb.getRunProc("update Gy_BarCodeBill set HPrintQty=isnull(HPrintQty,0)+1 where HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                oWeb.getRunProc("update Gy_BarCodeBill_PrintQty set HPrintQty=isnull(HPrintQty,0)+1 where HBarCodeInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
             }
             catch (Exception e)
             {
@@ -3152,9 +3160,9 @@
         private void Sub_SetReport(string sOpenTmp)
         {
             //鍒ゆ柇琛屾暟
-            for (int i = 0; i < grdSub.Rows.Count; i++)
+            for (int i = 0; i < grdList.Rows.Count; i++)
             {
-                grdSub.Rows[i].Cells[0].Value = "*";
+                grdList.Rows[i].Cells[0].Value = "*";
                 //grdSub.Rows[i].Cells[0].Value = "";
             }
             //for (int i = 0; i < grdSub.SelectedRows.Count; i++)
@@ -3196,7 +3204,8 @@
             try
             {
                 DataTable ds = new DataTable();
-                BLL.Utility.FillRecordToReport(Report, grdSub, ds, HMaterIDCol);
+                //BLL.Utility.FillRecordToReport(Report, grdSub, ds, HMaterIDCol);
+                SCM.Utility.FillRecordToReport(Report, grdList, ds, Fun_GetCol("閫夋嫨"));
             }
             catch (Exception e)
             {
@@ -3234,6 +3243,76 @@
 
             //
             Display();
+        }
+
+        //璇曟墦鍗�
+        private void sdy_Click(object sender, EventArgs e)
+        {
+            //鍒ゆ柇鏄惁宸茬粡鐢熸垚鏉$爜
+            if (DBUtility.ClsPub.isStrNull(grdSub.Rows[0].Cells[HTMCol].Value) == "")
+            {
+                MessageBox.Show("鏉$爜鏈敓鎴愶紝璇峰厛鐢熸垚鏉$爜锛�");
+                return;
+            }
+            //閫夋嫨鎵撳嵃妯℃澘
+            SCM.Gy_OpenTmp oFrm = new SCM.Gy_OpenTmp();
+            oFrm.sBillName = ModName;
+            oFrm.sBillModel = ModCaption;
+            oFrm.ShowDialog();
+            if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
+            {
+                //寰幆閫変腑琛�
+                Sub_SetReport2(oFrm.sOpenTmp);
+                Report.Print(true);
+                Thread.Sleep(1000);
+            }
+
+            //
+            Display();
+        }
+
+        //璇曟墦鍗伴�変腑琛�
+        private void Sub_SetReport2(string sOpenTmp)
+        {
+            //鍒ゆ柇琛屾暟
+            //for (int i = 0; i < grdSub.Rows.Count; i++)
+            //{
+            //    grdSub.Rows[i].Cells[0].Value = "*";
+            //    //grdSub.Rows[i].Cells[0].Value = "";
+            //}
+            sBarCodeItemID = "";
+            for (int i = 0; i < grdList.SelectedRows.Count; i++)
+            {
+                grdList.Rows[grdList.SelectedRows[i].Index].Cells[0].Value = "*";
+                sBarCodeItemID = sBarCodeItemID + "," + DBUtility.ClsPub.isLong(grdList.Rows[grdList.SelectedRows[i].Index].Cells[Fun_GetCol("HItemID")].Value).ToString();
+            }
+            //
+            Report = new GridppReport();
+            Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + sOpenTmp + ".grf");  //here .
+            Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
+            Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
+            Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd2);
+        }
+
+        //璇曟墦鍗扮粨鏉熷悗鍥炲~閫変腑琛屾潯鐮佹墦鍗版鏁�
+        private void ReportPrintEnd2()
+        {
+            try
+            {
+                //sBarCode = "";
+                //for (int i = 0; i < grdSub.Rows.Count; i++)
+                //{
+                //    sBarCode = sBarCode + "," + DBUtility.ClsPub.isStrNull(grdSub.Rows[i].Cells[HTMCol].Value);
+                //}
+
+                //oWeb.getRunProc("exec h_p_Gy_BarCodePrintQty_Update '" + sBarCode + "'", ref DBUtility.ClsPub.sExeReturnInfo);
+                sBarCodeItemID = sBarCodeItemID.Remove(0, 1);
+                oWeb.getRunProc("update Gy_BarCodeBill_PrintQty set HPrintQty=isnull(HPrintQty,0)+1 where HBarCodeItemID in (" + sBarCodeItemID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
+            }
+            catch (Exception e)
+            {
+                MessageBox.Show("鎵撳嵃澶辫触!鎵撳嵃缁撴潫 锛�" + e.Message);
+            }
         }
 
         #endregion
@@ -3398,9 +3477,6 @@
             oGy_BarCodeBill_SNO.ShowDialog();
 
         }
-       
-
-        
 
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1