duhe
2023-09-07 2df469d76274eee773d8e247659f9ee09eed67b5
WarM/ÌõÂë´òÓ¡/Kf_WeighToBarCode.cs
@@ -21,7 +21,6 @@
            InitializeComponent();
        }
        public frmBillQueryCondition_New frmCondition;
        public string ViewName = "Sc_ICMOBillStatus_Tmp";
        public string ModCaption = "称重入库";
        public const string ModName = "85";
        public Int64 HInterID = 0;
@@ -36,7 +35,10 @@
        public Int64 HSourceEntryID = 0;
        public string HSourceBillNo = "";
        public string HSourceBillType = "";
        public Int64 ProcessExchangeInterID = 0;
        public Int64 HSupID = 0;
        public double HSourceQty = 0;
        public double HMaterWeight = 0;         //物料克重
        public string HMaker = DBUtility.ClsPub.CurUserName;
        public Int64 HStockOrgID = DBUtility.ClsPub.HOrgID;
        public DateTime HDate = DateTime.Today;
@@ -56,8 +58,10 @@
            cmbHBarCodeType.Items.Clear();
            cmbHBarCodeType.Items.Add("唯一条码");
            DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp);
            txtHBarCode.Text = "";
            grdMain.DataSource = null;
            grdSub.DataSource = null;
            chkHDYFlag.Checked = true;
        }
        //窗体加载
@@ -65,7 +69,6 @@
        {
            frmCondition = new frmBillQueryCondition_New();
            this.Text = ModCaption;
            initGrid();
            Sub_GetSystemParameter();
        }
@@ -106,6 +109,11 @@
                HInterID = DBUtility.ClsPub.CreateBillID_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo);           //得到新单据ID
                HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);    //得到新单据号
            }
            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);    //得到新单据号
            }
            else
            {
                HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
@@ -130,14 +138,18 @@
            GraphicsGrid();
        }
        private void grdSub_Paint(object sender, PaintEventArgs e)
        {
            GraphicsGrid();
        }
        private void GraphicsGrid()
        {
            DBUtility.Xt_BaseBillFun.GraphicsGrid(grdMain);
        }
        private void grdSub_Paint(object sender, PaintEventArgs e)
        {
            GraphicsGridSub();
        }
        private void GraphicsGridSub()
        {
            DBUtility.Xt_BaseBillFun.GraphicsGrid(grdSub);
        }
@@ -298,6 +310,19 @@
        private bool Sub_SaveBill()
        {
            //称重记录列表是否有记录判断
            bool b = false;
            for (int i = 0; i < grdMain.RowCount; i++)
            {
                b = true;
                break;
            }
            if (b == false)
            {
                MessageBox.Show("当前称重记录列表无数据,不允许换班生成单据!", "提示");
                return false;
            }
            //判断会计期是否合理
            string s = "";
            int sYear = 0;
@@ -313,7 +338,16 @@
                oCn.BeginTran();
                //生成出入库单据
                //插入子表
                oCn.RunProc("EXEC h_p_Kf_ProductInBillSub_Insert_New " + HInterID.ToString() + ",'" + HBillNo + "','" + HSourceBillType + "'");
                DataSet ds = oCn.RunProcReturn("EXEC h_p_Kf_ProductInBillSub_Insert_New " + HInterID.ToString() + ",'" + HBillNo + "','" + HSourceBillType + "'", "h_p_Kf_ProductInBillSub_Insert_New");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                }
                else if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0][0]) != "OK")
                {
                    oCn.RollBack();
                    MessageBox.Show("生成入库单失败,当前称重记录列表无数据,不允许换班生成单据!", "提示");
                    return false;
                }
                //插入主表
                oCn.RunProc("Insert Into Kf_ICStockBillMain " +
                    "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
@@ -329,6 +363,8 @@
                    + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ") ");
                //更新关联数量
                oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToProductIn_Add " + HInterID.ToString());
                //回填已生单状态
                oCn.RunProc("Update KF_WeighSource_Temp set HRelationInterID=1 where HInterID= " + HInterID.ToString());
                MessageBox.Show("生成生产入库单:" + HBillNo + " æˆåŠŸï¼", "提示");
                oCn.Commit();
                return true;
@@ -451,21 +487,53 @@
            BarCode_Display();
            grdMain.Rows[0].Selected = true;
            //打印条码
            sBarCodeItemID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[0].Index].Cells[Fun_GetCol("HItemID")].Value).ToString();
            Sub_SetReport("物料条码");
            Report.Print(false);
            Thread.Sleep(1000);
            //自动打印
            if (chkHDYFlag.Checked == true)
            {
                //打印条码
                Sub_SetReport("物料条码");
                Report.Print(false);
                Thread.Sleep(1000);
            }
            else
            {
                //选择打印模板
                BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
                oFrm.sBillName = ModName;
                oFrm.sBillModel = ModCaption;
                oFrm.ShowDialog();
                if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
                {
                    Sub_SetReport(oFrm.sOpenTmp);
                    Report.Print(false);
                    Thread.Sleep(1000);
                }
            }
            txtHQty.Text = "";
            txtHWeightQyt.Text = "";
            txtHKDQty.Text = "";
            txtHBarcodeNo.Text = "";
            txtHRemark.Text = "";
            txtHRemark.Tag = 0;
            txtHQty.Focus();
        }
        //条码生成前判断
        private bool Sub_AllowSave()
        {
            //判断当前单据ID是否已上传生成单据
            DataSet Ds = oCn.RunProcReturn("select top 1 1 from KF_WeighSource_Temp with(nolock) where HInterID=" + HInterID.ToString() + " and HRelationInterID=1 ", "KF_WeighSource_Temp", ref DBUtility.ClsPub.sExeReturnInfo);
            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
            {
            }
            else
            {
                MessageBox.Show("当前条码记录已换班上传生成单据,请退出后重新进入该模块进行条码生成操作!", "提示");
                return false;
            }
            if (HInterID==0 || HBillNo=="")
            {
                MessageBox.Show("获取条码对应单据ID或单据号失败,请重新刷新界面!", "提示");
@@ -481,6 +549,16 @@
                MessageBox.Show("请输入正确重量!", "提示");
                return false;
            }
            else if (DBUtility.ClsPub.isDoule(txtHQty.Text)- DBUtility.ClsPub.isDoule(txtHKDQty.Text) <= 0)
            {
                MessageBox.Show("输入的扣点数不能大于米数!", "提示");
                return false;
            }
            else if (DBUtility.ClsPub.isInt(txtHBarcodeNo.Text) == 0)
            {
                MessageBox.Show("请输入包号!", "提示");
                return false;
            }
            else if (HWhID==0)
            {
                MessageBox.Show("物料未设置默认仓库,获取仓库信息失败,请先设置物料默认仓库!", "提示");
@@ -490,6 +568,22 @@
            {
                MessageBox.Show("物料默认仓库启用了仓位,但未设置仓位,获取仓位信息失败,请先设置物料默认仓位!", "提示");
                return false;
            }
            //实际克重=重量/米数*1000,实际克重超出物料维护克重的百分之二十或不足物料维护克重的百分之八十,预警提示
            double sQty = 0;    //实际克重
            sQty = DBUtility.ClsPub.isDoule(txtHWeightQyt.Text) / DBUtility.ClsPub.isDoule(txtHQty.Text) * 1000;
            if (sQty > HMaterWeight * 1.2 || sQty < HMaterWeight * 0.8)
            {
                if (MessageBox.Show("物料维护克重为:"+HMaterWeight.ToString()+ ",实际克重为:" + sQty.ToString() + ",所输入实际克重超出物料维护克重的百分之二十或不足物料维护克重的百分之八十,请检查输入的数据是否正确!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            return true;
        }
@@ -550,47 +644,64 @@
            string HBarCode = "";
            string HBarCodeType = "";
            double HQty = 0;            //米数
            double HNowQty = 0;         //米数
            double HMaterialJQty = 0;   //重量
            double HMaterialMQty = 0;   //扣点数
            double HQty = 0;            //数量
            Int64 HDeptID = 0;
            string HRemark = "";
            string HMaterName = "";
            string HMaterModel = "";
            string ProcessExchangeBillNo = "";
            Int64 HBarcodeNo = 0;       //包数
            Int64 HBadReasonID = 0;     //不良原因ID
            string HCusMaterName = "";  //客户物料名称
            string HCusModel = "";      //客户规格型号
            HBarCode = TM;
            HBarCodeType = DBUtility.ClsPub.isStrNull(cmbHBarCodeType.Text);
            HQty = DBUtility.ClsPub.isDoule(txtHQty.Text);
            HNowQty = DBUtility.ClsPub.isDoule(txtHQty.Text);
            HMaterialJQty = DBUtility.ClsPub.isDoule(txtHWeightQyt.Text);
            HMaterialMQty = DBUtility.ClsPub.isDoule(txtHKDQty.Text);
            HQty = HNowQty- HMaterialMQty;
            HDeptID = DBUtility.ClsPub.isLong(txtHDeptName.Tag);
            HRemark = DBUtility.ClsPub.isStrNull(txtHRemark.Text);
            HMaterName = DBUtility.ClsPub.isStrNull(txtHMaterName.Text);
            HMaterModel = DBUtility.ClsPub.isStrNull(txtHMaterModel.Text);
            ProcessExchangeBillNo = DBUtility.ClsPub.isStrNull(txtHBillNo.Text);
            HBarcodeNo = DBUtility.ClsPub.isLong(txtHBarcodeNo.Text);
            HBadReasonID = DBUtility.ClsPub.isLong(txtHRemark.Tag);
            HCusMaterName = DBUtility.ClsPub.isStrNull(txtHCusMaterName.Text);
            HCusModel = DBUtility.ClsPub.isStrNull(txtHCusModel.Text);
            try
            {
                oCn.BeginTran();
                //写入条码档案
                //写入条码档案    (客户物料名称HCusMaterName存入HMaterialModel字段,客户规格型号HCusModel存入HCusModel字段,不良原因ID存入HCustomQty1字段)
                oCn.RunProc("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,HBarCodeDate,HMaterialJQty,HMaterialMQty " +
                ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate,HMaterialJQty,HMaterialMQty,HNowQty " +
                ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag " +
                ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
                ",HOrderInterID,HOrderEntryID,HOrderBillNo,HCustomQty1,HMaterialModel,HCusModel " +
                ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HLogo " +
                ") Values ("
                + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString()
                + ",'" + HBatchNo + "',0,0,'" + HMaker + "',getdate(),0," + HQty.ToString()
                + ",'" + HBatchNo + "'," + HSupID.ToString() + ",0,'" + HMaker + "',getdate(),0," + HQty.ToString()
                + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "',''"
                + ", 1,1," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
                + ", 0,'',getdate(),'','" + sDate + "'," + HMaterialJQty.ToString() + "," + HMaterialMQty.ToString()
                + ", 1," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
                + ", 0,'',getdate(),'','" + sDate + "'," + HMaterialJQty.ToString() + "," + HMaterialMQty.ToString() + "," + HNowQty.ToString()
                + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0"
                + ",'" + HMaterName + "','" + HMaterModel + "',''," + HAuxPropID.ToString() + ",'','')");
                + ", " + ProcessExchangeInterID.ToString() + ",0,'" + ProcessExchangeBillNo + "'," + HBadReasonID.ToString() + ",'" + HCusMaterName + "','" + HCusModel + "'"
                + ",'" + HMaterName + "','" + HMaterModel + "',''," + HAuxPropID.ToString() + ",'','','1')");
                //回填最大流水号
                oCn.RunProc("exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "',1 ");
                //回填源单临时表HInterID
                oCn.RunProc("update a set a.HInterID=" + HInterID.ToString() + ",a.HBillNo='" + HBillNo +"',a.HRelationInterID= 0 from KF_WeighSource_Temp a where a.HInterID<>" + HInterID.ToString() + " and a.HMaker='" + HMaker + "' and a.HSourceBillNo='" + ProcessExchangeBillNo + "'");
                //写入条码出入库临时表
                oCn.RunProc("Insert into KF_PonderationBillMain_Temp " +
@@ -606,7 +717,7 @@
                    + "," + HWhID.ToString() + ",0," + HSPID.ToString() + ",0,0,''"
                    +",0," + HQty.ToString() + ",1,'" + HBatchNo + "','" + HBarCode + "',''"
                    +",'" + HMaker + "',getdate()," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillType + "','" + HSourceBillNo + "'"
                    +",0,0,'0',0,'',0"
                    +",0,0,'',0,'',0"
                    +"," + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",'','称重入库生成','2'"
                    +",0,0,'',0)");
@@ -634,6 +745,8 @@
            txtHMaterName.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("物料名称")].Value);
            txtHMaterModel.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("规格型号")].Value);
            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);
            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);
@@ -644,6 +757,9 @@
            HSourceBillNo = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("生产订单")].Value);
            HSourceBillType = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HSourceBillType")].Value);
            HSourceQty = DBUtility.ClsPub.isDoule(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("数量")].Value);
            ProcessExchangeInterID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("ProcessExchangeInterID")].Value);
            HSupID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HSupID")].Value);
            HMaterWeight = DBUtility.ClsPub.isDoule(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HMaterWeight")].Value);
        }
        //返回源单列表信息
@@ -689,5 +805,202 @@
        #endregion
        #region  //作废
        private void cmdZF_Click(object sender, EventArgs e)
        {
            if (grdMain.CurrentRow == null)
            {
                MessageBox.Show("请先选择需要作废的条码!", "提示");
                return;
            }
            else
            {
                if (MessageBox.Show("确定要作废所选条码?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                {
                    return;
                }
                else
                {
                    string HRemark = "";
                    string HItemID = "";
                    string HBarCode = "";
                    string HBarCode2 = "";
                    for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
                    {
                        HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
                        HBarCode = HBarCode + ",'" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value) + "'";
                        if (i != 0 && i % 100 == 0)
                        {
                            HBarCode2 = HBarCode2 + "#" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value);
                        }
                        else
                        {
                            HBarCode2 = HBarCode2 + "," + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value);
                        }
                        if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("作废标记")].Value) != "")
                        {
                            HRemark = HRemark + "、" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value);
                        }
                    }
                    if (HRemark != "")
                    {
                        MessageBox.Show("所选条码编号:"+ HRemark.Remove(0, 1)+" å·²ä½œåºŸï¼Œä¸å…è®¸é‡å¤ä½œåºŸï¼", "提示");
                        return;
                    }
                    HItemID = HItemID.Remove(0, 1);     //去掉字符串第一个字符
                    HBarCode = HBarCode.Remove(0, 1);
                    HBarCode2 = HBarCode2.Remove(0, 1);
                    try
                    {
                        oCn.BeginTran();
                        string[] NewBarCode;
                        NewBarCode = HBarCode2.Split(Convert.ToChar("#"));
                        //作废条码
                        oCn.RunProc("update Gy_BarCodeBill set HStopflag=1,HDeleteMan='" + DBUtility.ClsPub.CurUserName + "',HDeleteDate=getdate() where HItemID in (" + HItemID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                        //删除条码出入库临时表记录
                        oCn.RunProc("delete from KF_PonderationBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + HBillType + "' and HBarCode in (" + HBarCode + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                        //写入系统日志
                        for (int i = 0; i <= NewBarCode.Length - 1; i++)
                        {
                            oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + DBUtility.ClsPub.CurUserName + "','" + DBUtility.ClsPub.ComputerName + "','作废条码:" + NewBarCode[i] + "','称重入库模块','" + DBUtility.ClsPub.IPAddress + "','作废'", ref DBUtility.ClsPub.sExeReturnInfo);
                        }
                        oCn.Commit();
                    }
                    catch (Exception e2)
                    {
                        oCn.RollBack();
                        MessageBox.Show("作废条码失败!" + e2.Message, "提示");
                        return;
                    }
                    //刷新称重记录列表信息
                    BarCode_Display();
                    MessageBox.Show("所选条码编号:" + HBarCode.Remove(0, 1) + " ä½œåºŸæˆåŠŸï¼", "提示");
                }
            }
        }
        #endregion
        #region  //反作废
        private void cmdFZF_Click(object sender, EventArgs e)
        {
            if (grdMain.CurrentRow == null)
            {
                MessageBox.Show("请先选择需要反作废的条码!", "提示");
                return;
            }
            else
            {
                if (MessageBox.Show("确定要反作废所选条码?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                {
                    return;
                }
                else
                {
                    string HRemark = "";
                    string HItemID = "";
                    string HBarCode = "";
                    string HBarCode2 = "";
                    for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
                    {
                        HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
                        HBarCode = HBarCode + ",'" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value) + "'";
                        if (i != 0 && i % 100 == 0)
                        {
                            HBarCode2 = HBarCode2 + "#" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value);
                        }
                        else
                        {
                            HBarCode2 = HBarCode2 + "," + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value);
                        }
                        if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("作废标记")].Value) == "")
                        {
                            HRemark = HRemark + "、" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条码编号")].Value);
                        }
                    }
                    if (HRemark != "")
                    {
                        MessageBox.Show("所选条码编号:" + HRemark.Remove(0, 1) + " æœªä½œåºŸï¼Œä¸å…è®¸åä½œåºŸï¼", "提示");
                        return;
                    }
                    HItemID = HItemID.Remove(0, 1);     //去掉字符串第一个字符
                    HBarCode = HBarCode.Remove(0, 1);
                    HBarCode2 = HBarCode2.Remove(0, 1);
                    try
                    {
                        oCn.BeginTran();
                        string[] NewBarCode;
                        NewBarCode = HBarCode2.Split(Convert.ToChar("#"));
                        //反作废条码
                        oCn.RunProc("update Gy_BarCodeBill set HStopflag=0,HDeleteMan='',HDeleteDate=null where HItemID in (" + HItemID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                        //删除条码出入库临时表记录
                        oCn.RunProc("delete from KF_PonderationBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + HBillType + "' and HBarCode in (" + HBarCode + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                        //写入条码出入库临时表
                        oCn.RunProc("Insert into KF_PonderationBillMain_Temp " +
                        "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" +
                        ",HWhID,HSCWHID,HStockPlaceID,HOutStockPlaceID,HGroupID,HAddr" +
                        ",HQtyMust,HQty,HPieceQty,HBatchNo,HBarCode,HBarCode_Pack" +
                        ",HMaker,HMakeDate,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
                        ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag,HMTONo,HPlanMode" +
                        ",HSTOCKORGID,HOtherOrgID,HOWNERID,HOWNERTYPEID,HExpressNumber,HSubBillType" +
                        ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " +
                        " select " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "',HMaterID,HAuxPropID,0" +
                        ",HWhID,0,HSPID,0,0,''" +
                        ",0,HQty,1,HBatchNo,HBarCode,''" +
                        ",'" + HMaker + "',getdate(),HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" +
                        ",0,0,'',0,'',0" +
                        ",HSTOCKORGID,HSTOCKORGID,HSTOCKORGID,'','称重入库生成-反作废','2'" +
                        ",0,0,'',0" +
                        "from Gy_BarCodeBill with(nolock) where HItemID in (" + HItemID + ")"
                        );
                        //写入系统日志
                        for (int i = 0; i <= NewBarCode.Length - 1; i++)
                        {
                            oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + DBUtility.ClsPub.CurUserName + "','" + DBUtility.ClsPub.ComputerName + "','反作废条码:" + NewBarCode[i] + "','称重入库模块','" + DBUtility.ClsPub.IPAddress + "','反作废'", ref DBUtility.ClsPub.sExeReturnInfo);
                        }
                        oCn.Commit();
                    }
                    catch (Exception e2)
                    {
                        oCn.RollBack();
                        MessageBox.Show("反作废条码失败!" + e2.Message, "提示");
                        return;
                    }
                    //刷新称重记录列表信息
                    BarCode_Display();
                    MessageBox.Show("所选条码编号:" + HBarCode.Remove(0, 1) + " åä½œåºŸæˆåŠŸï¼", "提示");
                }
            }
        }
        #endregion
        #region  //备注   ä¸è‰¯åŽŸå› é€‰æ‹©
        private void cmdHBadReasonID_Click(object sender, EventArgs e)
        {
            DAL.ClsGy_BadReason_View oBadReason = new DAL.ClsGy_BadReason_View();
            if (oBadReason.RefreshView())
            {
                this.txtHRemark.Text = oBadReason.oModel.HName;
                this.txtHRemark.Tag = oBadReason.oModel.HItemID.ToString();
            }
        }
        #endregion
    }
}