zrg
2024-10-09 243e86af1a7c74c8bfda3bb41f29a11fef13c065
WebAPI/Controllers/Êý¾Ýͬ²½/¶¤¶¤Í¬²½/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 ä¿å…»çº§åˆ«ä»£ç ='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 ä¿å…»çº§åˆ«ä»£ç ='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;
                        }