/// <summary> /// 插入buildplan数据 /// </summary> /// <param name="item"></param> /// <returns></returns> public static bool InsertBulidPlanData(BuildPlanInfo item) { string sql = $@" INSERT INTO [dbo].[EKS_T_BulidPlanData] ([ID],[BuildPlanID] ,[Workcell],[Bay],[Station],[Model] ,[BuildPlan],[Shift],[ShiftDate],[StartTime] ,[EndTime],[UPH]) VALUES (@ID,@BuildPlanID,@Workcell,@Bay,@Station,@Model, @BuildPlan,@Shift,@ShiftDate,@StartTime,@EndTime,@UPH)"; DAL.ProcedureParameter[] para = new DAL.ProcedureParameter[] { new DAL.ProcedureParameter("@ID", item.ID), new DAL.ProcedureParameter("@BuildPlanID", item.BuildPlanID), new DAL.ProcedureParameter("@Workcell", item.Workcell), new DAL.ProcedureParameter("@Bay", item.Bay), new DAL.ProcedureParameter("@Station", item.Station), new DAL.ProcedureParameter("@Model", item.Model), new DAL.ProcedureParameter("@BuildPlan", item.BuildPlan), new DAL.ProcedureParameter("@Shift", item.Shift), new DAL.ProcedureParameter("@ShiftDate", item.ShiftDate), new DAL.ProcedureParameter("@StartTime", item.StartTime), new DAL.ProcedureParameter("@EndTime", item.EndTime), new DAL.ProcedureParameter("@UPH", item.UPH), }; try { return(sqlser.Execute(sql, para) > 0); } catch (Exception ex) { ErrorBll.LogError("同步buildplan数据时,插入buildplan数据异常!", ex); return(false); } }
public static List <BuildPlanInfo> GetSynBulidPlanData(DateTime start, DateTime end) { if (start == null || start == DateTime.MinValue) { start = DateTime.Now.AddDays(-3); } if (end == null || end == DateTime.MinValue) { end = DateTime.Now; } List <BuildPlanInfo> list = new List <BuildPlanInfo>(); BuildPlanInfo temp = null; string para = $"start={start.ToString("yyyy-MM-dd")}&end={end.ToString("yyyy-MM-dd")}"; var result = JabilCommon.HttpMethods.HttpPost(BulidPlanServerUrl, para); if (string.IsNullOrWhiteSpace(result)) { return(list); } JObject jo = (JObject)JsonConvert.DeserializeObject(result); if (jo["Status"] == null) { return(list); } var status = jo["Status"].ToString(); if (status != "0") { return(list); } if (jo["Data"] == null) { return(list); } var data = (JArray)jo["Data"]; foreach (var it in data) { temp = new BuildPlanInfo(); temp.BuildPlanID = JsonHelper.GetJValue(it, "BuildPlanID"); temp.Workcell = JsonHelper.GetJValue(it, "Workcell"); temp.Bay = JsonHelper.GetJValue(it, "Bay"); temp.Station = JsonHelper.GetJValue(it, "Station"); temp.Model = JsonHelper.GetJValue(it, "Model"); temp.BuildPlan = JsonHelper.GetJValue(it, "BuildPlan"); temp.Shift = JsonHelper.GetJValue(it, "Shift"); temp.ShiftDate = JsonHelper.GetJValue(it, "ShiftDate"); temp.StartTime = JsonHelper.GetJValue(it, "StartTime"); temp.EndTime = JsonHelper.GetJValue(it, "EndTime"); temp.UPH = JsonHelper.GetJValueFloat(it, "UPH"); list.Add(temp); } return(list); }