jingh
2021-12-30 3c434584c37880246ca5defe7defeba64036b456
博日夏宝条码完善
1个文件已修改
81 ■■■■■ 已修改文件
WarM/条码打印/Gy_BarCodeBill.cs 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WarM/ÌõÂë´òÓ¡/Gy_BarCodeBill.cs
@@ -785,7 +785,7 @@
                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                        LSHlen = 4;
                    }
                    else if (cmbHBarCodeType.Text == "仪器成品条码规则")
                    else if (cmbHBarCodeType.Text == "仪器成品条码规则") //另外处理了
                    {
                        //物料编码+序列号+生产日期
                        //sTMNumber = HMaterNumber + sYear + sPeriod + sDay;
@@ -806,7 +806,7 @@
                    {
                        //制造本部1位(默认1)+机型代码5位()+å¹´2位+月1位(A、B、C代替10月份)
                        //+日2位+条码批次码2位+压缩机代码1位+00+流水号4位+校验码(默认0)
                        sTMNumber = "1" + HModelName + sYear + Sub_PeriodChange(sPeriod) + sDay + HBarCodeBatchNo + HYasuoji;
                        sTMNumber = "1" + HModelName + sYear + Sub_PeriodChange(sPeriod) + sDay + HBarCodeBatchNo + HYasuoji + "00" ;
                        Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号
                                                                                                                    //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
@@ -875,7 +875,16 @@
                            //条码编号 = æ¡ç å‰ç¼€ + æµæ°´å·
                            TM = sTMNumber + LSH2;
                        }
                        else if(cmbHBarCodeType.Text == "仪器外购件条码普通规则" || cmbHBarCodeType.Text == "试剂成品条码规则"
                            || cmbHBarCodeType.Text == "半成品条码" || cmbHBarCodeType.Text == "外销机条码")
                        {
                            TM = sTMNumber + LSH2;
                        }
                        else if (cmbHBarCodeType.Text == "内销机条码")
                        {
                            TM = sTMNumber + LSH2 + "0";
                        }
                        //
                        if (i + 1 > grdSub.Rows.Count)
                        {
                            grdSub.RowCount = grdSub.RowCount + 1;
@@ -1113,7 +1122,8 @@
        }
        //生成条码 åšæ—¥ //物料编码+序列号+生产日期
        //生成条码 åšæ—¥
        //物料编码+序列号+生产日期
        private void SaveBarCode_bori() 
        {
            grdSub.Rows.Clear();
@@ -1127,7 +1137,7 @@
            int HBQty = 0;              //箱数
            double HQty = 0;            //数量
            string WeiShu = "";         //尾数
            int LSH = 0;                //流水号
            //int LSH = 0;                //流水号
            string LSH2 = "";           //流水号转换成字符
            string sDate = "";          //日期
            string sYear = "";          //å¹´
@@ -1161,25 +1171,36 @@
                    sDay = "0" + ClsPub.isDate(sDate).Day.ToString();
                    sDay = sDay.Substring(sDay.Length - 2, 2);
                    //==================================
                    if (cmbHBarCodeType.Text == "唯一条码")
                    {
                        //条码前缀 = ç»„织代码 + ç‰©æ–™ä»£ç  + å¹´ + æœˆ + æ—¥
                        sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay;
                        Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号
                        //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                    }
                    else
                    {
                        MessageBox.Show("错误的条码类型,不能生成条码!");
                        return;
                    }
                    //if (cmbHBarCodeType.Text == "试剂成品条码规则")
                    //{
                    //    //条码前缀 = ç»„织代码 + ç‰©æ–™ä»£ç  + å¹´ + æœˆ + æ—¥
                    //sTMNumber = HMaterNumber + HNumber + sYear + sPeriod + sDay;
                    //    Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号
                    //    //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                    //    LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                    //}
                    //else
                    //{
                    //    MessageBox.Show("错误的条码类型,不能生成条码!");
                    //    return;
                    //}
                    HBQty = HBQty + ClsPub.isInt(grdMain.Rows[j].Cells[HBQtyCol].Value);
                    HMinQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value);
                    HSumQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value);
                    n = 0;
                    for (int i = k; i < HBQty; i++)
                    //从金蝶序列号表获取序列号
                    DataSet DSet = oCn.RunProcReturn("exec h_p_CLD_GetBarCodeSno  "+ ClsPub.isStrNull(grdMain.Rows[j].Cells[HMainIDCol].Value) + "," + ClsPub.isStrNull(grdMain.Rows[j].Cells[HSubIDCol].Value) + "  ", "h_p_CLD_GetBarCodeSno", ref DBUtility.ClsPub.sExeReturnInfo);
                    //生成首行标题
                    if (DSet == null)
                    {
                        MessageBox.Show("没有返回任何结果,金蝶云序列号不存在!" + DBUtility.ClsPub.sExeReturnInfo);
                        continue;
                    }
                    //
                    for (int i = k; i < DSet.Tables[0].Rows.Count; i++)
                    //for (int i = k; i < HBQty; i++)
                    {
                        if (HSumQty - HMinQty > 0)
                        {
@@ -1199,17 +1220,17 @@
                            HMinQty = HSumQty;
                        }
                        //
                        LSH = LSH + 1;
                        LSH2 = LSH.ToString();
                        while (LSH2.Length < LSHlen)  //如果流水号小于6位数前面补0
                        {
                            LSH2 = "0" + LSH2;
                        }
                        if (cmbHBarCodeType.Text == "唯一条码")
                        {
                        //LSH = LSH + 1;
                        LSH2 =DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[n]["SHNO"]);
                        //while (LSH2.Length < LSHlen)  //如果流水号小于6位数前面补0
                        //{
                        //    LSH2 = "0" + LSH2;
                        //}
                        //if (cmbHBarCodeType.Text == "唯一条码")
                        //{
                            //条码编号 = æ¡ç å‰ç¼€ + æµæ°´å·
                            TM = sTMNumber + LSH2;
                        }
                            TM = HMaterNumber + LSH2 + sYear + sPeriod + sDay ;
                        //}
                        if (i + 1 > grdSub.Rows.Count)
                        {
@@ -1283,7 +1304,7 @@
                        grdSub.Rows[i].Cells[HGiveAwayFlag2Col] = oCell;
                        k = k + 1;
                        n = n + 1;
                        oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                        //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                    }
                }
            }