예제 #1
0
        public PagedListModel <CNCMachineDTO> QueryCNCMachineDTOs(CNCMachineDTO searchModel, Page page)
        {
            int totalcount;
            var result = CNCMachineRepository.QueryCNCMachineDTOs(searchModel, page, out totalcount).ToList();
            var bd     = new PagedListModel <CNCMachineDTO>(totalcount, result);

            return(bd);
        }
예제 #2
0
        public string AddOrEditCNCMachineAPI(CNCMachineDTO dto)
        {
            try
            {
                int EQP_Uid = CNCMachineRepository.GetEquipment_UID(dto.BG_Organization_UID, dto.FunPlant_Organization_UID == null ? 0 : dto.FunPlant_Organization_UID.Value, dto.Equipment);

                if (EQP_Uid == 0)
                {
                    return("保存失败:没有找到对应的设备EMT号.");
                }

                if (dto.CNCMachineUID == 0)
                {
                    CNCMachine SC = new CNCMachine();

                    SC.Plant_Organization_UID    = dto.Plant_Organization_UID;
                    SC.BG_Organization_UID       = dto.BG_Organization_UID;
                    SC.FunPlant_Organization_UID = dto.FunPlant_Organization_UID;
                    if (EQP_Uid != 0)
                    {
                        SC.EQP_Uid = EQP_Uid;
                    }
                    else
                    {
                        SC.EQP_Uid = null;
                    }

                    SC.Machine_Name  = dto.Machine_Name;
                    SC.Machine_ID    = dto.Machine_ID;
                    SC.Project_UID   = dto.Project_UID;
                    SC.Is_Enable     = dto.Is_Enable;
                    SC.Modified_UID  = dto.Modified_UID;
                    SC.Modified_Date = dto.Modified_Date;
                    CNCMachineRepository.Add(SC);

                    _unitOfWork.Commit();
                    return("");
                }
                else
                {
                    var SC = CNCMachineRepository.GetFirstOrDefault(m => m.CNCMachineUID == dto.CNCMachineUID);

                    SC.Plant_Organization_UID    = dto.Plant_Organization_UID;
                    SC.BG_Organization_UID       = dto.BG_Organization_UID;
                    SC.FunPlant_Organization_UID = dto.FunPlant_Organization_UID;
                    if (EQP_Uid != 0)
                    {
                        SC.EQP_Uid = EQP_Uid;
                    }
                    else
                    {
                        SC.EQP_Uid = null;
                    }
                    SC.Machine_Name  = dto.Machine_Name;
                    SC.Machine_ID    = dto.Machine_ID;
                    SC.Project_UID   = dto.Project_UID;
                    SC.Is_Enable     = dto.Is_Enable;
                    SC.Modified_UID  = dto.Modified_UID;
                    SC.Modified_Date = dto.Modified_Date;

                    CNCMachineRepository.Update(SC);
                    _unitOfWork.Commit();

                    return("0");
                }
            }
            catch (Exception e)
            {
                return("保存失败:" + e.Message);
            }
        }
예제 #3
0
        public IHttpActionResult DoAllExportCNCMachineReprotAPI(CNCMachineDTO search)
        {
            var result = cNCMachineService.DoAllExportCNCMachineReprot(search);

            return(Ok(result));
        }
예제 #4
0
 public List <CNCMachineReportDTO> DoAllExportMachineReport(CNCMachineDTO searchModel)
 {
     return(CNCMachineRepository.DoAllExportMachineReport(searchModel));
 }
예제 #5
0
 public string AddOrEditCNCMachineAPI(CNCMachineDTO dto)
 {
     return(cNCMachineService.AddOrEditCNCMachineAPI(dto));
 }