yxj
7 天以前 92d1a0d613fa5d063c9bd496563d06632382aa98
新增凯贝立讯客户条码生成规则
1个文件已修改
171 ■■■■■ 已修改文件
WarM/条码打印/Gy_CusBarCodeBill_KaiBei_LangChao.cs 171 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WarM/ÌõÂë´òÓ¡/Gy_CusBarCodeBill_KaiBei_LangChao.cs
@@ -68,7 +68,7 @@
        public const Int16 HCusModelCol = 46;
        //
        public  string ModName = "85";
        public  string ModCaption = "浪潮、元脑、顺达客户标签生成";
        public  string ModCaption = "浪潮、元脑、顺达、立讯客户标签生成";
        public const string ModRightName = "Gy_CusBarCodeBill_KaiBei_LangChao";
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
@@ -82,7 +82,8 @@
        public Int64 HOrgID = ClsPub.HOrgID;
        public string HCS = "Z";           //厂商代码
        public string sDate = "";          //日期
        public string sYear = "";          //年(2位)
        public string sYear = "";          //å¹´
        public string sYear2 = "";         //年(2位)
        public string sYear4 = "";         //年(4位)
        public string sPeriod = "";        //月
        public string sPeriod2 = "";       //月(正常)
@@ -458,6 +459,7 @@
            //日期获取方式
            sDate = dtpHDate.Value.ToShortDateString();
            sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
            sYear2 = 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);
@@ -578,6 +580,10 @@
                double HWMinQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[HWMinQtyCol].Value);               // å¤–箱最小包装数
                string HCusModelName = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelNameCol].Value);   // å®¢æˆ·æ–™å·
                string HCode1 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode1Col].Value);                 // ç‰©æ–™ç±»åˆ«
                if (cmbHCusName.Text.Contains("达创精密智造"))
                {
                    HCode1 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value);                 // æ‰¹å·
                }
                string HCode2 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode2Col].Value);                 // æ‰¹æ¬¡ä½
                HCode2 = HCode2.ToUpper();
                string HCode3 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].Value);                 // ç‰ˆæœ¬å·
@@ -730,43 +736,56 @@
                        long sHMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value);                  // ç‰©æ–™å†…码
                        string sHMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNumberCol].Value);     // ç‰©æ–™ä»£ç 
                        string sHCusModelName = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelNameCol].Value);   // å®¢æˆ·æ–™å·
                        string sHCode1 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode1Col].Value);                 // ç‰©æ–™ç±»åˆ«
                        string sHCode2 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode2Col].Value);                 // æ‰¹æ¬¡ä½
                        sHCode2 = sHCode2.ToUpper();
                        string HBatchNoNumber = sHCode1 + sYear + sPeriod + sDay + HCS;                                      // æ‰¹æ¬¡ç”Ÿæˆå‰ç¼€
                        HBatchNoNumber = HBatchNoNumber.ToUpper();
                        DataSet oDsBatchNo = oCn.RunProcReturn("exec h_p_Gy_CusBarCodeBill_KaiBeiLC_GetBatchNo '" + sHSourceBillNo + "'," + sHMaterID.ToString() + ",'" + sHMaterNumber + "','" + sHCusModelName + "','" + sHCode2 + "','" + HBatchNoNumber + "'", "h_p_Gy_CusBarCodeBill_KaiBeiLC_GetBatchNo");
                        //
                        if (oDsBatchNo == null && oDsBatchNo.Tables[0].Rows.Count == 0)
                        if (cmbHCusName.Text.Contains("达创精密智造"))
                        {
                            MessageBox.Show("获取批次失败!");
                            bc.Enabled = true;
                            oCn.RollBack();
                            return;
                            //获取最大流水号
                            //条码前缀 = å®¢æˆ·ç‰©æ–™å¯¹åº”表中客户产品编码+供应商代码(固定'0001010121')+年月日(YYMMDD)
                            sTMNumber = sHCusModelName + "0001010121" + sYear2 + sPeriod2 + sDay;
                            Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号
                            LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                        }
                        else if (DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0][0]) == "1")
                        {
                            MessageBox.Show(DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HRemark"]));
                            bc.Enabled = true;
                            oCn.RollBack();
                            return;
                        }
                        //浪潮、元脑、顺达
                        else
                        {
                            grdMain.Rows[j].Cells[HBaNoCol].Value = sHCode2;
                            grdMain.Rows[j].Cells[HBatchNoCol].Value = DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HBatchNo"]);
                            grdMain.Rows[j].Cells[HCode2Col].Value = DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HCode2"]);
                        }
                            string sHCode1 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode1Col].Value);                 // ç‰©æ–™ç±»åˆ«
                            string sHCode2 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode2Col].Value);                 // æ‰¹æ¬¡ä½
                            sHCode2 = sHCode2.ToUpper();
                            string HBatchNoNumber = sHCode1 + sYear + sPeriod + sDay + HCS;                                      // æ‰¹æ¬¡ç”Ÿæˆå‰ç¼€
                            HBatchNoNumber = HBatchNoNumber.ToUpper();
                        HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value);
                        HCode3 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].Value);
                        //获取最大流水号
                        LSH = 0;
                        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.isLong(Ds.Tables[0].Rows[0][0]);
                            DataSet oDsBatchNo = oCn.RunProcReturn("exec h_p_Gy_CusBarCodeBill_KaiBeiLC_GetBatchNo '" + sHSourceBillNo + "'," + sHMaterID.ToString() + ",'" + sHMaterNumber + "','" + sHCusModelName + "','" + sHCode2 + "','" + HBatchNoNumber + "'", "h_p_Gy_CusBarCodeBill_KaiBeiLC_GetBatchNo");
                            //
                            if (oDsBatchNo == null && oDsBatchNo.Tables[0].Rows.Count == 0)
                            {
                                MessageBox.Show("获取批次失败!");
                                bc.Enabled = true;
                                oCn.RollBack();
                                return;
                            }
                            else if (DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0][0]) == "1")
                            {
                                MessageBox.Show(DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HRemark"]));
                                bc.Enabled = true;
                                oCn.RollBack();
                                return;
                            }
                            else
                            {
                                grdMain.Rows[j].Cells[HBaNoCol].Value = sHCode2;
                                grdMain.Rows[j].Cells[HBatchNoCol].Value = DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HBatchNo"]);
                                grdMain.Rows[j].Cells[HCode2Col].Value = DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HCode2"]);
                            }
                            HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value);
                            HCode3 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].Value);
                            //获取最大流水号
                            LSH = 0;
                            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.isLong(Ds.Tables[0].Rows[0][0]);
                            }
                        }
                        HBQty = ClsPub.isInt(grdMain.Rows[j].Cells[HBQtyCol].Value);
@@ -791,23 +810,37 @@
                            {
                                LSH2 = "0" + LSH2;
                            }
                            //条码编号 = æ‰¹æ¬¡ + æµæ°´å· + ç‰ˆæœ¬å·
                            TM = HBatchNo + LSH2 + HCode3;
                            HEntryID = j + 1;
                            HBarCode = TM.ToUpper();
                            if(cmbHCusName.Text.Contains("元脑"))
                            if (cmbHCusName.Text.Contains("达创精密智造"))
                            {
                                TM = sTMNumber + LSH2;
                                HBarCodeType = "立讯内箱码";
                                HSno = 0;
                            }
                            else if (cmbHCusName.Text.Contains("元脑"))
                            {
                                //条码编号 = æ‰¹æ¬¡ + æµæ°´å· + ç‰ˆæœ¬å·
                                TM = HBatchNo + LSH2 + HCode3;
                                HBarCodeType = "元脑内箱码";
                                HSno = LSH;
                            }
                            else if (cmbHCusName.Text.Contains("顺达"))
                            {
                                //条码编号 = æ‰¹æ¬¡ + æµæ°´å· + ç‰ˆæœ¬å·
                                TM = HBatchNo + LSH2 + HCode3;
                                HBarCodeType = "顺达内箱码";
                                HSno = LSH;
                            }
                            else
                            {
                                //条码编号 = æ‰¹æ¬¡ + æµæ°´å· + ç‰ˆæœ¬å·
                                TM = HBatchNo + LSH2 + HCode3;
                                HBarCodeType = "内箱码";
                                HSno = LSH;
                            }
                            HEntryID = j + 1;
                            HBarCode = TM.ToUpper();
                            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);
@@ -831,7 +864,6 @@
                            HCode1 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode1Col].Value).ToUpper();
                            HCode2 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode2Col].Value).ToUpper();
                            HCode3 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].Value).ToUpper();
                            HSno = LSH;
                            HBoxNo = HCode1 + sYear + sPeriod + sDay + HCS;
                            HBoxNo = HBoxNo.ToUpper();
                            sHBaNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[HBaNoCol].Value);                        // ç•Œé¢ä¸Šè¾“入的批次位
@@ -876,6 +908,7 @@
                    {
                        HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value);
                        HCode3 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].Value);
                        HCusModelName = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelNameCol].Value);
                        if (cmbHCusName.Text.Contains("元脑"))
                        {
                            LWSHlen = 5;
@@ -896,6 +929,17 @@
                            Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号
                            LWSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                        }
                        else if (cmbHCusName.Text.Contains("达创精密智造"))
                        {
                            LWSHlen = 6;
                            HBarCodeType = "立讯外箱码";
                            //获取最大流水号
                            //条码前缀 = å®¢æˆ·ç‰©æ–™å¯¹åº”表中客户产品编码+年月日(YYMMDD)
                            sTMNumber = HCusModelName + sYear2 + sPeriod2 + sDay;
                            Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号
                            LWSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                        }
                        //浪潮
                        else
                        {
                            LWSHlen = 5;
@@ -938,7 +982,6 @@
                            HAuxPropID = ClsPub.isLong(grdMain.Rows[j].Cells[HAuxPropIDCol].Value);
                            HQty = HWMinQty;
                            HCusID = ClsPub.isLong(cmbHCusName.SelectedValue);
                            HCusModelName = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelNameCol].Value);
                            HCusModel = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelCol].Value);
                            HGiveAwayFlag = ClsPub.isBool(grdMain.Rows[j].Cells[HGiveAwayFlagCol].Value);
                            HISKFPERIOD = ClsPub.isBool(grdMain.Rows[j].Cells[HISKFPERIODCol].Value);
@@ -1014,7 +1057,7 @@
        private void Display()
        {
            //刷新内箱码列表
            DataSet DSet = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_CusList where HInterID=" + HInterID.ToString() + " and (条码类型='内箱码' or æ¡ç ç±»åž‹='元脑内箱码' or æ¡ç ç±»åž‹='顺达内箱码') order by HItemID", "h_v_Gy_BarCodeBill_CusList", ref DBUtility.ClsPub.sExeReturnInfo);
            DataSet DSet = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_CusList where HInterID=" + HInterID.ToString() + " and æ¡ç ç±»åž‹ in ('内箱码','元脑内箱码','顺达内箱码','立讯内箱码') order by HItemID", "h_v_Gy_BarCodeBill_CusList", ref DBUtility.ClsPub.sExeReturnInfo);
            //生成首行标题
            if (DSet == null)
            {
@@ -1025,7 +1068,7 @@
            grdSub.DataSource = DSet.Tables[0].DefaultView;
            //刷新外箱码列表
            DataSet DWSet = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_CusList where HInterID=" + HInterID.ToString() + " and (条码类型='外箱码' or æ¡ç ç±»åž‹='元脑外箱码' or æ¡ç ç±»åž‹='顺达外箱码') order by HItemID", "h_v_Gy_BarCodeBill_CusList", ref DBUtility.ClsPub.sExeReturnInfo);
            DataSet DWSet = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_CusList where HInterID=" + HInterID.ToString() + " and æ¡ç ç±»åž‹ in ('外箱码','元脑外箱码','顺达外箱码','立讯外箱码') order by HItemID", "h_v_Gy_BarCodeBill_CusList", ref DBUtility.ClsPub.sExeReturnInfo);
            //生成首行标题
            if (DWSet == null)
            {
@@ -1591,18 +1634,34 @@
            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() +
                                "," + HMinQtyCol.ToString() +
                                "," + HWMinQtyCol.ToString() +
                                "," + HAuxPropNumberCol.ToString() +
                                "," + HCusModelNameCol.ToString() +
                                "," + HCusModelCol.ToString() +
                                //"," + HCode1Col.ToString() +
                                //"," + HCode2Col.ToString() +
                                //"," + HCode3Col.ToString() +
                                "," + HInnerBillNoCol.ToString() +
                                "," + HRemarkCol.ToString();
            string sAllowCol = HRemarkCol.ToString();
            if (cmbHCusName.Text.Contains("达创精密智造"))
            {
                sAllowCol = HQtyCol.ToString() +
                                    "," + HMinQtyCol.ToString() +
                                    "," + HWMinQtyCol.ToString() +
                                    "," + HAuxPropNumberCol.ToString() +
                                    "," + HCusModelNameCol.ToString() +
                                    "," + HCusModelCol.ToString() +
                                    "," + HBatchNoCol.ToString() +
                                    "," + HInnerBillNoCol.ToString() +
                                    "," + HRemarkCol.ToString();
            }
            else
            {
                //设置可编辑列
                sAllowCol = HQtyCol.ToString() +
                                    "," + HMinQtyCol.ToString() +
                                    "," + HWMinQtyCol.ToString() +
                                    "," + HAuxPropNumberCol.ToString() +
                                    "," + HCusModelNameCol.ToString() +
                                    "," + HCusModelCol.ToString() +
                                    //"," + HCode1Col.ToString() +
                                    //"," + HCode2Col.ToString() +
                                    //"," + HCode3Col.ToString() +
                                    "," + HInnerBillNoCol.ToString() +
                                    "," + HRemarkCol.ToString();
            }
            grdMain.Columns[HBillNoCol].ReadOnly = true;
            //设置合计列
            string sTotalCol = HQtyCol.ToString();
@@ -1772,7 +1831,7 @@
        {
            try
            {
                oCn.RunProc("update Gy_BarCodeBill_Cus set HPrintQty=isnull(HPrintQty,0)+1 where HBarCodeType in ('内箱码','元脑内箱码','顺达内箱码') and HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.RunProc("update Gy_BarCodeBill_Cus set HPrintQty=isnull(HPrintQty,0)+1 where HBarCodeType in ('内箱码','元脑内箱码','顺达内箱码','立讯内箱码') and HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
            }
            catch (Exception e)
            {
@@ -1887,7 +1946,7 @@
        {
            try
            {
                oCn.RunProc("update Gy_BarCodeBill_Cus set HPrintQty=isnull(HPrintQty,0)+1 where HBarCodeType in ('外箱码','元脑外箱码','顺达外箱码') and HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.RunProc("update Gy_BarCodeBill_Cus set HPrintQty=isnull(HPrintQty,0)+1 where HBarCodeType in ('外箱码','元脑外箱码','顺达外箱码','立讯外箱码') and HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
            }
            catch (Exception e)
            {