Exemple #1
0
        private void frmBOR_Load(object sender, EventArgs e)
        {
            string[]                gubun          = { "공정명" };
            ProductService          pService       = new ProductService();
            List <ComboItemVO>      allProcessItem = pService.GetProcessInfoByCodeTypes(gubun);
            List <ProdCBOBindingVO> allProItem     = pService.GetProductInfo();
            MachineService          mService       = new MachineService();
            List <MachineVO>        allMachineItem = mService.GetMachineInfo();



            CommonUtil.ComboBinding(cboProcess, allProcessItem, "공정명");
            CommonUtil.ProdNameBinding(cboProduct, allProItem);
            CommonUtil.MachineNameBinding(cboMachine, allMachineItem);

            CommonUtil.SetInitGridView(dgvBOR);
            CommonUtil.AddGridTextColumn(dgvBOR, "BOR_ID", "bor_id", 60);
            CommonUtil.AddGridTextColumn(dgvBOR, "품목ID", "product_id", 150);
            CommonUtil.AddGridTextColumn(dgvBOR, "품목명", "product_name", 150);
            CommonUtil.AddGridTextColumn(dgvBOR, "공정명", "process_name", 150);
            CommonUtil.AddGridTextColumn(dgvBOR, "설비ID", "m_id", 150);
            CommonUtil.AddGridTextColumn(dgvBOR, "설비명", "m_name", 150);
            CommonUtil.AddGridTextColumn(dgvBOR, "Tact_Time", "bor_tacttime", 150);
            CommonUtil.AddGridTextColumn(dgvBOR, "사용유무", "bor_yn", 60);
            CommonUtil.AddGridTextColumn(dgvBOR, "비고", "bor_comment", 200);
            CommonUtil.AddGridTextColumn(dgvBOR, "수정자", "bor_uadmin", 120);
            CommonUtil.AddGridTextColumn(dgvBOR, "수정일", "bor_udate", 120);

            DGV_Binding();
        }
Exemple #2
0
 public MachineUser[] ProcedureTest()
 {
     using (var service = new MachineService())
     {
         return(service.GetMachinesByProcudeure());
     }
 }
Exemple #3
0
 public EgressUnit Procedure()
 {
     using (var service = new MachineService())
     {
         return(service.GetEgressByProcudeure());
     }
 }
        public async void Update_ErrorsOccurred_ShouldReturnErrorResponse()
        {
            var mock          = new ServiceMockFacade <IMachineService, IMachineRepository>();
            var model         = new ApiMachineServerRequestModel();
            var validatorMock = new Mock <IApiMachineServerRequestModelValidator>();

            validatorMock.Setup(x => x.ValidateUpdateAsync(It.IsAny <int>(), It.IsAny <ApiMachineServerRequestModel>())).Returns(Task.FromResult(new ValidationResult(new List <ValidationFailure>()
            {
                new ValidationFailure("text", "test")
            })));
            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Machine()));
            var service = new MachineService(mock.LoggerMock.Object,
                                             mock.MediatorMock.Object,
                                             mock.RepositoryMock.Object,
                                             validatorMock.Object,
                                             mock.DALMapperMockFactory.DALMachineMapperMock,
                                             mock.DALMapperMockFactory.DALLinkMapperMock);

            UpdateResponse <ApiMachineServerResponseModel> response = await service.Update(default(int), model);

            response.Should().NotBeNull();
            response.Success.Should().BeFalse();
            validatorMock.Verify(x => x.ValidateUpdateAsync(It.IsAny <int>(), It.IsAny <ApiMachineServerRequestModel>()));
            mock.MediatorMock.Verify(x => x.Publish(It.IsAny <MachineUpdatedNotification>(), It.IsAny <CancellationToken>()), Times.Never());
        }
Exemple #5
0
 public Machine Unreachable()
 {
     using (var service = new MachineService())
     {
         return(service.GetMachines().First());
     }
 }
Exemple #6
0
        //create machine service method
        private MachineService CreateMachineService()
        {
            Guid           userId  = Guid.Parse(User.Identity.GetUserId());
            MachineService service = new MachineService(userId);

            return(service);
        }
        public async Task LoadAsync(MachineDetailsArgs args)
        {
            ViewModelArgs = args ?? MachineDetailsArgs.CreateDefault();

            if (ViewModelArgs.IsNew)
            {
                Item       = new MachineModel();
                IsEditMode = true;
            }
            else
            {
                try
                {
                    var item = await MachineService.GetMachineAsync(ViewModelArgs.MachineID);

                    Item = item ?? new MachineModel {
                        MachineID = ViewModelArgs.MachineID, IsEmpty = true
                    };
                }
                catch (Exception ex)
                {
                    LogException("Machine", "Load", ex);
                }
            }
        }
Exemple #8
0
        //一键补货
        public ResultObj <int> PostFullFilByOneKey(string machineId)
        {
            // lstCommandModel的第一条消息为机器编号
            if (!MachineHelper.IsOnline(machineId))
            {
                return(Content(0));
            }

            IMachine _IMachine = new MachineService();
            int      result    = _IMachine.GetFullfilGood(machineId);

            if (result == 1)
            {
                List <CommandModel> lstCommand = new List <CommandModel>();
                lstCommand.Add(new CommandModel()
                {
                    Content = machineId,
                    Size    = 12
                });

                //var log = LogManager.GetLogger("FycnApi", "weixin");
                //log.Info("test");
                //log.Info(tradeNoNode.InnerText);
                SocketHelper.GenerateCommand(11, 13, 84, lstCommand);
            }
            return(Content(result));
        }
Exemple #9
0
        private void LoadDate()
        {
            //로드 때 갖고오지 못하게 하기
            cmbMachines.SelectedIndexChanged  -= CmbMachines_SelectedIndexChanged;
            cmbEmployees.SelectedIndexChanged -= CmbEmployees_SelectedIndexChanged;

            // 직원 콤보 로드
            EmployeesService          eService  = new EmployeesService();
            BindingList <EmployeeDTO> ebindlist = new BindingList <EmployeeDTO>(eService.SelectAll().Where((elem) => (elem.Authority | 0b0001) == 0b0001).ToList());

            eService.Dispose();
            cmbEmployees.DataSource = ebindlist;

            // 기계 콤보 로드
            MachineService           mService  = new MachineService();
            BindingList <MachineDTO> mbindlist = new BindingList <MachineDTO>(mService.SelectAll());

            mService.Dispose();
            cmbMachines.DataSource = mbindlist;

            // 이벤트 재활성화
            cmbMachines.SelectedIndexChanged  += CmbMachines_SelectedIndexChanged;
            cmbEmployees.SelectedIndexChanged += CmbEmployees_SelectedIndexChanged;

            // 데이터그리드뷰 로드
            LoadDgvs();
        }
        public void ShouldChangeTheCreditInsideMachine()
        {
            var machineService = new MachineService(new ProductRepository());

            machineService.AddCredit(new Money(1, 0, 0, 0));

            Assert.AreEqual(machineService.Machine.CreditMoney.Total, Money.TenCent.Total);
        }
Exemple #11
0
        static void Main(string[] args)
        {
            MachineService proxy      = new MachineService();
            string         serverName = proxy.getMachineNameAndOS();

            Console.WriteLine("Server: " + serverName);
            Console.ReadLine();
        }
 public SubAssemblyController(LineService lineService, SiteService siteService, PlantService plantService, MachineService machineService, SubAssemblyService SubAssemblyService)
 {
     this._lineService        = lineService;
     this._siteService        = siteService;
     this._plantService       = plantService;
     this._machineService     = machineService;
     this._SubAssemblyService = SubAssemblyService;
 }
Exemple #13
0
        public PartController(PartService partService, PlantService plantService, MachineService machineService, LineService lineService)
        {
            //  this._lineService = lineService;

            this._partService    = partService;
            this._plantService   = plantService;
            this._machineService = machineService;
            this._lineService    = lineService;
        }
Exemple #14
0
 public AuditTaskController(MaintenanceRequestServices mrServices, StatusServices statusService, SiteService siteService, PlantService plantService, MachineService machineService, UserService userService)
 {
     this._mrServices     = mrServices;
     this._statusService  = statusService;
     this._siteService    = siteService;
     this._plantService   = plantService;
     this._machineService = machineService;
     this._userService    = userService;
 }
Exemple #15
0
 private async Task <IList <MachineModel> > GetItemsAsync()
 {
     if (!ViewModelArgs.IsEmpty)
     {
         DataRequest <MachineModel> request = BuildDataRequest();
         return(await MachineService.GetMachinesAsync(request));
     }
     return(new List <MachineModel>());
 }
Exemple #16
0
        public async Task <IHttpActionResult> GetMachineById([FromUri] int id)
        {
            //instantiate service
            MachineService service = CreateMachineService();

            List <MachineListItem> machine = await service.GetMachineById(id);

            return(Ok(machine)); //200
        }
Exemple #17
0
        public async Task <IHttpActionResult> GetMachines()
        {
            //instantiate service
            MachineService service = CreateMachineService();

            List <MachineListItem> machines = await service.GetAllMachines();

            return(Ok(machines)); //200
        }
Exemple #18
0
        public async Task <IHttpActionResult> GetAllTasksForMachineById([FromUri] int id)
        {
            //instantiate service
            MachineService service = CreateMachineService();

            var result = await service.GetAllTasksForMachineById(id);

            return(Ok(result)); //200
        }
        public void ShouldReturnCorrectMachineStateObject()
        {
            var machineService = new MachineService(new ProductRepository());

            var machineState = machineService.GetMachineState();

            Assert.AreEqual(machineState.CreditMoney.Total, Money.Zero.Total);
            Assert.AreEqual(machineState.Products.Count, 4);
        }
Exemple #20
0
        public void ShouldResetTheCreditToZero()
        {
            var machineService = new MachineService(new ProductRepository());

            machineService.AddCredit(new Money(1, 0, 0, 0));
            machineService.CancelPurchase();


            Assert.AreEqual(machineService.Machine.CreditMoney.Total, Money.Zero.Total);
        }
Exemple #21
0
        public void ShouldUpdateMachineMoneyAndReturnMoney()
        {
            var machineService = new MachineService(new ProductRepository());

            machineService.AddCredit(new Money(1, 0, 0, 0));
            machineService.ResetCredit();


            Assert.AreEqual(machineService.Machine.CreditMoney.Total, Money.Zero.Total);
        }
Exemple #22
0
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            WPCSConfig.MachineNr = MachineNrTB.Text;
            WPCSConfig.MachineIP = MachineIPTB.Text;
            ApiConfig.Host       = ServerIPTB.Text;
            MachineService ms  = new MachineService();
            Msg <string>   msg = ms.SettingIP(WPCSConfig.MachineNr, WPCSConfig.MachineIP);

            MessageBox.Show(msg.Content);
        }
Exemple #23
0
 public MaintenanceRequestController(MaintenanceRequestServices mrServices, SiteService siteService, PlantService plantService, LineService lineService, MachineService machineService, MaintenancePriorityTypeServices mtpService, StatusServices statusService, UserService userService)
 {
     this._mrServices     = mrServices;
     this._siteService    = siteService;
     this._plantService   = plantService;
     this._lineService    = lineService;
     this._machineService = machineService;
     this._mtpService     = mtpService;
     this._statusService  = statusService;
     this._userService    = userService;
 }
Exemple #24
0
 public MachineController(SiteService siteService, PlantService plantService, MachineService machineService, LineService lineService,
                          DashboardService dashboardService, PreventiveReviewHistoryService preventiveReviewHistoryService, PreventiveMaintenanceService preventiveMaintenanceService)
 {
     this._lineService      = lineService;
     this._siteService      = siteService;
     this._plantService     = plantService;
     this._machineService   = machineService;
     this._dashboardService = dashboardService;
     this._preventiveReviewHistoryService = preventiveReviewHistoryService;
     this._preventiveMaintenanceService   = preventiveMaintenanceService;
 }
        public async void EnsureMachineIsNotFoundById()
        {
            var context = ContextMocker.GetContextMock();

            ContextMocker.SeedMachines(context);

            var machineService = new MachineService(context);

            var machineId = new Guid("11111111-2222-2222-2222-111111111111");

            await Assert.ThrowsAsync <KeyNotFoundException>(() => (machineService.GetMachineById(machineId)));
        }
Exemple #26
0
        public void TestRepoShouldNotBeCalledIfWatchIdIsNullOrEmpty(string watchId)
        {
            //Given
            var mockRepo = new Mock <IMachineRepository>();
            var service  = new MachineService(mockRepo.Object);

            //When
            mockRepo.Setup(mr => mr.ReadAllMachinesWithSubs(It.IsAny <string>())).Returns(It.IsAny <List <MachineWithSubscription> >());

            //Then
            Assert.Throws <InvalidDataException>(() => service.GetAllMachinesWithSubs(It.IsAny <string>()));
            mockRepo.Verify(mr => mr.ReadAllMachinesWithSubs(It.IsAny <string>()), Times.Never);
        }
Exemple #27
0
        private void comboBinding()
        {
            string[]                gubun          = { "공정명" };
            ProductService          pService       = new ProductService();
            List <ComboItemVO>      allProcessItem = pService.GetProcessInfoByCodeTypes(gubun);
            List <ProdCBOBindingVO> allProItem     = pService.GetProductInfo();
            MachineService          mService       = new MachineService();
            List <MachineVO>        allMachineItem = mService.GetMachineInfo();

            CommonUtil.ComboBinding(cboProcessName, allProcessItem, "공정명");
            CommonUtil.ProdNameBinding(cboProductName, allProItem);
            CommonUtil.MachineNameBinding(cboMachine, allMachineItem);
        }
Exemple #28
0
        private async Task PopulateDetails(MachineModel selected)
        {
            try
            {
                var model = await MachineService.GetMachineAsync(selected.MachineId);

                selected.Merge(model);
            }
            catch (Exception ex)
            {
                LogException("Products", "Load Details", ex);
            }
        }
Exemple #29
0
        public void ReadAllMachineFromMachineRepoShouldBeCalledOnce()
        {
            //Given
            var machineRepo = new Mock <IMachineRepository>();

            //When
            machineRepo.Setup(mr => mr.ReadAllMachines()).Returns(It.IsAny <List <AlarmSystem.Core.Entity.DB.Machine> >());
            var machineService = new MachineService(machineRepo.Object);

            machineService.GetMachines();

            //Then
            machineRepo.Verify(mr => mr.ReadAllMachines(), Times.Once);
        }
Exemple #30
0
        public void MethodShouldCallCreateMachineMethodFromRepoOnce()
        {
            //Given
            var machineRepo = new Mock <IMachineRepository>();

            //When
            machineRepo.Setup(mr => mr.CreateMachine(It.IsAny <AlarmSystem.Core.Entity.DB.Machine>()));

            var machineService = new MachineService(machineRepo.Object);

            machineService.CreateMachine();
            //Then
            machineRepo.Verify(mr => mr.CreateMachine(It.IsAny <AlarmSystem.Core.Entity.DB.Machine>()), Times.Once);
        }