智云外网版WMS\MES\SCM(作废)
jhz
2022-07-31 c45e231e9b180c412f0c81db3b577ca2763b05fa
SCM/ÌõÂë´òÓ¡/Gy_BarCodeBill.cs
@@ -92,6 +92,8 @@
        public const Int16 HJiaYeLXCol = 71;
        public const Int16 HJiaYeLCol = 72;
        public const Int16 POOrderBillNoCol = 73;
        public const Int16 HBarCode_PackCol = 74;
        public const Int16 HCustomQty1Col = 75;
        public Int16 HSelectCol = 0;
        public Int16 HSno2Col = 1;
@@ -165,6 +167,8 @@
        public Int16 HJiaYeLX2Col = 69;
        public Int16 HJiaYeL2Col = 70;
        public Int16 POOrderBillNo2Col = 71;
        public Int16 HBarCode_Pack2Col = 72;
        public Int16 HCustomQty12Col = 73;
        //
        public  string ModName = "85";
        public  string ModCaption = "条码生成";
@@ -191,6 +195,8 @@
            ////表体清空
            //grdMain.Rows.Clear();
            //grdSub.Rows.Clear();
            txtHGroupID.Text = "";
            txtHCaseNo.Text = "";
            cmbHBarCodeType.Items.Clear();
            cmbSourceBillType.Items.Clear();
@@ -210,11 +216,28 @@
                cmbHBarCodeType.SelectedIndex = 0;
            }
            //
            cmbSourceBillType.Items.Add("生产订单");
            cmbSourceBillType.Items.Add("采购订单");
            cmbSourceBillType.Items.Add("收料通知单");
            cmbSourceBillType.Items.Add("委外订单");
            cmbSourceBillType.SelectedIndex = 0;
            if (CampanyName == "森楷") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
            {
                cmbSourceBillType.Items.Add("入库申请单");
                cmbSourceBillType.SelectedIndex = 0;
                label6.Visible = true;
                txtHGroupID.Visible = true;
                cmdHGroupID.Visible = true;
                label5.Visible = true;
                txtHCaseNo.Visible = true;
                chkAddModel.Visible = false;
                spRow.Visible = false;
                toolStripSeparator6.Visible = false;
            }
            else
            {
                cmbSourceBillType.Items.Add("生产订单");
                cmbSourceBillType.Items.Add("生产汇报单");
                cmbSourceBillType.Items.Add("采购订单");
                cmbSourceBillType.Items.Add("收料通知单");
                cmbSourceBillType.Items.Add("委外订单");
                cmbSourceBillType.SelectedIndex = 0;
            }
            //
            //DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp);
@@ -627,6 +650,19 @@
                    }
                }
            }
            if (CampanyName == "森楷") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
            {
                if (ClsPub.isInt(txtHCaseNo.Text) <= 0)
                {
                    MessageBox.Show(" ç®±å·å¿…须为大于 0 çš„æ•´æ•°ï¼");
                    return false;
                }
                else if(ClsPub.isInt(txtHCaseNo.Text) <= ClsPub.isInt(txtHCaseNo.Tag))
                {
                    MessageBox.Show(" æ‰€è¾“入箱号必须大于已生成过箱号数:" + txtHCaseNo.Tag.ToString() + "!");
                    return false;
                }
            }
            return true;
        }
@@ -1642,6 +1678,8 @@
                            grdSub.Rows[i].Cells[HJiaYeLX2Col].Value = grdMain.Rows[j].Cells[HJiaYeLXCol].Value;
                            grdSub.Rows[i].Cells[HJiaYeL2Col].Value = grdMain.Rows[j].Cells[HJiaYeLCol].Value;
                            grdSub.Rows[i].Cells[POOrderBillNo2Col].Value = grdMain.Rows[j].Cells[POOrderBillNoCol].Value;
                            grdSub.Rows[i].Cells[HBarCode_Pack2Col].Value = grdMain.Rows[j].Cells[HBarCode_PackCol].Value;
                            grdSub.Rows[i].Cells[HCustomQty12Col].Value = ClsPub.isLong(txtHCaseNo.Text) + i;
                            k = k + 1;
                            n = n + 1;
                            //oWeb.getRunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -1657,8 +1695,28 @@
                        //
                    }
                }
                if (CampanyName == "森楷") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
                {
                    string sHGroupID = "";      //班组
                    string sHBatchNo = "";      //批次
                    string HDate = "";          //日期
                    string sCaseNoNumber = "";  //箱号前缀
                    int sCaseNo = 0;            //箱号
                    string sMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HMaterNumberCol].Value);
                    string sAuxItemName = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HAuxPropNameCol].Value);
                    sHGroupID = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HGroupIDCol].Value);
                    sHBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HBatchNoCol].Value);
                    HDate = SetDateStr(dtpHDate.Value );
                    sCaseNo = ClsPub.isInt(txtHCaseNo.Text) + grdSub.Rows.Count - 1;
                    //箱号前缀 = ç­ç»„ID + æ‰¹æ¬¡ + æ—¥æœŸ + ç‰©æ–™ä»£ç  + è¾…助属性
                    sCaseNoNumber = sHGroupID + sHBatchNo + HDate + sMaterNumber + sAuxItemName;
                    oWeb.getRunProc("Exec h_p_WMS_SetBarCodeNoByEmp  '" + sCaseNoNumber + "'," + sCaseNo, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                string HWei = "";      //尾数
                string HBarCode = "";
                string HBarCode_Pack = "";
                string HBarCodeType = "";
                Int64 HMaterID = 0;
                Int64 HAuxPropID = 0;
@@ -1700,6 +1758,7 @@
                string HCustomBatchNo = "";
                string HGBBarCode = "";
                string POOrderBillNo = "";
                long HCustomQty1 = 0;
                string[] sSQLMul = new string[grdSub.Rows.Count];
@@ -1769,6 +1828,8 @@
                        HCustomBatchNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCustomBatchNo2Col].Value);
                        HGBBarCode = ClsPub.isStrNull(grdSub.Rows[i].Cells[HGBBarCode2Col].Value);
                        POOrderBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[POOrderBillNo2Col].Value);
                        HBarCode_Pack = ClsPub.isStrNull(grdSub.Rows[i].Cells[HBarCode_Pack2Col].Value);
                        HCustomQty1 = ClsPub.isLong(grdSub.Rows[i].Cells[HCustomQty12Col].Value);
                        sSQLMul[mm] = "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
                                    ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
@@ -1777,8 +1838,9 @@
                                    ",HPressModel,HCusModel,HMaterialModel,HColor,HBarCodeDate " +
                                    ",HLogo,HPackageSize,HMaterialJQty,HMaterialMQty,HCustomBatchNo " +
                                    ",HSTOCKORGID,HOWNERID,HBeginDate,HSeOrderBillNo,HGBBarCode " +
                                    ",POOrderBillNo,HInterID " +
                                    ",POOrderBillNo,HInterID,HInitSourceEntryID,HBarCode_Pack " +
                                    ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo " +
                                    ",HCustomQty1 " +
                                    ") values ("
                                    + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
                                    + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
@@ -1788,8 +1850,9 @@
                                    + ",'" + HPressModel + "','" + HCusModel + "','" + HMaterialModel + "','" + HColor + "','" + sDate + "'"
                                    + ",'" + HLogo + "','" + HPackageSize + "'," + HMaterialJQty.ToString() + "," + HMaterialMQty.ToString() + ",'" + HCustomBatchNo + "'"
                                    + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HBeginDate.ToShortDateString() + "','" + HSeOrderBillNo + "','" + HGBBarCode + "'"
                                    + ",'" + POOrderBillNo + "'," + HInterID.ToString()
                                    + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "')";
                                    + ",'" + POOrderBillNo + "'," + HInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HBarCode_Pack + "'"
                                    + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "'"
                                    + ", " + HCustomQty1.ToString() + ")";
                        //oCn.RunProc("exec setLSH '" + ClsPub.GetServerDate(0) + "'");
                        mm = mm + 1;
                        Application.DoEvents();
@@ -1799,6 +1862,9 @@
                        Application.DoEvents();
                    }
                }
                //
                //
                oWeb.Timeout = 200000;
                if (oWeb.getRunProcByMul_Back(sSQLMul, ref DBUtility.ClsPub.sExeReturnInfo))
                {
@@ -1822,7 +1888,11 @@
                    grdSub.RowCount = 0;
                    grdSub.RowCount = 20;
                }
                tabControl1.SelectedIndex = 1;
                if (CampanyName == "森楷") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
                {
                    oWeb.getRunProc("exec h_p_WMS_BarCodeBackToOtherInRepuest  " + HInterID.ToString() + "", ref DBUtility.ClsPub.sExeReturnInfo);
                }
                tabControl1.SelectedIndex = 2;
            }
            catch (Exception e)
            {
@@ -1836,13 +1906,24 @@
        #endregion 
        public string SetDateStr(DateTime sDateTime)
        {
            string sDate = sDateTime.ToShortDateString();
            string sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
            string sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
            sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
            string sDay = "0" + ClsPub.isDate(sDate).Day.ToString();
            sDay = sDay.Substring(sDay.Length - 2, 2);
            return sYear+ sPeriod+ sDay;
        }
        #region çª—体处理方法
        //初始化GRID
        private void initGrid()
        {
            grdMain.RowCount = 0;
            grdSub.RowCount = 0;
            grdMain.ColumnCount = 74;                       //总列数
            grdMain.ColumnCount = 76;                       //总列数
            ClsPub1.initGridFst(grdMain, this.Name);
            grdMain.Columns[HSnoCol].HeaderText = "序号";
            grdMain.Columns[HMainIDCol].HeaderText = "源单主ID";
@@ -1910,6 +1991,7 @@
            grdMain.Columns[HJiaYeLXCol].HeaderText = "制冷液类型";
            grdMain.Columns[HJiaYeLCol].HeaderText = "加液量";
            grdMain.Columns[POOrderBillNoCol].HeaderText = "采购订单号";
            grdMain.Columns[HBarCode_PackCol].HeaderText = "托条码编号";
            ////
            //格式化    éšè—åˆ—
            grdMain.Columns[HTagCol].Visible = false;
@@ -1976,6 +2058,8 @@
            grdMain.Columns[HJiaYeLXCol].Visible = false;
            grdMain.Columns[HJiaYeLCol].Visible = false;
            grdMain.Columns[POOrderBillNoCol].Visible = false;
            grdMain.Columns[HBarCode_PackCol].Visible = false;
            grdMain.Columns[HCustomQty1Col].Visible = false;
            if (CampanyName == "韩电") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
            {
@@ -2023,6 +2107,11 @@
                grdMain.Columns[HSupNameCol].Visible = true;
                grdMain.Columns[POOrderBillNoCol].Visible = true;
            }
            else if (CampanyName == "森楷") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
            {
                grdMain.Columns[HGroupNumberCol].Visible = true;
                grdMain.Columns[HGroupNameCol].Visible = true;
            }
            //设置可编辑列
@@ -2051,7 +2140,7 @@
            ClsPub1.initGridLast(sAllowCol, sTotalCol, oSumGrid);
            //----------------------------
            grdSub.ColumnCount = 72;                       //总列数
            grdSub.ColumnCount = 74;                       //总列数
            ClsPub1.initGridFst(grdSub, this.Name);
            grdSub.Columns[HSelectCol].HeaderText = "选择";
            grdSub.Columns[HTMCol].HeaderText = "条码编号";
@@ -2123,6 +2212,7 @@
            grdSub.Columns[HJiaYeLX2Col].HeaderText = "制冷液类型";
            grdSub.Columns[HJiaYeL2Col].HeaderText = "加液量";
            grdSub.Columns[POOrderBillNo2Col].HeaderText = "采购订单号";
            grdSub.Columns[HBarCode_Pack2Col].HeaderText = "托条码编号";
            //格式化    éšè—åˆ—
            grdSub.Columns[HBarCodeType2Col].Visible = false;
@@ -2187,6 +2277,8 @@
            grdSub.Columns[HJiaYeLX2Col].Visible = false;
            grdSub.Columns[HJiaYeL2Col].Visible = false;
            grdSub.Columns[POOrderBillNo2Col].Visible = false;
            grdSub.Columns[HBarCode_Pack2Col].Visible = false;
            grdSub.Columns[HCustomQty12Col].Visible = false;
            if (CampanyName == "韩电") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
            {
@@ -2641,6 +2733,15 @@
                    FillSelectData(oIFCLD_ICMOList.oBillSelectColl);
                }
            }
            else if (cmbSourceBillType.Text.Trim() == "生产汇报单")
            {
                sWhere = " and HOrgID =" + sHOrgID.ToString();
                SCM.Cls_S_IF_ICMOReportBillList oIF_ICMOReportBillList = new SCM.Cls_S_IF_ICMOReportBillList();
                if (oIF_ICMOReportBillList.Refresh(sWhere))  //选择原单
                {
                    FillSelectData(oIF_ICMOReportBillList.oBillSelectColl);
                }
            }
            else if (cmbSourceBillType.Text.Trim() == "收料通知单")
            {
                sWhere = " and HOrgID =" + sHOrgID.ToString();
@@ -2666,6 +2767,15 @@
                if (oIF_EntrustOrderBillList.Refresh(sWhere))  //选择原单
                {
                    FillSelectData(oIF_EntrustOrderBillList.oBillSelectColl);
                }
            }
            else if (cmbSourceBillType.Text.Trim() == "入库申请单")
            {
                sWhere = " and HOrgID =" + sHOrgID.ToString();
                SCM.Cls_S_IF_StockInRequestBillList oIF_StockInRequestBillList = new SCM.Cls_S_IF_StockInRequestBillList();
                if (oIF_StockInRequestBillList.Refresh(sWhere))  //选择原单
                {
                    FillSelectData(oIF_StockInRequestBillList.oBillSelectColl);
                }
            }
            else
@@ -2708,6 +2818,16 @@
                    //写入信息
                    Sub_WriteInForm(Ds.Tables[0], i);
                }
                //生产汇报单
                if (oSelectRow.BillType == "3711")
                {
                    grdMain.Rows.Add();
                    grdMain.Rows[i].Cells[HTagCol].Value = "*";
                    //得到信息
                    Ds = oWeb.getDataSetBySQL("select * from h_v_IF_ICMOReportList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_ICMOReportList", ref DBUtility.ClsPub.sExeReturnInfo);
                    //写入信息
                    Sub_WriteInForm1(Ds.Tables[0], i);
                }
                //收料通知单
                if (oSelectRow.BillType == "1103")
                {
@@ -2737,6 +2857,47 @@
                    Ds = oWeb.getDataSetBySQL("select * from h_v_IF_EntrustOrderList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_EntrustOrderList", ref DBUtility.ClsPub.sExeReturnInfo);
                    //写入信息
                    Sub_WriteInForm1(Ds.Tables[0], i);
                }
                //入库申请单
                if (oSelectRow.BillType == "1241")
                {
                    grdMain.Rows.Add();
                    grdMain.Rows[i].Cells[HTagCol].Value = "*";
                    //得到信息
                    Ds = oWeb.getDataSetBySQL("select * from h_v_IF_StockInRequestList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_StockInRequestList", ref DBUtility.ClsPub.sExeReturnInfo);
                    //写入信息
                    Sub_WriteInForm_1241(Ds.Tables[0], i);
                    if (CampanyName == "森楷") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
                    {
                        //选源单后获取班组、箱号信息显示在界面上
                        SCM.ClsGy_Group_View oGroup = new SCM.ClsGy_Group_View();
                        txtHGroupID.Tag = DBUtility.ClsPub.isLong(grdMain.Rows[0].Cells[HGroupIDCol].Value);
                        if (oGroup.GetInfoByID(DBUtility.ClsPub.isLong(grdMain.Rows[0].Cells[HGroupIDCol].Value)))
                        {
                            txtHGroupID.Text = oGroup.omodel.HName;
                        }
                        else
                        {
                            txtHGroupID.Text = "";
                        }
                        string HGroupID = "";   //班组
                        string HBatchNo = "";   //批次
                        string HDate = "";      //日期
                        string sCaseNoNumber = "";      //箱号前缀
                        string sMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HMaterNumberCol].Value);
                        string sAuxItemName = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HAuxPropNameCol].Value);
                        HGroupID = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HGroupIDCol].Value);
                        HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HBatchNoCol].Value);
                        HDate = SetDateStr(dtpHDate.Value);
                        //箱号前缀 = ç­ç»„ID + æ‰¹æ¬¡ + æ—¥æœŸ + ç‰©æ–™ä»£ç  + è¾…助属性
                        sCaseNoNumber = HGroupID + HBatchNo + HDate + sMaterNumber + sAuxItemName;
                        Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo  '" + sCaseNoNumber + "'", "h_p_WMS_GetMaxNo", ref DBUtility.ClsPub.sExeReturnInfo);//获取最大流水号
                        txtHCaseNo.Text = (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) + 1).ToString();
                        txtHCaseNo.Tag = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]).ToString();
                    }
                }
                //即时库存
                if (oSelectRow.BillType == "JSKC")
@@ -2994,6 +3155,65 @@
                                "," + HGBBarCodeCol.ToString() +
                                "," + HMinQtyCol.ToString();
            }
            grdMain.Columns[HBillNoCol].ReadOnly = true;
            //设置合计列
            string sTotalCol = HQtyCol.ToString();
            //
            ClsPub1.initGridLast(sAllowCol, sTotalCol, oSumGrid);
            tabControl1.SelectedIndex = 0;
            bc.Enabled = true;
            //
            RowCount(i, 0);
        }
        //根据TABLE写入界面(入库申请单)
        private void Sub_WriteInForm_1241(DataTable oTable, int i)
        {
            ////加载表体
            grdMain.Rows[i].Cells[HTagCol].Value = "*";
            grdMain.Rows[i].Cells[HQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["未生成条码数量"]);
            grdMain.Rows[i].Cells[HinitQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["未生成条码数量"]);
            grdMain.Rows[i].Cells[HMinQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["最小包装数"]);
            //
            grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[0]["hmainid"].ToString();
            grdMain.Rows[i].Cells[HSubIDCol].Value = oTable.Rows[0]["hsubid"].ToString();
            grdMain.Rows[i].Cells[HBillNoCol].Value = oTable.Rows[0]["单据号"].ToString();
            grdMain.Rows[i].Cells[HBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString();
            grdMain.Rows[i].Cells[HDateCol].Value = oTable.Rows[0]["日期"].ToString();
            grdMain.Rows[i].Cells[HSupIDCol].Value = oTable.Rows[0]["hsupid"].ToString();
            grdMain.Rows[i].Cells[HSupNumberCol].Value = oTable.Rows[0]["供应商代码"].ToString();
            grdMain.Rows[i].Cells[HSupNameCol].Value = oTable.Rows[0]["供应商"].ToString();
            grdMain.Rows[i].Cells[HDeptIDCol].Value = oTable.Rows[0]["HDeptID"].ToString();
            grdMain.Rows[i].Cells[HDeptNumberCol].Value = oTable.Rows[0]["部门代码"].ToString();
            grdMain.Rows[i].Cells[HDeptNameCol].Value = oTable.Rows[0]["部门"].ToString();
            grdMain.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString();
            grdMain.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["物料代码"].ToString();
            grdMain.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["物料名称"].ToString();
            grdMain.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["规格型号"].ToString();
            grdMain.Rows[i].Cells[HBatchNoCol].Value = oTable.Rows[0]["批次"].ToString();
            grdMain.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString();
            grdMain.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["计量单位代码"].ToString();
            grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["计量单位"].ToString();
            grdMain.Rows[i].Cells[HRemarkCol].Value = oTable.Rows[0]["备注"].ToString();
            grdMain.Rows[i].Cells[HAuxPropIDCol].Value = oTable.Rows[0]["HAuxPropID"].ToString();
            grdMain.Rows[i].Cells[HAuxPropNumberCol].Value = oTable.Rows[0]["辅助属性代码"].ToString();
            grdMain.Rows[i].Cells[HAuxPropNameCol].Value = oTable.Rows[0]["辅助属性"].ToString();
            grdMain.Rows[i].Cells[HJiaYeCol].Value = oTable.Rows[0]["品种"].ToString();
            grdMain.Rows[i].Cells[HModelCol].Value = oTable.Rows[0]["规格型号"].ToString();
            grdMain.Rows[i].Cells[HLogoCol].Value = oTable.Rows[0]["等级"].ToString();
            grdMain.Rows[i].Cells[HPackageSizeCol].Value = oTable.Rows[0]["筒数"].ToString();
            grdMain.Rows[i].Cells[HBarCode_PackCol].Value = oTable.Rows[0]["码单"].ToString();
            grdMain.Rows[i].Cells[HColorCol].Value = oTable.Rows[0]["色泽"].ToString();
            grdMain.Rows[i].Cells[HCusModelCol].Value = oTable.Rows[0]["管色"].ToString();
            grdMain.Rows[i].Cells[HMQtyCol].Value = oTable.Rows[0]["毛重"].ToString();
            grdMain.Rows[i].Cells[HJQtyCol].Value = oTable.Rows[0]["净重"].ToString();
            grdMain.Rows[i].Cells[HPressModelCol].Value = oTable.Rows[0]["捻向"].ToString();
            grdMain.Rows[i].Cells[HGroupIDCol].Value = oTable.Rows[0]["HGroupID"].ToString();
            grdMain.Rows[i].Cells[HGroupNumberCol].Value = oTable.Rows[0]["班组代码"].ToString();
            grdMain.Rows[i].Cells[HGroupNameCol].Value = oTable.Rows[0]["班组"].ToString();
            //--
            //设置可编辑列
            string sAllowCol = HTagCol.ToString();
            grdMain.Columns[HBillNoCol].ReadOnly = true;
            //设置合计列
            string sTotalCol = HQtyCol.ToString();
@@ -3505,6 +3725,20 @@
                        txtHSourceBillNo.Text = "";
                    }
                }
                else if (cmbSourceBillType.Text.Trim() == "入库申请单")
                {
                    SCM.Cls_S_IF_StockInRequestBillList oIF_StockInRequestBillList = new SCM.Cls_S_IF_StockInRequestBillList();
                    if (oIF_StockInRequestBillList.RefreshBySourceBillNo(" Where å•据号 like '%" + txtHSourceBillNo.Text + "' "))  //选择原单
                    {
                        FillSelectData(oIF_StockInRequestBillList.oBillSelectColl);
                        txtHSourceBillNo.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("未查询到任务数据,请确认所选组织、源单类型与源单单号是否正确!");
                        return;
                    }
                }
                else
                {
@@ -3513,9 +3747,115 @@
            }
        }
        private void cmdHGroupID_Click(object sender, EventArgs e)
        {
            long sHOrgID = -1;
            string sWhere = "";
            sHOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
            if (sHOrgID == -1)
            {
                MessageBox.Show("选择组织有错误!");
                return;
            }
            sWhere = " and HUSEORGID = " + sHOrgID;
            SCM.ClsGy_Group_View oGroup = new SCM.ClsGy_Group_View();
            if (oGroup.RefreshView())
            {
                txtHGroupID.Text = oGroup.oModel.HName;
                txtHGroupID.Tag = oGroup.oModel.HItemID.ToString();
                if (CampanyName == "森楷") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
                {
                    for (int i = 0; i < grdMain.Rows.Count; i++)
                    {
                        if (ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value) != 0)
                        {
                            grdMain.Rows[i].Cells[HGroupIDCol].Value = oGroup.oModel.HItemID.ToString();
                            grdMain.Rows[i].Cells[HGroupNumberCol].Value = oGroup.oModel.HNumber;
                            grdMain.Rows[i].Cells[HGroupNameCol].Value = oGroup.oModel.HName;
                        }
                    }
                    string HGroupID = "";   //班组
                    string HBatchNo = "";   //批次
                    string HDate = "";      //日期
                    string sCaseNoNumber = "";      //箱号前缀
                    string sMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HMaterNumberCol].Value);
                    string sAuxItemName = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HAuxPropNameCol].Value);
                    HGroupID = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HGroupIDCol].Value);
                    HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HBatchNoCol].Value);
                    HDate = SetDateStr(dtpHDate.Value);
                    //箱号前缀 = ç­ç»„ID + æ‰¹æ¬¡ + æ—¥æœŸ + ç‰©æ–™ä»£ç  +辅助属性
                    sCaseNoNumber = HGroupID + HBatchNo + HDate + sMaterNumber + sAuxItemName;
                    DataSet Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo  '" + sCaseNoNumber + "'", "h_p_WMS_GetMaxNo", ref DBUtility.ClsPub.sExeReturnInfo);//获取最大流水号
                    txtHCaseNo.Text = (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) + 1).ToString();
                    txtHCaseNo.Tag = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]).ToString();
                }
            }
            else
            {
                txtHGroupID.Text = "";
                if (CampanyName == "森楷") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
                {
                    for (int i = 0; i < grdMain.Rows.Count; i++)
                    {
                        if (ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value) != 0)
                        {
                            grdMain.Rows[i].Cells[HGroupIDCol].Value = 0;
                            grdMain.Rows[i].Cells[HGroupNumberCol].Value = "";
                            grdMain.Rows[i].Cells[HGroupNameCol].Value = "";
                        }
                    }
                    string HGroupID = "";   //班组
                    string HBatchNo = "";   //批次
                    string HDate = "";      //日期
                    string sCaseNoNumber = "";      //箱号前缀
                    string sMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HMaterNumberCol].Value);
                    string sAuxItemName = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HAuxPropNameCol].Value);
                    HGroupID = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HGroupIDCol].Value);
                    HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HBatchNoCol].Value);
                    HDate = SetDateStr(dtpHDate.Value);
                    //箱号前缀 = ç­ç»„ID + æ‰¹æ¬¡ + æ—¥æœŸ
                    sCaseNoNumber = HGroupID + HBatchNo + HDate + sMaterNumber + sAuxItemName;
                    DataSet Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo  '" + sCaseNoNumber + "'", "h_p_WMS_GetMaxNo", ref DBUtility.ClsPub.sExeReturnInfo);//获取最大流水号
                    txtHCaseNo.Text = (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) + 1).ToString();
                    txtHCaseNo.Tag = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]).ToString();
                }
            }
            oGroup = null;
        }
        private void txtHGroupID_TextChanged(object sender, EventArgs e)
        {
            if (txtHGroupID.Text.Trim() == "")
            {
                txtHGroupID.Tag = "0";
            }
        }
        private void clear_Click(object sender, EventArgs e)
        {
            try
            {
                oWeb.getRunProc("exec h_p_Xt_ClearDataBaseProcess ", ref DBUtility.ClsPub.sExeReturnInfo);
                MessageBox.Show("清理数据库堵塞完成!");
            }
            catch (Exception sExeReturnInfo)
            {
                MessageBox.Show("清理数据库堵塞失败!" + sExeReturnInfo.Message);
            }
        }
        private void back_Click(object sender, EventArgs e)
        {
            bc.Enabled = false;
        }
    }
}