private VM_Result_Data getEmployeeData(string param) { var retData = new VM_Result_Data(); retData.Content = "查询失败"; var bllEmp = new MesWeb.BLL.T_Employee(); var bllDpt = new MesWeb.BLL.T_Department(); var empList = bllEmp.GetModelList(param); try { if (empList.Count > 0) { var vmEmpList = new List <VM_Search_Employee>(); foreach (var emp in empList) { var vmEmp = new VM_Search_Employee(emp); var dpt = bllDpt.GetModelList("DepartmentID = " + emp.DepartmentID).FirstOrDefault(); if (dpt != null) { vmEmp.DepartmentName = dpt.DepartmentName; } vmEmpList.Add(vmEmp); } retData.Appendix = vmEmpList; retData.Code = RESULT_CODE.OK; retData.Content = "查询成功"; } } catch (Exception) { } return(retData); }
public JsonResult GetSelEmployeeAction(int Id) { var bllUser = new MesWeb.BLL.T_User(); var user = bllUser.GetModel(Id); if (user != null) { var bllEmp = new MesWeb.BLL.T_Employee(); var empId = bllEmp.GetModel(user.EmployeeID.Value).EmployeeID; if (empId > 0) { return(new BasicDataController().GetSelEmployeeAction(empId)); } } log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name); log.Error("获取员工信息失败!"); return(null); }
public JsonResult SearchMaterials(VM_MaterialOutputCond cond) { var retData = new VM_Result_Data(); var bllEmp = new MesWeb.BLL.T_Employee(); var bllOuput = new MesWeb.BLL.T_MaterialOutput(); var emp = bllEmp.GetModelList("EmployeeName = '" + cond.EmployeeName + "'").FirstOrDefault(); if (emp != null) { var empId = emp.EmployeeID; var materials = bllOuput.GetModelList("GnerateTime > '" + cond.StartDate + "' and GnerateTime < '" + cond.EndDate + "' and EmployeeID = " + empId); if (materials.Count > 0) { retData.Code = RESULT_CODE.OK; retData.Content = "查询成功"; var vmOutputList = new List <VM_MaterialOutputDetail>(); for (int i = 0; i < materials.Count; ++i) { vmOutputList.Add(new VM_MaterialOutputDetail(materials[i]) { Index = i + 1, EmployeeName = emp.EmployeeName }); } retData.Appendix = vmOutputList; } else { retData.Content = "查询失败"; } } else { log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name); log.Error("查询物料的操作人员不存在"); retData.Content = "操作人员不存在"; } return(Json(retData)); }
/// <summary> /// 用户配置 /// </summary> /// <returns></returns> public ActionResult UserConf() { var vmJstreeList = new List <VM_JSTree>(); var bllDept = new MesWeb.BLL.T_Department(); var bllEmp = new MesWeb.BLL.T_Employee(); var deptList = bllDept.GetModelList(""); var bllUser = new MesWeb.BLL.T_User(); var userList = bllUser.GetModelList(""); foreach (var dept in deptList) { var deptTree = new VM_JSTree { text = dept.DepartmentName, id = "dept_" + dept.DepartmentID.ToString() }; deptTree.children = new List <VM_JSTree>(); foreach (var user in userList) { if (!user.EmployeeID.HasValue) { continue; } var emp = bllEmp.GetModel(user.EmployeeID.Value); if (emp != null) { if (emp.DepartmentID == dept.DepartmentID) { deptTree.children.Add(new VM_JSTree { text = user.UserName, id = "user_" + user.UserID.ToString() }); // userList.Remove(user); } } } vmJstreeList.Add(deptTree); } return(View(vmJstreeList)); }
///////////////////// protected VM_MachineProperty GetMachineProperty(int Id) { log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name); var machLayout = bllLayout.GetModel(Id); var machPty = new VM_MachineProperty(); if (machLayout != null) { if (machLayout.LayoutTypeID == (int)LAYOUT_TPYE.MACHINE) { try { var bllMach = new MesWeb.BLL.T_Machine(); var bllCurData = new MesWeb.BLL.T_CurrentData(); var bllEmployee = new MesWeb.BLL.T_Employee(); var bllSpec = new MesWeb.BLL.T_Specification(); var bllColData = new MesWeb.BLL.T_CollectedDataParameters(); var mach = bllMach.GetModel((int)machLayout.TableRowID); if (mach == null) { return(null); } var curData = bllCurData.GetModelList("MachineID = " + mach.MachineID).FirstOrDefault(); if (curData == null) { return(null); } /// var emmployee = bllEmployee.GetModel((int)curData.EmployeeID_Main); var spec = bllSpec.GetModel((int)curData.SpecificationID); var curMeters = bllColData.GetModelList("MachineID = " + mach.MachineID + " AND ParameterCodeID = " + (int)SPEC_PARAM_CODE.METERS_COUNT_FACT).FirstOrDefault().CollectedValue; var materialRFID = bllColData.GetModelList("MachineID = " + mach.MachineID + " AND ParameterCodeID = " + (int)SPEC_PARAM_CODE.MATERIAL_RFID).FirstOrDefault().CollectedValue; var linearSpeed = bllColData.GetModelList("MachineID = " + mach.MachineID + " AND ParameterCodeID = " + (int)SPEC_PARAM_CODE.LINEAR_SPEED).FirstOrDefault().CollectedValue; machPty.MachineName = mach.MachineName; machPty.TaskNum = "4000"; machPty.AxisNum = curData.Axis_No; // machPty.ManuMan = emmployee.EmployeeName; machPty.ManuMan = "张三"; machPty.SpecNum = spec.SpecificationName; machPty.ODMax = spec.ODMax; machPty.ODMin = spec.ODMin; machPty.SpecColor = spec.SpecificationColor; machPty.UnitPrice = spec.SpecificationPrice; machPty.MaterialRFID = materialRFID; machPty.CurrentMeters = curMeters; machPty.BatchNum = "Na"; machPty.ContUnit = "Na"; machPty.JobNum = "Na"; machPty.EstTime = ((40000 - double.Parse(curMeters)) / double.Parse(linearSpeed) / 60).ToString("0.00") + "分钟"; machPty.ReachedNum = (double.Parse(curMeters) * 100 / 4000 + "%").ToString(); } catch (Exception e) { log.Error("数据库操作失败", e); return(null); } } else { log.Error("该标志不属于机台"); return(null); } } else { log.Error("查找机台失败!"); return(null); } return(machPty); }
public VM_JSMind genMindStruct(string axisNumStr, string id, ref VM_JSMind mind, string parentId = "", bool isRoot = false) { if (string.IsNullOrEmpty(axisNumStr) || !HisMain.IsAxisNum(axisNumStr)) { return(null); } var bllMachine = new MesWeb.BLL.T_Machine(); var bllMachineType = new MesWeb.BLL.T_MachineType(); var bllEmployee = new MesWeb.BLL.T_Employee(); var bllMaterial = new MesWeb.BLL.T_MaterialOutput(); HisMain axisNum = new HisMain(); if (axisNumStr.StartsWith("ZD")) { axisNum.Year = axisNumStr.Substring(2, 4); axisNum.Month = axisNumStr.Substring(6, 2); axisNum.MachineTypeID = "5"; } else if (axisNumStr.StartsWith("CP")) { axisNum = new HisMain(axisNumStr); } var hisTabName = "HISMAIN" + axisNum.Year + axisNum.Month + axisNum.MachineTypeID.Trim(); var bllHisMain = new MesWeb.BLL.T_HisMain(hisTabName); var hisMain = bllHisMain.GetModelList("Axis_No like '%" + axisNumStr + "%'").FirstOrDefault(); if (hisMain == null) { return(null); } var machineType = bllMachineType.GetModel(int.Parse(axisNum.MachineTypeID)); MesWeb.Model.T_MaterialOutput material = null; if (hisMain != null) { material = bllMaterial.GetModelList("MaterialRFID = '" + hisMain.MaterialRFID + "'").FirstOrDefault(); } if (material != null) { hisMain.SpecColor = material.Color; hisMain.SpecName = material.MaterialType; hisMain.Supplier = material.SupplyCompany; hisMain.BatchNo = material.BatchNo; } var employeeCode = hisMain.EmployeeID_Main; var employee = bllEmployee.GetModelList("EmployeeCode = '" + employeeCode + "'").FirstOrDefault(); if (employee != null) { hisMain.EmployeeID_Main = employee.EmployeeName; } var machine = bllMachine.GetModel(hisMain.MachineID.Value); var node = new JSMind_Data(); node.topic = machineType.MachineType + machine.MachineName; node.id = id; node.parentid = parentId; node.isroot = isRoot; node.data = hisMain; mind.data.Add(node); if (hisMain != null) { var startAxisNums = ("" + hisMain.Start_Axis_No).Split(','); foreach (var stNum in startAxisNums) { genMindStruct(stNum, stNum, ref mind, id); } } return(mind); }
public JsonResult GetProcDetail(VM_ProcDetail procDetail) { var retData = new VM_Result_Data(); if (procDetail == null) { procDetail = new VM_ProcDetail(); } //procDetail.CertProduct = "<a href='javascript:void(0)' onclick='showCertProduct()'>成品证书</a> <a href='javascript:void(0)' onclick='showCertPlastic()'>塑料证书</a>"; var procDetailList = new List <VM_ProcDetail>(); var bllMachine = new MesWeb.BLL.T_Machine(); var bllEmp = new MesWeb.BLL.T_Employee(); var bllSpec = new MesWeb.BLL.T_Specification(); var bllAxis = new MesWeb.BLL.T_Axis(); try { if (!string.IsNullOrEmpty(procDetail.BatchNo)) { var searchCond = new List <string>(); searchCond.Add(procDetail.BatchNo); try { var gumId = MaterialController.SearchReportId(searchCond, MaterialController.gumReportType); procDetail.CertPlastic = "<a href='javascript: void(0)' onclick='showReportPlastic(this)' id='" + gumId + "'>胶料表</a>"; } catch { } } try { //找到历史数据表 HisData hisData = new HisData(procDetail.Axis_No); //查询OD的最值 var hisDs = DbHelperSQL.Query("SELECT MAX(CollectedValue) AS Max,MIN(CollectedValue) AS Min" + " FROM " + hisData.TableName + " WHERE(ParameterCodeID = " + (int)SPEC_PARAM_CODE.OUTTER_OD + ") AND(Axis_No = '" + hisData.AxisNumStr + "')" + " GROUP BY Axis_No"); var hisRow = hisDs.Tables[0].Rows[0]; var odMax = hisRow["max"].ToString(); var odMin = hisRow["min"].ToString(); procDetail.ODMax = odMax; procDetail.ODMin = odMin; var axis = new HisMain(procDetail.Axis_No); procDetail.GeneratorTime = axis.Year + "-" + axis.Month + "-" + axis.Day; } catch { } //获取回溯信息 var axisInfo = bllAxis.GetModelList("Axis_No = '" + procDetail.Axis_No + "'").FirstOrDefault(); if (axisInfo != null) { procDetail.Comment = axisInfo.comment; } //机台 var machine = bllMachine.GetModel((int)procDetail.MachineID); if (machine != null) { //只有挤绝缘和挤护套有数据 if (machine.MachineTypeID == 2 || machine.MachineTypeID == 5) { var machineName = machine.MachineName ?? ""; var axisColor = procDetail.SpecColor ?? ""; var printCode = procDetail.Printcode ?? ""; procDetail.MachineName = "<a href='javascript: void(0)' machineType='" + machine.MachineTypeID + "' employee='" + procDetail.EmployeeName + "' printCode='" + printCode + "' axisColor='" + axisColor + "' machineName='" + machineName + "' axisNum='" + procDetail.Axis_No + "' onclick='viewHisMachine(this)' machineId='" + machine.MachineID + "'>" + machine.MachineName + "</a>"; } else { procDetail.MachineName = machine.MachineName; } } retData.Code = RESULT_CODE.OK; TempData[SERACH_ASIX] = procDetail.Axis_No; } catch (Exception e) { retData.Content = "查询失败,请联系管理员"; retData.Code = RESULT_CODE.OK; retData.Appendix = procDetail; } procDetailList.Add(procDetail); retData.Appendix = procDetailList; return(Json(retData)); }
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)); }