private void btnReset_Click(object sender, EventArgs e) { try { var line = (LineModel)cboChuyen.SelectedItem; if (line != null) { if (frmMainNew.KeypadQuantityProcessingType == 0) { HelperControl.ResetKeypad(line.MaChuyen, radioGroup1.SelectedIndex == 1 ? true : false, frmMainNew); } else { HelperControl.ResetKeypad_Moi(line.MaChuyen, radioGroup1.SelectedIndex == 1 ? true : false, frmMainNew); } } else { MessageBox.Show("Lỗi: Không thể khởi tạo thông tin KeyPad. Vì không có danh sách chuyền. Có thể bạn chưa chạy tiến trình tự động."); } } catch (Exception ex) { MessageBox.Show("Lỗi: " + ex.Message); } }
private void cbbChuyen_SelectedIndexChanged(object sender, EventArgs e) { try { txtLaoDongChuyen.Value = 0; numOff.Value = 0; numVacation.Value = 0; numPregnant.Value = 0; numNew.Value = 0; txtNangSuatLaoDong.Text = "0"; chkIsStopOnDay.Checked = false; LoadPCCToCbbSanPham(); GetDayInformationToGridView(); selectedLine = ((LineModel)cbbChuyen.SelectedItem); if (selectedLine != null) { TimeSpan timeinWork = HelperControl.TimeIsWorkAllDayOfLine(selectedLine.Shifts); if (timeinWork.TotalSeconds == 0) { MessageBox.Show("Chuyền chưa có thông tin giờ làm việc trong ngày. Vui lòng kiểm tra ca làm việc của chuyền", "Lỗi ca làm việc", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { secondsWorkOfLine = timeinWork.TotalSeconds; } } } catch (Exception ex) { MessageBox.Show("Lỗi: " + ex.Message); } }
/// <summary> /// new method date : 14/9/2016 - Hai /// </summary> /// <param name="sttChuyen_SanPham"></param> /// <param name="thoiGianCheTaoSanPham"></param> /// <param name="maChuyen"></param> private void SaveData(int sttChuyen_SanPham, double thoiGianCheTaoSanPham, int maChuyen) { try { // Kiem tra tinh trang cap nhap trang thai IsFinishBTPThoatChuyen // Update nhung row cap nhap sai hoac khong cap nhap chuyen_sanphamDAO.UpdateIsFinishBTPChuyen(); if (maChuyen != 0) { var thanhpham = new ThanhPhamModel(); thanhpham.Id = dailyWorkerInfoId; thanhpham.Ngay = selectedDate; thanhpham.STTChuyen_SanPham = sttChuyen_SanPham; thanhpham.CreatedDate = DateTime.Now; thanhpham.ShowLCD = chkbShowLCD.Checked; thanhpham.HieuSuat = double.Parse(numHieuSuat.Text); double nangSuatLaoDong = 0; double.TryParse(txtNangSuatLaoDong.Text, out nangSuatLaoDong); thanhpham.NangXuatLaoDong = nangSuatLaoDong; nangSuatLaoDong = 0; double.TryParse(txtLean.Text, out nangSuatLaoDong); thanhpham.LeanKH = nangSuatLaoDong; thanhpham.LaoDongChuyen = (int)txtLaoDongChuyen.Value; thanhpham.LDOff = (int)numOff.Value; thanhpham.LDNew = (int)numNew.Value; thanhpham.LDPregnant = (int)numPregnant.Value; thanhpham.LDVacation = (int)numVacation.Value; thanhpham.LineId = maChuyen; // Thông tin nang xuat var nangxuat = new NangXuat(); nangxuat.Ngay = selectedDate; nangxuat.STTCHuyen_SanPham = thanhpham.STTChuyen_SanPham; nangxuat.DinhMucNgay = (double)numDinhMucNgay.Value; // (float)Math.Round((thanhpham.NangXuatLaoDong * thanhpham.LaoDongChuyen), 1); nangxuat.NhipDoSanXuat = (float)Math.Round((((thoiGianCheTaoSanPham * 100) / double.Parse(numHieuSuat.Text)) / thanhpham.LaoDongChuyen), 1); nangxuat.TimeLastChange = DateTime.Now.TimeOfDay; nangxuat.IsStopOnDay = chkIsStopOnDay.Checked; if (nangxuat.IsStopOnDay) { nangxuat.TimeStopOnDay = DateTime.Now.TimeOfDay; } var chuyenSanPham = BLLAssignmentForLine.Instance.LayLuyKeTHandKeHoachTheoSTT(sttChuyen_SanPham); bool isEndDate = false; int soLuongConLai = chuyenSanPham.SanLuongKeHoach - chuyenSanPham.LuyKeTH; if (chuyenSanPham != null && soLuongConLai <= nangxuat.DinhMucNgay) { /// check lai DMNgay isEndDate = true; nangxuat.DinhMucNgay = soLuongConLai; // thanhpham.NangXuatLaoDong = nangxuat.DinhMucNgay / thanhpham.LaoDongChuyen; } nangxuat.IsEndDate = isEndDate; nangxuat.TGCheTaoSP = (int)((thoigianchetao * 100) / thanhpham.HieuSuat); thanhpham.NangSuatObj = nangxuat; if (thanhpham.NangXuatLaoDong > 0 && thanhpham.LaoDongChuyen > 0) { var rs = BLLProductivity.InsertOrUpdate_TP(thanhpham, frmMainNew.getBTPInLineByType, frmMainNew.calculateNormsdayType, frmMainNew.TypeOfCaculateDayNorms); if (rs.IsSuccess) { GetDayInformationToGridView(); ResetForm(); dailyWorkerInfoId = 0; SetProductivityWorker(); HelperControl.ResetKeypad(maChuyen, false, frmMainNew); } MessageBox.Show(rs.Messages[0].msg, rs.Messages[0].Title); } else { MessageBox.Show("Lỗi: Bạn chưa nhập đúng thông tin Năng Suất Lao Động hoặc Số Lao Động", "Lỗi thao tác", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Bạn chưa chọn chuyền sản xuất. Vui lòng thực hiện thao tác này...", "Lỗi thao tác", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show("Lỗi: " + ex.Message); } }
/// <summary> /// Инициализация. /// </summary> public void Init() { StartScreen = GameObject.Find("PnlStartScreen").GetComponent <StartScreenControl>(); StartScreen.Init(); StartScreen.Complete += StartScreen_OnComplete; Introduction = GameObject.Find("PnlIntroduction").GetComponent <IntroductionControl>(); Introduction.Init(MainManager.Instance.Persons.Select(p => p.Person).ToList()); Introduction.Complete += Introduction_OnComplete; Introduction.MenuClick += Control_OnMenuClick; Introduction.HelperShow += Control_OnHelperShow; Tasks = GameObject.Find("PnlTasks").GetComponent <TasksControl>(); Tasks.Init(); Tasks.Complete += Tasks_OnComplete; Tasks.MenuClick += Control_OnMenuClick; Tasks.HelperShow += Control_OnHelperShow; AR = GameObject.Find("PnlAR").GetComponent <ARControl>(); AR.Init(); AR.BackClick += AR_OnBackClick; AR.Complete += AR_OnComplete; AR.MenuClick += Control_OnMenuClick; Test = GameObject.Find("PnlTest").GetComponent <TestControl>(); Test.Init(); Test.BackClick += Test_OnBackClick; Test.Complete += Test_OnComplete; Test.MenuClick += Control_OnMenuClick; WrongAnswer = GameObject.Find("PnlWrongAnswer").GetComponent <WrongAnswerControl>(); WrongAnswer.Init(); WrongAnswer.Complete += WrongAnswer_OnComplete; WrongAnswer.MenuClick += Control_OnMenuClick; RightAnswer = GameObject.Find("PnlRightAnswer").GetComponent <RightAnswerControl>(); RightAnswer.Init(); RightAnswer.Complete += RightAnswer_OnComplete; RightAnswer.MenuClick += Control_OnMenuClick; RightAnswer.HelperShow += Control_OnHelperShow; EndScreen = GameObject.Find("PnlEndScreen").GetComponent <EndScreenControl>(); EndScreen.Init(); EndScreen.Complete += EndScreen_OnComplete; EndScreen.MenuClick += Control_OnMenuClick; EndScreen.HelperShow += Control_OnHelperShow; EndScreen.ExitClick += Control_OnExitClick; Menu = GameObject.Find("PnlMenu").GetComponent <MenuControl>(); Menu.Init(); Menu.BackClick += Menu_OnBackClick; Menu.Complete += Menu_OnComplete; Menu.HelperChange += Menu_OnHelperChange; Menu.ExitClick += Control_OnExitClick; Helper = GameObject.Find("PnlHelper").GetComponent <HelperControl>(); Helper.Init(); QuitConfirm = GameObject.Find("PnlQuitConfirm").GetComponent <QuitConfirm>(); QuitConfirm.Init(); QuitConfirm.Hide(); QuitConfirm.HelperShow += Control_OnHelperShow; QuitConfirm.Complete += QuitConfirm_OnComplete; AllControls = new List <BaseUIControl>(); AllControls.Add(StartScreen); AllControls.Add(Introduction); AllControls.Add(Tasks); AllControls.Add(AR); AllControls.Add(Test); AllControls.Add(WrongAnswer); AllControls.Add(RightAnswer); AllControls.Add(EndScreen); AllControls.Add(Menu); SetState(UIState.StartScreen); }