From eb22fa59bce6c5e1a90f2e6613847c4b9e5e4df3 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期三, 28 十二月 2022 08:48:27 +0800
Subject: [PATCH] 点检记录单信息维护

---
 WebAPI/ListModels.cs                                     |   14 ++++
 DAL/生产管理/模具管理/ClsSc_MouldDotCheckBill.cs                 |   46 +++++++++++++--
 Model/生产管理/模具管理/ClsSc_MouldDotCheckBillSub_Item.cs       |   19 ++++++
 Model/Model.csproj                                       |    1 
 Model/生产管理/模具管理/ClsSc_MouldDotCheckBillMain.cs           |    1 
 WebAPI/Controllers/Sc_MouldRepairInBillListController.cs |   81 ++++++++++++++++----------
 DAL/生产管理/模具管理/ClsSc_MouldDotCheckRuleBill.cs             |    1 
 7 files changed, 124 insertions(+), 39 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/ClsSc_MouldDotCheckBill.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/ClsSc_MouldDotCheckBill.cs"
index b1128a3..36f94d8 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/ClsSc_MouldDotCheckBill.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/ClsSc_MouldDotCheckBill.cs"
@@ -9,11 +9,12 @@
     {
         public Model.ClsSc_MouldDotCheckBillMain omodel = new Model.ClsSc_MouldDotCheckBillMain();
         public List<Model.ClsSc_MouldDotCheckBillSub> DetailColl = new List<Model.ClsSc_MouldDotCheckBillSub>();
+        public List<Model.ClsSc_MouldDotCheckBillSub_Item> DetailCol = new List<Model.ClsSc_MouldDotCheckBillSub_Item>();
 
         public ClsSc_MouldDotCheckBill()
         {
             base.MvarItemKeySub = "Sc_MouldDotCheckBillSub";
-            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub2 = "Sc_MouldDotCheckBillSub_Item";
             base.MvarItemKeySub3 = "";
             base.MvarItemKeySub4 = "";
             base.MvarItemKey="Sc_MouldDotCheckBillMain";
@@ -41,7 +42,6 @@
                 //鏇存柊涓昏〃
                 oCn.RunProc("UpDate Sc_MouldDotCheckBillMain set  " +
                 " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
-                ",HDate='" + omodel.HDate + "'" +
                 ",HYear='" + omodel.HYear.ToString() + "'" +
                 ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                 //",HStockType='" + omodel.HStockType + "'" +
@@ -51,6 +51,7 @@
                     //========================================
                 ",HPlanNo='" + omodel.HPlanNo + "'" +
                 ",HPlanInterID=" + omodel.HPlanInterID.ToString() +
+                ",HMouldDotCheckRuleID=" + omodel.HMouldDotCheckRuleID.ToString() +
 
 
                 ",HMouldID=" + omodel.HMouldID.ToString() +
@@ -65,6 +66,7 @@
                 DeleteRelation(ref sReturn, lngBillKey);
                 //鍒犻櫎瀛愯〃
                 DeleteBillSub(lngBillKey);
+                DeleteBillSub2(lngBillKey);
                 //鎻掑叆瀛愯〃
                 omodel.HInterID = lngBillKey;
                 //鎻掑叆瀛愯〃
@@ -83,6 +85,22 @@
                       ",'" + 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.ClsSc_MouldDotCheckBillSub_Item oSub in DetailCol)
+                {
+                    oCn.RunProc("Insert into Sc_MouldDotCheckBillSub_Item " +
+                    " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
+                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                    ",HMaterID,HUnitID" +
+                    ",HQty,HQtyMust" +
+                    ") values("
+                    + 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.HMaterID.ToString() + "," + oSub.HUnitID.ToString() +
+                    "," + oSub.HQty.ToString() + "," + oSub.HQtyMust.ToString() +
+                    ") ");
                 }
                 //
                 //foreach (Model.ClsSc_MouldDotCheckBillSub oSub in DetailColl)
@@ -122,13 +140,13 @@
                 ",HYear,HPeriod,HRemark" +
                 ",HMouldID,HBeginDate"+
                 ",HEndDate,HPlanNo,HPlanInterID" +
-                ",HInnerBillNo,HExplanation" +
+                ",HInnerBillNo,HExplanation,HMouldDotCheckRuleID" +
                 ") " +
-                " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()" +
-                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'"+
+                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()" +
+                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" +
                 "," + omodel.HMouldID.ToString() + ",'" + omodel.HBeginDate + "'" +
                 ",'" + omodel.HEndDate + "','" + omodel.HPlanNo + "'," + omodel.HPlanInterID.ToString() +
-                ",'" + omodel.HInnerBillNo + "','" + omodel.HExplanation + "'" +
+                ",'" + omodel.HInnerBillNo + "','" + omodel.HExplanation + "'," + omodel.HMouldDotCheckRuleID +
                 ") ");
                 //鎻掑叆瀛愯〃
                 foreach (Model.ClsSc_MouldDotCheckBillSub oSub in DetailColl)
@@ -147,6 +165,22 @@
                       "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                       ") ");
                 }
+
+                //閰嶄欢椤圭洰
+                foreach (Model.ClsSc_MouldDotCheckBillSub_Item oSub in DetailCol)
+                {
+                    oCn.RunProc("Insert into Sc_MouldDotCheckBillSub_Item " +
+                    " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
+                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                    ",HMaterID,HUnitID" +
+                    ",HQty,HQtyMust" +
+                    ") values("
+                    + 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.HMaterID.ToString() + "," + oSub.HUnitID.ToString() +
+                    "," + oSub.HQty.ToString() + "," + oSub.HQtyMust.ToString() +
+                    ") ");
+                }
                 //
                 //foreach (Model.ClsSc_MouldDotCheckBillSub oSub in DetailColl)
                 //{
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/ClsSc_MouldDotCheckRuleBill.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/ClsSc_MouldDotCheckRuleBill.cs"
index 7273a94..c0d9de1 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/ClsSc_MouldDotCheckRuleBill.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/ClsSc_MouldDotCheckRuleBill.cs"
@@ -40,7 +40,6 @@
                 //鏇存柊涓昏〃
                 oCn.RunProc("UpDate Sc_MouldDotCheckRuleBillMain set  " +
                 " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
-                ",HDate='" + omodel.HDate + "'" +
                 ",HYear='" + omodel.HYear.ToString() + "'" +
                 ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                 ",HRemark='" + omodel.HRemark + "'" +
diff --git a/Model/Model.csproj b/Model/Model.csproj
index 54df10e..0a25abc 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -518,6 +518,7 @@
     <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSc_MouldDotCheckBillMain.cs" />
     <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSc_MouldDotCheckBillSub.cs" />
     <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSc_MouldDotCheckPlanBillMain.cs" />
+    <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSc_MouldDotCheckBillSub_Item.cs" />
     <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSc_MouldDotCheckPlanBillSub_Item.cs" />
     <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSc_MouldDotCheckPlanBillSub.cs" />
     <Compile Include="鐢熶骇绠$悊\妯″叿绠$悊\ClsSc_MouldDotCheckRuleBillMain.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/ClsSc_MouldDotCheckBillMain.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/ClsSc_MouldDotCheckBillMain.cs"
index 8521b88..36bbb4f 100644
--- "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/ClsSc_MouldDotCheckBillMain.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/ClsSc_MouldDotCheckBillMain.cs"
@@ -13,5 +13,6 @@
         public string HEndDate;//       datetime      --点检结束日期
         public string HExplanation;//   varchar(500)     --摘要 
         public string HInnerBillNo;//   varchar(50)     --内部单据号
+        public string HMouldDotCheckRuleID;//  器具点检规程ID
     }
 }
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/ClsSc_MouldDotCheckBillSub_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/ClsSc_MouldDotCheckBillSub_Item.cs"
new file mode 100644
index 0000000..4751711
--- /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/ClsSc_MouldDotCheckBillSub_Item.cs"
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsSc_MouldDotCheckBillSub_Item : DBUtility.ClsXt_BaseBillSub
+    {
+        //============
+
+
+        public Int64 HMaterID;//    int       --配件ID
+        public Int64 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 4041532..0fcfe00 100644
--- a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
+++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -336,8 +336,7 @@
                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
                 }
 
-                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
-                //{
+                
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "Sucess锛�";
@@ -345,15 +344,6 @@
                 objJsonResult.list = columnNameList;
 
                 return objJsonResult;
-                //}
-                //else
-                //{
-                //objJsonResult.code = "0";
-                //objJsonResult.count = 0;
-                //objJsonResult.Message = "鏃犳暟鎹�";
-                //objJsonResult.data = null;
-                //return objJsonResult;
-                //}
             }
             catch (Exception ex)
             {
@@ -3200,6 +3190,7 @@
             string msg2 = sArray[0].ToString();
             string msg3 = sArray[1].ToString();
             string msg4 = sArray[2].ToString();
+            string msg5 = sArray[3].ToString();
 
             string UserName = "";
             ListModels oListModels = new ListModels();
@@ -3223,6 +3214,7 @@
                 {
                     //oItem.HMaker = "";
                     UserName = oItem.HMaker;  //鍒跺崟浜�
+                    oItem.HMaker = msg4;
                     oItem.HBillType = "3821";
                     oItem.HBillSubType = "3821";
 
@@ -3285,6 +3277,32 @@
                     oBill.DetailColl.Add(oItemSub);
 
                 }
+
+                //閰嶄欢椤硅〃浣撴暟鎹�
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg5 = msg5.Substring(1, msg5.Length - 2);
+                msg5 = msg5.Replace("\\", "");
+                msg5 = msg5.Replace("\n", "");  //\n
+                                                //msg2 = msg2.Replace("'", "鈥�");
+                List<Model.ClsSc_MouldDotCheckBillSub_Item> ls1 = new List<Model.ClsSc_MouldDotCheckBillSub_Item>();
+                ls1 = oListModels.getObjectByJson_Sc_MouldDotCheckBillSub_Item(msg5);
+                int j = 0;
+                foreach (Model.ClsSc_MouldDotCheckBillSub_Item oItemSub in ls1)
+                {
+
+                    j++;
+                    oItemSub.HEntryID = j;
+                    //oItemSub.HCloseMan = "";       //琛屽叧闂�
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+
+                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+
+                    oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+                    oBill.DetailCol.Add(oItemSub);
+                }
+
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
@@ -3346,28 +3364,29 @@
         [HttpGet]
         public object Sc_MouldDotCheckBillListProjectDetai(string sqlWhere)
         {
-            DataSet ds;
+            DataSet ds, ds1;
+            List<object> list = new List<object>();
+            string Swhere = "";
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                if (sqlWhere == null || sqlWhere.Equals(""))
-                {
-                    ds = oCN.RunProcReturn("select HDotCheckItemID,鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,琛ㄤ綋澶囨敞 HRemark,HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName from h_v_Sc_MouldDotCheckBillList", "h_v_Sc_MouldDotCheckBillList");
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
-                }
-                else
-                {
-                    string sql1 = "select HDotCheckItemID,鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,琛ㄤ綋澶囨敞 HRemark,HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName from h_v_Sc_MouldDotCheckBillList where 1 = 1 ";
-                    string sql = sql1 + sqlWhere;
-                    ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckBillList");
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
-                }
+                //鑾峰彇鐐规椤圭洰缂栬緫鏁版嵁
+                ds = oCN.RunProcReturn("select HDotCheckItem, HDotCheckPart , HClaim, a.HRemark,a.HManagerID,e.HNumber HManagerCode,e.HName HManagerName from Sc_MouldDotCheckBillSub a left join Gy_Employee e on a.HManagerID=e.HItemID where 1=1 " + sqlWhere, "Sc_MouldDotCheckBillSub");
+                //鑾峰彇閰嶄欢椤圭洰缂栬緫鏁版嵁
+                ds1 = oCN.RunProcReturn(@"select b.HMaterID,  mt.Hnumber HMaterNumber ,mt.HName HMaterName, b.HUnitID
+                    ,u2.hnumber HUnitNumber,u2.HName HUnitName,b.HQty,b.HQtyMust,b.HRemark 
+                    from Sc_MouldDotCheckBillSub_Item b 
+                    left join Gy_Material mt on b.HMaterID=mt.HItemID 
+                    left join h_v_IF_Unit u2 on b.HUnitID=u2.HItemID  where 1=1 " + sqlWhere, "Sc_MouldDotCheckBillSub_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)
             {
@@ -3693,7 +3712,7 @@
                     ,u2.hnumber HUnitNumber,u2.HName HUnitName,b.HQty,b.HQtyMust,b.HRemark 
                     from Sc_MouldDotCheckPlanBillSub_Item b 
                     left join Gy_Material mt on b.HMaterID=mt.HItemID 
-                    left join h_v_IF_Unit u2 on b.HUnitID=u2.HItemID  where 1=1 " + sqlWhere, "Sc_MouldDotCheckPlanBillSub");
+                    left join h_v_IF_Unit u2 on b.HUnitID=u2.HItemID  where 1=1 " + sqlWhere, "Sc_MouldDotCheckPlanBillSub_Item");
                 list.Add(ds.Tables[0]);
                 list.Add(ds1.Tables[0]);
                 objJsonResult.code = "0";
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index cca2ee8..d631d71 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -846,7 +846,7 @@
         }
 
         /// <summary>
-        /// 澶勭悊鏂板妯″叿鐐规璁板綍琛ㄥ瓙琛ㄧ殑json
+        /// 澶勭悊鏂板妯″叿鐐规璁板綍琛ㄥ瓙琛� 鐐规椤圭洰 鐨刯son
         /// </summary>
         /// <param name="jsonString"></param>
         /// <returns></returns>
@@ -858,6 +858,18 @@
         }
 
         /// <summary>
+        /// 澶勭悊鏂板妯″叿鐐规璁板綍琛ㄥ瓙琛� 閰嶄欢淇℃伅 鐨刯son
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsSc_MouldDotCheckBillSub_Item> getObjectByJson_Sc_MouldDotCheckBillSub_Item(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsSc_MouldDotCheckBillSub_Item> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldDotCheckBillSub_Item>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
         /// 澶勭悊鏂板妯″叿鐐规璁″垝琛ㄤ富琛ㄧ殑json
         /// ClsSc_MouldDotCheckPlanBillMain
         /// </summary>

--
Gitblit v1.9.1