chenhaozhe
2025-06-26 94877ee81ae7e133b96c6d4934133e0cbae274cf
WarM/ÌõÂë´òÓ¡/Gy_CusBarCodeBill_KaiBei.cs
@@ -81,6 +81,7 @@
        public string sYear4 = "";         //年(4位)
        public string sPeriod = "";        //月
        public string sDay = "";           //日
        public string HBarCodeType = "超聚变内标签";   //条码类型
        #region å›ºå®šä»£ç 
@@ -514,7 +515,6 @@
                HCode2 = HCode2.ToUpper();
                string HCode3 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].Value);                 // ç‰ˆæœ¬å·
                string HBatchNoNumber = "";                                                                         // æ‰¹æ¬¡ç”Ÿæˆå‰ç¼€
                string HBarCodeType = "超聚变内标签";                                                               // æ¡ç ç±»åž‹
                string HInnerBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HInnerBillNoCol].Value);     // å®¢æˆ·è®¢å•号
                if (HMaterID != 0)
@@ -604,7 +604,6 @@
                Int64 HEntryID = 0;
                string HBarCode = "";       //条形码 
                string HBarCodeType = "";   //条码类型
                Int64 HMaterID = 0;         //物料ID
                Int64 HUnitID = 0;          //计量单位ID
                Int64 HAuxPropID = 0;       //辅助属性ID
@@ -682,7 +681,6 @@
                            HEntryID = j + 1;
                            HBarCode = TM.ToUpper();
                            HBarCodeType = "超聚变内标签";
                            HMaterID = ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value);
                            HUnitID = ClsPub.isLong(grdMain.Rows[j].Cells[HUnitIDCol].Value);
                            HAuxPropID = ClsPub.isLong(grdMain.Rows[j].Cells[HAuxPropIDCol].Value);
@@ -998,10 +996,17 @@
                                        grdMain.Rows[sRow].Cells[HMaterNumberCol].Value = oMater.omodel.HNumber;
                                        grdMain.Rows[sRow].Cells[HMaterNameCol].Value = oMater.omodel.HName;
                                        grdMain.Rows[sRow].Cells[HMaterModelCol].Value = oMater.omodel.HModel;
                                        grdMain.Rows[sRow].Cells[HMinQtyCol].Value = oMater.omodel.HQtyMin;
                                        grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = 0;
                                        grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = "";
                                        grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = "";
                                        if (HBarCodeType == "超聚变内标签")
                                        {
                                            grdMain.Rows[sRow].Cells[HMinQtyCol].Value =1;
                                        }
                                        else
                                        {
                                            grdMain.Rows[sRow].Cells[HMinQtyCol].Value = oMater.omodel.HQtyMin;
                                        }
                                        if (oUnit.GetInfoByID(oMater.omodel.HUnitID))
                                        {
                                            grdMain.Rows[sRow].Cells[HUnitIDCol].Value = oUnit.omodel.HItemID.ToString();
@@ -1385,6 +1390,12 @@
                return;
            }
            //打印前判断条码是否已打印过
            if (ReportPrintBegin())
            {
                return;
            }
            //选择打印模板
            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
            oFrm.sBillName = ModName;
@@ -1410,6 +1421,12 @@
                return;
            }
            //打印前判断条码是否已打印过
            if (ReportPrintBegin())
            {
                return;
            }
            //选择打印模板
            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
            oFrm.sBillName = ModName;
@@ -1426,6 +1443,30 @@
        #endregion
        //打印前判断条码是否超过允许可打印次数
        private bool ReportPrintBegin()
        {
            DataSet DS;
            if (HBarCodeType == "超聚变内标签")
            {
                DS = oCn.RunProcReturn("select top 1 1 from Gy_BarCodeBill_Cus with(nolock) where HPrintQty >=1 and HInterID = " + HInterID, "Gy_BarCodeBill_Cus");
                if (DS == null || DS.Tables[0].Rows.Count == 0)
                {
                    return false;
                }
                else
                {
                    MessageBox.Show("条码已打印,不允许再次打印!");
                    return true;
                }
            }
            else
            {
                return false;
            }
        }
        private void Sub_SetReport(string sOpenTmp)
        {
            //判断行数
@@ -1438,6 +1479,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);
        }
@@ -1468,6 +1510,16 @@
            }
        }
        //打印开始前判断
        private void ReportPrintBegin2()
        {
            //打印前判断条码是否已打印过
            if (ReportPrintBegin())
            {
                Report.AbortPrint();
            }
        }
        //打印结束后回填条码打印次数
        private void ReportPrintEnd()
        {