From f3406b5d603b0b8ac026cda734739262207d6065 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期二, 20 十二月 2022 16:27:11 +0800
Subject: [PATCH] 器具维修记录单 源单类型 (手工录入 维修派工单 故障登记单 ) 根据类型去选择相对应的单据 带出数据 器具维修记录单 子表两个 页签  (维修信息 配件信息)--参考设备维修记录单

---
 DAL/生产管理/模具管理/ClsSb_MouldRepairWorkBill.cs               |   34 +++++++++++
 WebAPI/ListModels.cs                                     |   14 ++++
 Model/Model.csproj                                       |    1 
 WebAPI/Controllers/Sc_MouldRepairInBillListController.cs |   92 +++++++++++++++++++++---------
 Model/生产管理/模具管理/ClsSb_MouldRepairWorkBillSub_Item.cs     |   14 ++++
 5 files changed, 125 insertions(+), 30 deletions(-)

diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSb_MouldRepairWorkBill.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSb_MouldRepairWorkBill.cs"
index 15d28be..1e6dc1c 100644
--- "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSb_MouldRepairWorkBill.cs"
+++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSb_MouldRepairWorkBill.cs"
@@ -9,6 +9,7 @@
     {
         public Model.ClsSb_MouldRepairWorkBillMain omodel = new Model.ClsSb_MouldRepairWorkBillMain();
         public List<Model.ClsSb_MouldRepairWorkBillSub> DetailColl = new List<Model.ClsSb_MouldRepairWorkBillSub>();
+        public List<Model.ClsSb_MouldRepairWorkBillSub_Item> DetailCol = new List<Model.ClsSb_MouldRepairWorkBillSub_Item>();
 
         public ClsSb_MouldRepairWorkBill()
         {
@@ -17,7 +18,7 @@
             base.MvarItemKeySub3 = "";
             base.MvarItemKeySub4 = "";
             base.MvarItemKey="Sc_MouldRepairWorkBillMain";
-            base.MvarReportTitle = "妯″叿缁翠慨宸ュ崟";
+            base.MvarReportTitle = "妯″叿缁翠慨璁板綍宸ュ崟";
             base.BillType = "3807";
             base.HBillSubType = "3807";
 
@@ -72,6 +73,7 @@
                 " where HInterID=" + lngBillKey.ToString());
                 //鍒犻櫎鍏宠仈
                 DeleteRelation(ref sReturn, lngBillKey);
+                oCn.RunProc("delete from Sc_MouldRepairWorkBillSub_Item where HInterID=" + lngBillKey);
                 //鍒犻櫎瀛愯〃
                 DeleteBillSub(lngBillKey);
                 //鎻掑叆瀛愯〃
@@ -86,6 +88,21 @@
                       + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + 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.HRepairID.ToString() + ",'" + oSub.HRepairExplanation + "'," + oSub.HManagerID.ToString() + "," + oSub.HMoney.ToString() + 
+                      ") ");
+                }
+                //鎻掑叆瀛愯〃閰嶄欢淇℃伅
+                foreach (Model.ClsSb_MouldRepairWorkBillSub_Item oSub in DetailCol)
+                {
+                    oCn.RunProc("Insert into Sc_MouldRepairWorkBillSub_Item " +
+                      " (HInterID,HEntryID,HMaterID" +
+                      ",HQty,HUnitID,HQtyMust" +
+                      ",HCloseMan,HCloseType,HRemark" +
+                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                      ") values("
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() +
+                      "," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
+                      ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
+                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                       ") ");
                 }
                 //
@@ -149,6 +166,21 @@
                        "," + oSub.HRepairID.ToString() + ",'" + oSub.HRepairExplanation + "'," + oSub.HManagerID.ToString() + "," + oSub.HMoney.ToString() +
                        ") ");
                 }
+                //鎻掑叆瀛愯〃閰嶄欢淇℃伅
+                foreach (Model.ClsSb_MouldRepairWorkBillSub_Item oSub in DetailCol)
+                {
+                    oCn.RunProc("Insert into Sc_MouldRepairWorkBillSub_Item " +
+                      " (HInterID,HEntryID,HMaterID" +
+                      ",HQty,HUnitID,HQtyMust" +
+                      ",HCloseMan,HCloseType,HRemark" +
+                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                      ") values("
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() +
+                      "," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
+                      ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
+                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
+                      ") ");
+                }
                 //
                 //foreach (Model.ClsSb_MouldRepairWorkBillSub oSub in DetailColl)
                 //{
diff --git a/Model/Model.csproj b/Model/Model.csproj
index ac80a05..1245121 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -498,6 +498,7 @@
     <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsGy_MouldRoutingBillMain.cs" />
     <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsGy_MouldRoutingBillSub.cs" />
     <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSb_MouldRepairWorkBillMain.cs" />
+    <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSb_MouldRepairWorkBillSub_Item.cs" />
     <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSb_MouldRepairWorkBillSub.cs" />
     <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSc_MouldBorrowInBillMain.cs" />
     <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSc_MouldBorrowInBillSub.cs" />
diff --git "a/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSb_MouldRepairWorkBillSub_Item.cs" "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSb_MouldRepairWorkBillSub_Item.cs"
new file mode 100644
index 0000000..1945ae5
--- /dev/null
+++ "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\346\250\241\345\205\267\347\256\241\347\220\206/ClsSb_MouldRepairWorkBillSub_Item.cs"
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsSb_MouldRepairWorkBillSub_Item : DBUtility.ClsXt_BaseBillSub
+    {
+        public long HMaterID;//    int       --配件ID
+        public long HUnitID;//     int     --计量单位
+        public double HQty;//       dec(18,8)       --用量
+        public double HQtyMust;//    dec(18,8)     --标准用量(暂时隐藏)
+    }
+}
diff --git a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
index 44b4b93..44c6e98 100644
--- a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
+++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -1485,7 +1485,7 @@
         #endregion
 
 
-        #region 妯″叿缁翠慨鍗曚繚瀛�/缂栬緫
+        #region 妯″叿缁翠慨璁板綍鍗曚繚瀛�/缂栬緫
         /// <summary>
         /// 淇濆瓨妯″叿缁翠慨鍗�
         /// </summary>
@@ -1501,6 +1501,7 @@
             string msg2 = sArray[0].ToString();
             string msg3 = sArray[1].ToString();
             string msg4 = sArray[2].ToString();
+            string msg5 = sArray[3].ToString();
 
 
             string UserName = "";
@@ -1573,24 +1574,62 @@
                 List<Model.ClsSb_MouldRepairWorkBillSub> ls = new List<Model.ClsSb_MouldRepairWorkBillSub>();
                 ls = oListModels.getObjectByJson_Gy_MouldRepairWorkBillSub(msg3);
                 int i = 0;
-                foreach (Model.ClsSb_MouldRepairWorkBillSub oItemSub in ls)
+                foreach (Model.ClsSb_MouldRepairWorkBillSub oItem in ls)
                 {
 
                     i++;
-                    oItemSub.HEntryID = i;
+                    oItem.HEntryID = i;
                     //oItemSub.HCloseMan = "";       //琛屽叧闂�
-                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
-                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+                    oItem.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItem.HCloseType = false;   //鍏抽棴绫诲瀷
                     //oItemSub.HRemark = "";         //澶囨敞
-                    oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+                    oItem.HRelationQty = 0;     //鍏宠仈鏁伴噺
                     //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦
                     //oItemSub.HRepairID = 0;       //缁翠慨椤圭洰
                     //oItemSub.HRepairExplanation ="";   //缁翠慨瑕佹眰
                     //oItemSub.HManagerID = 0;   //璐熻矗浜篒D
                     //oItemSub.HMoney = 0;        //缁翠慨璐圭敤
-                    oBill.DetailColl.Add(oItemSub);
+                    oBill.DetailColl.Add(oItem);
 
                 }
+
+                //閰嶄欢鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg5 = msg5.Substring(1, msg5.Length - 2);
+                msg5 = msg5.Replace("\\", "");
+                msg5 = msg5.Replace("\n", "");  //\n
+                //msg2 = msg2.Replace("'", "鈥�");
+                List<Model.ClsSb_MouldRepairWorkBillSub_Item> ls1 = new List<Model.ClsSb_MouldRepairWorkBillSub_Item>();
+                ls1 = oListModels.getObjectByJson_Gy_MouldRepairWorkBillSub_Item(msg5);
+                int j = 0;
+                foreach (Model.ClsSb_MouldRepairWorkBillSub_Item 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;     //鍏宠仈鏁伴噺
+                    //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦
+                    //HMaterID = "";//閰嶄欢浠g爜
+                    //HUnitID = "";//鍗曚綅浠g爜
+                    //HQty = "";//瀹為檯鐢ㄩ噺
+                    //HQtyMust = "";//鍗曚綅鐢ㄩ噺
+                    //HRemark = "";//澶囨敞
+                    //oItemSub.HRepairID = 0;       //缁翠慨椤圭洰
+                    //oItemSub.HRepairExplanation ="";   //缁翠慨瑕佹眰
+                    //oItemSub.HManagerID = 0;   //璐熻矗浜篒D
+                    //oItemSub.HMoney = 0;        //缁翠慨璐圭敤
+                    oBill.DetailCol.Add(oItemSub);
+
+                }
+
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
@@ -1652,30 +1691,27 @@
         [HttpGet]
         public object Sb_MouldRepairWorkBillListProjectDetai(string sqlWhere)
         {
-            DataSet ds;
+            DataSet ds, ds1;
+            List<object> list = new List<object>();
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                if (sqlWhere == null || sqlWhere.Equals(""))
-                {
-                    //ds = oCN.RunProcReturn("select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark   from Sc_MouldRepairWorkBillSub", "Sc_MouldRepairWorkBillSub");
-                    ds = oCN.RunProcReturn("select HRepairID, 瀛愮淮淇」鐩唬鐮� HRepairCode,瀛愮淮淇」鐩� HRepairName,瀛愮淮淇姹� HRepairExplanation,HManagerSonID HManagerID,瀛愯礋璐d汉浠g爜 HManagerCode,瀛愯礋璐d汉 HManagerName,缁翠慨璐圭敤 HMoney,琛ㄤ綋澶囨敞 HRemark,婧愬崟涓诲唴鐮� HSourceInterID,婧愬崟瀛愬唴鐮� HSourceEntryID,婧愬崟鍗曞彿 HSourceBillNo,婧愬崟绫诲瀷 HSourceBillType   from h_v_Sc_MouldRepairWorkBillList_Edit", "h_v_Sc_MouldRepairWorkBillList_Edit");
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
-                }
-                else
-                {
-                    //string sql1 = "select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark  from Sc_MouldRepairWorkBillSub where 1 = 1 ";
-                    string sql1 = "select HRepairID,瀛愮淮淇」鐩唬鐮� HRepairCode,瀛愮淮淇」鐩� HRepairName,瀛愮淮淇姹� HRepairExplanation,HManagerSonID HManagerID,瀛愯礋璐d汉浠g爜 HManagerCode,瀛愯礋璐d汉 HManagerName,缁翠慨璐圭敤 HMoney,琛ㄤ綋澶囨敞 HRemark,婧愬崟涓诲唴鐮� HSourceInterID,婧愬崟瀛愬唴鐮� HSourceEntryID,婧愬崟鍗曞彿 HSourceBillNo,婧愬崟绫诲瀷 HSourceBillType   from h_v_Sc_MouldRepairWorkBillList_Edit where 1 = 1 ";
-                    string sql = sql1 + sqlWhere;
-                    ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairWorkBillList_Edit");
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
-                }
+
+                string sql = "select HRepairID,瀛愮淮淇」鐩唬鐮� HRepairCode,瀛愮淮淇」鐩� HRepairName,瀛愮淮淇姹� HRepairExplanation,HManagerSonID HManagerID,瀛愯礋璐d汉浠g爜 HManagerCode,瀛愯礋璐d汉 HManagerName,缁翠慨璐圭敤 HMoney,琛ㄤ綋澶囨敞 HRemark,婧愬崟涓诲唴鐮� HSourceInterID,婧愬崟瀛愬唴鐮� HSourceEntryID,婧愬崟鍗曞彿 HSourceBillNo,婧愬崟绫诲瀷 HSourceBillType   from h_v_Sc_MouldRepairWorkBillList_Edit where 1 = 1 "+ sqlWhere;
+                ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairWorkBillList_Edit");
+
+                string sql1 = "select 閰嶄欢ID HMaterID, 閰嶄欢浠g爜 HMaterNumber,閰嶄欢鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,鍗曚綅ID HUnitID,璁¢噺鍗曚綅浠g爜 HUnitNumber,璁¢噺鍗曚綅鍚嶇О HUnitName,鐢ㄩ噺 HQty,鏍囧噯鐢ㄩ噺 HQtyMust,瀛愬娉�1 HRemark,瑙勬牸鍨嬪彿 HMaterSpec  from h_v_Sc_MouldRepairWorkBillSub_Item  where 1 = 1 " + sqlWhere ;
+                ds1 = oCN.RunProcReturn(sql1, "h_v_Sc_MouldRepairWorkBillSub_Item");
+
+                list.Add(ds.Tables[0]);
+                list.Add(ds1.Tables[0]);
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                objJsonResult.data = null;
+                objJsonResult.list = list;
+
             }
             catch (Exception e)
             {
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index 1c0c735..5b6dd50 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -482,7 +482,7 @@
 
 
         /// <summary>
-        /// 澶勭悊鏂板妯″叿缁翠慨瀛愯〃鐨刯son
+        /// 澶勭悊鏂板妯″叿缁翠慨瀛愯〃淇濆吇淇℃伅鐨刯son
         /// </summary>
         /// <param name="jsonString"></param>
         /// <returns></returns>
@@ -494,6 +494,18 @@
         }
 
         /// <summary>
+        /// 澶勭悊鏂板妯″叿缁翠慨瀛愯〃閰嶄欢淇℃伅鐨刯son
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsSb_MouldRepairWorkBillSub_Item> getObjectByJson_Gy_MouldRepairWorkBillSub_Item(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsSb_MouldRepairWorkBillSub_Item> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_MouldRepairWorkBillSub_Item>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
         /// 澶勭悊鏂板妯″叿缁翠慨楠屾敹鍗曚富琛ㄧ殑json
         /// </summary>
         /// <param name="jsonString"></param>

--
Gitblit v1.9.1