示例#1
0
        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));
        }
示例#2
0
        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);
        }