zzr99
2022-07-28 acb7c8de21c66ded398cc52a9e6be712b85d50e8
WarM/ÌõÂë´òÓ¡/Sc_ICMOToBarCode.cs
@@ -41,6 +41,7 @@
        public Int64 HInterID_TTM = 0;
        public string HBillNo_TTM = "";
        ClsCN SubCn = new ClsCN();
        Pub_Class.ClsGridViewSum oSumGrid = new Pub_Class.ClsGridViewSum();
        //
        private void initGrid()
        {
@@ -216,6 +217,7 @@
        {
            //
            //frmCondition = new frmBillQueryCondition_New();
            oSumGrid.ogrdMain = grdMain;
            this.Text = ModCaption;
            //lblCaption.Text = ModCaption;
            initGrid();
@@ -787,13 +789,49 @@
                string WeiShu = "";         //尾数
                int LSHlen = 6;             //流水号长度
                string TM = "";             //条码
                string sPackBarCode = "";
                //HDate = dtpHBeginDate.Value.ToShortDateString();
                //HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
                //HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
                //HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
                //HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
                //HDay = HDay.Substring(HDay.Length - 2, 2);
                HDate = dtpHBeginDate.Value.ToShortDateString();
                HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
                HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
                HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
                HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
                HDay = HDay.Substring(HDay.Length - 2, 2);
                    HDate = dtpHBeginDate.Value.ToShortDateString();
                    DataSet DSet1 = oCn.RunProcReturn("select * from Gy_FactoryDayOff Where HFactoryDayOffDate='" + HDate.ToString() + "'", "Gy_FactoryDayOff", ref DBUtility.ClsPub.sExeReturnInfo);
                    //生成首行标题
                    if (DSet1 == null || DSet1.Tables[0].Rows.Count == 0)
                    {
                        HDate = DateTime.Now.ToShortDateString();
                        HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
                        HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
                        HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
                        HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
                        HDay = HDay.Substring(HDay.Length - 2, 2);
                        long HTMaterID = 0;
                        HTMaterID = ClsPub.isLong(grdMain.Rows[0].Cells[Fun_GetCol("HMaterID")].Value);
                        string sPackStr = "ZXM" + HYear + HPeriod + HDay + HTMaterID; //外箱码 å‰ç¼€
                        DataSet DsTM = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号                                                                                          //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                        Int64 TTM_LSH = ClsPub.isInt(DsTM.Tables[0].Rows[0][0]) + 1;
                        sPackBarCode = sPackStr + TTM_LSH.ToString();
                        oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
                    }
                    else
                    {
                    HDate = DBUtility.ClsPub.isStrNull(DSet1.Tables[0].Rows[0]["HNoFactoryDayOffDate"]);
                    HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
                    HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
                    HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
                    HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
                    HDay = HDay.Substring(HDay.Length - 2, 2);
                    long HTMaterID = 0;
                    HTMaterID = ClsPub.isLong(grdMain.Rows[0].Cells[Fun_GetCol("HMaterID")].Value);
                    string sPackStr = "ZXM" + HYear + HPeriod + HDay + HTMaterID; //外箱码 å‰ç¼€
                    DataSet DsTM = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号                                                                                          //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                    Int64 TTM_LSH = ClsPub.isInt(DsTM.Tables[0].Rows[0][0]) + 1;
                    sPackBarCode = sPackStr + TTM_LSH.ToString() + "+" ;
                    oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
                    }
                //=============根据界面上已经分配的数据进行条码生成和打印。
                //获取本次生成的 ä¸»å†…码 
@@ -807,13 +845,13 @@
                //00 å…ˆç”Ÿæˆ å”¯ä¸€çš„ æ‰˜æ¡ç 
                //生成一个外箱码
                long HTMaterID = 0;
                HTMaterID = ClsPub.isLong(grdMain.Rows[0].Cells[Fun_GetCol("HMaterID")].Value);
                string sPackStr = "ZXM" + HYear + HPeriod + HDay + HTMaterID; //外箱码 å‰ç¼€
                DataSet  DsTM = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号                                                                                          //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                Int64 TTM_LSH = ClsPub.isInt(DsTM.Tables[0].Rows[0][0]) + 1;
                string sPackBarCode = sPackStr + TTM_LSH.ToString();
                oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
                //long HTMaterID = 0;
                //HTMaterID = ClsPub.isLong(grdMain.Rows[0].Cells[Fun_GetCol("HMaterID")].Value);
                //string sPackStr = "ZXM" + HYear + HPeriod + HDay + HTMaterID; //外箱码 å‰ç¼€
                //DataSet  DsTM = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号                                                                                          //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                //Int64 TTM_LSH = ClsPub.isInt(DsTM.Tables[0].Rows[0][0]) + 1;
                //string sPackBarCode = sPackStr + TTM_LSH.ToString();
                //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
                //MessageBox.Show("11");
@@ -947,7 +985,7 @@
                }
                //2.循环结束后,根据 æœ¬æ¬¡ç”Ÿæˆçš„ ä¸»å†…码,从后台数据库获取 æ¡ç åˆ—表,生成 ç»„托单 å’Œ æ‰˜æ¡ç ï¼Œ ç›´æŽ¥è°ƒç”¨å­˜å‚¨è¿‡ç¨‹ 
                 //根据外箱码 å†™å…¥ ç»„托单主表,组托单子表,SUM,外箱码档案,SUM档案
                oCn.RunProc("exec  h_p_WMS_PackUnionBill_AddNew  '" + sPackBarCode + "'," + HInterID_TTM.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //根据箱条码,写入 ä¸»è¡¨ï¼Œå­è¡¨ ï¼Œç®±æ¡ç æ¡£æ¡ˆ
                oCn.RunProc("exec  h_p_WMS_PackUnionBill_AddNew  '" + sPackBarCode + "'," + HInterID_TTM.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "','" + HDate + "'," + HInterID.ToString()); //根据箱条码,写入 ä¸»è¡¨ï¼Œå­è¡¨ ï¼Œç®±æ¡ç æ¡£æ¡ˆ
                oCn.RunProc("exec  h_p_WMS_PackUnionBill_SumSubBill  " + HInterID_TTM.ToString() + ",'" + sPackBarCode + "','3783','" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //根据箱条码,写入 SUM表,SUM条码档案
@@ -1053,6 +1091,7 @@
            bool flag = this.txtHZXQty.Text.Trim() != "";
            double num;
            double HICMOQty = 0;
            if (flag)
            {
                num = Pub_Class.ClsPub.isDoule(this.txtHZXQty.Text);
@@ -1070,6 +1109,17 @@
            {
                for (int i = 0; i < this.grdMain.Rows.Count; i++)
                {
                    for (int i1 = 0; i1 < this.grdMain.Rows.Count; i1++)
                    {
                        HICMOQty += Pub_Class.ClsPub.isDoule(this.grdMain.Rows[i1].Cells["生产订单数量"].Value);
                    }
                    if (HICMOQty < num)
                    {
                        MessageBox.Show("请点击超额生产按钮生成条码!");
                        break;
                    }
                    bool flag3 = num > 0.0;
                    if (!flag3)
                    {
@@ -1312,9 +1362,49 @@
                }
                if (cmbHBarCodeType.Text == "唯一条码")
                {
                    //条码编号 = æ¡ç å‰ç¼€ + æµæ°´å·
                    TM = HTMNumber + LSH2;
                    HDate = DateTime.Now.ToShortDateString();
                    DataSet DSet = oCn.RunProcReturn("select * from Gy_FactoryDayOff Where HFactoryDayOffDate='" + HDate.ToString() + "'", "Gy_FactoryDayOff", ref DBUtility.ClsPub.sExeReturnInfo);
                    //生成首行标题
                    if (DSet == null || DSet.Tables[0].Rows.Count == 0)
                    {
                        HDate = DateTime.Now.ToShortDateString();
                        HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
                        HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
                        HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
                        HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
                        HDay = HDay.Substring(HDay.Length - 2, 2);
                        HTMNumber = HOrgNumber + HMaterNumber + HYear + HPeriod + HDay;
                        Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HTMNumber + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号
                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                        TM = HTMNumber + LSH2;
                    }
                    else
                    {
                        HDate = DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[0]["HNoFactoryDayOffDate"]);
                        HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
                        HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
                        HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
                        HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
                        HDay = HDay.Substring(HDay.Length - 2, 2);
                        HTMNumber = HOrgNumber + HMaterNumber + HYear + HPeriod + HDay;
                        Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HTMNumber + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号
                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                        TM = HTMNumber + LSH2 + "+";
                    }
                    //HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
                    //HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
                    //HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
                    //HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
                    //HDay = HDay.Substring(HDay.Length - 2, 2);
                    //HTMNumber = HOrgNumber + HMaterNumber + HYear + HPeriod + HDay;
                    //Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HTMNumber + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号
                    //LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                }
                //if (cmbHBarCodeType.Text == "唯一条码")
                //{
                //    //条码编号 = æ¡ç å‰ç¼€ + æµæ°´å·
                //    TM = HTMNumber + LSH2;
                //}
                if (TM.Trim() == "")
                {
                    MessageBox.Show("条形码不能为空,不能生成条码!");