From 8ce597d937ebd43bd121f316d10581ff585571b0 Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期六, 14 九月 2024 16:49:25 +0800
Subject: [PATCH] 凯贝浪潮客户条码生成批次获取修改,工资结算单(集体)网页模块调用方法新增、修改

---
 DAL/工资管理/ClsPay_GroupBalBill.cs                       |  228 +++++++++++++++---------
 Model/工资管理/ClsPay_GroupBalBillSub.cs                  |    1 
 WarM/条码打印/Gy_CusBarCodeBill_KaiBei_LangChao.cs        |   49 ++++
 WebAPI/Controllers/工资管理/Pay_GroupBalBillController.cs |  204 ++++++++++++++++++++++
 4 files changed, 388 insertions(+), 94 deletions(-)

diff --git "a/DAL/\345\267\245\350\265\204\347\256\241\347\220\206/ClsPay_GroupBalBill.cs" "b/DAL/\345\267\245\350\265\204\347\256\241\347\220\206/ClsPay_GroupBalBill.cs"
index 7214ef3..d442146 100644
--- "a/DAL/\345\267\245\350\265\204\347\256\241\347\220\206/ClsPay_GroupBalBill.cs"
+++ "b/DAL/\345\267\245\350\265\204\347\256\241\347\220\206/ClsPay_GroupBalBill.cs"
@@ -30,15 +30,75 @@
         {
             DetailColl = null;
         }
-       
+
         #endregion   鑷畾涔夋柟娉�
+
+        //淇濆瓨鍓嶆帶鍒�
+        public bool BeforeSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn)
+        {
+            try
+            {
+                DataSet Ds = oCn.RunProcReturn("Exec h_p_Pay_GroupBalBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_GroupBalBill_BeforeSaveCtrl");
+                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+                {
+                    sReturn = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+                    return false;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1)
+                    {
+                        sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
+                        return false;
+                    }
+                }
+                return true;
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
+
+        //淇濆瓨鍚庢帶鍒�
+        public bool AfterSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn)
+        {
+            try
+            {
+                DataSet Ds = oCn.RunProcReturn("Exec h_p_Pay_GroupBalBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_GroupBalBill_AfterSaveCtrl");
+                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+                {
+                    sReturn = "淇濆瓨鍚庡垽鏂け璐ワ紒";
+                    return false;
+                }
+                else
+                {
+                    if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1)
+                    {
+                        sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
+                        return false;
+                    }
+                }
+                return true;
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
+
         //淇敼鍗曟嵁
         public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
         {
             try
             {
-                //
                 oCn.BeginTran();
+                //淇濆瓨鍓嶆帶鍒�
+                if (!BeforeSave(lngBillKey, omodel.HBillNo, 2, ref sReturn))
+                {
+                    oCn.RollBack();
+                    return false;
+                }
                 //鏇存柊涓昏〃
                 oCn.RunProc("UpDate Pay_GroupBalBillMain set  " +
                 " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
@@ -51,13 +111,14 @@
                 //========================================
                 ",HGroupID=" + omodel.HGroupID.ToString() +
                 ",HDeptID=" + omodel.HDeptID.ToString() +
+                ",HPayType=" + omodel.HPayType.ToString() +
                 ",HOtherSubsidy=" + omodel.HOtherSubsidy.ToString() +
                 ",HOtherDeduct=" + omodel.HOtherDeduct.ToString() +
                 ",HSumMoney=" + omodel.HSumMoney.ToString() +
                 ",HPayMoney=" + omodel.HPayMoney.ToString() +
-                ",HPayType=" + omodel.HPayType.ToString() +
                 ",HExplanation='" + omodel.HExplanation + "'" +
                 ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
+                ",HStockOrgID=" + omodel.HSTOCKORGID.ToString() +
                 " where HInterID=" + lngBillKey.ToString());
                 //鍒犻櫎鍏宠仈
                 DeleteRelation(ref sReturn, lngBillKey);
@@ -69,17 +130,19 @@
                 foreach (Model.ClsPay_GroupBalBillSub oSub in DetailColl)
                 {
                     oCn.RunProc("Insert into Pay_GroupBalBillSub " +
-                      " (HInterID,HEntryID,HRemark" +
-                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                      ",HMaterID,HUnitID,HProcID,HTimes,HQty,HPrice,HSourceID" +
-                      ",HMoney,HICMOInterID,HICMOBillNo,HProcReportInterID,HProcReportEntryID,HProcReportBillNo" +
-                      ",HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HSqty" +
+                      " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" +
+                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                      ",HMaterID,HUnitID,HProcID,HSourceID" +
+                      ",HTimes,HQty,HPrice,HMoney,HSqty" +
+                      ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcReportInterID,HProcReportEntryID,HProcReportBillNo" +
+                      ",HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo" +
                       ") values("
-                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'" +
-                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
-                      "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HTimes.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HSourceID.ToString() +
-                      "," + oSub.HMoney.ToString() + "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HProcReportInterID.ToString() + "," + oSub.HProcReportEntryID.ToString() + ",'" + oSub.HProcReportBillNo + "'" +
-                      "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID.ToString() + ",'" + oSub.HProcPlanBillNo + "'," + oSub.HSqty.ToString() + 
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
+                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" +
+                      "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HSourceID.ToString() +
+                      "," + oSub.HTimes.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HSqty.ToString() +
+                      "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HProcReportInterID.ToString() + "," + oSub.HProcReportEntryID.ToString() + ",'" + oSub.HProcReportBillNo + "'" +
+                      "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID.ToString() + ",'" + oSub.HProcPlanBillNo + "'" +
                       ") ");
                 }
                 //
@@ -87,33 +150,26 @@
                 foreach (Model.ClsPay_GroupBalBillEmp oSubSec in DetailEmpColl)
                 {
                     oCn.RunProc("Insert into Pay_GroupBalBillEmp " +
-                      " (HInterID,HEntryID,HRemark" +
-                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                        ",HEmpID,HEmpRate" +
-                        ",HBaseTimes,HOverTimes,HLeaveTimes,HCTPrjID" +
-                        ",HBaseDays,HOverDays,HLeaveDays,HYf" +
-                        ",HMoney,HOtherSubsidy,HOtherDeduct,HIsPay,HAvgFlag" +
-                        ")" +
-                        " values("
-                      + omodel.HInterID.ToString() + "," + oSubSec.HEntryID.ToString() + ",'" + oSubSec.HRemark + "'" +
-                      "," + oSubSec.HSourceInterID.ToString() + "," + oSubSec.HSourceEntryID.ToString() + ",'" + oSubSec.HSourceBillNo + "','" + oSubSec.HSourceBillType + "'," + oSubSec.HRelationQty.ToString() + "," + oSubSec.HRelationMoney.ToString() +
-                        "," + oSubSec.HEmpID.ToString() + "," + oSubSec.HEmpRate.ToString() +
-                        "," + oSubSec.HBaseTimes.ToString() + "," + oSubSec.HOverTimes.ToString() + "," + oSubSec.HLeaveTimes.ToString() + "," + oSubSec.HCTPrjID.ToString() +
-                        "," + oSubSec.HBaseDays.ToString() + "," + oSubSec.HOverDays.ToString() + "," + oSubSec.HLeaveDays.ToString() + "," + oSubSec.HYf.ToString() +
-                        "," + oSubSec.HMoney.ToString() + "," + oSubSec.HOtherSubsidy.ToString() + "," + oSubSec.HOtherDeduct.ToString() + "," + Convert.ToString(oSubSec.HIsPay ? 1 : 0) + "," + Convert.ToString(oSubSec.HAvgFlag ? 1 : 0) + ") ");
+                      " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" +
+                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                      ",HEmpID,HEmpRate,HCTPrjID,HMoney,HOtherSubsidy,HOtherDeduct" +
+                      ",HBaseDays,HBaseTimes,HOverDays,HOverTimes,HLeaveDays,HLeaveTimes" +
+                      ",HIsPay,HAvgFlag,HYF" +
+                      ") values("
+                      + omodel.HInterID.ToString() + "," + oSubSec.HEntryID.ToString() + ",'" + oSubSec.HRemark + "'," + oSubSec.HRelationQty.ToString() + "," + oSubSec.HRelationMoney.ToString() +
+                      "," + oSubSec.HSourceInterID.ToString() + "," + oSubSec.HSourceEntryID.ToString() + ",'" + oSubSec.HSourceBillNo + "','" + oSubSec.HSourceBillType + "'" +
+                      "," + oSubSec.HEmpID.ToString() + "," + oSubSec.HEmpRate.ToString() + "," + oSubSec.HCTPrjID.ToString() + "," + oSubSec.HMoney.ToString() + "," + oSubSec.HOtherSubsidy.ToString() + "," + oSubSec.HOtherDeduct.ToString() +
+                      "," + oSubSec.HBaseDays.ToString() + "," + oSubSec.HBaseTimes.ToString() + "," + oSubSec.HOverDays.ToString() + "," + oSubSec.HOverTimes.ToString() + "," + oSubSec.HLeaveDays.ToString() + "," + oSubSec.HLeaveTimes.ToString() +
+                      "," + Convert.ToString(oSubSec.HIsPay ? 1 : 0) + "," + Convert.ToString(oSubSec.HAvgFlag ? 1 : 0) + "," + oSubSec.HYf.ToString() +
+                      ") ");
                 }
-                //foreach (Model.ClsPay_GroupBalBillSub oSub in DetailColl)
-                //{
-                //    Ds = oCn.RunProcReturn("exec h_p_Pay_GroupBalBill_Qty " + oSub.HICMOInterID, "");
-                //    if (Ds.Tables[0].Rows.Count == 0)
-                //        return;
-                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
-                //    {
-                //        sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨";
-                //        return false;
-                //    }
-                //}
-                sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
+                //淇濆瓨鍚庢帶鍒�
+                if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn))
+                {
+                    oCn.RollBack();
+                    return false;
+                }
+                sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 淇敼鎴愬姛锛�";
                 oCn.Commit();
                 return true;
             }
@@ -124,6 +180,7 @@
                 throw (e);
             }
         }
+
         //鏂板鍗曟嵁
         public override bool AddBill(ref string sReturn)
         {
@@ -133,36 +190,43 @@
                 omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                 oCn.BeginTran();
+                //淇濆瓨鍓嶆帶鍒�
+                if (!BeforeSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn))
+                {
+                    oCn.RollBack();
+                    return false;
+                }
                 //涓昏〃
                 oCn.RunProc("Insert Into Pay_GroupBalBillMain   " +
                 "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                 ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
-                ",HGroupID,HDeptID,HPayType,HOtherSubsidy" +
-                ",HOtherDeduct,HSumMoney,HPayMoney" +
-                ",HExplanation,HInnerBillNo" +
+                ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
+                ",HGroupID,HDeptID,HPayType,HOtherSubsidy,HOtherDeduct" +
+                ",HSumMoney,HPayMoney,HExplanation,HInnerBillNo,HStockOrgID" +
                 ") " +
-                " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
-                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
-                ", " + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HPayType.ToString() + "," + omodel.HOtherSubsidy.ToString() +
-                "," + omodel.HOtherDeduct.ToString() + "," + omodel.HSumMoney.ToString() + "," + omodel.HPayMoney.ToString() +
-                ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'" +
+                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate.ToShortDateString() + "'" +
+                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
+                "," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType + "'" +
+                "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HPayType.ToString() + "," + omodel.HOtherSubsidy.ToString() + "," + omodel.HOtherDeduct.ToString() +
+                "," + omodel.HSumMoney.ToString() + "," + omodel.HPayMoney.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + omodel.HSTOCKORGID.ToString() +
                 ") ");
-                //
                 //鎻掑叆瀛愯〃
                 foreach (Model.ClsPay_GroupBalBillSub oSub in DetailColl)
                 {
                     oCn.RunProc("Insert into Pay_GroupBalBillSub " +
-                      " (HInterID,HEntryID,HRemark" +
-                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                      ",HMaterID,HUnitID,HProcID,HTimes,HQty,HPrice,HSourceID" +
-                      ",HMoney,HICMOInterID,HICMOBillNo,HProcReportInterID,HProcReportEntryID,HProcReportBillNo" +
-                      ",HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HSqty" +
+                      " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" +
+                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                      ",HMaterID,HUnitID,HProcID,HSourceID" +
+                      ",HTimes,HQty,HPrice,HMoney,HSqty" +
+                      ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcReportInterID,HProcReportEntryID,HProcReportBillNo" +
+                      ",HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo" +
                       ") values("
-                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'" +
-                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
-                      "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HTimes.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HSourceID.ToString() +
-                      "," + oSub.HMoney.ToString() + "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HProcReportInterID.ToString() + "," + oSub.HProcReportEntryID.ToString() + ",'" + oSub.HProcReportBillNo + "'" +
-                      "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID.ToString() + ",'" + oSub.HProcPlanBillNo + "'," + oSub.HSqty.ToString() + 
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
+                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" +
+                      "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HSourceID.ToString() +
+                      "," + oSub.HTimes.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HSqty.ToString() +
+                      "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HProcReportInterID.ToString() + "," + oSub.HProcReportEntryID.ToString() + ",'" + oSub.HProcReportBillNo + "'" +
+                      "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID.ToString() + ",'" + oSub.HProcPlanBillNo + "'" +
                       ") ");
                 }
                 //
@@ -170,35 +234,26 @@
                 foreach (Model.ClsPay_GroupBalBillEmp oSubSec in DetailEmpColl)
                 {
                     oCn.RunProc("Insert into Pay_GroupBalBillEmp " +
-                      " (HInterID,HEntryID,HRemark" +
-                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
-                        ",HEmpID,HEmpRate" +
-                        ",HBaseTimes,HOverTimes,HLeaveTimes,HCTPrjID" +
-                        ",HBaseDays,HOverDays,HLeaveDays,HYf" +
-                        ",HMoney,HOtherSubsidy,HOtherDeduct,HIsPay,HAvgFlag" +
-                        ")" +
-                        " values("
-                      + omodel.HInterID.ToString() + "," + oSubSec.HEntryID.ToString() + ",'" + oSubSec.HRemark + "'" +
-                      "," + oSubSec.HSourceInterID.ToString() + "," + oSubSec.HSourceEntryID.ToString() + ",'" + oSubSec.HSourceBillNo + "','" + oSubSec.HSourceBillType + "'," + oSubSec.HRelationQty.ToString() + "," + oSubSec.HRelationMoney.ToString() +
-                        "," + oSubSec.HEmpID.ToString() + "," + oSubSec.HEmpRate.ToString() +
-                        "," + oSubSec.HBaseTimes.ToString() + "," + oSubSec.HOverTimes.ToString() + "," + oSubSec.HLeaveTimes.ToString() + "," + oSubSec.HCTPrjID.ToString() +
-                        "," + oSubSec.HBaseDays.ToString() + "," + oSubSec.HOverDays.ToString() + "," + oSubSec.HLeaveDays.ToString() + "," + oSubSec.HYf.ToString() +
-                        "," + oSubSec.HMoney.ToString() + "," + oSubSec.HOtherSubsidy.ToString() + "," + oSubSec.HOtherDeduct.ToString() + "," + Convert.ToString(oSubSec.HIsPay ? 1 : 0) + "," + Convert.ToString(oSubSec.HAvgFlag ? 1 : 0) + ") ");
+                      " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" +
+                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+                      ",HEmpID,HEmpRate,HCTPrjID,HMoney,HOtherSubsidy,HOtherDeduct" +
+                      ",HBaseDays,HBaseTimes,HOverDays,HOverTimes,HLeaveDays,HLeaveTimes" +
+                      ",HIsPay,HAvgFlag,HYF" +
+                      ") values("
+                      + omodel.HInterID.ToString() + "," + oSubSec.HEntryID.ToString() + ",'" + oSubSec.HRemark + "'," + oSubSec.HRelationQty.ToString() + "," + oSubSec.HRelationMoney.ToString() +
+                      "," + oSubSec.HSourceInterID.ToString() + "," + oSubSec.HSourceEntryID.ToString() + ",'" + oSubSec.HSourceBillNo + "','" + oSubSec.HSourceBillType + "'" +
+                      "," + oSubSec.HEmpID.ToString() + "," + oSubSec.HEmpRate.ToString() + "," + oSubSec.HCTPrjID.ToString() + "," + oSubSec.HMoney.ToString() + "," + oSubSec.HOtherSubsidy.ToString() + "," + oSubSec.HOtherDeduct.ToString() +
+                      "," + oSubSec.HBaseDays.ToString() + "," + oSubSec.HBaseTimes.ToString() + "," + oSubSec.HOverDays.ToString() + "," + oSubSec.HOverTimes.ToString() + "," + oSubSec.HLeaveDays.ToString() + "," + oSubSec.HLeaveTimes.ToString() +
+                      "," + Convert.ToString(oSubSec.HIsPay ? 1 : 0) + "," + Convert.ToString(oSubSec.HAvgFlag ? 1 : 0) + "," + oSubSec.HYf.ToString() +
+                      ") ");
                 }
-                //
-                //foreach (Model.ClsPay_GroupBalBillSub oSub in DetailColl)
-                //{
-                //    Ds = oCn.RunProcReturn("exec h_p_Pay_GroupBalBill_Qty " + oSub.HICMOInterID, "");
-                //    if (Ds.Tables[0].Rows.Count == 0)
-                //        return;
-                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
-                //    {
-                //        sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨";
-                //        return false;
-                //    }
-                //}
-                //
-                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                //淇濆瓨鍚庢帶鍒�
+                if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn))
+                {
+                    oCn.RollBack();
+                    return false;
+                }
+                sReturn = "鍗曟嵁鍙凤細" + omodel.HBillNo + " 鏂板鎴愬姛锛�";
                 oCn.Commit();
                 return true;
             }
@@ -209,6 +264,7 @@
                 throw (e);
             }
         }
+
         //鏄剧ず鍗曟嵁
         public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
         {
diff --git "a/Model/\345\267\245\350\265\204\347\256\241\347\220\206/ClsPay_GroupBalBillSub.cs" "b/Model/\345\267\245\350\265\204\347\256\241\347\220\206/ClsPay_GroupBalBillSub.cs"
index fa8beea..9c8e54e 100644
--- "a/Model/\345\267\245\350\265\204\347\256\241\347\220\206/ClsPay_GroupBalBillSub.cs"
+++ "b/Model/\345\267\245\350\265\204\347\256\241\347\220\206/ClsPay_GroupBalBillSub.cs"
@@ -16,6 +16,7 @@
         public double HPrice;//		decimal(18,8)		--工价
         public double HMoney;//		decimal(18,8)		--金额 
         public Int64 HICMOInterID;//	int		--生产任务单ID
+        public Int64 HICMOEntryID;//	int		--生产任务单子ID
         public string HICMOBillNo;//	varchar(50)		--生产任务单号
         public Int64 HProcReportInterID;//        int      --工序汇报单ID
         public Int64 HProcReportEntryID;//	int	--工序汇报单子ID
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei_LangChao.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei_LangChao.cs"
index a4bb4a3..99f13fa 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei_LangChao.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei_LangChao.cs"
@@ -589,9 +589,9 @@
                     }
                     else
                     {
-                        grdMain.Rows[j].Cells[HBaNoCol].Value = HCode2;
-                        grdMain.Rows[j].Cells[HBatchNoCol].Value = DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0]["HBatchNo"]);
-                        grdMain.Rows[j].Cells[HCode2Col].Value = DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0]["HCode2"]);
+                        //grdMain.Rows[j].Cells[HBaNoCol].Value = HCode2;
+                        //grdMain.Rows[j].Cells[HBatchNoCol].Value = DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0]["HBatchNo"]);
+                        //grdMain.Rows[j].Cells[HCode2Col].Value = DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0]["HCode2"]);
 
                         if (DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HExpiryDateCol].Value) == "")
                         {
@@ -712,6 +712,39 @@
                 {
                     if (ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value) != 0)
                     {
+                        string sHSourceBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBillNoCol].Value);         // 婧愬崟鍗曞彿
+                        long sHMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value);                  // 鐗╂枡鍐呯爜
+                        string sHMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNumberCol].Value);     // 鐗╂枡浠g爜
+                        string sHCusModelName = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelNameCol].Value);   // 瀹㈡埛鏂欏彿
+                        string sHCode1 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode1Col].Value);                 // 鐗╂枡绫诲埆
+                        string sHCode2 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode2Col].Value);                 // 鎵规浣�
+                        sHCode2 = sHCode2.ToUpper();
+                        string HBatchNoNumber = sHCode1 + sYear + sPeriod + sDay + HCusModel;                                // 鎵规鐢熸垚鍓嶇紑
+                        HBatchNoNumber = HBatchNoNumber.ToUpper();
+
+                        DataSet oDsBatchNo = oCn.RunProcReturn("exec h_p_Gy_CusBarCodeBill_KaiBeiLC_GetBatchNo '" + sHSourceBillNo + "'," + sHMaterID.ToString() + ",'" + sHMaterNumber + "','" + sHCusModelName + "','" + sHCode2 + "','" + HBatchNoNumber + "'", "h_p_Gy_CusBarCodeBill_KaiBeiLC_GetBatchNo");
+                        //
+                        if (oDsBatchNo == null && oDsBatchNo.Tables[0].Rows.Count == 0)
+                        {
+                            MessageBox.Show("鑾峰彇鎵规澶辫触锛�");
+                            bc.Enabled = true;
+                            oCn.RollBack();
+                            return;
+                        }
+                        else if (DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0][0]) == "1")
+                        {
+                            MessageBox.Show(DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HRemark"]));
+                            bc.Enabled = true;
+                            oCn.RollBack();
+                            return;
+                        }
+                        else
+                        {
+                            grdMain.Rows[j].Cells[HBaNoCol].Value = sHCode2;
+                            grdMain.Rows[j].Cells[HBatchNoCol].Value = DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HBatchNo"]);
+                            grdMain.Rows[j].Cells[HCode2Col].Value = DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HCode2"]);
+                        }
+
                         HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value);
                         HCode3 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].Value);
                         //鑾峰彇鏈�澶ф祦姘村彿
@@ -1076,12 +1109,12 @@
             string sAllowCol =  HQtyCol.ToString()+
                                 "," + HMinQtyCol.ToString() +
                                 "," + HWMinQtyCol.ToString() +
-                                "," + HMaterNumberCol.ToString() +
+                                //"," + HMaterNumberCol.ToString() +
                                 "," + HAuxPropNumberCol.ToString() +
                                 "," + HUnitNumberCol.ToString() +
-                                "," + HCode1Col.ToString() +
+                                //"," + HCode1Col.ToString() +
                                 //"," + HCode2Col.ToString() +
-                                "," + HCode3Col.ToString() +
+                                //"," + HCode3Col.ToString() +
                                 "," + HInnerBillNoCol.ToString() +
                                 "," + HRemarkCol.ToString();
 
@@ -1506,9 +1539,9 @@
                                 "," + HMinQtyCol.ToString() +
                                 "," + HWMinQtyCol.ToString() +
                                 "," + HAuxPropNumberCol.ToString() +
-                                "," + HCode1Col.ToString() +
+                                //"," + HCode1Col.ToString() +
                                 //"," + HCode2Col.ToString() +
-                                "," + HCode3Col.ToString() +
+                                //"," + HCode3Col.ToString() +
                                 "," + HInnerBillNoCol.ToString() +
                                 "," + HRemarkCol.ToString();
             grdMain.Columns[HBillNoCol].ReadOnly = true;
diff --git "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_GroupBalBillController.cs" "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_GroupBalBillController.cs"
index a1c9f76..c5ecf76 100644
--- "a/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_GroupBalBillController.cs"
+++ "b/WebAPI/Controllers/\345\267\245\350\265\204\347\256\241\347\220\206/Pay_GroupBalBillController.cs"
@@ -590,6 +590,210 @@
         }
         #endregion
 
+        #region 宸ヨ祫缁撶畻鍗�(闆嗕綋)妯″潡   浠庡垪琛ㄩ�変腑鎵撳紑鍗曟嵁锛岃繑鍥炲崟鎹俊鎭椂璋冪敤
+        /// <summary>
+        /// 宸ヨ祫缁撶畻鍗�(闆嗕綋)缂栬緫鏃讹紝鏍规嵁鍗曟嵁ID鑾峰彇鍗曟嵁淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        [Route("Pay_GroupBalBillController/GetPay_GroupBalBill_Json")]
+        [HttpGet]
+        public object GetPay_GroupBalBill_Json(Int64 HInterID, string HMaker)
+        {
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 3, false, HMaker))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //杩斿洖鍒楄〃淇℃伅
+                ds = oCn.RunProcReturn("exec h_p_Pay_GroupBalBill_EditInit " + HInterID, "h_p_Pay_GroupBalBill_EditInit");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ュ伐璧勭粨绠楀崟(闆嗕綋)锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎴愬姛锛�";
+                    objJsonResult.data = new
+                    {
+                        Mainlist = ds.Tables[0],    //杩斿洖涓昏〃淇℃伅锛�0锛�
+                        Sublist = ds.Tables[1],     //杩斿洖瀛愯〃1淇℃伅锛�1锛�
+                        Emplist = ds.Tables[2],     //杩斿洖瀛愯〃2淇℃伅锛�2锛�
+                    };
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "杩斿洖宸ヨ祫缁撶畻鍗�(闆嗕綋)淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ヨ祫缁撶畻鍗�(闆嗕綋)淇濆瓨
+        /// <summary>
+        /// 宸ヨ祫缁撶畻鍗�(闆嗕綋)淇濆瓨
+        /// </summary>
+        [Route("Pay_GroupBalBillController/GetPay_GroupBalBill_Save_Json")]
+        [HttpPost]
+        public object GetPay_GroupBalBill_Save_Json([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string sMainStr = sArray[0].ToString();         //涓昏〃鏁版嵁
+            string sSubStr = sArray[1].ToString();          //瀛愯〃鏁版嵁
+            string sSubStr2 = sArray[2].ToString();         //瀛愯〃鏁版嵁2
+            string OperationType = sArray[3].ToString();    //鎿嶄綔绫诲瀷锛�1鏂板銆�2缂栬緫锛�
+            string HMaker = sArray[4].ToString();           //鍒跺崟浜�
+            try
+            {
+                //鍒ゆ柇鏉冮檺
+                if (OperationType == "1")
+                {
+                    BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
+                    //鍒ゆ柇鏂板鏉冮檺
+                    if (!DBUtility.ClsPub.Security_Log(ModRightName, 1, false, HMaker))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify;
+                    //鍒ゆ柇缂栬緫鏉冮檺
+                    if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 1, false, HMaker))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                //琛ㄥご璧嬪��
+                sMainStr = sMainStr.Replace("\\", "");
+                sMainStr = sMainStr.Replace("\n", "");
+                sMainStr = "[" + sMainStr.ToString() + "]";
+                List<Model.ClsPay_GroupBalBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPay_GroupBalBillMain>>(sMainStr);
+                foreach (Model.ClsPay_GroupBalBillMain oItem in lsmain)
+                {
+                    //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                    if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oItem.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oItem.HYear = sYear;
+                    oItem.HPeriod = sPeriod;
+                    DBUtility.ClsPub.CurUserName = oItem.HMaker;
+                    oBill.omodel = oItem;
+                }
+                //琛ㄤ綋璧嬪��
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                sSubStr = sSubStr.Substring(1, sSubStr.Length - 2);
+                sSubStr = sSubStr.Replace("\\", "");
+                sSubStr = sSubStr.Replace("\n", "");
+                sSubStr = "[" + sSubStr.ToString() + "]";
+                List<Model.ClsPay_GroupBalBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPay_GroupBalBillSub>>(sSubStr);
+                int i = 0;
+                foreach (Model.ClsPay_GroupBalBillSub oItemSub in ls)
+                {
+                    i++;
+                    oItemSub.HEntryID = i;
+                    oBill.DetailColl.Add(oItemSub);
+                }
+                //琛ㄤ綋璧嬪��2
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                sSubStr2 = sSubStr2.Substring(1, sSubStr2.Length - 2);
+                sSubStr2 = sSubStr2.Replace("\\", "");
+                sSubStr2 = sSubStr2.Replace("\n", "");
+                sSubStr2 = "[" + sSubStr2.ToString() + "]";
+                List<Model.ClsPay_GroupBalBillEmp> ls2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPay_GroupBalBillEmp>>(sSubStr2);
+                int j = 0;
+                foreach (Model.ClsPay_GroupBalBillEmp oItemSub2 in ls2)
+                {
+                    j++;
+                    oItemSub2.HEntryID = j;
+                    oBill.DetailEmpColl.Add(oItemSub2);
+                }
+
+                //淇濆瓨
+                bool bResult;
+                if (OperationType == "1")   //鏂板淇濆瓨
+                {
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else                        //缂栬緫淇濆瓨
+                {
+                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //鎴愬姛锛�
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        #endregion
+
 
 
 

--
Gitblit v1.9.1