public JsonResult GetTraceDataAction(string axisNumStr) { var retData = new VM_Result_Data(); var vmJSMind = new VM_JSMind(); var bllCodeUsed = new MesWeb.BLL.T_CodeUsed(); var bllMachine = new MesWeb.BLL.T_Machine(); var bllMachineType = new MesWeb.BLL.T_MachineType(); VM_JSMind vmJsMind = new VM_JSMind(); retData.Appendix = genMindStruct(axisNumStr.Trim(), "root", ref vmJsMind, isRoot: true); if (vmJsMind.data.Count > 0) { retData.Code = RESULT_CODE.OK; retData.Content = "查询成功"; } else { retData.Content = "查询失败"; } return(Json(retData)); }
//获取同一年的轴号数据集合 private List <List <MesWeb.Model.T_HisMain> > getSameYearData(DateTime?startTime, DateTime?endTime, string machineType = "5") { var bllCodeUsed = new MesWeb.BLL.T_CodeUsed(); var usedCodeList = new List <MesWeb.Model.T_CodeUsed>(); var bllSpec = new MesWeb.BLL.T_Specification(); List <MesWeb.Model.T_HisMain> hisMainList = new List <MesWeb.Model.T_HisMain>(); var startMonth = startTime.Value.Month; var endMonth = endTime.Value.Month; List <List <MesWeb.Model.T_HisMain> > hisMainListArray = new List <List <MesWeb.Model.T_HisMain> >(); string cp = "CP0" + machineType; List <MesWeb.Model.T_HisMain> hisMainTmps; try { if (startTime.Value.Year > DateTime.Now.Year) { return(hisMainListArray); } for (var i = startMonth; i <= endMonth; ++i) { if (i > DateTime.Now.Month) { hisMainListArray.Add(hisMainList); return(hisMainListArray); } var tableName = "HISMAIN" + startTime.Value.Year + i.ToString("00") + machineType; var bllHisMain = new MesWeb.BLL.T_HisMain(tableName); //同一月 if (startMonth == endMonth) { for (var j = startTime.Value.Day; j <= endTime.Value.Day; ++j) { hisMainTmps = bllHisMain.GetModelList("Axis_No like '" + cp + "" + startTime.Value.Year + i.ToString("00") + j.ToString("00") + "%" + "'"); if (hisMainTmps.Count > 0) { hisMainList.AddRange(hisMainTmps); } hisMainTmps = bllHisMain.GetModelList("Axis_No like 'ZD" + startTime.Value.Year + i.ToString("00") + j.ToString("00") + "%" + "'"); if (hisMainTmps.Count > 0) { hisMainList.AddRange(hisMainTmps); } } //不是同一月 } else { //起始月 if (i == startMonth) { //遍历起始月 for (var j = startTime.Value.Day; j <= 31; ++j) { hisMainTmps = bllHisMain.GetModelList("Axis_No like '" + cp + "" + startTime.Value.Year + i.ToString("00") + j.ToString("00") + "%" + "'"); if (hisMainTmps.Count > 0) { hisMainList.AddRange(hisMainTmps); } hisMainTmps = bllHisMain.GetModelList("Axis_No like 'ZD" + startTime.Value.Year + i.ToString("00") + j.ToString("00") + "%" + "'"); if (hisMainTmps.Count > 0) { hisMainList.AddRange(hisMainTmps); } } //遍历终止月 } else if (i == endMonth) { for (var j = 1; j <= endTime.Value.Day; ++j) { hisMainTmps = bllHisMain.GetModelList("Axis_No like '" + cp + "" + startTime.Value.Year + i.ToString("00") + j.ToString("00") + "%" + "'"); if (hisMainTmps.Count > 0) { hisMainList.AddRange(hisMainTmps); } hisMainTmps = bllHisMain.GetModelList("Axis_No like 'ZD" + startTime.Value.Year + i.ToString("00") + j.ToString("00") + "%" + "'"); if (hisMainTmps.Count > 0) { hisMainList.AddRange(hisMainTmps); } } //遍历其它月 } else { for (var j = 1; j <= 31; ++j) { hisMainTmps = bllHisMain.GetModelList("Axis_No like '" + cp + "" + startTime.Value.Year + i.ToString("00") + j.ToString("00") + "%" + "'"); if (hisMainTmps.Count > 0) { hisMainList.AddRange(hisMainTmps); } hisMainTmps = bllHisMain.GetModelList("Axis_No like 'ZD" + startTime.Value.Year + i.ToString("00") + j.ToString("00") + "%" + "'"); if (hisMainTmps.Count > 0) { hisMainList.AddRange(hisMainTmps); } } } } } hisMainListArray.Add(hisMainList); } catch (Exception e) { return(hisMainListArray); } return(hisMainListArray); }
public JsonResult GetAxisDetailAction(string axisNumStr) { log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name); var retData = new VM_Result_Data(); var procDetailList = new List <VM_ProcDetail>(); var hisData = new VM_ProcDetail(); axisNumStr = axisNumStr.Trim(); HisMain axisNum = new HisMain(axisNumStr); var tabName = axisNum.GetHisDataTableName(); if (string.IsNullOrEmpty(tabName)) { retData.Content = "轴号有误"; return(Json(retData)); } try { var bllHisData = new MesWeb.BLL.T_HisMain(tabName); var findData = bllHisData.GetModelList("Axis_No = '" + axisNumStr + "'").FirstOrDefault(); hisData = new VM_ProcDetail { Axis_No = findData.Axis_No, CurrentDataID = findData.CurrentDataID, SpecificationID = findData.SpecificationID, MachineID = findData.MachineID, MachineTypeID = findData.MachineTypeID, EmployeeID_Main = findData.EmployeeID_Main, EmployeeID_Assistant = findData.EmployeeID_Assistant, Start_Axis_No = findData.Start_Axis_No, Printcode = findData.Printcode }; var specID = hisData.SpecificationID; var bllMachine = new MesWeb.BLL.T_Machine(); var bllEmp = new MesWeb.BLL.T_Employee(); var bllSpec = new MesWeb.BLL.T_Specification(); var bllCodeUsed = new MesWeb.BLL.T_CodeUsed(); var bllLayout = new MesWeb.BLL.T_LayoutPicture(); var spec = bllSpec.GetModel((int)specID); hisData.SpecName = spec.SpecificationName; hisData.ODMax = spec.ODMax.ToString(); hisData.ODMin = spec.ODMin.ToString(); hisData.SpecColor = spec.SpecificationColor; hisData.RolledYield = "100%"; hisData.GeneratorTime = bllCodeUsed.GetModelList("Axis_No = '" + hisData.Axis_No + "'").FirstOrDefault().GeneratorTime.Value.ToShortDateString(); var machine = bllMachine.GetModel((int)hisData.MachineID); var machineLayout = bllLayout.GetModelList("LayoutTypeID = " + 1).Find(s => { return(s.TableRowID == machine.MachineID); }); // hisData.EmployeeName = bllEmp.GetModel((int)hisData.EmployeeID_Main).EmployeeName; hisData.EmployeeName = hisData.EmployeeID_Main; var tableName = axisNum.Year + axisNum.Month + ((int)(machine.MachineTypeID)).ToString("00"); hisData.MachineName = "<a href='/HistoryQuery/HistoryMachine/" + tableName + "," + axisNumStr + "'>" + machine.MachineName + "</a>"; retData.Code = RESULT_CODE.OK; } catch (Exception e) { log.Error("查询轴号信息失败", e); retData.Content = "查询失败,请联系管理员"; } procDetailList.Add(hisData); retData.Appendix = procDetailList; return(Json(retData)); }