1
duhe
2025-03-31 9b4915b7b3669ffe80774740bd06c547ece49494
WarM/ÌõÂë´òÓ¡/Kf_WeighToBarCode.cs
@@ -28,6 +28,8 @@
        public Int64 HInterID = 0;
        public string HBillNo = "";
        public string HBillType = "1202";
        public Int64 HMaterID = 0;
        public string HBatchNo = "";
        public Int64 HAuxPropID = 0;
        public Int64 HUnitID = 0;
        public Int64 HWhID = 0;
@@ -48,6 +50,8 @@
        public string PrintQtyCtl = "";         //条码打印次数控制
        public string UpdatePrintQtyCtl = "";   //条码打印次数更新
        public string sBarCodeItemID = "";      //条码自增列
        public string HBarCode_Pack = "";       //托条码
        public long HSNo = 0;                   //组托计数用
        public DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
@@ -113,11 +117,15 @@
            {
                HInterID = DBUtility.ClsPub.CreateBillID_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo);           //得到新单据ID
                HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);    //得到新单据号
                HSNo = 0;
                this.lblSNo.Text = "";
            }
            else if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1)
            {
                HInterID = DBUtility.ClsPub.CreateBillID_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo);           //得到新单据ID
                HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);    //得到新单据号
                HSNo = 0;
                this.lblSNo.Text = "";
            }
            else
            {
@@ -129,7 +137,7 @@
            if (grdSub.Rows.Count > 0)
            {
                grdSub.Rows[0].Selected = true;
                SourceBill();
                SourceBill(1);
                txtHQty.Focus();
            }
            else
@@ -328,6 +336,12 @@
                return false;
            }
            if (DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text) != "")
            {
                MessageBox.Show("当前组托未结束,请结束组托后再点击换班!", "提示");
                return false;
            }
            //判断会计期是否合理
            string s = "";
            int sYear = 0;
@@ -413,8 +427,7 @@
                }
                Source_Display();
                grdSub.Rows[0].Selected = true;
                DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp);
                SourceBill();
                SourceBill(2);
                txtHBarCode.Text = "";
                txtHQty.Focus();
            }
@@ -430,8 +443,7 @@
            }
            Source_Display();
            grdSub.Rows[0].Selected = true;
            DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp);
            SourceBill();
            SourceBill(2);
            txtHBarCode.Text = "";
            txtHQty.Focus();
        }
@@ -462,11 +474,6 @@
        private void cmdSourceBillNo_Click(object sender, EventArgs e)
        {
            //初始化右边表头信息
            cmbHBarCodeType.Items.Clear();
            cmbHBarCodeType.Items.Add("唯一条码");
            DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp);
            if (grdSub.CurrentRow == null)
            {
                MessageBox.Show("请在左边单据列表中选择一行单据!", "提示");
@@ -479,7 +486,7 @@
            }
            else
            {
                SourceBill();
                SourceBill(3);
                txtHQty.Focus();
            }
        }
@@ -496,6 +503,10 @@
            }
            SaveBarCode();
            BarCode_Display();
            if (DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text) != "")
            {
                this.lblSNo.Text = "当前已组 " + HSNo + " ä»¶";
            }
            grdMain.Rows[0].Selected = true;
            sBarCodeItemID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[0].Index].Cells[Fun_GetCol("HItemID")].Value).ToString();
@@ -703,7 +714,6 @@
            Int64 HBadReasonID = 0;     //不良原因ID
            string HCusMaterName = "";  //客户物料名称
            string HCusModel = "";      //客户规格型号
            string HBarCode_Pack = "";  //托盘条码
            HBarCode = TM;
            HBarCodeType = DBUtility.ClsPub.isStrNull(cmbHBarCodeType.Text);
@@ -720,7 +730,10 @@
            HBadReasonID = DBUtility.ClsPub.isLong(txtHRemark.Tag);
            HCusMaterName = DBUtility.ClsPub.isStrNull(txtHCusMaterName.Text);
            HCusModel = DBUtility.ClsPub.isStrNull(txtHCusModel.Text);
            HBarCode_Pack = DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text);
            if (HBarCode_Pack != "")
            {
                HSNo = HSNo + 1;
            }
            try
            {
@@ -734,7 +747,7 @@
                ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate,HMaterialJQty,HMaterialMQty,HNowQty " +
                ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag,HBarCode_Pack " +
                ",HOrderInterID,HOrderEntryID,HOrderBillNo,HCustomQty1,HMaterialModel,HCusModel " +
                ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HLogo " +
                ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HLogo,HPackflag " +
                ") Values ("
                + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString()
                + ",'" + HBatchNo + "'," + HSupID.ToString() + ",0,'" + HMaker + "',getdate(),0," + HQty.ToString()
@@ -743,7 +756,7 @@
                + ", 0,'',getdate(),'','" + sDate + "'," + HMaterialJQty.ToString() + "," + HMaterialMQty.ToString() + "," + HNowQty.ToString()
                + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0,'" + HBarCode_Pack + "'"
                + ", " + HProcessExchangeInterID.ToString() + ",0,'" + HProcessExchangeBillNo + "'," + HBadReasonID.ToString() + ",'" + HCusMaterName + "','" + HCusModel + "'"
                + ",'" + HMaterName + "','" + HMaterModel + "',''," + HAuxPropID.ToString() + ",'','','1')");
                + ",'" + HMaterName + "','" + HMaterModel + "',''," + HAuxPropID.ToString() + ",'','','1',0)");
                //回填最大流水号
                oCn.RunProc("exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "',1 ");
@@ -782,9 +795,53 @@
        #region  //返回信息
        //返回源单列表信息
        private void SourceBill()
        //返回源单列表信息(num=1,打开模块时加载显示;num=2,扫流转卡显示;num=3,选单按钮显示)
        private void SourceBill(int num)
        {
            //打开模块时加载显示
            if (num == 1)
            {
                txtHBarCode_Pack.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HBarCode_Pack")].Value);
                HBarCode_Pack = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HBarCode_Pack")].Value);
                HSNo = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HSNo")].Value);
                if (HBarCode_Pack == "")
                {
                    this.lblSNo.Text = "";
                }
                else
                {
                    this.lblSNo.Text = "当前已组 " + HSNo + " ä»¶";
                    cmdHBPack.Enabled = false;
                }
            }
            //扫流转卡显示
            if (num == 2)
            {
                //初始化右边表头信息
                DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp);
                if (HBarCode_Pack != "")
                {
                    txtHBarCode_Pack.Text = HBarCode_Pack;
                    this.lblSNo.Text = "当前已组 " + HSNo + " ä»¶";
                }
            }
            //选单按钮显示
            if (num == 3)
            {
                if (HBarCode_Pack != "" && (HMaterID != DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HMaterID")].Value)
                    || HBatchNo != DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("批号")].Value)))
                {
                    MessageBox.Show("所扫描流转卡对应物料、批号与当前正在组托物料、批号不一致,不同物料、批号不允许组托在同一托上,如需换物料生成条码请先结束当前组托!", "提示");
                    return;
                }
                //初始化右边表头信息
                DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp);
                if (HBarCode_Pack != "")
                {
                    txtHBarCode_Pack.Text = HBarCode_Pack;
                    this.lblSNo.Text = "当前已组 " + HSNo + " ä»¶";
                }
            }
            txtHBillNo.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("单据号")].Value);
            txtHDeptName.Tag = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HDeptID")].Value);
            txtHDeptName.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("车间")].Value);
@@ -795,6 +852,8 @@
            txtHBatchNo.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("批号")].Value);
            txtHCusMaterName.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HCusMaterName")].Value);
            txtHCusModel.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HCusModel")].Value);
            HMaterID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HMaterID")].Value);
            HBatchNo = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("批号")].Value);
            HAuxPropID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HAuxPropID")].Value);
            HUnitID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HUnitID")].Value);
            HWhID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HWhID")].Value);
@@ -874,6 +933,7 @@
                    string HItemID = "";
                    string HBarCode = "";
                    string HBarCode2 = "";
                    long HSNo_Temp = HSNo;
                    for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
                    {
                        HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
@@ -890,14 +950,35 @@
                        {
                            HRemark = HRemark + "、" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value);
                        }
                        //更新当前已组托件数
                        if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) != ""
                            && DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) == HBarCode_Pack
                            && DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码类型")].Value) != "托盘条码")
                        {
                            HSNo = HSNo - 1;
                        }
                        if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码类型")].Value) == "托盘条码")
                        {
                            MessageBox.Show("所选条码编号:" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value) + " ä¸ºæ‰˜ç›˜æ¡ç ï¼Œä¸å…è®¸ä½œåºŸï¼", "提示");
                            return;
                            if (DBUtility.ClsPub.isBool(grdMain.SelectedRows[i].Cells[Fun_GetCol("HPackflag")].Value))
                            {
                                MessageBox.Show("所选条码编号:" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value) + " ä¸ºæ‰˜ç›˜æ¡ç ï¼Œä¸”已组托生成对应组托单,不允许作废!", "提示");
                                return;
                            }
                            else if (HSNo > 0)
                            {
                                MessageBox.Show("所选条码编号:" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value) + " ä¸ºæ‰˜ç›˜æ¡ç ï¼Œä¸”当前托盘条码下已生成对应条码,不允许作废!", "提示");
                                return;
                            }
                            else
                            {
                                HBarCode_Pack = "";
                            }
                        }
                    }
                    if (HRemark != "")
                    {
                        HSNo = HSNo_Temp;
                        HBarCode_Pack = DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text);
                        MessageBox.Show("所选条码编号:"+ HRemark.Remove(0, 1)+" å·²ä½œåºŸï¼Œä¸å…è®¸é‡å¤ä½œåºŸï¼", "提示");
                        return;
                    }
@@ -925,11 +1006,23 @@
                    catch (Exception e2)
                    {
                        oCn.RollBack();
                        HSNo = HSNo_Temp;
                        HBarCode_Pack = DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text);
                        MessageBox.Show("作废条码失败!" + e2.Message, "提示");
                        return;
                    }
                    //刷新称重记录列表信息
                    BarCode_Display();
                    if (HBarCode_Pack != "")
                    {
                        this.lblSNo.Text = "当前已组 " + HSNo + " ä»¶";
                    }
                    else
                    {
                        txtHBarCode_Pack.Text = "";
                        this.lblSNo.Text = "";
                        cmdHBPack.Enabled = true;
                    }
                    MessageBox.Show("所选条码编号:" + HBarCode.Remove(0, 1) + " ä½œåºŸæˆåŠŸï¼", "提示");
                }
            }
@@ -957,7 +1050,27 @@
                    string HItemID = "";
                    string HBarCode = "";
                    string HBarCode2 = "";
                    string HBarCode_Pack = DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text);
                    long HSNo_Temp = HSNo;
                    bool HFlag = false;
                    //界面上为未启用组托状态
                    if (HBarCode_Pack == "")
                    {
                        for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
                        {
                            //判断条码是否为托盘条码,未生成组托单,已作废状态,界面上为未组托状态
                            if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码类型")].Value) == "托盘条码"
                                && DBUtility.ClsPub.isBool(grdMain.SelectedRows[i].Cells[Fun_GetCol("HPackflag")].Value) == false
                                && DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("作废标记")].Value) != ""
                                )
                            {
                                HFlag = true;
                                HBarCode_Pack = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value);
                                break;
                            }
                        }
                    }
                    for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
                    {
                        HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
@@ -974,20 +1087,44 @@
                        {
                            HRemark = HRemark + "、" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value);
                        }
                        if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码类型")].Value) == "托盘条码")
                        //条码为组托条码
                        if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) != "")
                        {
                            MessageBox.Show("所选条码编号:" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value) + " ä¸ºæ‰˜ç›˜æ¡ç ï¼Œä¸å…è®¸åä½œåºŸï¼", "提示");
                            return;
                        }
                        if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) != ""
                            && DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) != HBarCode_Pack)
                        {
                            MessageBox.Show("所选条码编号:" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value) + " å·²ç”Ÿæˆå¯¹åº”组托单,不允许反作废!", "提示");
                            return;
                            //已上传生成组托单
                            if (DBUtility.ClsPub.isBool(grdMain.SelectedRows[i].Cells[Fun_GetCol("HPackflag")].Value))
                            {
                            }
                            //未上传生成组托单
                            else
                            {
                                //条码对应托条码和界面上的托条码一致
                                if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) == HBarCode_Pack)
                                {
                                    //更新当前已组托件数
                                    if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码类型")].Value) != "托盘条码")
                                    {
                                        HSNo = HSNo + 1;
                                    }
                                }
                                //条码对应托条码和界面上的托条码不一致
                                else
                                {
                                    MessageBox.Show("所选条码编号:" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value) + " å¯¹åº”托条码:" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) + " å·²ç”Ÿæˆç»„托单,或已作废,不允许反作废!", "提示");
                                    return;
                                }
                            }
                        }
                    }
                    if (HRemark != "")
                    {
                        HSNo = HSNo_Temp;
                        if(HFlag)
                        {
                            HBarCode_Pack = "";
                        }
                        MessageBox.Show("所选条码编号:" + HRemark.Remove(0, 1) + " æœªä½œåºŸï¼Œä¸å…è®¸åä½œåºŸï¼", "提示");
                        return;
                    }
@@ -1023,7 +1160,7 @@
                        ",0,0,'',0,'',0" +
                        ",HSTOCKORGID,HSTOCKORGID,HSTOCKORGID,'','称重入库生成-反作废','2'" +
                        ",0,0,'',0" +
                        "from Gy_BarCodeBill with(nolock) where HItemID in (" + HItemID + ")"
                        "from Gy_BarCodeBill with(nolock) where HItemID in (" + HItemID + ") and HBarCodeType='唯一条码' "
                        );
                        //写入系统日志
@@ -1036,11 +1173,28 @@
                    catch (Exception e2)
                    {
                        oCn.RollBack();
                        HSNo = HSNo_Temp;
                        if (HFlag)
                        {
                            HBarCode_Pack = "";
                        }
                        MessageBox.Show("反作废条码失败!" + e2.Message, "提示");
                        return;
                    }
                    //刷新称重记录列表信息
                    BarCode_Display();
                    if (HBarCode_Pack != "")
                    {
                        txtHBarCode_Pack.Text = HBarCode_Pack;
                        this.lblSNo.Text = "当前已组 " + HSNo + " ä»¶";
                        cmdHBPack.Enabled = false;
                    }
                    else
                    {
                        txtHBarCode_Pack.Text = "";
                        this.lblSNo.Text = "";
                        cmdHBPack.Enabled = true;
                    }
                    MessageBox.Show("所选条码编号:" + HBarCode.Remove(0, 1) + " åä½œåºŸæˆåŠŸï¼", "提示");
                }
            }
@@ -1069,23 +1223,25 @@
            {
                return;
            }
            HSNo = 0;
            SavePackBarCode();
            BarCode_Display();
            this.lblSNo.Text = "当前已组 " + HSNo + " ä»¶";
            grdMain.Rows[0].Selected = true;
            txtHBarCode_Pack.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[0].Index].Cells[Fun_GetCol("条码编号")].Value);
            HBarCode_Pack = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[0].Index].Cells[Fun_GetCol("条码编号")].Value);
            cmdHBPack.Enabled = false;
            sBarCodeItemID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[0].Index].Cells[Fun_GetCol("HItemID")].Value).ToString();
            //自动打印
            if (chkHDYFlag.Checked == true)
            {
                //打印条码
                Sub_SetReport("托盘条码");
                Report.Print(false);
                Thread.Sleep(1000);
            }
            else
            //if (chkHDYFlag.Checked == true)
            //{
            //    //打印条码
            //    Sub_SetReport("托盘条码");
            //    Report.Print(false);
            //    Thread.Sleep(1000);
            //}
            //else
            {
                //选择打印模板
                BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
@@ -1118,6 +1274,11 @@
            if (HInterID == 0 || HBillNo == "")
            {
                MessageBox.Show("获取条码对应单据ID或单据号失败,请重新刷新界面!", "提示");
                return false;
            }
            if (HProcessExchangeInterID == 0)
            {
                MessageBox.Show("请先扫描流转卡号!", "提示");
                return false;
            }
            return true;
@@ -1158,10 +1319,24 @@
            TM = sTMNumber + LSH2;
            string HBarCode = "";
            string HBarCodeType = "托盘条码";
            string HBarCodeType = "";
            string HMaterID = "";       //物料内码
            string HBatchNo = "";       //批次
            string HMaterName = "";
            string HMaterModel = "";
            string HProcessExchangeBillNo = "";
            string HCusMaterName = "";  //客户物料名称
            string HCusModel = "";      //客户规格型号
            HBarCode = TM;
            HBarCodeType = "";
            HBarCodeType = "托盘条码";
            HMaterID = DBUtility.ClsPub.isStrNull(txtHMaterNumber.Tag);
            HBatchNo = DBUtility.ClsPub.isStrNull(txtHBatchNo.Text);
            HMaterName = DBUtility.ClsPub.isStrNull(txtHMaterName.Text);
            HMaterModel = DBUtility.ClsPub.isStrNull(txtHMaterModel.Text);
            HProcessExchangeBillNo = DBUtility.ClsPub.isStrNull(txtHBillNo.Text);
            HCusMaterName = DBUtility.ClsPub.isStrNull(txtHCusMaterName.Text);
            HCusModel = DBUtility.ClsPub.isStrNull(txtHCusModel.Text);
            try
            {
@@ -1175,16 +1350,16 @@
                ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate,HMaterialJQty,HMaterialMQty,HNowQty " +
                ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag " +
                ",HOrderInterID,HOrderEntryID,HOrderBillNo,HCustomQty1,HMaterialModel,HCusModel " +
                ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HLogo " +
                ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HLogo,HPackflag " +
                ") Values ("
                + "'" + HBarCode + "','" + HBarCodeType + "',0,0,1,'" + HBarCode + "'"
                + ",'',0,0,'" + HMaker + "',getdate(),0,1"
                + ",0,0,'','',''"
                + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + ",1,'" + HBarCode + "'"
                + ",'" + HBatchNo + "'," + HSupID.ToString() + ",0,'" + HMaker + "',getdate(),0,1"
                + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "',''"
                + ",1,0,0,0,0,''"
                + ", 0,'',getdate(),'','" + sDate + "',0,0,0"
                + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0"
                + ", " + HProcessExchangeInterID.ToString() + ",0,'',0,'',''"
                + ",'','','',0,'','','1')");
                + ", " + HProcessExchangeInterID.ToString() + ",0,'" + HProcessExchangeBillNo + "',0,'" + HCusMaterName + "','" + HCusModel + "'"
                + ",'" + HMaterName + "','" + HMaterModel + "',''," + HAuxPropID.ToString() + ",'','','1',0)");
                //回填最大流水号
                oCn.RunProc("exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "',1 ");
@@ -1203,8 +1378,6 @@
        #region  //结束组托
        private void cmdHEPack_Click(object sender, EventArgs e)
        {
            string HBarCode_Pack = DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text);
            //生成组托单前判断
            if(HBarCode_Pack=="")
            {
@@ -1215,7 +1388,8 @@
            for (int i = 0; i < grdMain.RowCount; i++)
            {
                if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[Fun_GetCol("条码类型")].Value) == "唯一条码"
                    && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) == HBarCode_Pack)
                    && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) == HBarCode_Pack
                    && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[Fun_GetCol("作废标记")].Value) == "")
                {
                    b = true;
                    break;
@@ -1261,18 +1435,25 @@
                ",HAuxPropID,HBatchNo,HMTONo" +
                ",HSourceID,HEquipID,HGroupID,HWorkerID,HStatus" +
                ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType) " +
                " select " + HPUInterID.ToString() + ",HItemID,'0,0,''" +
                " select " + HPUInterID.ToString() + ",HItemID,0,0,''" +
                ",HMaterID,HUnitID,HQty,HBarCode,HBarCode_Pack,getdate()" +
                ",HAuxPropID,HBatchNo,HMTONo" +
                ",0,0,0,0,0" +
                ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
                "from Gy_BarCodeBill with(nolock) where HInterID=" + HInterID.ToString() + " and HBarCode_Pack='" + HBarCode_Pack + "' and HStopflag=0"
                " from Gy_BarCodeBill with(nolock) where HInterID=" + HInterID.ToString() + " and HBarCode_Pack='" + HBarCode_Pack + "' and HStopflag=0 and HBarCodeType='唯一条码' "
                );
                //回填条码档案组托标记
                oCn.RunProc("update Gy_BarCodeBill set HPackflag=1 where HInterID=" + HInterID.ToString() + " and HBarCode_Pack='" + HBarCode_Pack + "' and HStopflag=0", ref DBUtility.ClsPub.sExeReturnInfo);
                MessageBox.Show("生成生产组托单:" + HPUBillNo + " æˆåŠŸï¼", "提示");
                txtHBarCode_Pack.Text = "";
                HBarCode_Pack = "";
                cmdHBPack.Enabled = true;
                HSNo = 0;
                this.lblSNo.Text = "";
                BarCode_Display();
                oCn.Commit();
                return;
            }