1
zrg
2025-06-26 b891b1ca5af8e615ca68d5055e0babea5daa748b
WarM/ÌõÂë´òÓ¡/Gy_CusBarCodeBillList.cs
@@ -238,6 +238,7 @@
        GridppReport Report;
        int CurRows = 0;
        string sBarCodeItemID = ""; //条码自增列
        string HBarCodeType = "";   //条码类型
        //预览
        private void yl_Click(object sender, EventArgs e)
@@ -245,6 +246,12 @@
            //打印预览权限
            if (!DBUtility.ClsPub.Security_Log(ModRightNamePrint, 1, true, DBUtility.ClsPub.CurUserName))
            {
                return;
            }
            //打印前判断条码是否超过允许可打印次数
            if (ReportPrintBegin())
            {
                MessageBox.Show("所选条码中存在已打印的【超聚变内标签】条码,不允许再次打印!");
                return;
            }
@@ -269,6 +276,12 @@
            {
                return;
            }
            //打印前判断条码是否超过允许可打印次数
            if (ReportPrintBegin())
            {
                MessageBox.Show("所选条码中存在已打印的【超聚变内标签】条码,不允许再次打印!");
                return;
            }
            //选择打印模板
            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
@@ -280,6 +293,40 @@
                Sub_SetReport(oFrm.sOpenTmp);
                Report.Print(false);
                Thread.Sleep(1000);
            }
        }
        //打印前判断条码是否超过允许可打印次数
        private bool ReportPrintBegin()
        {
            sBarCodeItemID = "";
            for (int i = 0; i < grdMain.SelectedRows.Count; i++)
            {
                sBarCodeItemID = sBarCodeItemID + "," + DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[Fun_GetCol("HItemID")].Value).ToString();
                if(HBarCodeType != "超聚变内标签" && DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[Fun_GetCol("条码类型")].Value)== "超聚变内标签")
                {
                    HBarCodeType = "超聚变内标签";
                }
            }
            sBarCodeItemID = sBarCodeItemID.Remove(0, 1);
            if (HBarCodeType == "超聚变内标签")
            {
                DataSet DS;
                DS = oCn.RunProcReturn("select top 1 1 from Gy_BarCodeBill_Cus with(nolock) where HPrintQty >=1 and HBarCodeType = '超聚变内标签' and HItemID in (" + sBarCodeItemID + ")", "Gy_BarCodeBill_Cus");
                if (DS == null || DS.Tables[0].Rows.Count == 0)
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }
            else
            {
                return false;
            }
        }
@@ -299,6 +346,7 @@
            Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + sOpenTmp + ".grf");  //here .
            Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
            Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
            Report.PrintBegin += new _IGridppReportEvents_PrintBeginEventHandler(ReportPrintBegin2);
            Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
        }
@@ -331,6 +379,17 @@
            }
        }
        //打印开始前判断
        private void ReportPrintBegin2()
        {
            //打印前判断条码是否已打印过
            if (ReportPrintBegin())
            {
                MessageBox.Show("条码已打印,不允许再次打印!");
                Report.AbortPrint();
            }
        }
        //打印结束后回填条码打印次数
        private void ReportPrintEnd()
        {