yusijie
2024-09-18 359be0508a24daeabe1e687265aa6783961d1221
WarM/ÌõÂë´òÓ¡/Gy_CusBarCodeBill_KaiBei.cs
@@ -78,7 +78,8 @@
        public Int64 HOrgID = ClsPub.HOrgID;
        public string HCusModel = "Z";     //厂商代码
        public string sDate = "";          //日期
        public string sYear = "";          //å¹´
        public string sYear = "";          //年(2位)
        public string sYear4 = "";         //年(4位)
        public string sPeriod = "";        //月
        public string sDay = "";           //日
@@ -450,6 +451,7 @@
            //日期获取方式
            sDate = dtpHDate.Value.ToShortDateString();
            sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
            sYear4 = ClsPub.isDate(sDate).Year.ToString();
            sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
            sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
            sDay = "0" + ClsPub.isDate(sDate).Day.ToString();
@@ -650,11 +652,14 @@
                double HSumQty = 0;         //产品数量
                double HMinQty = 0;         //最小包装数
                int HBQty = 0;              //箱数
                int LSH = 0;                //流水号
                int LSH = 0;                //内箱流水号
                int LWSH = 0;               //外箱流水号
                string LSH2 = "";           //流水号转换成字符
                string HCode1 = "";         //物料类别
                string HCode2 = "";         //批次位
                string HCode3 = "";         //版本号
                string sTMNumber = "";      //外箱条码前缀
                DataSet Ds;
                Int64 HEntryID = 0;
                string HBarCode = "";       //条形码 
@@ -699,11 +704,19 @@
                        {
                            //获取最大流水号
                            LSH = 0;
                            DataSet Ds = oCn.RunProcReturn("select top 1 HSno from Gy_BarCodeBill_Cus where HBatchNo='" + HBatchNo + "' order by HSno desc", "Gy_BarCodeBill_Cus");
                            Ds = oCn.RunProcReturn("select top 1 HSno from Gy_BarCodeBill_Cus where HBatchNo='" + HBatchNo + "' order by HSno desc", "Gy_BarCodeBill_Cus");
                            if (Ds != null && Ds.Tables[0].Rows.Count != 0)
                            {
                                LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                            }
                        }
                        //外箱码   ä¾›åº”商代码(浪潮定义的供应商代码)+8位日期(例如20230905)+5位流水码(纯数字)
                        else
                        {
                            //条码前缀 = ä¾›åº”商代码 + å¹´ + æœˆ + æ—¥
                            sTMNumber = HCusModel + sYear + sPeriod + sDay;
                            Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号
                            LWSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                        }
                        HBQty = ClsPub.isInt(grdMain.Rows[j].Cells[HBQtyCol].Value);
@@ -714,7 +727,7 @@
                        for (int i = 0; i < HBQty; i++)
                        {
                            pb1.Value = n+1;
                            pb1.Value = n+1;
                            if (HSumQty - HMinQty > 0)
                            {
                                HSumQty = HSumQty - HMinQty;
@@ -724,21 +737,27 @@
                                HMinQty = HSumQty;
                            }
                            //
                            LSH = LSH + 1;
                            LSH2 = ConvertToBase(LSH, 36);
                            while (LSH2.Length < LSHlen)  //如果流水号位数小于 LSHlen å‰é¢è¡¥0
                            {
                                LSH2 = "0" + LSH2;
                            }
                            if (cmbHBarCodeType.Text == "内箱码")
                            {
                                LSH = LSH + 1;
                                LSH2 = ConvertToBase(LSH, 36);
                                while (LSH2.Length < LSHlen)  //如果流水号位数小于 LSHlen å‰é¢è¡¥0
                                {
                                    LSH2 = "0" + LSH2;
                                }
                                //条码编号 = æ‰¹æ¬¡ + æµæ°´å· + ç‰ˆæœ¬å·
                                TM = HBatchNo + LSH2 + HCode3;
                            }
                            //外箱码
                            else
                            {
                                TM = HBatchNo;
                                LSH = 0;
                                LWSH = LWSH + 1;
                                LSH2 = LWSH.ToString();
                                while (LSH2.Length < 5)  //如果流水号位数小于 5 å‰é¢è¡¥0
                                {
                                    LSH2 = "0" + LSH2;
                                }
                                TM = sTMNumber + LSH2;
                            }
                            HEntryID = j + 1;
@@ -1332,6 +1351,7 @@
            grdMain.Rows[i].Cells[HISKFPERIODCol].Value = oTable.Rows[0]["HISKFPERIOD"].ToString();
            grdMain.Rows[i].Cells[HEXPUNITCol].Value = oTable.Rows[0]["HEXPUNIT"].ToString();
            grdMain.Rows[i].Cells[HEXPPERIODCol].Value = oTable.Rows[0]["HEXPPERIOD"].ToString();
            grdMain.Rows[i].Cells[HInnerBillNoCol].Value = oTable.Rows[0]["销售订单编号"].ToString();
            //--
            //设置可编辑列
            string sAllowCol = HQtyCol.ToString() +