From cd50e79ee0899945e12c0092b83b105649e70e84 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期五, 18 十月 2024 13:14:48 +0800
Subject: [PATCH] 结算单个人集体按用户绑定班组显示

---
 WorkM/流转卡管理/Sc_ProcessExchangeBill.cs |  657 +++++++++++++++++++++++++++++++----------------------------
 1 files changed, 346 insertions(+), 311 deletions(-)

diff --git "a/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/Sc_ProcessExchangeBill.cs" "b/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/Sc_ProcessExchangeBill.cs"
index 5676212..77962cb 100644
--- "a/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/Sc_ProcessExchangeBill.cs"
+++ "b/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/Sc_ProcessExchangeBill.cs"
@@ -105,6 +105,7 @@
         public const Int16 HMouldNoCol = 79;
         public const Int16 HProcWorkNumCol = 80;
         public const Int16 HICMOEntryIDCol = 81;
+        public const Int16 HSNCtrlCol = 82;
 
 
 
@@ -751,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();
             //鐏板害婧愬崟绫诲瀷
@@ -1214,6 +1216,7 @@
                     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;
@@ -1288,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;
+                //}
 
             }
             //鍗曟嵁鍙锋槸鍚﹂噸澶�
@@ -1318,280 +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;
-            //璧嬪�糏D
-            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);
-            //===================
-            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++)
-            {
-                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;
+                //璧嬪�糏D
+                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.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);
-                    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;
             }
         }
@@ -1604,7 +1621,7 @@
         {
 
             //
-            grdMain.ColumnCount = 82;                       //鎬诲垪鏁�
+            grdMain.ColumnCount = 83;                       //鎬诲垪鏁�
             DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name);
             //
             grdMain.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True;
@@ -1723,6 +1740,7 @@
             grdMain.Columns[HEditCol].HeaderText = "涓嶅彲缂栬緫";
             grdMain.Columns[HOverRateCol].HeaderText = "瓒呴姣斾緥";
             grdMain.Columns[HMaxQtyCol].HeaderText = " 鏈�楂樹笂闄�";
+            grdMain.Columns[HSNCtrlCol].HeaderText = "SN鐮佽繃绔�";
 
 
             //鏍煎紡鍖� 
@@ -1865,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);
@@ -2475,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("鎵撳嵃澶辫触锛孾椤圭洰鍙穄,[娴佽浆鍗$紪鍙穄,[娴佽浆鍗℃暟閲廬,[浜у搧浠g爜],[浜у搧鍚嶇О],[璁″垝寮�宸ユ棩鏈焆,[璁″垝瀹屽伐鏃ユ湡],[璁㈠崟璺熻釜鍙穄,[鍘熸枡鎵规],[妯″叿璁惧]." + e.Message);
+                MessageBox.Show("鎵撳嵃澶辫触锛孾椤圭洰鍙穄,[娴佽浆鍗$紪鍙穄,[娴佽浆鍗℃暟閲廬,[浜у搧浠g爜],[浜у搧鍚嶇О],[璁″垝寮�宸ユ棩鏈焆,[璁″垝瀹屽伐鏃ユ湡],[璁㈠崟璺熻釜鍙穄,[鍘熸枡鎵规],[妯″叿璁惧],[鍥惧彿鐗堟湰],[鎬昏鍥惧彿],[鏉愯川],[鎴愬搧缂栧彿],[鐗堟湰]." + e.Message);
             }
 
         }
@@ -3340,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;
+            //}
 
 
 
@@ -3526,6 +3555,7 @@
                 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();
@@ -3712,5 +3742,10 @@
             //
             DBUtility.ClsPub.HideGridView(grdMain, Name, ClsPub.AppPath);//璁剧疆闅愯棌鍒�
         }
+
+        private void grdMain_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        {
+
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1