From aea7384c05c804ebe3778c8a7215b79eba2c954e Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期三, 30 十一月 2022 15:14:39 +0800
Subject: [PATCH] 设备保养记录单选择原单

---
 WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs                       |   34 +++++++++++
 WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs |   12 ---
 Model/Model.csproj                                            |    1 
 Model/生产管理/设备管理/ClsSb_EquipRepairWorkBillSub_Mater.cs         |   23 +++++++
 WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs   |    2 
 WebAPI/Controllers/Sc_MouldRepairInBillListController.cs      |   13 ---
 WebAPI/Controllers/WebAPIController.cs                        |    4 
 WebAPI/Properties/PublishProfiles/FolderProfile.pubxml        |    2 
 WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs     |   65 +++++++++++++++------
 9 files changed, 111 insertions(+), 45 deletions(-)

diff --git a/Model/Model.csproj b/Model/Model.csproj
index 2af9d9f..97c0ef9 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -566,6 +566,7 @@
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipRepairRequestBillSub.cs" />
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipRepairSendWorkBillMain.cs" />
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipRepairSendWorkBillSub.cs" />
+    <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSb_EquipRepairWorkBillSub_Mater.cs" />
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSc_EquipMaintainBillSub_Item.cs" />
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSc_EquipMaintainPlanBillSub_Item.cs" />
     <Compile Include="鐢熶骇绠$悊\璁惧绠$悊\ClsSc_ICMOBillMain.cs" />
diff --git "a/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipRepairWorkBillSub_Mater.cs" "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipRepairWorkBillSub_Mater.cs"
new file mode 100644
index 0000000..fe3b021
--- /dev/null
+++ "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsSb_EquipRepairWorkBillSub_Mater.cs"
@@ -0,0 +1,23 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Model
+{
+    public class ClsSb_EquipRepairWorkBillSub_Mater : DBUtility.ClsXt_BaseBillSub
+    {
+        public Int64 HMaterID { get; set; }
+        public string HMaterNumber { get; set; }
+        public string HMaterName{ get; set; }
+        public string HMaterModel{ get; set; }
+        public double HQty{ get; set; }
+        public double HQtyMust{ get; set; }
+        public Int64 HUnitID{ get; set; }
+        public string HUnitNumber{ get; set; }
+        public string HUnitName{ get; set; }
+        public Int64 HManagerID{ get; set; }
+        public string HManagerNumber{ get; set; }
+        public string HManagerName{ get; set; }
+    }
+}
diff --git a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
index 1b252df..dcb999a 100644
--- a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -383,7 +383,7 @@
             {
 
                 //寰楀埌淇℃伅
-                ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillQuerySub_Mould  where hmainid= " + HProcExchHinteID , "h_v_Sc_ProcessExchangeBillQuerySub_Mould");
+                ds = oCN.RunProcReturn("select  * from h_v_Sc_ProcessExchangeBillQuerySub_Mould  where hmainid= " + HProcExchHinteID , "h_v_Sc_ProcessExchangeBillQuerySub_Mould");
                 //鍐欏叆淇℃伅
                 //if (ds == null || ds.Tables[0].Rows.Count == 0)
                 //{
diff --git a/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs
index 302afc7..bfbd5fd 100644
--- a/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs
+++ b/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs
@@ -44,22 +44,12 @@
                     ds = oCN.RunProcReturn(sql, "h_v_Sc_EquipMaintainPlan");
                 }
 
-                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
-                //{
+               
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
                 objJsonResult.data = ds.Tables[0];
                 return objJsonResult;
-                //}
-                //else
-                //{
-                //objJsonResult.code = "0";
-                //objJsonResult.count = 0;
-                //objJsonResult.Message = "鏃犳暟鎹�";
-                //objJsonResult.data = null;
-                //return objJsonResult;
-                //}
             }
             catch (Exception ex)
             {
diff --git a/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs b/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs
index 20e9a95..cf6838a 100644
--- a/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs
+++ b/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs
@@ -237,6 +237,7 @@
             string msg2 = sArray[0].ToString();
             string msg3 = sArray[1].ToString();
             string msg4 = sArray[2].ToString();
+            string msg5 = sArray[3].ToString();
 
 
             //string UserName = "";
@@ -330,6 +331,30 @@
                     oBill.DetailColl.Add(oItemSub);
 
                 }
+
+                //閰嶄欢琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                //msg5 = msg5.Substring(1, msg5.Length - 2);
+                msg5 = msg5.Replace("\\", "");
+                msg5 = msg5.Replace("\n", "");  //\n
+                                                //msg2 = msg2.Replace("'", "鈥�");
+                List<Model.ClsSb_EquipRepairWorkBillSub_Mater> ls1 = new List<Model.ClsSb_EquipRepairWorkBillSub_Mater>();
+                ls1 = JsonConvert.DeserializeObject<List<Model.ClsSb_EquipRepairWorkBillSub_Mater>>(msg5);
+                int j = 0;
+                foreach (Model.ClsSb_EquipRepairWorkBillSub_Mater oItemSub in ls1)
+                {
+
+                    j++;
+                    oItemSub.HEntryID = i;
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷                   
+                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�    
+                    oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+                    oBill.DetailColl_Mater.Add(oItemSub);
+
+                }
+
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
@@ -386,35 +411,37 @@
         }
         #endregion
 
-        #region[璁惧缁翠慨鍒楄〃缂栬緫鏃惰幏鍙栬〃浣撴暟鎹甝
+        #region[璁惧缁翠慨鍒楄〃缂栬緫鏃惰幏鍙栬〃浣撴暟鎹�(缁翠慨鍒楄〃銆侀厤浠跺垪琛�)]
         [Route("Sb_EqpRepairWorkBill/Sb_EqpRepairWorkBillListProjectDetai")]
         [HttpGet]
-        public object Sb_EqpRepairWorkBillListProjectDetai(string sqlWhere)
+        public object Sb_EqpRepairWorkBillListProjectDetai(string HInterID)
         {
-            DataSet ds;
+            DataSet ds, ds1;
+            List<object> list = new List<object>();
+            string sqlWhere = "";
             try
             {
-                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                if (sqlWhere == null || sqlWhere.Equals(""))
+                if (HInterID != "" || HInterID != null)
                 {
-                    //ds = oCN.RunProcReturn("select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark   from Sc_MouldRepairWorkBillSub", "Sc_MouldRepairWorkBillSub");
-                    ds = oCN.RunProcReturn("select HRepairID,缁翠慨椤圭洰浠g爜 HRepairCode,缁翠慨椤圭洰 HRepairName,HManagerID1 HManagerID,琛ㄤ綋璐熻矗浜轰唬鐮� HManagerCode,琛ㄤ綋璐熻矗浜� HManagerName,HRepairID1 HRepairID, 琛ㄤ綋缁翠慨椤圭洰浠g爜 HRepairCode,琛ㄤ綋缁翠慨椤圭洰 HRepairName,琛ㄤ綋缁翠慨瑕佹眰 HRepairExplanation,琛ㄤ綋澶囨敞 HRemark,婧愬崟涓诲唴鐮� HSourceInterID,婧愬崟瀛愬唴鐮� HSourceEntryID,婧愬崟鍗曞彿 HSourceBillNo,婧愬崟绫诲瀷 HSourceBillType  from h_v_Sc_EquipRepairWorkBillList_Edit", "h_v_Sc_EquipRepairWorkBillList_Edit");
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
+                    sqlWhere = " and hmainid='" + HInterID + "'";
                 }
                 else
                 {
-                    //string sql1 = "select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark  from Sc_MouldRepairWorkBillSub where 1 = 1 ";
-                    string sql1 = "select HRepairID,缁翠慨椤圭洰浠g爜 HRepairCode,缁翠慨椤圭洰 HRepairName,HManagerID1 HManagerID,琛ㄤ綋璐熻矗浜轰唬鐮� HManagerCode,琛ㄤ綋璐熻矗浜� HManagerName,HRepairID1 HRepairID, 琛ㄤ綋缁翠慨椤圭洰浠g爜 HRepairCode,琛ㄤ綋缁翠慨椤圭洰 HRepairName,琛ㄤ綋缁翠慨瑕佹眰 HRepairExplanation,琛ㄤ綋澶囨敞 HRemark ,婧愬崟涓诲唴鐮� HSourceInterID,婧愬崟瀛愬唴鐮� HSourceEntryID,婧愬崟鍗曞彿 HSourceBillNo,婧愬崟绫诲瀷 HSourceBillType from h_v_Sc_EquipRepairWorkBillList_Edit where 1 = 1 ";
-                    string sql = sql1 + sqlWhere;
-                    ds = oCN.RunProcReturn(sql, "h_v_Sc_EquipRepairWorkBillList_Edit");
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
+                    sqlWhere = HInterID;
                 }
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+              
+                ds = oCN.RunProcReturn("select HRepairID,缁翠慨椤圭洰浠g爜 HRepairCode,缁翠慨椤圭洰 HRepairName,HManagerID1 HManagerID,琛ㄤ綋璐熻矗浜轰唬鐮� HManagerCode,琛ㄤ綋璐熻矗浜� HManagerName,HRepairID1 HRepairID, 琛ㄤ綋缁翠慨椤圭洰浠g爜 HRepairCode,琛ㄤ綋缁翠慨椤圭洰 HRepairName,琛ㄤ綋缁翠慨瑕佹眰 HRepairExplanation,琛ㄤ綋澶囨敞 HRemark,婧愬崟涓诲唴鐮� HSourceInterID,婧愬崟瀛愬唴鐮� HSourceEntryID,婧愬崟鍗曞彿 HSourceBillNo,婧愬崟绫诲瀷 HSourceBillType  from h_v_Sc_EquipRepairWorkBillList_Edit where 1 = 1 " + sqlWhere , "h_v_Sc_EquipRepairWorkBillList_Edit");
+                string sql1 = "select * from h_v_Sb_EquipRepairWorkBillSub_Mater where 1 = 1 " + sqlWhere;
+                ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipRepairWorkBillSub_Mater");
+                list.Add(ds.Tables[0]);
+                list.Add(ds1.Tables[0]);
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                objJsonResult.list = list;
+
             }
             catch (Exception e)
             {
diff --git a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
index 3bbf7c7..ad6be8f 100644
--- a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
+++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -280,22 +280,13 @@
 
                 ds = Sc_MouldDotCheckPlanBillList_s(sWhere);
 
-                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
-                //{
+               
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
                 objJsonResult.data = ds.Tables[0];
                 return objJsonResult;
-                //}
-                //else
-                //{
-                //objJsonResult.code = "0";
-                //objJsonResult.count = 0;
-                //objJsonResult.Message = "鏃犳暟鎹�";
-                //objJsonResult.data = null;
-                //return objJsonResult;
-                //}
+              
             }
             catch (Exception ex)
             {
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 9c55f9f..e7bb55d 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -3179,9 +3179,9 @@
         /// <returns></returns>
         [Route("Web/GetMaintainItemtemByEquipProjectID")]
         [HttpGet]
-        public object GetMaintainItemtemByEquipProjectID(int EquipProjectID)
+        public object GetMaintainItemtemByEquipProjectID(string EquipProjectID)
         {
-            if (EquipProjectID <= 0)
+            if (EquipProjectID == null)
             {
                 objjson.code = "0";
                 objjson.count = 0;
diff --git a/WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs b/WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs
index 7d04a25..b6f38de 100644
--- a/WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs
+++ b/WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs
@@ -9,6 +9,7 @@
     {
         public Models.ClsSb_EquipRepairWorkBillMain omodel = new Models.ClsSb_EquipRepairWorkBillMain();
         public List<Models.ClsSb_EquipRepairWorkBillSub> DetailColl = new List<Models.ClsSb_EquipRepairWorkBillSub>();
+        public List<Model.ClsSb_EquipRepairWorkBillSub_Mater> DetailColl_Mater = new List<Model.ClsSb_EquipRepairWorkBillSub_Mater>();
 
         public ClsSb_EquipRepairWorkBill()
         {
@@ -71,6 +72,8 @@
                 DeleteRelation(ref sReturn, lngBillKey);
                 //鍒犻櫎瀛愯〃
                 DeleteBillSub(lngBillKey);
+                //鍒犻櫎閰嶄欢鏁版嵁
+                oCn.RunProc("delete from Sb_EquipRepairWorkBillSub_Mater where HInterID="+ lngBillKey);
                 //鎻掑叆瀛愯〃
                 omodel.HInterID = lngBillKey;
                 foreach (Models.ClsSb_EquipRepairWorkBillSub oSub in DetailColl)
@@ -85,6 +88,22 @@
                       "," + oSub.HRepairID.ToString() + ",'"+ oSub.HManagerID.ToString() + "','" + oSub.HRepairExplanation + "'," + oSub.HEmpID.ToString() + 
                        ") ");
                 }
+
+                foreach (Model.ClsSb_EquipRepairWorkBillSub_Mater oSub in DetailColl_Mater)
+                {
+                    oCn.RunProc("Insert into Sb_EquipRepairWorkBillSub_Mater " +
+                      " (HInterID,HEntryID," +
+                      "HCloseMan,HEntryCloseDate,HCloseType,HRemark," +
+                      "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
+                      "HQty,HMaterID,HUnitID,HQtyMust," +
+                      "HManagerID ) values(" +
+                      omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() +
+                      ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
+                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
+                      "," + oSub.HQty.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
+                      "," + oSub.HManagerID.ToString() + ") ");
+                }
+
                 //
                 //foreach (Model.ClsSb_EquipRepairWorkBillSub oSub in DetailColl)
                 //{
@@ -153,6 +172,21 @@
                       "," + oSub.HRepairID.ToString() + ",'"+ oSub.HManagerID.ToString() + "','" + oSub.HRepairExplanation + "'," + oSub.HEmpID.ToString() +
                        ") ");
                 }
+
+                foreach (Model.ClsSb_EquipRepairWorkBillSub_Mater oSub in DetailColl_Mater)
+                {
+                    oCn.RunProc("Insert into Sb_EquipRepairWorkBillSub_Mater " +
+                      " (HInterID,HEntryID," +
+                      "HCloseMan,HEntryCloseDate,HCloseType,HRemark," +
+                      "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
+                      "HQty,HMaterID,HUnitID,HQtyMust," +
+                      "HManagerID ) values(" +
+                      omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() +
+                      ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
+                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
+                      "," + oSub.HQty.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
+                      "," + oSub.HManagerID.ToString() + ") ");
+                }
                 //
                 //foreach (Model.ClsSb_EquipRepairWorkBillSub oSub in DetailColl)
                 //{
diff --git a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml
index 3f2fe11..9250916 100644
--- a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml
+++ b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml
@@ -10,7 +10,7 @@
     <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
     <LastUsedPlatform>x86</LastUsedPlatform>
     <PublishProvider>FileSystem</PublishProvider>
-    <PublishUrl>E:\缃戦〉鍙戝竷\WEBAPI</PublishUrl>
+    <PublishUrl>D:\缃戠珯鍙戝竷\鏅轰簯MESWMS\API</PublishUrl>
     <WebPublishMethod>FileSystem</WebPublishMethod>
     <SiteUrlToLaunchAfterPublish />
   </PropertyGroup>

--
Gitblit v1.9.1