From 243e86af1a7c74c8bfda3bb41f29a11fef13c065 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期三, 09 十月 2024 16:32:52 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/数据同步/钉钉同步/DD_DataSynchronizationController.cs |  169 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 113 insertions(+), 56 deletions(-)

diff --git "a/WebAPI/Controllers/\346\225\260\346\215\256\345\220\214\346\255\245/\351\222\211\351\222\211\345\220\214\346\255\245/DD_DataSynchronizationController.cs" "b/WebAPI/Controllers/\346\225\260\346\215\256\345\220\214\346\255\245/\351\222\211\351\222\211\345\220\214\346\255\245/DD_DataSynchronizationController.cs"
index df0bb97..4bb6860 100644
--- "a/WebAPI/Controllers/\346\225\260\346\215\256\345\220\214\346\255\245/\351\222\211\351\222\211\345\220\214\346\255\245/DD_DataSynchronizationController.cs"
+++ "b/WebAPI/Controllers/\346\225\260\346\215\256\345\220\214\346\255\245/\351\222\211\351\222\211\345\220\214\346\255\245/DD_DataSynchronizationController.cs"
@@ -276,11 +276,14 @@
             public string HNewModel;//	varchar(100)		--缁翠慨鍚庢柊瑙勬牸				addnew
             public Single HNewDesignLife;//	money			--鏂拌璁″鍛�
             public string HRemark;
+            public string HPlanNo;
+            public string HPlanInterID;
             public DateTime HRequestComDate;
             public double HRecentMainModule;
             public double HCumulativeModule;
             public double HProductionModule;
             public DateTime HRepairAccepDate;
+            public string HMaintainLevID;
 
 
 
@@ -523,8 +526,8 @@
                 //OriginatorId = "12",                                                                                          //鏍规嵁娴佺▼鍙戣捣浜哄伐鍙锋煡璇€��
 
                 //TaskId = "12",                                                                                                //浠诲姟ID銆�
-                //CreateFromTimeGMT = DateTime.Now.AddMonths(-10).ToString("yyyy-MM-dd"),                                          //鍒涘缓鏃堕棿璧峰鍊笺��
-                //CreateToTimeGMT = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"),                                               //鍒涘缓鏃堕棿缁堟鍊笺��
+                //CreateFromTimeGMT = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd"),                                          //鍒涘缓鏃堕棿璧峰鍊笺��
+                //CreateToTimeGMT = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd hh:mm:ss"),                                               //鍒涘缓鏃堕棿缁堟鍊笺��
                 ModifiedFromTimeGMT = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"),                                          //淇敼鏃堕棿璧峰鍊笺��
                 ModifiedToTimeGMT = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"),                                               //淇敼鏃堕棿缁堟鍊笺��
 
@@ -2071,7 +2074,7 @@
 
                             if (getInstanceByIdResponse.Body.InstanceStatus != "COMPLETED")
                             {
-                                continue;
+                                //continue;
                             }
 
                             //寮�鍗曟棩鏈�
@@ -2079,6 +2082,30 @@
                             {
                                 double HDate_Temp = double.Parse(response.Body.Result[i].FormData["dateField_lq0v65sv"].ToString());
                                 oItem.HDate = convertFromMillisecondsToDateString(HDate_Temp, "yyyy-MM-dd HH:mm");
+                            }
+
+                            //妯″叿淇濆吇绾у埆
+                            if (keys.Contains("selectField_m1ip9j31"))
+                            {
+                                string HDate_Temp = response.Body.Result[i].FormData["selectField_m1ip9j31"].ToString();
+                                if (!HDate_Temp.Contains("涓夌骇"))
+                                {
+                                    ds = oCN.RunProcReturn("select  * from h_v_Gy_MaintainLev where 淇濆吇绾у埆浠g爜='BY-SE-002'", "h_v_Gy_MaintainLev");
+                                    if (ds.Tables[0].Rows.Count > 0)
+                                    {
+                                        HDate_Temp = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                                    }
+                                }
+                                else if (HDate_Temp.Contains("涓夌骇"))
+                                {
+                                    ds = oCN.RunProcReturn("select  * from h_v_Gy_MaintainLev where 淇濆吇绾у埆浠g爜='BY-SE-003'", "h_v_Gy_MaintainLev");
+                                    if (ds.Tables[0].Rows.Count > 0)
+                                    {
+                                        HDate_Temp = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                                    }
+                                }
+                              
+                                oItem.HMaintainLevID = HDate_Temp;
                             }
 
                             //淇ā寮�濮嬫椂闂�
@@ -2149,6 +2176,17 @@
                                 }
                                 oItem.HMouldID = long.Parse(HMouldID);
                                 oItem.HRemark = HDate_Temp;
+
+
+                                //鏌ヨ淇濆吇璁″垝
+                                ds = oCN.RunProcReturn(@"select  a.HInterID,a.HBillNo from  Sc_MouldMaintainPlanBillMain a
+                                    inner join Sc_MouldMaintainPlanBillSub b on a.HInterID = b.HInterID
+                                    where a.HMouldID =" + oItem.HMouldID + " and a.HMaintainLevID = " + oItem.HMaintainLevID, "Sc_MouldMaintainPlanBillMain");
+
+                                if (ds.Tables[0].Rows.Count > 0) {
+                                    oItem.HPlanInterID = ds.Tables[0].Rows[0]["HInterID"].ToString();
+                                    oItem.HPlanNo = ds.Tables[0].Rows[0]["HInterID"].ToString();
+                                }
                             }
 
 
@@ -2369,13 +2407,15 @@
                 ",HPlanNo,HPlanInterID,HMouldID,HBeginDate" +
                 ",HEndDate" +
                 ",HInnerBillNo,HExplanation,HMouldMaintainRuleInterID,HMaintainLevID,HLastResult" +
-                ",HRequestComDate,HRecentMainModule,HCumulativeModule,HProductionModule)" +
+                ",HRequestComDate,HRecentMainModule,HCumulativeModule,HProductionModule" +
+                ",HPlanInterID,HPlanNo,HMaintainLevID)" +
                 "values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + oItem.HBillNo + "','"+ oItem.HDate + "','" + oItem.HOriginator + "','" + oItem.HMakeDate + "'" +
                       ",'" + DateTime.Now.Year + "','" + DateTime.Now.Month + "','"+ oItem.HRemark + "','" + oItem.HUpdateDate + "'" +
                       ",'','0','" + oItem.HMouldID + "','" + oItem.HRepairBeginDate + "'" +
                       ",'" + oItem.HRepairEndDate + "'" +
                       ",'" + oItem.HInstanceID + "','',"+ HMouldMaintainRuleInterID + ",0,'OK'" +
-                      ",'"+ oItem.HRequestComDate + "'," + oItem.HRecentMainModule + "," + oItem.HCumulativeModule + "," + oItem.HProductionModule + ")";
+                      ",'"+ oItem.HRequestComDate + "'," + oItem.HRecentMainModule + "," + oItem.HCumulativeModule + "," + oItem.HProductionModule + "" +
+                      "," + oItem.HPlanInterID + "," + oItem.HPlanNo + "," + oItem.HMaintainLevID + ")";
                             LogService.Write(sql_main);
                             oCN.RunProc(sql_main);
                             int i = 1;
@@ -2522,6 +2562,72 @@
                                 continue;
                             }
 
+                            if (oItem.HInstanceID != "9b6e108c-b7bf-45e4-910d-5629ac30d4aa") {
+                                continue;
+                            }
+
+                            //璁惧缂栫爜
+                            if (keys.Contains("textField_lfg9hgys"))
+                            {
+                                string HDate_Temp = response.Body.Result[i].FormData["textField_lfg9hgys"].ToString();
+                                DataSet ds = oCN.RunProcReturn("select * from Gy_EquipFileBillMain with(nolock)  where HEquipFileNo='" + HDate_Temp + "'", "Gy_EquipFileBillMain");
+                                string HEquipID = "0";
+                                if (ds.Tables[0].Rows.Count > 0)
+                                {
+                                    HEquipID = ds.Tables[0].Rows[0]["HInterID"].ToString();
+                                    oItem.HEquipID = long.Parse(HEquipID);
+                                    oItem.HRemark2 = HDate_Temp;
+                                }
+                                else
+                                {
+                                    continue;
+                                }
+                            }
+
+                            //缁翠慨閮ㄩ棬
+                            if (keys.Contains("selectField_kzgkw10a"))
+                            {
+                                string HDate_Temp = response.Body.Result[i].FormData["selectField_kzgkw10a"].ToString();
+                                DataSet ds = oCN.RunProcReturn("select * from Gy_Department with(nolock)  where HName='" + HDate_Temp + "'", "Gy_Department");
+                                string HDeptID = "0";
+                                if (ds.Tables[0].Rows.Count > 0)
+                                {
+                                    HDeptID = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                                    oItem.HDeptID = long.Parse(HDeptID);
+                                }
+                                else
+                                {
+                                    continue;
+                                }
+
+                            }
+
+                            //缁翠慨浜�
+                            if (keys.Contains("employeeField_lthwkdh2"))
+                            {
+                                string[] HDate_Temp = JsonConvert.DeserializeObject<string[]>(JsonConvert.SerializeObject(response.Body.Result[i].FormData["employeeField_lthwkdh2"]));
+                                DataSet ds = oCN.RunProcReturn("select * from Gy_Employee with(nolock)  where HName='" + HDate_Temp[0] + "'", "Gy_Employee");
+                                string HEmpID = "0";
+                                if (ds.Tables[0].Rows.Count > 0)
+                                {
+                                    HEmpID = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                                    oItem.HEmpID = long.Parse(HEmpID);
+                                }
+                                else
+                                {
+                                    continue;
+                                }
+
+                            }
+
+                            //缁翠慨鍐呭
+                            if (keys.Contains("textField_l2r9bvwk"))
+                            {
+                                string HDate_Temp = response.Body.Result[i].FormData["textField_l2r9bvwk"].ToString();
+
+                                oItem.HRepairContent = HDate_Temp;
+                            }
+
                             //鎶ヤ慨绫诲埆
                             if (keys.Contains("multiSelectField_lfg9hgyv"))
                             {
@@ -2564,60 +2670,11 @@
                                 {
                                     HDate_Temp = "0";
                                 }
-                                LogService.Write("1:------"+HDate_Temp+ ",2:------" + int.Parse(new string(HDate_Temp.Where(char.IsDigit).ToArray())));
+                                //LogService.Write("1:------"+HDate_Temp+ ",2:------" + int.Parse(new string(HDate_Temp.Where(char.IsDigit).ToArray())));
                                 //a = HDate_Temp;
                                 oItem.HTimes = int.Parse(new string(HDate_Temp.Where(char.IsDigit).ToArray()));
                                 oItem.HPlanTimes = int.Parse(new string(HDate_Temp.Where(char.IsDigit).ToArray()));
                             }
-
-                            //璁惧缂栫爜
-                            if (keys.Contains("textField_lfg9hgys"))
-                            {
-                                string HDate_Temp = response.Body.Result[i].FormData["textField_lfg9hgys"].ToString();
-                                DataSet ds = oCN.RunProcReturn("select * from Gy_EquipFileBillMain with(nolock)  where HEquipFileNo='" + HDate_Temp + "'", "Gy_EquipFileBillMain");
-                                string HEquipID = "0";
-                                if (ds.Tables[0].Rows.Count > 0)
-                                {
-                                    HEquipID = ds.Tables[0].Rows[0]["HInterID"].ToString();
-                                }
-                                oItem.HEquipID = long.Parse(HEquipID);
-                                oItem.HRemark2 = HDate_Temp;
-                            }
-
-                            //缁翠慨閮ㄩ棬
-                            if (keys.Contains("selectField_kzgkw10a"))
-                            {
-                                string HDate_Temp = response.Body.Result[i].FormData["selectField_kzgkw10a"].ToString();
-                                DataSet ds = oCN.RunProcReturn("select * from Gy_Department with(nolock)  where HName='" + HDate_Temp + "'", "Gy_Department");
-                                string HDeptID = "0";
-                                if (ds.Tables[0].Rows.Count > 0)
-                                {
-                                    HDeptID = ds.Tables[0].Rows[0]["HItemID"].ToString();
-                                }
-                                oItem.HDeptID = long.Parse(HDeptID);
-                            }
-
-                            //缁翠慨浜�
-                            if (keys.Contains("employeeField_lthwkdh2"))
-                            {
-                                string[] HDate_Temp = JsonConvert.DeserializeObject<string[]>(JsonConvert.SerializeObject(response.Body.Result[i].FormData["employeeField_lthwkdh2"]));
-                                DataSet ds = oCN.RunProcReturn("select * from Gy_Employee with(nolock)  where HName='" + HDate_Temp[0] + "'", "Gy_Employee");
-                                string HEmpID = "0";
-                                if (ds.Tables[0].Rows.Count > 0)
-                                {
-                                    HEmpID = ds.Tables[0].Rows[0]["HItemID"].ToString();
-                                }
-                                oItem.HEmpID = long.Parse(HEmpID);
-                            }
-
-                            //缁翠慨鍐呭
-                            if (keys.Contains("textField_l2r9bvwk"))
-                            {
-                                string HDate_Temp = response.Body.Result[i].FormData["textField_l2r9bvwk"].ToString();
-
-                                oItem.HRepairContent = HDate_Temp;
-                            }
-
 
                             //瀛愯〃 缁翠慨瑕佹眰 缁翠慨澶囨敞(闂鎻忚堪)
 
@@ -2673,7 +2730,7 @@
                         }
                         catch (Exception e)
                         {
-                            //LogService.Write(a);
+                            LogService.Write(e.Message);
                             a = "";
                             continue;
                         }

--
Gitblit v1.9.1