wtt
2024-08-01 55e565721ef588d7ae9f421b6d1fce63b51aa55f
WorkM/Á÷ת¿¨¹ÜÀí/Sc_ProcessExchangeBill.cs
@@ -102,6 +102,10 @@
        public const Int16 HTechnologyParameterCol = 76;
        public const Int16 HPicNumCol = 77;
        public const Int16 HProcCheckNoteCol = 78;
        public const Int16 HMouldNoCol = 79;
        public const Int16 HProcWorkNumCol = 80;
        public const Int16 HICMOEntryIDCol = 81;
        public const Int16 HSNCtrlCol = 82;
@@ -748,7 +752,8 @@
            this.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
            this.Sub_OperStatus();//设置TOOLBAR
            this.Sub_ClearBill();//清空界面
            this.txtHBillNo.Text = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);//得到新单号
            //this.txtHBillNo.Text = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);//得到新单号
            this.txtHBillNo.Text = ClsPub.CreateBillCode_Prod(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);//得到新单号    20240620返回值改取存储过程
            this.txtHBillNo.Enabled = true;
            this.txtHBillNo.Focus();
            //灰度源单类型
@@ -775,6 +780,7 @@
                    xyz.Enabled = true;
                    mz.Enabled = true;
                    tc.Enabled = true;
                    fz.Enabled = false;
                    //redblue.Enabled = false;
                    //未审核
                    if (txtHChecker.Text.Trim() == "")
@@ -895,6 +901,7 @@
                    xyz.Enabled = false;
                    mz.Enabled = false;
                    tc.Enabled = true;
                    fz.Enabled = true;
                    Sub_LrtextStatus(true);
                    grdStatus = true;
                    //redblue.Enabled = true;
@@ -1053,6 +1060,11 @@
                this.txtHOrderProcNO.Text = DBUtility.ClsPub.isStrNull(BillOld.omodel.HOrderProcNO);
                this.txtHMateOutBatchNo.Text = DBUtility.ClsPub.isStrNull(BillOld.omodel.HMateOutBatchNo);
                this.txtHProjectNum.Text = DBUtility.ClsPub.isStrNull(BillOld.omodel.HProjectNum);
                this.textHPicNumVer.Text = DBUtility.ClsPub.isStrNull(BillOld.omodel.HPicNumVer);
                this.textHPicNumAssemble.Text = DBUtility.ClsPub.isStrNull(BillOld.omodel.HPicNumAssemble);
                this.textHMaterTexture.Text = DBUtility.ClsPub.isStrNull(BillOld.omodel.HMaterTexture);
                this.textHProductNum.Text = DBUtility.ClsPub.isStrNull(BillOld.omodel.HProductNum);
                this.textHVerNum.Text = DBUtility.ClsPub.isStrNull(BillOld.omodel.HVerNum);
                //加载表体
                initGrid();
                int i = 0;
@@ -1077,6 +1089,8 @@
                    grdMain.Rows[i].Cells[HRelationQty_WWOrderCol].Value = oSub.HRelationQty_WWOrder.ToString();
                    grdMain.Rows[i].Cells[HRelationQty_BadCol].Value = oSub.HRelationQty_Bad.ToString();
                    grdMain.Rows[i].Cells[HRelationMoneyCol].Value = oSub.HRelationMoney.ToString();
                    grdMain.Rows[i].Cells[HMouldNoCol].Value = oSub.HMouldNo.ToString();
                    grdMain.Rows[i].Cells[HProcWorkNumCol].Value = oSub.HProcWorkNum.ToString();
                    //======================================================================================
                    //
                    grdMain.Rows[i].Cells[HProcIDCol].Value = oSub.HProcID.ToString();
@@ -1202,10 +1216,12 @@
                    grdMain.Rows[i].Cells[HTechnologyParameterCol].Value = oSub.HTechnologyParameter.ToString();
                    grdMain.Rows[i].Cells[HOverRateCol].Value = oSub.HOverRate.ToString();
                    grdMain.Rows[i].Cells[HMaxQtyCol].Value = oSub.HMaxQty.ToString();
                    grdMain.Rows[i].Cells[HSNCtrlCol].Value = DBUtility.ClsPub.isBool(oSub.HSNCtrl);
                    //
                    grdMain.Rows[i].Cells[HICMOBillNoCol].Value = oSub.HICMOBillNo;
                    grdMain.Rows[i].Cells[HICMOInterIDCol].Value = oSub.HICMOInterID.ToString();
                    grdMain.Rows[i].Cells[HICMOEntryIDCol].Value = oSub.HICMOEntryID.ToString();
                    grdMain.Rows[i].Cells[HSeOrderBillNoCol].Value = oSub.HSeOrderBillNo;
                    grdMain.Rows[i].Cells[HSeOrderInterIDCol].Value = oSub.HSeOrderInterID.ToString();
                    grdMain.Rows[i].Cells[HSeOrderEntryIDCol].Value = oSub.HSeOrderEntryID.ToString();
@@ -1275,11 +1291,11 @@
                    return false;
                }
                //txtHMateOutBatchNo
                if (DBUtility.ClsPub.isStrNull(txtHMateOutBatchNo.Text) == "")
                {
                    MessageBox.Show("原料批次不能为空!", "提示");
                    return false;
                }
                //if (DBUtility.ClsPub.isStrNull(txtHMateOutBatchNo.Text) == "")
                //{
                //    MessageBox.Show("原料批次不能为空!", "提示");
                //    return false;
                //}
            }
            //单据号是否重复
@@ -1305,271 +1321,294 @@
            }
            return true;
        }
        //保存单据
        private bool Sub_SaveBill()
        {
            Model.ClsSc_ProcessExchangeBillSub oBillSub = new Model.ClsSc_ProcessExchangeBillSub();
            //判断权限
            //if (!ClsPub.Security_Log(ModRightNameEdit, 1, true, DBUtility.ClsPub.CurUserName))
            //{
            //    return false;
            //}
            //
            Int32 i;
            bool bResult;
            BillNew = new DAL.ClsSc_ProcessExchangeBill();
            //失去焦点
            lblCaption.Focus();
            if (!Sub_AllowSave())//单据完整性判断
                return false;
            //赋值ID
            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
                BillNew.omodel.HInterID = BillOld.omodel.HInterID;
            else if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_UpdatePrice)
                BillNew.omodel.HInterID = BillOld.omodel.HInterID;
            //主类赋值
            //判断会计期是否合理
            string s = "";
            int sYear = 0;
            int sPeriod = 0;
            if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(dtpHDate.Value, ref sYear, ref sPeriod, ref s) == false)
            try
            {
                MessageBox.Show(s, "提示");
                return false;
            }
            //源单信息
            //BillNew.omodel.HMainSourceBillType = cmbSourceBillType.Text;
            //
            BillNew.omodel.HYear = sYear;
            BillNew.omodel.HPeriod = sPeriod;
            //固定赋值=================================
            BillNew.omodel.HBillNo = this.txtHBillNo.Text.Trim();  //在赋值类前就处理好字符串和数字
            BillNew.omodel.HDate = this.dtpHDate.Value;
            BillNew.omodel.HRemark = this.txtHRemark.Text.Trim();
            //====================================================
            BillNew.omodel.HMaker = DBUtility.ClsPub.CurUserName;
            BillNew.omodel.HWWOrderInterID = ClsPub.isLong(this.txtHWWOrderInterID.Text.ToString());
            BillNew.omodel.HWWOrderEntryID = ClsPub.isLong(this.txtHWWOrderEntryID.Text.ToString());
            BillNew.omodel.HWWOrderBillNo = ClsPub.isStrNull(this.txtHWWOrderBillNo.Text);
            BillNew.omodel.HICMOInterID = ClsPub.isLong(this.txtHICMOBillNo.Tag);
            BillNew.omodel.HICMOEntryID = ClsPub.isLong(this.txtHICMOEntryID.Text);
            BillNew.omodel.HICMOBillNo = ClsPub.isStrNull(this.txtHICMOBillNo.Text);
            BillNew.omodel.HMaterID2 = ClsPub.isLong(this.txtHMaterID2.Tag);
            BillNew.omodel.HMaterID = ClsPub.isLong(this.txtHMaterID.Tag.ToString());
            BillNew.omodel.HMaterNumber = ClsPub.isStrNull(this.txtHMaterNumber.Text);
            BillNew.omodel.HBatchNo = ClsPub.isStrNull(this.txtHBatchNo.Text);
            BillNew.omodel.HUnitID = ClsPub.isLong(this.txtHUnitID.Tag.ToString());
            BillNew.omodel.HUnitNumber = ClsPub.isStrNull(this.txtHUnitNumber.Text);
            BillNew.omodel.HPlanQty = ClsPub.isDoule(this.txtHPlanQty.Text);
            BillNew.omodel.HQty = ClsPub.isDoule(this.txtHQty.Text);
            //BillNew.omodel.HQty = ClsPub.isDoule(this.txtHprocExQty.Text);
            BillNew.omodel.HPlanBeginDate = ClsPub.isDate(this.dtpHPlanBeginDate.Value);
            BillNew.omodel.HPlanEndDate = ClsPub.isDate(this.dtpHPlanEndDate.Value);
            BillNew.omodel.HExplanation = ClsPub.isStrNull(this.txtHExplanation.Text);
            BillNew.omodel.HInnerBillNo = ClsPub.isStrNull(this.txtHInnerBillNo.Text);
            BillNew.omodel.HWorkShopID = ClsPub.isLong(this.txtHWorkShopID.Tag.ToString());
            BillNew.omodel.HSupID = ClsPub.isLong(this.txtHSupID.Tag.ToString());
            BillNew.omodel.HBLFlag = chkHBLFlag.Checked;
            //BillNew.omodel.HWorkTypeNum = ClsPub.isStrNull(this.txtHWorkTypeID.Tag.ToString());
            //========================
            BillNew.omodel.HMainMaterID = ClsPub.isLong(this.txtHMainMaterID.Text.ToString());
            BillNew.omodel.HKeyMaterID = ClsPub.isLong(this.txtHKeyMaterID.Text.ToString());
            BillNew.omodel.HOrderProcNO = ClsPub.isStrNull(this.txtHOrderProcNO.Text.ToString());
            BillNew.omodel.HEquipMentID = ClsPub.isLong(this.txtHEquipMentID.Tag.ToString());
            BillNew.omodel.HMateOutBatchNo = ClsPub.isStrNull(this.txtHMateOutBatchNo.Text);
            BillNew.omodel.HProjectNum = ClsPub.isStrNull(this.txtHProjectNum.Text);
            //===================
            BillNew.omodel.HProdMaterCode = ClsPub.isStrNull(this.txtHProdMaterCode.Text);
            BillNew.omodel.HSeOrderBillNo = ClsPub.isStrNull(this.txtHSeOrderBillNo.Text);
            BillNew.omodel.HCusShortName = ClsPub.isStrNull(this.txtHCusShortName.Text);
            BillNew.omodel.HCusNeedMaterial = ClsPub.isStrNull(this.txtHCusNeedMaterial.Text);
            BillNew.omodel.HPlanSendGoodsDate = ClsPub.isStrNull(this.txtHPlanSendGoodsDate.Text);
            BillNew.omodel.HProdMaterName = ClsPub.isStrNull(this.txtHProdMaterName.Text);
            BillNew.omodel.HCusName = ClsPub.isStrNull(this.txtHCusName.Text);
            BillNew.omodel.HWorkRemark = ClsPub.isStrNull(this.txtHWorkRemark.Text);
            BillNew.omodel.HImportNote = ClsPub.isStrNull(this.txtHImportNote.Text);
            BillNew.omodel.HMaterNumber_A = ClsPub.isStrNull(this.txtHMaterNumber_A.Text);
            BillNew.omodel.HMaterNumber_B = ClsPub.isStrNull(this.txtHMaterNumber_B.Text);
            BillNew.omodel.HMaterNumber_C = ClsPub.isStrNull(this.txtHMaterNumber_C.Text);
            BillNew.omodel.HMaterNumber_D = ClsPub.isStrNull(this.txtHMaterNumber_D.Text);
            BillNew.omodel.HProdType = ClsPub.isStrNull(this.txtHProdType.Text);
            BillNew.omodel.HMaterShortName = ClsPub.isStrNull(this.txtHMaterShortName.Text);
            BillNew.omodel.HMaterIDA = ClsPub.isStrNull(this.txtHMaterIDA.Text);
            BillNew.omodel.HMaterIDB = ClsPub.isStrNull(this.txtHMaterIDB.Text);
            BillNew.omodel.HMaterIDC = ClsPub.isStrNull(this.txtHMaterIDC.Text);
            BillNew.omodel.HMaterIDD = ClsPub.isStrNull(this.txtHMaterIDD.Text);
            //获取最大行号
            int MaxRowNo = 0;
            for (int n = 0; n < grdMain.Rows.Count; n++)
            {
                if (DBUtility.ClsPub.isInt(grdMain.Rows[n].Cells[HEntryIDCol].Value) > MaxRowNo)
                Model.ClsSc_ProcessExchangeBillSub oBillSub = new Model.ClsSc_ProcessExchangeBillSub();
                //判断权限
                //if (!ClsPub.Security_Log(ModRightNameEdit, 1, true, DBUtility.ClsPub.CurUserName))
                //{
                //    return false;
                //}
                //
                Int32 i;
                bool bResult;
                BillNew = new DAL.ClsSc_ProcessExchangeBill();
                //失去焦点
                lblCaption.Focus();
                if (!Sub_AllowSave())//单据完整性判断
                    return false;
                //赋值ID
                if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
                    BillNew.omodel.HInterID = BillOld.omodel.HInterID;
                else if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_UpdatePrice)
                    BillNew.omodel.HInterID = BillOld.omodel.HInterID;
                //主类赋值
                //判断会计期是否合理
                string s = "";
                int sYear = 0;
                int sPeriod = 0;
                //if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(dtpHDate.Value, ref sYear, ref sPeriod, ref s) == false)
                //{
                //    MessageBox.Show(s, "提示");
                //    return false;
                //}
                sYear = ClsPub.isDate(dtpHDate.Value).Year;
                sPeriod = ClsPub.isDate(dtpHDate.Value).Month;
                //源单信息
                //BillNew.omodel.HMainSourceBillType = cmbSourceBillType.Text;
                //
                BillNew.omodel.HYear = sYear;
                BillNew.omodel.HPeriod = sPeriod;
                BillNew.omodel.HPRDORGID = DBUtility.ClsPub.HOrgID;  //组织
                                                                     //固定赋值=================================
                BillNew.omodel.HBillNo = this.txtHBillNo.Text.Trim();  //在赋值类前就处理好字符串和数字
                BillNew.omodel.HDate = this.dtpHDate.Value;
                BillNew.omodel.HRemark = this.txtHRemark.Text.Trim();
                //====================================================
                BillNew.omodel.HMaker = DBUtility.ClsPub.CurUserName;
                BillNew.omodel.HWWOrderInterID = ClsPub.isLong(this.txtHWWOrderInterID.Text.ToString());
                BillNew.omodel.HWWOrderEntryID = ClsPub.isLong(this.txtHWWOrderEntryID.Text.ToString());
                BillNew.omodel.HWWOrderBillNo = ClsPub.isStrNull(this.txtHWWOrderBillNo.Text);
                BillNew.omodel.HICMOInterID = ClsPub.isLong(this.txtHICMOBillNo.Tag);
                BillNew.omodel.HICMOEntryID = ClsPub.isLong(this.txtHICMOEntryID.Text);
                BillNew.omodel.HICMOBillNo = ClsPub.isStrNull(this.txtHICMOBillNo.Text);
                BillNew.omodel.HMaterID2 = ClsPub.isLong(this.txtHMaterID2.Tag);
                BillNew.omodel.HMaterID = ClsPub.isLong(this.txtHMaterID.Tag.ToString());
                BillNew.omodel.HMaterNumber = ClsPub.isStrNull(this.txtHMaterNumber.Text);
                BillNew.omodel.HBatchNo = ClsPub.isStrNull(this.txtHBatchNo.Text);
                BillNew.omodel.HUnitID = ClsPub.isLong(this.txtHUnitID.Tag.ToString());
                BillNew.omodel.HUnitNumber = ClsPub.isStrNull(this.txtHUnitNumber.Text);
                BillNew.omodel.HPlanQty = ClsPub.isDoule(this.txtHPlanQty.Text);
                BillNew.omodel.HQty = ClsPub.isDoule(this.txtHQty.Text);
                //BillNew.omodel.HQty = ClsPub.isDoule(this.txtHprocExQty.Text);
                BillNew.omodel.HPlanBeginDate = ClsPub.isDate(this.dtpHPlanBeginDate.Value);
                BillNew.omodel.HPlanEndDate = ClsPub.isDate(this.dtpHPlanEndDate.Value);
                BillNew.omodel.HExplanation = ClsPub.isStrNull(this.txtHExplanation.Text);
                BillNew.omodel.HInnerBillNo = ClsPub.isStrNull(this.txtHInnerBillNo.Text);
                BillNew.omodel.HWorkShopID = ClsPub.isLong(this.txtHWorkShopID.Tag.ToString());
                BillNew.omodel.HSupID = ClsPub.isLong(this.txtHSupID.Tag.ToString());
                BillNew.omodel.HBLFlag = chkHBLFlag.Checked;
                //BillNew.omodel.HWorkTypeNum = ClsPub.isStrNull(this.txtHWorkTypeID.Tag.ToString());
                //========================
                BillNew.omodel.HMainMaterID = ClsPub.isLong(this.txtHMainMaterID.Text.ToString());
                BillNew.omodel.HKeyMaterID = ClsPub.isLong(this.txtHKeyMaterID.Text.ToString());
                BillNew.omodel.HOrderProcNO = ClsPub.isStrNull(this.txtHOrderProcNO.Text.ToString());
                BillNew.omodel.HEquipMentID = ClsPub.isLong(this.txtHEquipMentID.Tag.ToString());
                BillNew.omodel.HMateOutBatchNo = ClsPub.isStrNull(this.txtHMateOutBatchNo.Text);
                BillNew.omodel.HProjectNum = ClsPub.isStrNull(this.txtHProjectNum.Text);
                //===================
                BillNew.omodel.HProdMaterCode = ClsPub.isStrNull(this.txtHProdMaterCode.Text);
                BillNew.omodel.HSeOrderBillNo = ClsPub.isStrNull(this.txtHSeOrderBillNo.Text);
                BillNew.omodel.HCusShortName = ClsPub.isStrNull(this.txtHCusShortName.Text);
                BillNew.omodel.HCusNeedMaterial = ClsPub.isStrNull(this.txtHCusNeedMaterial.Text);
                BillNew.omodel.HPlanSendGoodsDate = ClsPub.isStrNull(this.txtHPlanSendGoodsDate.Text);
                BillNew.omodel.HProdMaterName = ClsPub.isStrNull(this.txtHProdMaterName.Text);
                BillNew.omodel.HCusName = ClsPub.isStrNull(this.txtHCusName.Text);
                BillNew.omodel.HWorkRemark = ClsPub.isStrNull(this.txtHWorkRemark.Text);
                BillNew.omodel.HImportNote = ClsPub.isStrNull(this.txtHImportNote.Text);
                BillNew.omodel.HMaterNumber_A = ClsPub.isStrNull(this.txtHMaterNumber_A.Text);
                BillNew.omodel.HMaterNumber_B = ClsPub.isStrNull(this.txtHMaterNumber_B.Text);
                BillNew.omodel.HMaterNumber_C = ClsPub.isStrNull(this.txtHMaterNumber_C.Text);
                BillNew.omodel.HMaterNumber_D = ClsPub.isStrNull(this.txtHMaterNumber_D.Text);
                BillNew.omodel.HProdType = ClsPub.isStrNull(this.txtHProdType.Text);
                BillNew.omodel.HMaterShortName = ClsPub.isStrNull(this.txtHMaterShortName.Text);
                BillNew.omodel.HMaterIDA = ClsPub.isStrNull(this.txtHMaterIDA.Text);
                BillNew.omodel.HMaterIDB = ClsPub.isStrNull(this.txtHMaterIDB.Text);
                BillNew.omodel.HMaterIDC = ClsPub.isStrNull(this.txtHMaterIDC.Text);
                BillNew.omodel.HMaterIDD = ClsPub.isStrNull(this.txtHMaterIDD.Text);
                //===================
                BillNew.omodel.HPicNumVer = ClsPub.isStrNull(this.textHPicNumVer.Text);
                BillNew.omodel.HPicNumAssemble = ClsPub.isStrNull(this.textHPicNumAssemble.Text);
                BillNew.omodel.HMaterTexture = ClsPub.isStrNull(this.textHMaterTexture.Text);
                BillNew.omodel.HProductNum = ClsPub.isStrNull(this.textHProductNum.Text);
                BillNew.omodel.HVerNum = ClsPub.isStrNull(this.textHVerNum.Text);
                //获取最大行号
                int MaxRowNo = 0;
                for (int n = 0; n < grdMain.Rows.Count; n++)
                {
                    MaxRowNo = DBUtility.ClsPub.isInt(grdMain.Rows[n].Cells[HEntryIDCol].Value);
                }
            }
            //明细类赋值
            BillNew.DetailColl = new List<Model.ClsSc_ProcessExchangeBillSub>();
            for (i = 0; i <= grdMain.RowCount - 1; i++)
            {
                if (ClsPub.isLong(grdMain.Rows[i].Cells[HProcIDCol].Value) != 0)
                {
                    Model.ClsSc_ProcessExchangeBillSub oSub = new Model.ClsSc_ProcessExchangeBillSub();
                    //固定赋值========================================
                    if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
                    if (DBUtility.ClsPub.isInt(grdMain.Rows[n].Cells[HEntryIDCol].Value) > MaxRowNo)
                    {
                        if (DBUtility.ClsPub.isInt(grdMain.Rows[i].Cells[HEntryIDCol].Value) == 0)
                        MaxRowNo = DBUtility.ClsPub.isInt(grdMain.Rows[n].Cells[HEntryIDCol].Value);
                    }
                }
                //明细类赋值
                BillNew.DetailColl = new List<Model.ClsSc_ProcessExchangeBillSub>();
                for (i = 0; i <= grdMain.RowCount - 1; i++)
                {
                    if (ClsPub.isLong(grdMain.Rows[i].Cells[HProcIDCol].Value) != 0)
                    {
                        Model.ClsSc_ProcessExchangeBillSub oSub = new Model.ClsSc_ProcessExchangeBillSub();
                        //固定赋值========================================
                        if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
                        {
                            oSub.HEntryID = MaxRowNo + i;
                            grdMain.Rows[i].Cells[HEntryIDCol].Value = oSub.HEntryID;
                            if (DBUtility.ClsPub.isInt(grdMain.Rows[i].Cells[HEntryIDCol].Value) == 0)
                            {
                                oSub.HEntryID = MaxRowNo + i;
                                grdMain.Rows[i].Cells[HEntryIDCol].Value = oSub.HEntryID;
                            }
                            else
                            {
                                oSub.HEntryID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HEntryIDCol].Value);
                            }
                        }
                        else if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
                        {
                            oSub.HEntryID = i + 1;
                        }
                        else
                        {
                            oSub.HEntryID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HEntryIDCol].Value);
                            if (DBUtility.ClsPub.isInt(grdMain.Rows[i].Cells[HEntryIDCol].Value) == 0)
                            {
                                oSub.HEntryID = MaxRowNo + i;
                                grdMain.Rows[i].Cells[HEntryIDCol].Value = oSub.HEntryID;
                            }
                            else
                            {
                                oSub.HEntryID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HEntryIDCol].Value);
                            }
                        }
                    }
                    else if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
                    {
                        oSub.HEntryID = i + 1;
                    }
                    else
                    {
                        if (DBUtility.ClsPub.isInt(grdMain.Rows[i].Cells[HEntryIDCol].Value) == 0)
                        oSub.HRemark = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HRemarkCol].Value);
                        oSub.HSourceInterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HSourceInterIDCol].Value);
                        oSub.HSourceEntryID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HSourceEntryIDCol].Value);
                        oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HSourceBillTypeCol].Value);
                        oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HSourceBillNoCol].Value);
                        oSub.HRelationQty = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HRelationQtyCol].Value);
                        oSub.HRelationQty_In = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HRelationQty_InCol].Value);
                        oSub.HRelationQty_Out = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HRelationQty_OutCol].Value);
                        oSub.HRelationQty_WWOrder = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HRelationQty_WWOrderCol].Value);
                        oSub.HRelationQty_Bad = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HRelationQty_BadCol].Value);
                        oSub.HRelationMoney = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HRelationMoneyCol].Value);
                        oSub.HCloseMan = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HCloseManCol].Value);
                        oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HEntryCloseDateCol].Value);
                        oSub.HCloseType = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HCloseTypeCol].Value);
                        //=============================
                        oSub.HQty = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HQtyCol].Value);
                        if (oSub.HQty <= 0)
                        {
                            oSub.HEntryID = MaxRowNo + i;
                            grdMain.Rows[i].Cells[HEntryIDCol].Value = oSub.HEntryID;
                            MessageBox.Show("第" + ClsPub.isStrNull(i + 1) + "行,流转卡数量不能为0或者小于0");
                            return false;
                        }
                        else
                        oSub.HProcNo = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HProcNoCol].Value);
                        if (oSub.HProcNo <= 0)
                        {
                            oSub.HEntryID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HEntryIDCol].Value);
                            MessageBox.Show("第" + ClsPub.isStrNull(i + 1) + "行,流水号不能为0或者小于0");
                            return false;
                        }
                        oSub.HProcID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HProcIDCol].Value);
                        oSub.HProcNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcNumberCol].Value);
                        oSub.HWorkRemark = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HWorkRemarkCol].Value);
                        oSub.HCenterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HCenterIDCol].Value);
                        oSub.HDeptID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HDeptIDCol].Value);
                        oSub.HDeptNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HDeptNumberCol].Value);
                        //oSub.HGroupID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HGroupIDCol].Value);
                        oSub.HGroupNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HGroupNumberCol].Value);
                        oSub.HWorkerID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HWorkerIDCol].Value);
                        oSub.HWorkerNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HWorkerNumberCol].Value);
                        oSub.HSourceID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HSourceIDCol].Value);
                        oSub.HTimeUnit = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HTimeUnitCol].Value);
                        oSub.HPlanWorkTimes = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HPlanWorkTimesCol].Value);
                        oSub.HPlanBeginDate = DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HPlanBeginDateCol].Value);
                        oSub.HPlanEndDate = DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HPlanEndDateCol].Value);
                        oSub.HRelBeginDate = DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HRelBeginDateCol].Value);
                        oSub.HRelEndDate = DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HRelEndDateCol].Value);
                        oSub.HReadyTime = 0;
                        oSub.HQueueTime = 0;
                        oSub.HMoveTime = 0;
                        oSub.HBeginDayQty = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HBeginDayQtyCol].Value);
                        oSub.HBeginFixQty = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HBeginFixQtyCol].Value);
                        oSub.HFixWorkDays = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HFixWorkDaysCol].Value);
                        oSub.HTrunWorkDays = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HTrunWorkDaysCol].Value);
                        oSub.HReadyTimes = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HReadyTimesCol].Value);
                        oSub.HMyWorkDays = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HMyWorkDaysCol].Value);
                        oSub.HOutPrice = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HOutPriceCol].Value);
                        oSub.HOutMoney = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HOutMoneyCol].Value);
                        oSub.HLastProc = "否";
                        oSub.HFstProc = "否";
                        oSub.HKeyProc = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HKeyProcCol].Value);
                        oSub.HSupID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HSupIDCol].Value);
                        oSub.HSupFlag = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HSupFlagCol].Value);
                        oSub.HBackProc = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HBackProcCol].Value);
                        oSub.HEdit = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HEditCol].Value);
                        //if (oSub.HSourceID == 0)
                        //{
                        //    MessageBox.Show("第" + ClsPub.isStrNull(i + 1) + "行,生产资源不能为空");
                        //    return false;
                        //}
                        //
                        if (oSub.HCenterID == 0 && oSub.HSupFlag == false)
                        {
                            MessageBox.Show("第" + ClsPub.isStrNull(i + 1) + "行,工作中心或委外标记不能同时为空");
                            return false;
                        }
                        oSub.HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HICMOBillNoCol].Value);
                        oSub.HICMOInterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HICMOInterIDCol].Value);
                        oSub.HICMOEntryID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HICMOEntryIDCol].Value);
                        oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HSeOrderInterIDCol].Value);
                        oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HSeOrderEntryIDCol].Value);
                        oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HSeOrderBillNoCol].Value);
                        oSub.HWWOrderInterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HWWOrderInterIDCol].Value);
                        oSub.HWWOrderEntryID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HWWOrderEntryIDCol].Value);
                        oSub.HWWOrderBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HWWOrderBillNoCol].Value);
                        oSub.HSumPassRate = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HSumPassRateCol].Value);
                        oSub.HPassRate = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HPassRateCol].Value);
                        oSub.HOverRate = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HOverRateCol].Value);
                        oSub.HMaxQty = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HMaxQtyCol].Value);
                        oSub.HTechnologyParameter = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HTechnologyParameterCol].Value);
                        oSub.HPicNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HPicNumCol].Value);
                        oSub.HProcCheckNote = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcCheckNoteCol].Value);
                        oSub.HMouldNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMouldNoCol].Value);
                        oSub.HProcWorkNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcWorkNumCol].Value);
                        oSub.HSNCtrl = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HSNCtrlCol].Value);
                        BillNew.DetailColl.Add(oSub);
                    }
                    oSub.HRemark = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HRemarkCol].Value);
                    oSub.HSourceInterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HSourceInterIDCol].Value);
                    oSub.HSourceEntryID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HSourceEntryIDCol].Value);
                    oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HSourceBillTypeCol].Value);
                    oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HSourceBillNoCol].Value);
                    oSub.HRelationQty = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HRelationQtyCol].Value);
                    oSub.HRelationQty_In = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HRelationQty_InCol].Value);
                    oSub.HRelationQty_Out = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HRelationQty_OutCol].Value);
                    oSub.HRelationQty_WWOrder = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HRelationQty_WWOrderCol].Value);
                    oSub.HRelationQty_Bad = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HRelationQty_BadCol].Value);
                    oSub.HRelationMoney = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HRelationMoneyCol].Value);
                    oSub.HCloseMan = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HCloseManCol].Value);
                    oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HEntryCloseDateCol].Value);
                    oSub.HCloseType = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HCloseTypeCol].Value);
                    //=============================
                    oSub.HQty = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HQtyCol].Value);
                    if (oSub.HQty <= 0)
                    {
                        MessageBox.Show("第" + ClsPub.isStrNull(i + 1) + "行,流转卡数量不能为0或者小于0");
                        return false;
                    }
                    oSub.HProcNo = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HProcNoCol].Value);
                    if (oSub.HProcNo <= 0)
                    {
                        MessageBox.Show("第" + ClsPub.isStrNull(i + 1) + "行,流水号不能为0或者小于0");
                        return false;
                    }
                    oSub.HProcID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HProcIDCol].Value);
                    oSub.HProcNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcNumberCol].Value);
                    oSub.HWorkRemark = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HWorkRemarkCol].Value);
                    oSub.HCenterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HCenterIDCol].Value);
                    oSub.HDeptID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HDeptIDCol].Value);
                    oSub.HDeptNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HDeptNumberCol].Value);
                    //oSub.HGroupID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HGroupIDCol].Value);
                    oSub.HGroupNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HGroupNumberCol].Value);
                    oSub.HWorkerID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HWorkerIDCol].Value);
                    oSub.HWorkerNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HWorkerNumberCol].Value);
                    oSub.HSourceID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HSourceIDCol].Value);
                    oSub.HTimeUnit = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HTimeUnitCol].Value);
                    oSub.HPlanWorkTimes = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HPlanWorkTimesCol].Value);
                    oSub.HPlanBeginDate = DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HPlanBeginDateCol].Value);
                    oSub.HPlanEndDate = DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HPlanEndDateCol].Value);
                    oSub.HRelBeginDate = DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HRelBeginDateCol].Value);
                    oSub.HRelEndDate = DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HRelEndDateCol].Value);
                    oSub.HReadyTime = 0;
                    oSub.HQueueTime = 0;
                    oSub.HMoveTime = 0;
                    oSub.HBeginDayQty = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HBeginDayQtyCol].Value);
                    oSub.HBeginFixQty = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HBeginFixQtyCol].Value);
                    oSub.HFixWorkDays = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HFixWorkDaysCol].Value);
                    oSub.HTrunWorkDays = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HTrunWorkDaysCol].Value);
                    oSub.HReadyTimes = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HReadyTimesCol].Value);
                    oSub.HMyWorkDays = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HMyWorkDaysCol].Value);
                    oSub.HOutPrice = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HOutPriceCol].Value);
                    oSub.HOutMoney = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HOutMoneyCol].Value);
                    oSub.HLastProc = "否";
                    oSub.HFstProc = "否";
                    oSub.HKeyProc = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HKeyProcCol].Value);
                    oSub.HSupID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HSupIDCol].Value);
                    oSub.HSupFlag = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HSupFlagCol].Value);
                    oSub.HBackProc = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HBackProcCol].Value);
                    oSub.HEdit = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HEditCol].Value);
                    //if (oSub.HSourceID == 0)
                    //{
                    //    MessageBox.Show("第" + ClsPub.isStrNull(i + 1) + "行,生产资源不能为空");
                    //    return false;
                    //}
                    //
                    if (oSub.HCenterID == 0 && oSub.HSupFlag == false)
                    {
                        MessageBox.Show("第" + ClsPub.isStrNull(i + 1) + "行,工作中心或委外标记不能同时为空");
                        return false;
                    }
                    oSub.HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HICMOBillNoCol].Value);
                    oSub.HICMOInterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HICMOInterIDCol].Value);
                    oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HSeOrderInterIDCol].Value);
                    oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HSeOrderEntryIDCol].Value);
                    oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HSeOrderBillNoCol].Value);
                    oSub.HWWOrderInterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HWWOrderInterIDCol].Value);
                    oSub.HWWOrderEntryID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HWWOrderEntryIDCol].Value);
                    oSub.HWWOrderBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HWWOrderBillNoCol].Value);
                    oSub.HSumPassRate = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HSumPassRateCol].Value);
                    oSub.HPassRate = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HPassRateCol].Value);
                    oSub.HOverRate = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HOverRateCol].Value);
                    oSub.HMaxQty = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HMaxQtyCol].Value);
                    oSub.HTechnologyParameter = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HTechnologyParameterCol].Value);
                    oSub.HPicNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HPicNumCol].Value);
                    oSub.HProcCheckNote = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcCheckNoteCol].Value);
                    BillNew.DetailColl.Add(oSub);
                }
            }
            //保存完毕后处理
            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
            {
                bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
            }
            else
            {
                bResult = BillNew.ModifyBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
            }
            //提示
            if (bResult == true)
            {
                BillChange = true;
                MessageBox.Show("单据存盘完毕!单据号:" + this.txtHBillNo.Text.Trim(), "提示");
                //保存完毕后处理
                if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
                {
                    BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
                    BillOld.omodel.HInterID = BillNew.omodel.HInterID;
                    this.Sub_ShowBill();
                    bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
                }
                else if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
                else
                {
                    BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
                    this.Sub_ShowBill();
                    bResult = BillNew.ModifyBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
                }
                this.Sub_OperStatus();
                return true;
                //提示
                if (bResult == true)
                {
                    BillChange = true;
                    MessageBox.Show("单据存盘完毕!单据号:" + this.txtHBillNo.Text.Trim(), "提示");
                    if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
                    {
                        BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
                        BillOld.omodel.HInterID = BillNew.omodel.HInterID;
                        this.Sub_ShowBill();
                    }
                    else if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
                    {
                        BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
                        this.Sub_ShowBill();
                    }
                    this.Sub_OperStatus();
                    return true;
                }
                else
                {
                    MessageBox.Show("保存失败!原因:" + ClsPub.sExeReturnInfo, "提示");
                    return false;
                }
            }
            else
            catch(Exception e1)
            {
                MessageBox.Show("保存失败!原因:" + ClsPub.sExeReturnInfo, "提示");
                MessageBox.Show(ClsPub.sExeReturnInfo + e1.Message);
                return false;
            }
        }
@@ -1582,7 +1621,7 @@
        {
            //
            grdMain.ColumnCount = 79;                       //总列数
            grdMain.ColumnCount = 83;                       //总列数
            DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name);
            //
            grdMain.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True;
@@ -1648,6 +1687,7 @@
            grdMain.Columns[HICMOBillNoCol].HeaderText = "生产订单号";
            grdMain.Columns[HICMOInterIDCol].HeaderText = "生产订单主内码";
            grdMain.Columns[HICMOEntryIDCol].HeaderText = "生产订单子内码";
            grdMain.Columns[HSeOrderInterIDCol].HeaderText = "销售订单主内码";
            grdMain.Columns[HSeOrderEntryIDCol].HeaderText = "销售订单子内码";
            grdMain.Columns[HSeOrderBillNoCol].HeaderText = "销售订单单号";
@@ -1659,6 +1699,8 @@
            grdMain.Columns[HTechnologyParameterCol].HeaderText = "工艺参数";
            grdMain.Columns[HPicNumCol].HeaderText = "图纸编号";
            grdMain.Columns[HProcCheckNoteCol].HeaderText = "本工序确认记录";
            grdMain.Columns[HMouldNoCol].HeaderText = "模具编号";
            grdMain.Columns[HProcWorkNumCol].HeaderText = "程序号";
            // grdMain.Columns[HKeyProcCol].HeaderText = "关键工序";
            grdMain.Columns[HKeyProcCol].Visible = false;
            ////固定赋值=====================================================
@@ -1698,6 +1740,7 @@
            grdMain.Columns[HEditCol].HeaderText = "不可编辑";
            grdMain.Columns[HOverRateCol].HeaderText = "超额比例";
            grdMain.Columns[HMaxQtyCol].HeaderText = " æœ€é«˜ä¸Šé™";
            grdMain.Columns[HSNCtrlCol].HeaderText = "SN码过站";
            //格式化 
@@ -1707,6 +1750,7 @@
            grdMain.Columns[HTagCol].Visible = false;
            grdMain.Columns[HWorkerIDCol].Visible = false;
            grdMain.Columns[HICMOInterIDCol].Visible = false;
            grdMain.Columns[HICMOEntryIDCol].Visible = false;
            grdMain.Columns[HOutMoneyCol].Visible = false;
            grdMain.Columns[HSourceIDCol].Visible = false;
            //grdMain.Columns[HEntryIDCol].Visible = false;
@@ -1813,6 +1857,8 @@
                            "," + HLastProcCol.ToString() +
                            "," + HFstProcCol.ToString() +
                            "," + HRemarkCol.ToString() +
                            "," + HMouldNoCol.ToString() +
                            "," + HProcWorkNumCol.ToString() +
                            "," + HSupNameCol +
                            "," + HSupFlagCol;
            //设置合计列
@@ -1837,6 +1883,12 @@
                oCell2.Value = 0;
                oCell2.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                grdMain.Rows[i].Cells[HEditCol] = oCell2;
                //SN码过站
                DataGridViewCheckBoxCell oCell3 = new DataGridViewCheckBoxCell();
                oCell3.ThreeState = false;
                oCell3.Value = 0;
                oCell3.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                grdMain.Rows[i].Cells[HSNCtrlCol] = oCell3;
            }
            //格式化网格
            DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid);
@@ -2447,10 +2499,15 @@
                Report.FieldByName("原料批次").AsString = txtHMateOutBatchNo.Text;
                Report.FieldByName("模具设备").AsString = txtHEquipMentID.Text;
                Report.FieldByName("项目号").AsString = txtHProjectNum.Text;
                Report.FieldByName("图号版本").AsString = textHPicNumVer.Text;
                Report.FieldByName("总装图号").AsString = textHPicNumAssemble.Text;
                Report.FieldByName("材质").AsString = textHMaterTexture.Text;
                Report.FieldByName("成品编号").AsString = textHProductNum.Text;
                Report.FieldByName("版本").AsString = textHVerNum.Text;
            }
            catch (Exception e)
            {
                MessageBox.Show("打印失败,[项目号],[流转卡编号],[流转卡数量],[产品代码],[产品名称],[计划开工日期],[计划完工日期],[订单跟踪号],[原料批次],[模具设备]." + e.Message);
                MessageBox.Show("打印失败,[项目号],[流转卡编号],[流转卡数量],[产品代码],[产品名称],[计划开工日期],[计划完工日期],[订单跟踪号],[原料批次],[模具设备],[图号版本],[总装图号],[材质],[成品编号],[版本]." + e.Message);
            }
        }
@@ -3312,62 +3369,62 @@
            string sNo = "";
            int row = oTable.Rows.Count - 1;
            //获取系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
            Ds = oCn.RunProcReturn("select HValue from Xt_SystemParameter with(nolock) where HKey='WMS_CampanyName'", "Xt_SystemParameter", ref DBUtility.ClsPub.sExeReturnInfo);
            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("获取系统参数失败!原因:" + DBUtility.ClsPub.sExeReturnInfo, "提示");
                return;
            }
            else
            {
                CampanyName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HValue"]);
            }
            if (CampanyName == "凯贝奈特") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
            {
            ////获取系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
            //Ds = oCn.RunProcReturn("select HValue from Xt_SystemParameter with(nolock) where HKey='WMS_CampanyName'", "Xt_SystemParameter", ref DBUtility.ClsPub.sExeReturnInfo);
            //if (Ds == null || Ds.Tables[0].Rows.Count == 0)
            //{
            //    MessageBox.Show("获取系统参数失败!原因:" + DBUtility.ClsPub.sExeReturnInfo, "提示");
            //    return;
            //}
            //else
            //{
            //    CampanyName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HValue"]);
            //}
            //if (CampanyName == "凯贝奈特") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
            //{
            }
            else
            {
                //获取当前改生产订单 æœ€å¤§æµè½¬å¡å·ï¼Œå¹¶ç´¯è®¡å¢žåŠ 1。
                //智见单号- å¹´æœˆæ—¥20200701+001
                string sOldNo = "";
                //Ds = oCn.RunProcReturn("select top 1 HBillNo  from Sc_ProcessExchangeBillmain where hicmointerid=" + oTable.Rows[row]["hmainid"].ToString() + "  order by LEN(HBillno) desc, HbillNo desc ", "Sc_ProcessExchangeBillmain");
            //}
            //else
            //{
            //    //获取当前改生产订单 æœ€å¤§æµè½¬å¡å·ï¼Œå¹¶ç´¯è®¡å¢žåŠ 1。
            //    //智见单号- å¹´æœˆæ—¥20200701+001
            //    string sOldNo = "";
            //    //Ds = oCn.RunProcReturn("select top 1 HBillNo  from Sc_ProcessExchangeBillmain where hicmointerid=" + oTable.Rows[row]["hmainid"].ToString() + "  order by LEN(HBillno) desc, HbillNo desc ", "Sc_ProcessExchangeBillmain");
                Ds = oCn.RunProcReturn("select top 1 HBillNo  from Sc_ProcessExchangeBillmain where HDate='" + dtpHDate.Value.ToShortDateString() + "' and HBillSubType<>'Split' order by  HbillNo desc ", "Sc_ProcessExchangeBillmain");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    sNo = "001";
                }
                else
                {
                    sOldNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]);
                    sOldNo = sOldNo.Substring(sOldNo.Length - 3, 3);
                    //if (sOldNo.Substring(0, 1) == "0" || sOldNo.Substring(0, 1) == "-")
                    //{
                    //    sOldNo = sOldNo.Substring(sOldNo.Length - 2, 2);
                    //    if (sOldNo.Substring(0, 1) == "0")
                    //    {
                    //        sOldNo = sOldNo.Substring(sOldNo.Length - 1, 1);
                    //    }
                    //}
                    sNo = "0000" + DBUtility.ClsPub.isStrNull(DBUtility.ClsPub.isLong(sOldNo) + 1);
                }
            //    Ds = oCn.RunProcReturn("select top 1 HBillNo  from Sc_ProcessExchangeBillmain where HDate='" + dtpHDate.Value.ToShortDateString() + "' and HBillSubType<>'Split' order by  HbillNo desc ", "Sc_ProcessExchangeBillmain");
            //    if (Ds == null || Ds.Tables[0].Rows.Count == 0)
            //    {
            //        sNo = "001";
            //    }
            //    else
            //    {
            //        sOldNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]);
            //        sOldNo = sOldNo.Substring(sOldNo.Length - 3, 3);
            //        //if (sOldNo.Substring(0, 1) == "0" || sOldNo.Substring(0, 1) == "-")
            //        //{
            //        //    sOldNo = sOldNo.Substring(sOldNo.Length - 2, 2);
            //        //    if (sOldNo.Substring(0, 1) == "0")
            //        //    {
            //        //        sOldNo = sOldNo.Substring(sOldNo.Length - 1, 1);
            //        //    }
            //        //}
            //        sNo = "0000" + DBUtility.ClsPub.isStrNull(DBUtility.ClsPub.isLong(sOldNo) + 1);
            //    }
                sNo = sNo.Substring(sNo.Length - 3, 3);
                //initGrid();
                //initGrid_Sub();
                //string sBillNo = oTable.Rows[row]["生产订单号"].ToString();
                string sYear = dtpHDate.Value.Year.ToString();
                string sMonth = "00" + dtpHDate.Value.Month.ToString();
                string sDay = "00" + dtpHDate.Value.Day.ToString();
                string sBillNo = sYear + sMonth.Substring(sMonth.Length - 2, 2) + sDay.Substring(sDay.Length - 2, 2);
                //sBillNo = sBillNo.Replace("WORKX", "");
                //sBillNo = sBillNo.Replace("WORK", "");
                //sBillNo = sBillNo.Replace("_", "-");
                sBillNo = sBillNo + "-" + sNo;
                txtHBillNo.Text = sBillNo;
            }
            //    sNo = sNo.Substring(sNo.Length - 3, 3);
            //    //initGrid();
            //    //initGrid_Sub();
            //    //string sBillNo = oTable.Rows[row]["生产订单号"].ToString();
            //    string sYear = dtpHDate.Value.Year.ToString();
            //    string sMonth = "00" + dtpHDate.Value.Month.ToString();
            //    string sDay = "00" + dtpHDate.Value.Day.ToString();
            //    string sBillNo = sYear + sMonth.Substring(sMonth.Length - 2, 2) + sDay.Substring(sDay.Length - 2, 2);
            //    //sBillNo = sBillNo.Replace("WORKX", "");
            //    //sBillNo = sBillNo.Replace("WORK", "");
            //    //sBillNo = sBillNo.Replace("_", "-");
            //    sBillNo = sBillNo + "-" + sNo;
            //    txtHBillNo.Text = sBillNo;
            //}
@@ -3406,6 +3463,11 @@
            txtHCusName.Text = oTable.Rows[row]["客户名称"].ToString();
            txtHWorkRemark.Text = oTable.Rows[row]["生产备注"].ToString();
            txtHImportNote.Text = oTable.Rows[row]["重要提示"].ToString();
            textHPicNumVer.Text = oTable.Rows[row]["图号版本"].ToString();
            textHPicNumAssemble.Text = oTable.Rows[row]["总装图号"].ToString();
            textHMaterTexture.Text = oTable.Rows[row]["材质"].ToString();
            textHProductNum.Text = oTable.Rows[row]["成品编号"].ToString();
            textHVerNum.Text = oTable.Rows[row]["版本"].ToString();
            // txtHWorkTypeID.Text = oTable.Rows[row]["生产车间名称"].ToString();
@@ -3479,6 +3541,7 @@
                //
                grdMain.Rows[i].Cells[HICMOBillNoCol].Value = oTable.Rows[i]["生产订单号"].ToString();
                grdMain.Rows[i].Cells[HICMOInterIDCol].Value = oTable.Rows[i]["hmainid"].ToString();
                grdMain.Rows[i].Cells[HICMOEntryIDCol].Value = oTable.Rows[i]["HEntryID"].ToString();
                grdMain.Rows[i].Cells[HSourceInterIDCol].Value = oTable.Rows[i]["hmainid"].ToString();
                grdMain.Rows[i].Cells[HSourceEntryIDCol].Value = oTable.Rows[i]["HEntryID"].ToString();
                grdMain.Rows[i].Cells[HSourceBillTypeCol].Value = oTable.Rows[i]["HBillType"].ToString();
@@ -3490,6 +3553,9 @@
                grdMain.Rows[i].Cells[HProcCheckNoteCol].Value = oTable.Rows[i]["本工序确认记录"].ToString();
                grdMain.Rows[i].Cells[HOverRateCol].Value = oTable.Rows[i]["超额比例"].ToString();
                grdMain.Rows[i].Cells[HMaxQtyCol].Value = oTable.Rows[i]["最高上限"].ToString();
                grdMain.Rows[i].Cells[HMouldNoCol].Value = oTable.Rows[i]["模具编号"].ToString();
                grdMain.Rows[i].Cells[HProcWorkNumCol].Value = oTable.Rows[i]["程序号"].ToString();
                grdMain.Rows[i].Cells[HSNCtrlCol].Value = oTable.Rows[i]["SN码过站"].ToString();
            }
            Sub_CountProcExchQty();
@@ -3676,5 +3742,10 @@
            //
            DBUtility.ClsPub.HideGridView(grdMain, Name, ClsPub.AppPath);//设置隐藏列
        }
        private void grdMain_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
        }
    }
}