From c0ea121256e4c23dba0efda571269c706766126a Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期三, 08 十二月 2021 19:13:03 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/工资管理/Pay_GroupBalBillController.cs |  144 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 142 insertions(+), 2 deletions(-)

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 5a974ca..7d9ddea 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"
@@ -94,13 +94,13 @@
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                string sql = @"SELECT HMaterID,HMaterCode,HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HUnitID,HUnitNumber,HUnitName
+                string sql = @"SELECT HMaterID,HMaterCode,HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HUnitID,HUnitNumber,HUnitName,
                     HProcID,HProcNumber,HProcName,HSourceID,HSourceNumber,HSourceName,宸ユ椂 HTimes,鏁伴噺 HQty,宸ヤ环 HPrice,閲戦 HMoney, HSumMoney,HOtherSubsidy,HOtherDeduct,HPayMoney FROM h_v_Pay_GroupBalBillList where 1 = 1 " + sqlWhere;
                 ds = oCN.RunProcReturn(sql, "h_v_Pay_GroupBalBillList");
                 string sql1 = @"select 
  HEmpID ,b.HNumber HEmpNumber, b.HName HEmpName, b.HEmpRate HEmpRate, HBaseTimes, HMoney, HOtherSubsidy, HOtherSubsidy, HYF,'' HISZF ,'' HISFT , a.HRemark
 from Pay_GroupBalBillEmp a
- left join Gy_Employee b on a.HEmpID = b.HItemID " + sqlWhere.Replace("hmainid", "HInterID");
+ left join Gy_Employee b on a.HEmpID = b.HItemID  where 1 = 1  " + sqlWhere.Replace("hmainid", "HInterID");
                 ds1 = oCN.RunProcReturn(sql1, "Pay_GroupBalBillEmp");
                 list.Add(ds.Tables[0]);
                 list.Add(ds1.Tables[0]);
@@ -120,6 +120,146 @@
         }
         #endregion
 
+
+
+        #region 璁惧淇濆吇璁″垝琛� 淇濆瓨/缂栬緫
+        /// <summary>
+        /// 淇濆瓨妯″叿缁翠慨鍗�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Pay_GroupBalBill/AddBill")]
+        [HttpPost]
+        public object AddBill([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+            string msg4 = sArray[2].ToString();
+
+            string UserName = "";
+            ListModels oListModels = new ListModels();
+            try
+            {
+                DLL.ClsPay_GroupBalBill oBill = new DLL.ClsPay_GroupBalBill();
+                List<Models.ClsPay_GroupBalBillMain> lsmain = new List<Models.ClsPay_GroupBalBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Pay_GroupBalBillMain(msg2);
+                foreach (Models.ClsPay_GroupBalBillMain oItem in lsmain)
+                {
+                    UserName = oItem.HMaker;  //鍒跺崟浜�
+                    oItem.HBillType = "2202";
+                    oItem.HBillSubType = "2202";
+                    //oItem.HInterID =0;
+                    //oItem.HBillNo = "";
+                    oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
+                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oBill.omodel = oItem;
+                }
+                //淇濆吇椤硅〃浣撴暟鎹�
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg3 = msg3.Substring(1, msg3.Length - 2);
+                msg3 = msg3.Replace("\\", "");
+                msg3 = msg3.Replace("\n", "");  //\n
+                //msg2 = msg2.Replace("'", "鈥�");
+                List<Models.ClsPay_GroupBalBillSub> ls = new List<Models.ClsPay_GroupBalBillSub>();
+                ls = oListModels.getObjectByJson_Pay_GroupBalBillSub(msg3);
+                int i = 0;
+                foreach (Models.ClsPay_GroupBalBillSub item in ls)
+                {
+                    i++;
+                    item.HEntryID = i;
+                    //oItemSub.HCloseMan = "";       //琛屽叧闂�
+                    item.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    item.HCloseType = false;   //鍏抽棴绫诲瀷
+                    //oItemSub.HRemark = "";         //澶囨敞
+                    item.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+                    item.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+                    //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
+                    //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
+                    item.HRelationQty = 0;     //鍏宠仈鏁伴噺
+                    oBill.DetailColl.Add(item);
+
+                }
+                //閰嶄欢椤硅〃浣撴暟鎹�
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg4 = msg4.Substring(1, msg4.Length - 2);
+                msg4 = msg4.Replace("\\", "");
+                msg4 = msg4.Replace("\n", "");  //\n
+                                                //msg2 = msg2.Replace("'", "鈥�");
+                List<Models.ClsPay_GroupBalBillEmp> ls1 = new List<Models.ClsPay_GroupBalBillEmp>();
+                ls1 = oListModels.getObjectByJson_Pay_GroupBalBillEmp(msg4);
+                int j = 0;
+                foreach (Models.ClsPay_GroupBalBillEmp oItemSub in ls1)
+                {
+
+                    j++;
+                    oItemSub.HEntryID = j;
+                    //oItemSub.HCloseMan = "";       //琛屽叧闂�
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+                                                   //oItemSub.HRemark = "";         //澶囨敞
+                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+                                                   //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
+                                                   //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
+                    oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+                    oBill.DetailEmpColl.Add(oItemSub);
+
+                }
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.omodel.HInterID == 0)
+                {
+                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    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 = "淇濆瓨鎴愬姛锛�";
+                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         /// <summary>
         ///宸ヨ祫缁撶畻涓汉鍗曞垹闄ゅ姛鑳�
         /// </summary>

--
Gitblit v1.9.1