zrg
2025-01-08 bafdbac9abdfc9de05b211cf7f54a3f792cb8a74
WarM/ÌõÂë´òÓ¡/Gy_PackBarCodeBill_automaticallyByPLC.cs
@@ -10,6 +10,7 @@
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.VisualBasic;
namespace WarM.条码打印
{
@@ -71,6 +72,10 @@
        public bool BillChange;   //
        public bool grdStatus;
        public int selectRow = 0;
        //记录当前组托的条码的源单ID、子ID,用于保证当前托中所有子条码为同一个工单生成
        public int HSourceInterID_ICMO = 0;
        public int HSourceEntryID_ICMO = 0;
        private void Gy_PackBarCodeBill_automaticallyByPLC_Load(object sender, EventArgs e)
        {
@@ -181,6 +186,11 @@
            DBUtility.Xt_BaseBillFun.initGridList(grdSub, this.Name + "grdSub");
            getDisplay_GrdMain();
            if (grdMain.Rows.Count > 0 && grdMain.Rows[0].Cells[4].Value!=null)
            {
                getPackQty(grdMain.Rows[0].Cells[4].Value.ToString());
            }
        }
@@ -347,22 +357,32 @@
        //未满托生成 æŒ‰é’® ç‚¹å‡»äº‹ä»¶
        private void button_produceByHand_Click(object sender, EventArgs e)
        {
            if (HQty == 0)
            try
            {
                MessageBox.Show("请扫码子条码!");
                return;
                if (HQty == 0)
                {
                    MessageBox.Show("请扫码子条码!");
                    return;
                }
                this.Sub_SaveBill();
                //组托成功后,清空组托数量与源单信息
                set_clearPackQtyAndSourceInfo();
            }
            this.Sub_SaveBill();
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        //自动组托 
        private void button_startListen_Click(object sender, EventArgs e)
        {
            if (DBUtility.ClsPub.isLong(textBox_PackQty.Text) == 0)
            {
                MessageBox.Show("请设置托条码的最小包装数!");
                return;
            }
            //if (DBUtility.ClsPub.isLong(textBox_PackQty.Text) == 0)
            //{
            //    MessageBox.Show("请设置托条码的最小包装数!");
            //    return;
            //}
            isStartListen = 1;
@@ -379,6 +399,8 @@
            comboBox_SourceNameParams.Enabled = false;
            button_saveParams.Enabled = false;
            textBox_HBarCode.Focus();
        }
        //停止组托
@@ -406,22 +428,31 @@
        {
            if(isStartListen == 1)
            {
                if(HQty == DBUtility.ClsPub.isDoule(textBox_PackQty.Text))
                try
                {
                    this.Sub_SaveBill();
                    //设置打印模板,打印
                    grdSub.Rows[0].Cells[0].Value = "*";
                    Report = new GridppReport();
                    Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + ".grf");  //here .
                    Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
                    Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
                    Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
                    if (comboBox_PrinterParams.Text != "")
                    if (HQty == DBUtility.ClsPub.isDoule(textBox_PackQty.Text))
                    {
                        Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(默认)", "");
                        this.Sub_SaveBill();
                        //设置打印模板,打印
                        grdSub.Rows[0].Cells[0].Value = "*";
                        Report = new GridppReport();
                        Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + ".grf");  //here .
                        Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
                        Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
                        Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
                        if (comboBox_PrinterParams.Text != "")
                        {
                            Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(默认)", "");
                        }
                        Report.Print(false);
                        //组托成功后,清空组托数量与源单信息
                        set_clearPackQtyAndSourceInfo();
                    }
                    Report.Print(false);
                }catch(Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
@@ -430,25 +461,31 @@
        //生成托盘条码
        private bool Sub_SaveBill()
        {
            //获取组织信息
            HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
            HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
            if (HOrgID == -1)
            try
            {
                MessageBox.Show("选择组织有错误!");
                return false;
            }
                //获取组织信息
                HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
                HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
                if (HOrgID == -1)
                {
                    throw new Exception("选择组织有错误!");
                }
            if (!Sub_AllowSave())//单据完整性判断
                if (!Sub_AllowSave())//单据完整性判断
                {
                    throw new Exception("单据完整性判断失败!");
                }
                SaveBarCode();
                return true;
            }catch(Exception ex)
            {
                return false;
                string sql = "exec h_p_WMS_PackBarCodeBill_dealDataWhenError '" + textBox_HPackBarCode + "'";
                oCn.RunProc(sql);
                throw new Exception(ex.Message);
            }
            SaveBarCode();
            return true;
        }
        //单据完整性判断          æœªå®Œæˆ
@@ -506,6 +543,15 @@
                sSQLMul[1] = " exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "'," + HQty.ToString() + " ";
                //判断当前托盘条码是否已经通过临时组托在条码档案中生成了,若已经生成了则不需要在插入
                ds = oCn.RunProcReturn("select * from Gy_BarCodeBill where HBarCode = '" + textBox_HPackBarCode.Text + "' and HSTOCKORGID = " + HOrgID, "Gy_BarCodeBill");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    sSQLMul[0] = "";
                }
                oCn.BeginTran();
                if (getRunProcByMul_Back(sSQLMul, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    //MessageBox.Show("条码生成完毕!");
@@ -517,15 +563,21 @@
                    setPackBarCodeBillData();
                    getDisplay_GrdMain();
                    oCn.Commit();
                }
                else
                {
                    //MessageBox.Show("条码生成失败!" + DBUtility.ClsPub.sExeReturnInfo);
                    oCn.RollBack();
                }
                //oCn.Commit();
            }
            catch (Exception e)
            {
                //MessageBox.Show("条码生成失败!" + e.Message);
                oCn.RollBack();
                throw new Exception(e.Message);
            }
        }
@@ -540,27 +592,30 @@
                {
                    for (int i = 0; i < 1; i++)
                    {
                        oCn.RunProc(sSQL[i]);
                        if (sSQL[i].Length > 0)
                        {
                            oCn.RunProc(sSQL[i]);
                        }
                    }
                    //上传组托信息到服务器
                    send();
                    oCn.Commit();
                }
                else
                {
                    sErrMsg = "没有数据!";
                    oCn.Commit();
                    return false;
                    sErrMsg = "没有数据!";
                    throw new Exception(sErrMsg);
                }
                oCn.Commit();
                //oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sErrMsg = e.Message;
                oCn.RollBack();
                return false;
                sErrMsg = e.Message;
                throw new Exception(sErrMsg);
            }
        }
        #endregion
@@ -570,16 +625,22 @@
        private void send()
        {
            string err = "";
            if (!CheckModRight(ModRightNamePackUnion, DBUtility.ClsPub.CurUserName, ref err))
            {
                MessageBox.Show(err);
                return;
            }
            //if (!CheckModRight(ModRightNamePackUnion, DBUtility.ClsPub.CurUserName, ref err))
            //{
            //    MessageBox.Show(err);
            //    return;
            //}
            //if (MessageBox.Show("确定要上传?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
            //{
            //    return;
            //}
            LoadData();
            try
            {
                LoadData();
            }catch(Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        //判断用户权限
@@ -608,7 +669,7 @@
            //判断是否数据完整 
            if (AllowLoadData() == false)
            {
                return;
                throw new Exception("数据完整性判断失败!");
            }
            try
            {
@@ -626,14 +687,14 @@
                }
                else
                {
                    MessageBox.Show("生成失败!原因:" + err);
                    return;
                    string error = "生成失败!原因:" + err;
                    throw new Exception(error);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("单据号:" + textBox_sBillID.Text + ",单据ID:" + textBox_sBillID.Text + ";上传失败!" + e.Message);
                return;
                string error = "单据号:" + textBox_sBillID.Text + ",单据ID:" + textBox_sBillID.Text + ";上传失败!" + e.Message;
                throw new Exception(error);
            }
        }
@@ -657,37 +718,37 @@
        public bool set_SavePackUnionBill_Add(Int64 HInterID, string HBillType, string HBillNo, string HBarCode_Pack, string HMaker, Int64 HStockOrgID, ref string sErrMsg)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            oCn.BeginTran();
            try
            {
                oCn.BeginTran();
                DataSet ds = oCn.RunProcReturn("exec h_p_Sc_PackUnionBill_Insert_New " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode_Pack + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_Sc_PackUnionBill_Insert_New");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";上传失败!";
                    oCn.RollBack();
                    return false;
                    sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";上传失败!";
                    throw new Exception(sErrMsg);
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 1)
                    {
                        sErrMsg = "上传失败,单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                        oCn.RollBack();
                        return false;
                        sErrMsg = "上传失败,单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                        throw new Exception(sErrMsg);
                    }
                    else
                    {
                        //sErrMsg = "生成生产组托单成功!单据号为:" + HBillNo;
                        oCn.Commit();
                        //sErrMsg = "生成生产组托单成功!单据号为:" + HBillNo;
                        return true;
                    }
                }
            }
            catch (Exception e)
            {
                sErrMsg = "生成生产组托单失败!" + e.Message;
                oCn.RollBack();
                return false;
                sErrMsg = "生成生产组托单失败!" + e.Message;
                throw new Exception(sErrMsg);
            }
        }
@@ -704,20 +765,30 @@
            {
                if (e.KeyChar == (char)Keys.Return)
                {
                    //防错判断
                    if(!judgeIsSameSourceBill(textBox_HBarCode.Text.Trim()))
                    {
                        textBox_HBarCode.Text = "";
                        return;
                    }
                    SetBarCode_Webs();
                    textBox_HBarCode.Text = "";
                    textBox_HBarCode.Focus();
                    autoProducePackBarCode();
                    if (grdMain.Rows.Count ==1 )
                    {
                        getPackQty(grdMain.Rows[0].Cells[4].Value.ToString());
                    }
                }
            }
            catch (Exception e2)
            {
                //if (DBUtility.ClsPub.bSound)
                //{
                //    DBUtility.ClsPub.MessageBeep((int)DBUtility.ClsPub.BeepType.Warning);
                //}
                MessageBox.Show("发生网络异常,请稍后再试!");
                textBox_HBarCode.Text = "";
                textBox_HBarCode.Focus();
                MessageBox.Show(e2.Message);
            }
        }
        //将条码信息写入条码出入库临时表
@@ -741,13 +812,13 @@
                }
                else
                {
                    MessageBox.Show(err);
                    return;
                    throw new Exception(err);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("扫描子条码,写入临时表信息失败!" + e.Message + err);
                string sError = "扫描子条码,写入临时表信息失败!" + e.Message + err;
                throw new Exception(sError);
            }
        }
@@ -1095,6 +1166,11 @@
        private void toolStripButton_Delete_Click(object sender, EventArgs e)
        {
            deleteGrdMainNote();
            if (grdMain.Rows.Count== 0)
            {
                set_clearPackQtyAndSourceInfo();
            }
        }
        #endregion
@@ -1105,14 +1181,29 @@
        {
            if (grdMain.SelectedRows != null && grdMain.SelectedRows.Count==1)
            {
                if (MessageBox.Show("确定要删除?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
                //if (MessageBox.Show("确定要删除?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
                //{
                //    return;
                //}
                //if (MessageBox.Show("删除后将不可恢复,确定要继续操作?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
                //{
                //    return;
                //}
                string pwd = Interaction.InputBox("请输入密码", "删除确认!", "", 100, 100);
                //点击取消
                if(pwd == "")
                {
                    return;
                }
                if (MessageBox.Show("删除后将不可恢复,确定要继续操作?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
                if(pwd != "123456")
                {
                    MessageBox.Show("密码错误!");
                    return;
                }
                Delete();
            }
            else
@@ -1161,9 +1252,270 @@
            }
        }
        #endregion
        #region ä¸´æ—¶ç»„托
        #region ä¸´æ—¶ç»„托 æŒ‰é’®ç‚¹å‡»äº‹ä»¶
        private void button_produceTemp_Click(object sender, EventArgs e)
        {
            if (HQty == 0)
            {
                MessageBox.Show("请扫码子条码!");
                return;
            }
            this.produceTemp();
            //设置打印模板,打印
            grdSub.Rows[0].Cells[0].Value = "*";
            Report = new GridppReport();
            Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + "_Temp" + ".grf");  //here .
            Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
            Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
            Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
            if (comboBox_PrinterParams.Text != "")
            {
                Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(默认)", "");
            }
            Report.Print(false);
            //组托成功后,清空组托数量与源单信息
            set_clearPackQtyAndSourceInfo();
        }
        #endregion
        #region ä¸´æ—¶ç»„托
        private void produceTemp()
        {
            //判断条码档案中是否已经存在该托条码,若存在,则不需要再创建。重新加载界面即可。
            DataSet ds_getPackBarCode;
            string sql_getPackBarCode = "select * from Gy_BarCodeBill where HBarCode = '" + textBox_HPackBarCode.Text + "'";
            ds_getPackBarCode = oCn.RunProcReturn(sql_getPackBarCode, "Gy_BarCodeBill");
            if (ds_getPackBarCode != null && ds_getPackBarCode.Tables[0].Rows.Count > 0)
            {
                //重新加载界面
                getDisplay_grdSub();
                setPackBarCodeBillData();
                getDisplay_GrdMain();
                return;
            }
            //获取组织信息
            HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
            HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
            //验证组织
            if (HOrgID == -1)
            {
                MessageBox.Show("选择组织有错误!");
                return;
            }
            //单据完整性判断
            if (!Sub_AllowSave())
            {
                return;
            }
            //获取当前产线及产线内码
            long HSourceID = 0;
            string sql = "select * from Gy_Source where HName = '" + comboBox_SourceNameParams.Text + "' ";
            DataSet ds = oCn.RunProcReturn(sql, "Gy_Source");
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                HSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HItemID"].ToString());
            }
            //拼接临时组托时,托条码的生成语句
            sSQLMul = new string[2];
            sSQLMul[0] = "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
                            ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
                            ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
                            ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
                            ",HCusID,HCusType,HEndDate,HWorkLineName,HJiaYe " +
                            ",HPressModel,HCusModel,HMaterialModel,HColor,HBarCodeDate " +
                            ",HLogo,HPackageSize,HMaterialJQty,HMaterialMQty,HCustomBatchNo " +
                            ",HSTOCKORGID,HOWNERID,HBeginDate,HSeOrderBillNo,HGBBarCode " +
                            ",POOrderBillNo,HInterID,HInitSourceEntryID,HBarCode_Pack " +
                            ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo " +
                            ",HCustomQty1,HLayerNumber,HCusBarCode,HBarCodeStatus,HSourceID " +
                            ") values ("
                            + "'" + textBox_HPackBarCode.Text + "','" + HBarCodeType + "',0,0,1"
                            + ",'',0,0,'" + ClsPub.CurUserName + "',getdate(),0,1"
                            + ",0,0,'','',''"
                            + "," + HQty.ToString() + ",1,0,0,0,''"
                            + ",0,'','','',''"
                            + ",'','','','','" + sDate + "'"
                            + ",'','',0,0,''"
                            + "," + HOrgID.ToString() + "," + HOrgID.ToString() + ",'','',''"
                            + ",''," + HInterID.ToString() + ",0,'" + textBox_HPackBarCode.Text + "'"
                            + ",'','','',0,''"
                            + ",0,0,'',''," + HSourceID +
                            ")";
            //拼接 æ›´æ–° æ‰˜æ¡ç æµæ°´å· çš„sql语句
            sSQLMul[1] = " exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "'," + HQty.ToString() + " ";
            if (sSQLMul.Length > 0)
            {
                //执行托条码的生成语句与托条码流水号的更新语句
                for (int i = 0; i < 1; i++)
                {
                    oCn.RunProc(sSQLMul[i]);
                }
                //重新加载界面
                getDisplay_grdSub();
                setPackBarCodeBillData();
                getDisplay_GrdMain();
            }
            else
            {
                MessageBox.Show("没有数据!");
                return;
            }
        }
        #endregion
        #region æ‰˜æ¡ç  æ‰«ç 
        private void textBox_HPackBarCode__KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Return)
            {
                //获取扫描的托条码
                string HPackBarCode = textBox_HPackBarCode.Text;
                //条码类型
                HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text);
                //获取组织信息
                HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
                HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
                //声明用于数据库查询的变量
                string sql = "";
                DataSet ds;
                //判断 æ‰˜æ¡ç æ˜¯å¦å·²ç»ç”Ÿæˆç»„托单
                sql = "select * from Sc_PackUnionBillMain where HBarCode_Pack = '" + HPackBarCode + "'";
                ds = oCn.RunProcReturn(sql, "Sc_PackUnionBillMain");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("托条码[" + HPackBarCode + "]已经组托!");
                    return;
                }
                //获取当前产线
                long HSourceID = 0;
                sql = "select * from Gy_Source where HName = '" + comboBox_SourceNameParams.Text + "'";
                ds = oCn.RunProcReturn(sql, "Gy_Source");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    HSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HItemID"].ToString());
                }
                //获取缓存列表中 æ‰˜æ¡ç  å¯¹åº”çš„ ç»„托记录
                sql = "select top(1) a.* from Sc_PackUnionBill_Temp as a inner join Gy_BarCodeBill as b on a.HBarCode = b.HBarCode where a.HBarCode_Pack = '" + HPackBarCode + "' and b.HSourceID = " + HSourceID + " and a.HStockorgID = " + HOrgID;
                //sql = "select top(1) a.* from Sc_PackUnionBill_Temp as a where a.HBarCode_Pack = '" + HPackBarCode + "' and a.HStockorgID = " + HOrgID;
                ds = oCn.RunProcReturn(sql, "Sc_PackUnionBill_Temp");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("缓存列表中未查询到该托条码与子条码的组托记录!");
                    return;
                }
                else
                {
                    string HBarCode_Pack = ds.Tables[0].Rows[0]["HBarCode_Pack"].ToString();
                    long HBillID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HInterID"].ToString());
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    textBox_HPackBarCode.Text = HBarCode_Pack;
                    textBox_sBillID.Text = HBillID.ToString();
                    textBox_sBillNo.Text = HBillNo;
                    getDisplay_GrdMain();
                    if (grdMain.Rows.Count > 0 && grdMain.Rows[0].Cells[4].Value != null)
                    {
                        getPackQty(grdMain.Rows[0].Cells[4].Value.ToString());
                    }
                }
            }
        }
        #endregion
        #endregion
        #region æ ¹æ®æ¡ç ç¼–号,获取条码中物料所对应的组托数量,同时记录源单主ID、子ID
        private void getPackQty(string HBarCode)
        {
            string sql = "select * from h_v_IF_BarCodeBillList_getPackQty where æ¡ç ç¼–号 = '" + HBarCode + "'";
            DataSet ds_getPackQty = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList_getPackQty");
            if (ds_getPackQty == null || ds_getPackQty.Tables[0].Rows.Count <= 0)
            {
                HSourceInterID_ICMO = 0;
                HSourceEntryID_ICMO = 0;
                textBox_PackQty.Text = "";
                return;
            }
            HSourceInterID_ICMO = int.Parse(ds_getPackQty.Tables[0].Rows[0]["HSourceInterID"].ToString());
            HSourceEntryID_ICMO = int.Parse(ds_getPackQty.Tables[0].Rows[0]["HSourceEntryID"].ToString());
            textBox_PackQty.Text = Double.Parse(ds_getPackQty.Tables[0].Rows[0]["组托数量"].ToString()).ToString();
        }
        #endregion
        #region åˆ¤æ–­å½“前扫描的条码是否与已经扫描过的条码为同一工单生成的
        private bool judgeIsSameSourceBill(string HBarCode)
        {
            if (grdMain.Rows.Count == 0)
            {
                return true;
            }
            else
            {
                string sql = "select * from h_v_IF_BarCodeBillList_getPackQty where æ¡ç ç¼–号 = '" + HBarCode + "'";
                DataSet ds_getPackQty = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList_getPackQty");
                if (ds_getPackQty == null || ds_getPackQty.Tables[0].Rows.Count <= 0)
                {
                    MessageBox.Show("当前条码不存在!");
                    return false;
                }
                else
                {
                    int HSourceInterID_ICMO_Bak = int.Parse(ds_getPackQty.Tables[0].Rows[0]["HSourceInterID"].ToString());
                    int HSourceEntryID_ICMO_Bak = int.Parse(ds_getPackQty.Tables[0].Rows[0]["HSourceEntryID"].ToString());
                    if (HSourceInterID_ICMO != HSourceInterID_ICMO_Bak || HSourceEntryID_ICMO != HSourceEntryID_ICMO_Bak)
                    {
                        MessageBox.Show("当前扫描的条码与之前所扫描的条码工单不一致!");
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
            }
        }
        #endregion
        #region æ¸…空 ç»„托数量 ä¸Žè®°å½•的源单主ID、子ID
        private void set_clearPackQtyAndSourceInfo()
        {
            textBox_PackQty.Text = "";
            HSourceInterID_ICMO = 0;
            HSourceEntryID_ICMO = 0;
        }
        #endregion
    }
}