duhe
2024-05-05 62a125536867798e695acb5743598345540266d8
条码自动生成:根据产品当天的生产数获取产品条码的最大流水号
1个文件已修改
1个文件已添加
50 ■■■■■ 已修改文件
LMES/bin/x86/Debug.zip 补丁 | 查看 | 原始文档 | blame | 历史
WarM/条码打印/Gy_BarCodeBill_automaticallyByPLC_New.cs 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LMES/bin/x86/Debug.zip
Binary files differ
WarM/ÌõÂë´òÓ¡/Gy_BarCodeBill_automaticallyByPLC_New.cs
@@ -966,28 +966,40 @@
            string LIU = "";
            int LEN = 4;
            //获取当日本产品条码编号最大的记录
            DataSet ds;
            string sql = "select * from h_v_IF_BarCodeBillList Where HMaterID = " + grdMain.Rows[0].Cells[HMaterIDCol].Value + " and HSTOCKORGID = " + HOrgID + " and CONVERT(varchar(100),条码日期, 23) = '" + HDate + "' order by æ¡ç ç¼–号 desc";
            ds = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList");
            if (ds != null)
            //获取产品条码备份表中当日本产品条码编号最大的记录
            long HMaxNo_Bak = 0;                //记录产品条码备份表中当日本产品条码编号最大的记录的条码编号的流水号
            DataSet ds1;
            string sql1 = "select * from Gy_BarCodeBill_SWELL_SubBarCodeBill Where HMaterID = " + grdMain.Rows[0].Cells[HMaterIDCol].Value + " and HSTOCKORGID = " + HOrgID + " and CONVERT(varchar(100),HBarCodeDate, 23) = '" + HDate + "' and HInterID <>0 order by HBarCode desc";
            ds1 = oCn.RunProcReturn(sql1, "Gy_BarCodeBill_SWELL_SubBarCodeBill");
            if (ds1 != null && ds1.Tables[0].Rows.Count>0)
            {
                long count = 0;
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string HBarCodeMaxNo = ds.Tables[0].Rows[0]["条码编号"].ToString();
                    HBarCodeMaxNo = HBarCodeMaxNo.Substring(HBarCodeMaxNo.Length - LEN, LEN);
                    count = ClsPub.isLong(HBarCodeMaxNo);
                }
                LIU += count + 1;
                while (LIU.Length < LEN)  //如果流水号小于6位数前面补0
                {
                    LIU = "0" + LIU;
                }
                string HBarCodeMaxNo = ds1.Tables[0].Rows[0]["HBarCode"].ToString();
                HBarCodeMaxNo = HBarCodeMaxNo.Substring(HBarCodeMaxNo.Length - LEN, LEN);
                HMaxNo_Bak = ClsPub.isLong(HBarCodeMaxNo);
            }
            else
            ////获取条码档案中当日本产品条码编号最大的记录
            long HMaxNo = 0;                //记录条码档案中当日本产品条码编号最大的记录的条码编号的流水号
            DataSet ds;
            string sql = "select * from h_v_IF_BarCodeBillList Where HMaterID = " + grdMain.Rows[0].Cells[HMaterIDCol].Value + " and HSTOCKORGID = " + HOrgID + " and CONVERT(varchar(100),条码日期, 23) = '" + HDate + "' and HInterID <> 0 order by æ¡ç ç¼–号 desc";
            ds = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList");
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                return "";
                string HBarCodeMaxNo = ds.Tables[0].Rows[0]["条码编号"].ToString();
                HBarCodeMaxNo = HBarCodeMaxNo.Substring(HBarCodeMaxNo.Length - LEN, LEN);
                HMaxNo = ClsPub.isLong(HBarCodeMaxNo);
            }
            //获取当日本产品 åœ¨æ¡ç æ¡£æ¡ˆå’Œäº§å“æ¡ç å¤‡ä»½è¡¨ä¸­ æœ€å¤§çš„æµæ°´å·
            long count = 0;
            count = HMaxNo >= HMaxNo_Bak ? HMaxNo : HMaxNo_Bak;
            //为流水号前面补零
            LIU += count + 1;
            while (LIU.Length < LEN)  //如果流水号小于6位数前面补0
            {
                LIU = "0" + LIU;
            }
            //拼接批号