zzr99
2022-01-11 7a721992346f308fc844c90e14092c6a02347a84
Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
2个文件已修改
211 ■■■■ 已修改文件
DAL/源单/InterFace源单/Cls_S_IF_POInStockBillList.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WarM/条码打印/Gy_BarCodeBill.cs 209 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/Ô´µ¥/InterFaceÔ´µ¥/Cls_S_IF_POInStockBillList.cs
@@ -16,7 +16,7 @@
            base.mvarItemKey = "1103";
            base.sCondtion = "  ";
            base.sOrderSql = "  order by å•据号 desc,hsubid ";
            base.sKeyCol = "供应商";
            base.sKeyCol = "HOrgID";
        }
    }
WarM/ÌõÂë´òÓ¡/Gy_BarCodeBill.cs
@@ -43,42 +43,43 @@
        public const Int16 HQtyCol = 22;
        public const Int16 HMinQtyCol = 23;
        public const Int16 HBQtyCol = 24;
        public const Int16 HDeptIDCol = 25;
        public const Int16 HDeptNumberCol = 26;
        public const Int16 HDeptNameCol = 27;
        public const Int16 HSourceIDCol = 28;
        public const Int16 HSourceNumberCol = 29;
        public const Int16 HSourceNameCol = 30;
        public const Int16 HDateCol = 31;
        public const Int16 HEndDateCol = 32;
        public const Int16 HSupIDCol = 33;
        public const Int16 HSupNumberCol = 34;
        public const Int16 HSupNameCol = 35;
        public const Int16 HCusIDCol = 36;
        public const Int16 HCusNumberCol = 37;
        public const Int16 HCusNameCol = 38;
        public const Int16 HCusTypeCol = 39;
        public const Int16 HSourceInterIDCol = 40;
        public const Int16 HSourceEntryIDCol = 41;
        public const Int16 HSourceBillNoCol = 42;
        public const Int16 HSourceBillTypeCol = 43;
        public const Int16 HInstructIDCol = 44;
        public const Int16 HInstructNoCol = 45;
        public const Int16 HSeOrderBillIDCol = 46;
        public const Int16 HSeOrderBillNoCol = 47;
        public const Int16 HWhIDCol = 48;
        public const Int16 HWhNumberCol = 49;
        public const Int16 HWhNameCol = 50;
        public const Int16 HSPIDCol = 51;
        public const Int16 HSPNumberCol = 52;
        public const Int16 HSPNameCol = 53;
        public const Int16 HinitQtyCol = 54;
        public const Int16 HRemarkCol = 55;
        public const Int16 HPinfanBarCodeCol = 56;
        public const Int16 HMTONoCol = 57;
        public const Int16 HShowDateCol = 58;
        public const Int16 HInnerBillNoCol = 59;
        public const Int16 HMakerCol = 60;
        public const Int16 HPackQtyCol = 25;
        public const Int16 HDeptIDCol = 26;
        public const Int16 HDeptNumberCol = 27;
        public const Int16 HDeptNameCol = 28;
        public const Int16 HSourceIDCol = 29;
        public const Int16 HSourceNumberCol = 30;
        public const Int16 HSourceNameCol = 31;
        public const Int16 HDateCol = 32;
        public const Int16 HEndDateCol = 33;
        public const Int16 HSupIDCol = 34;
        public const Int16 HSupNumberCol = 35;
        public const Int16 HSupNameCol = 36;
        public const Int16 HCusIDCol = 37;
        public const Int16 HCusNumberCol = 38;
        public const Int16 HCusNameCol = 39;
        public const Int16 HCusTypeCol = 40;
        public const Int16 HSourceInterIDCol = 41;
        public const Int16 HSourceEntryIDCol = 42;
        public const Int16 HSourceBillNoCol = 43;
        public const Int16 HSourceBillTypeCol = 44;
        public const Int16 HInstructIDCol = 45;
        public const Int16 HInstructNoCol = 46;
        public const Int16 HSeOrderBillIDCol = 47;
        public const Int16 HSeOrderBillNoCol = 48;
        public const Int16 HWhIDCol = 49;
        public const Int16 HWhNumberCol = 50;
        public const Int16 HWhNameCol = 51;
        public const Int16 HSPIDCol = 52;
        public const Int16 HSPNumberCol = 53;
        public const Int16 HSPNameCol = 54;
        public const Int16 HinitQtyCol = 55;
        public const Int16 HRemarkCol = 56;
        public const Int16 HPinfanBarCodeCol = 57;
        public const Int16 HMTONoCol = 58;
        public const Int16 HShowDateCol = 59;
        public const Int16 HInnerBillNoCol = 60;
        public const Int16 HMakerCol = 61;
        public Int16 HSelectCol = 0;
        public Int16 HSno2Col = 1;
@@ -138,6 +139,7 @@
        public Int16 HShowDate2Col = 55;
        public Int16 HInnerBillNo2Col = 56; 
        public Int16 HMaker2Col = 57; 
        public Int16 HEntryID2Col = 58;
        //
        public  string ModName = "85";
        public  string ModCaption = "条码生成";
@@ -911,6 +913,7 @@
                            return;
                        }
                        grdSub.Rows[i].Cells[HTMCol].Value = TM;
                        grdSub.Rows[i].Cells[HEntryID2Col].Value = j + 1;
                        grdSub.Rows[i].Cells[HMaterID2Col].Value = grdMain.Rows[j].Cells[HMaterIDCol].Value;
                        grdSub.Rows[i].Cells[HMaterNumber2Col].Value = grdMain.Rows[j].Cells[HMaterNumberCol].Value;
                        grdSub.Rows[i].Cells[HMaterName2Col].Value = grdMain.Rows[j].Cells[HMaterNameCol].Value;
@@ -1008,6 +1011,7 @@
            string HSeOrderBillNo = "";
            string HInnerBillNo = "";
            bool HGiveAwayFlag = false;
            Int64 HEntryID = 0;
            try
            {
                oCn.BeginTran();
@@ -1025,6 +1029,7 @@
                        }
                        //
                        HMaterID = ClsPub.isLong(grdSub.Rows[i].Cells[HMaterID2Col].Value);
                        HEntryID = ClsPub.isLong(grdSub.Rows[i].Cells[HEntryID2Col].Value);
                        HAuxPropID = ClsPub.isLong(grdSub.Rows[i].Cells[HAuxPropID2Col].Value);
                        HUnitID = ClsPub.isLong(grdSub.Rows[i].Cells[HUnitID2Col].Value);
                        HQty2 = ClsPub.isDoule(grdSub.Rows[i].Cells[HQty2Col].Value);
@@ -1056,7 +1061,7 @@
                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
                                    ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
                                    ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
                                    ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
                                    ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
                                    ",HGiveAwayFlag " +
                                    ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
                                    ") values ("
@@ -1065,7 +1070,7 @@
                                    + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
                                    + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
                                    + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'"
                                    + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString()
                                    + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString() + "," + HEntryID.ToString() + ""
                                    + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag)
                                    + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "')");
@@ -1473,7 +1478,7 @@
            //
            grdMain.RowCount = 0;
            grdSub.RowCount = 0;
            grdMain.ColumnCount = 61;                       //总列数
            grdMain.ColumnCount = 62;                       //总列数
            DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name);
            grdMain.Columns[HSnoCol].HeaderText = "序号";
            grdMain.Columns[HMainIDCol].HeaderText = "源单主ID";
@@ -1499,6 +1504,7 @@
            grdMain.Columns[HGiveAwayFlagCol].HeaderText = "是否赠品";
            grdMain.Columns[HQtyCol].HeaderText = "数量";
            grdMain.Columns[HMinQtyCol].HeaderText = "最小包装数";
            grdMain.Columns[HPackQtyCol].HeaderText = "外箱数";
            grdMain.Columns[HBQtyCol].HeaderText = "箱数";
            grdMain.Columns[HSupIDCol].HeaderText = "供应商ID";
            grdMain.Columns[HSupNumberCol].HeaderText = "供应商代码";
@@ -1585,6 +1591,7 @@
                                "," + HSeOrderBillNoCol.ToString() +
                                "," + HBatchNoCol.ToString() +
                                "," + HCusNumberCol.ToString() +
                                "," + HPackQtyCol.ToString() +
                                "," + HRemarkCol.ToString();
            //设置合计列
            string sTotalCol = HQtyCol.ToString();
@@ -1604,7 +1611,7 @@
            DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol,oSumGrid);
            //----------------------------
            grdSub.ColumnCount = 58;                       //总列数
            grdSub.ColumnCount = 59;                       //总列数
            DBUtility.Xt_BaseBillFun.initGridFst(grdSub, this.Name);
            grdSub.Columns[HSelectCol].HeaderText = "选择";
            grdSub.Columns[HTMCol].HeaderText = "条码编号";
@@ -1662,6 +1669,7 @@
            grdSub.Columns[HShowDate2Col].HeaderText = "日期";
            grdSub.Columns[HInnerBillNo2Col].HeaderText = "内部采购订单号";
            grdSub.Columns[HMaker2Col].HeaderText = "制单人";
            grdSub.Columns[HEntryID2Col].HeaderText = "行号";
            //格式化 
            grdSub.Columns[HMaterID2Col].Visible = false;
            grdSub.Columns[HModel2Col].Visible = false;
@@ -2377,6 +2385,7 @@
                                "," + HMinQtyCol.ToString() +
                                "," + HAuxPropNumberCol.ToString() +
                                "," + HBatchNoCol.ToString() +
                                "," + HPackQtyCol.ToString() +
                                "," + HRemarkCol.ToString();
            grdMain.Columns[HBillNoCol].ReadOnly = true;
            //设置合计列
@@ -3213,6 +3222,26 @@
        //生成外箱码
        private void wxm_Click(object sender, EventArgs e)
        {
            try
            {
                Int64 iInterID = 0;
                Int64 dPackQty = 0; //外箱数量
                Int64 dPackLeftQty = 0; //外箱剩余数量
                Int64 dLabelQty = 0; //小箱数量
                Int64 dQty = 0; //总数量
                Int64 dEntryID = 0; //行号
                string sPackBarCode = ""; //外箱码
                string sBarCode = ""; //唯一码
                Int64 LSH = 0;
                DataSet Ds;
                string sYear = DateTime.Today.Year.ToString().Substring(2, 2);
                string sPeriod = "0" + DateTime.Today.Month.ToString();
                sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
                string sDay = "0" + DateTime.Today.Day.ToString();
                sDay = sDay.Substring(sDay.Length - 2, 2);
                //
                string sPackStr = "ZXM" + sYear + sPeriod + sDay; //外箱码 å‰ç¼€
            //必须条码生成按钮是灰度才可以生成箱条码
            if(bc.Enabled != false)
            {
@@ -3220,23 +3249,95 @@
                return;
            }  
            //-------------------根据HINTERID生成箱条码
            //生成前判断,循环物料网格,判断 æ˜¯å¦è®¾ç½®äº†åˆç†çš„ å¤–箱数量。 å¤–箱数量 å¿…须是 æœ€å°åŒ…装数的 å€æ•° å¹¶å¿…须大于0和大于等于最小包装数量。
                for (int i = 0; i < grdMain.Rows.Count; i++)
                {
                    if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value) != 0)
                    {
                        if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value) <= 0)
                        {
                            MessageBox.Show("请录入合理的外箱数量,第" + Convert.ToString(i + 1) + "行");
                            return;
                        }
                        if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value)
                            % DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMinQtyCol].Value) != 0
                            || DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value)
                            < DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMinQtyCol].Value))
                        {
                            MessageBox.Show("外箱数量必须是最小包装数的倍数,且大于等于最小包装数,第" + Convert.ToString(i + 1) + "行");
                            return;
                        }
                    }
                }
                //oCn.BeginTran();
            //从0行进行循环 ç‰©æ–™ç½‘格,获取外箱数量
                for (int i = 0; i < grdMain.Rows.Count; i++)
                {
                    if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value) != 0)
                    {
                        //获取总数量、外箱数量
                        dPackQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value);
                        dQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HQtyCol].Value);
                        dEntryID = i + 1;
                        dPackLeftQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value);
                        //生成一个外箱码
                        Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号                                                                                          //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1;
                        sPackBarCode = sPackStr + LSH.ToString();
                        oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
            //子循环 æ¡ç ç½‘æ ¼
            //根据外箱数量 æ‰£å‡ï¼Œç›´åˆ° å¤–箱数量扣减完,生成 å¤–箱条码和组托单
            //结束循环
            //刷新打印页签(-S çš„ è™šæ‹Ÿæ¡ç ä¸æ˜¾ç¤º ï¼‰
                        for (int j = 0; j < grdSub.Rows.Count; j++)
                        {
                            if (dEntryID == DBUtility.ClsPub.isLong(grdSub.Rows[j].Cells[HEntryID2Col].Value))
                            {
                                if (dQty <= 0)
                                {
                                    continue;
                                }
                                if (dPackLeftQty > 0) //当剩余外箱数量小于等于0时,重新生成外箱码
                                {
                                }
                                else
                                {
                                    //生成一个外箱码
                                    Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号                                                                                          //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
                                    LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1;
                                    sPackBarCode = sPackStr + LSH.ToString();
                                    oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
                                    dPackLeftQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value);
                                }
                                sBarCode = DBUtility.ClsPub.isStrNull(grdSub.Rows[j].Cells[HTMCol].Value); // æ¡ç 
                                dLabelQty = DBUtility.ClsPub.isLong(grdSub.Rows[j].Cells[HQty2Col].Value); // å°ç®±æ•°é‡
                                oCn.RunProc("update Gy_BarCodebill set HInnerBillNo= '" + sPackBarCode + "' Where HbarCode='" + sBarCode + "'");
                                dPackLeftQty = dPackLeftQty - dLabelQty;
                                dQty = dQty - dLabelQty;
                                if (dPackLeftQty <= 0)//当箱剩余数量小于等于0时 æ‰§è¡Œ ç»„托单
                                {
                                    //获取组托单内码
                                    iInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo); ;//得到新单号;
                                                                                                                            //根据外箱码 å†™å…¥ ç»„托单主表,组托单子表,SUM,外箱码档案,SUM档案
                                    oCn.RunProc("exec  h_p_WMS_PackUnionBill_AddNew  '" + sPackBarCode + "'," + iInterID.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //根据箱条码,写入 ä¸»è¡¨ï¼Œå­è¡¨ ï¼Œç®±æ¡ç æ¡£æ¡ˆ
                                    oCn.RunProc("exec  h_p_WMS_PackUnionBill_SumSubBill  " + iInterID.ToString() + ",'" + sPackBarCode + "','3783','" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //根据箱条码,写入 SUM表,SUM条码档案
                                }
                            }
                            else
                            {
                                continue;
                            }
                        }
                    }
                }
                wxm.Enabled = false;
                //oCn.Commit();
                MessageBox.Show("生成箱码完毕!");
                //刷新数据
                Display();
            }
            catch(Exception e1)
            {
                //oCn.RollBack();
                MessageBox.Show("生成箱码失败!" + e1.Message );
            }
        }
    }
}