From a3a6f4ce6dc87b99fb34470fc017b922b6ac5faa Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期四, 13 一月 2022 19:15:56 +0800
Subject: [PATCH] 新增桌面版委外用料清单

---
 WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs |  134 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 120 insertions(+), 14 deletions(-)

diff --git a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs
index 0f5157b..8f00320 100644
--- a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs
+++ b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs
@@ -1,4 +1,5 @@
-锘縰sing System;
+锘縰sing Newtonsoft.Json.Linq;
+using System;
 using System.Collections.Generic;
 using System.Data;
 using System.Linq;
@@ -86,20 +87,12 @@
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�";
+                    objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵�侊紒";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                if (oBill.omodel.HChecker != "")
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-
-                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+               
+                bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
                 if (IsDete)
                 {
                     objJsonResult.code = "0";
@@ -154,7 +147,7 @@
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sqlWhere == null || sqlWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select 鐐规椤圭洰ID,鐐规椤圭洰,鐐规閮ㄤ綅,鍏蜂綋瑕佹眰,璐熻矗浜篒D,璐熻矗浜轰唬鐮�,璐熻矗浜�,瀛愬娉� from h_v_Sb_EquipDotCheckRuleList", "h_v_Sb_EquipDotCheckRuleList");
+                    ds = oCN.RunProcReturn("select 鐐规椤圭洰ID HDotCheckItemID,鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,璐熻矗浜篒D HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName,瀛愬娉� HRemark from h_v_Sb_EquipDotCheckRuleList", "h_v_Sb_EquipDotCheckRuleList");
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
@@ -162,7 +155,7 @@
                 }
                 else
                 {
-                    string sql1 = "select 鐐规椤圭洰ID,鐐规椤圭洰,鐐规閮ㄤ綅,鍏蜂綋瑕佹眰,璐熻矗浜篒D,璐熻矗浜轰唬鐮�,璐熻矗浜�,瀛愬娉� from h_v_Sb_EquipDotCheckRuleList where 1 = 1 ";
+                    string sql1 = "select 鐐规椤圭洰ID HDotCheckItemID,鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,璐熻矗浜篒D HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName,瀛愬娉� HRemark from h_v_Sb_EquipDotCheckRuleList where 1 = 1 ";
                     string sql = sql1 + sqlWhere;
                     ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckRuleList");
                     objJsonResult.code = "0";
@@ -181,5 +174,118 @@
             return objJsonResult;
         }
         #endregion
+
+        #region 璁惧鐐规瑙勭▼鍗� 淇濆瓨/缂栬緫
+        /// <summary>
+        /// 璁惧鐐规瑙勭▼鍗� 淇濆瓨
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Sb_EquipDotCheckRuleBill/SaveEquipDotCheckRuleBill")]
+        [HttpPost]
+        public object SaveEquipDotCheckRuleBill([FromBody] JObject msg)
+        {
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+
+
+            string UserName = "";
+            ListModels oListModels = new ListModels();
+            try
+            {
+                DLL.ClsSb_EquipDotCheckRuleBill oBill = new DLL.ClsSb_EquipDotCheckRuleBill();
+                List<Models.ClsSb_EquipDotCheckRuleBillMain> lsmain = new List<Models.ClsSb_EquipDotCheckRuleBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Sb_EquipDotCheckRuleBillMain(msg2);
+                foreach (Models.ClsSb_EquipDotCheckRuleBillMain oItem in lsmain)
+                {
+                    UserName = oItem.HMaker;  //鍒跺崟浜�
+                    oItem.HBillType = "3913";
+                    oItem.HBillSubType = "3913";
+                    DBUtility.ClsPub.CurUserName = UserName;
+                    oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+
+                    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.ClsSb_EquipDotCheckRuleBillSub> ls = new List<Models.ClsSb_EquipDotCheckRuleBillSub>();
+                ls = oListModels.getObjectByJson_Sb_EquipDotCheckRuleBillSub(msg3);
+                int i = 0;
+                foreach (Models.ClsSb_EquipDotCheckRuleBillSub oItemSub in ls)
+                {
+
+                    i++;
+                    oItemSub.HEntryID = i;
+                    //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.DetailColl_Mater.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
     }
 }

--
Gitblit v1.9.1