public RespUserInfo(IDbName database, string rfid) { employeeQuery = new EmployeeQuery(database); var employee = employeeQuery.GetEmployee(rfid); if (employee == null) { Exception = new RespException(true, "Invalid RFID number", EKB_SYS_REQUEST.GET_USER_INFO); return; } id = employee.id; UserName = ShareFuncs.ConvertToUnSign(employee.Name); Pass = true; UserCode = employee.UserCode; UserRFID = employee.RFID_Code; Department = employee.Department.Code; JobTitle = employee.JobTitle.Job; }
public EKanbanResponse(IDbName _database, int _ekanbanDeviceId) { EKanbanTaskQuery eKanbanTaskQuery = new EKanbanTaskQuery(_database); SequenceQuery sequenceQuery = new SequenceQuery(_database); ComponentQuery componentQuery = new ComponentQuery(_database); var ekanbanDevice = eKanbanTaskQuery.GetEKanbanDevice(_ekanbanDeviceId); var _Interface = eKanbanTaskQuery.GetLastEKanbanInterface(_ekanbanDeviceId); SizeList = new List <SizeInfo>(); PartList = new List <PartInfo>(); List <OriginalSize> originalSizes = new List <OriginalSize>(); foreach (var item in _Interface.EKanbanLoadings) { var Seq = sequenceQuery.GetOriginalSequence(ShareFuncs.GetInt(item.OriginalSequence_Id)); TotalCartQty += ShareFuncs.GetInt(Seq.Quantity); foreach (var size in Seq.OriginalSizes) { originalSizes.Add(size); } } foreach (var item in originalSizes) { var foundSizes = SizeList.Where(i => i.SizeId == item.SizeId); if (foundSizes.Count() > 0) { foundSizes.First().SizeQty += ShareFuncs.GetInt(item.Quantity); } else { SizeList.Add(new SizeInfo(ShareFuncs.GetInt(item.SizeId), ShareFuncs.GetInt(item.Quantity))); } } Interface = new InterfaceInfo(_Interface); foreach (var item in _Interface.EkanbanComponents) { var Component = componentQuery.GetShoeComponent(ShareFuncs.GetInt(item.ShoeComponent_Id)); PartList.Add(new PartInfo(ShareFuncs.ConvertToUnSign(Component.Reference))); } //if (DateTime.Now.Hour == 17) //{ // if (DateTime.Now.Minute > 50) // { // ScreenOff = true; // ekanbanDevice.ScreenOff = true; // } //} //else //{ // if (DateTime.Now.Hour > 17) // { // ScreenOff = true; // ekanbanDevice.ScreenOff = true; // } //} //if (DateTime.Now.Hour == 6 && DateTime.Now.Minute < 45) //{ // ScreenOff = false; // ekanbanDevice.ScreenOff = false; //} ekanbanDevice.NetworkStatus = (int)SYS_MODELS._ENUM.SysActionCode.ONLINE; ekanbanDevice.LastOnline = DateTime.Now; eKanbanTaskQuery.UpdateEKanbanDevice(ekanbanDevice); if (ekanbanDevice.ScreenOff == null) { ScreenOff = false; } else { ScreenOff = (bool)ekanbanDevice.ScreenOff; } }
public BLastCut(IDbName database, int bdeviceId, int bInterfaceId) { BeamCutQuery = new BeamCutQuery(database); StockQuery = new StockQuery(database); EmployeeQuery = new EmployeeQuery(database); SequenceQuery = new SequenceQuery(database); ScheduleQuery = new ScheduleQuery(database); ComponentQuery = new ComponentQuery(database); try { var bInterface = BeamCutQuery.GetLastInterface(bdeviceId); if (bInterface == null) { Exception = new RespException(true, "Can not find BInterface", EKB_SYS_REQUEST.BEAM_GET_LAST_CUT); bInterface = BeamCutQuery.GetBeamInterfaceById(bInterfaceId); if (bInterface == null) { Exception = new RespException(true, "Can not find BInterface", EKB_SYS_REQUEST.BEAM_GET_LAST_CUT); return; } } var bpo = BeamCutQuery.GetBeamCutPo(ShareFuncs.GetInt(bInterface.BeamCutPo_Id)); if (bpo == null) { Exception = new RespException(true, "Can not find clone Po", EKB_SYS_REQUEST.BEAM_GET_LAST_CUT); return; } var originalPo = SequenceQuery.GetOriginalPo(ShareFuncs.GetInt(bInterface.OriginalPo_Id)); if (originalPo == null) { Exception = new RespException(true, "Can not find Po", EKB_SYS_REQUEST.BEAM_GET_LAST_CUT); return; } BinterfaceId = bInterface.id; PoNumber = originalPo.PoNumber; StartSeq = ShareFuncs.GetInt(bInterface.StartSeqNo); StopSeq = ShareFuncs.GetInt(bInterface.StopSeqNo); if (bInterface.StartCutTime != null) { StartTime = ((DateTime)bInterface.StartCutTime).ToString("hh:mm tt, dd/MM/yyyy"); } if (bInterface.StopCutTime != null) { StopTime = ((DateTime)bInterface.StopCutTime).ToString("hh:mm tt, dd/MM/yyyy"); } CutQty = ShareFuncs.GetInt(bInterface.CuttingQty); CutTime = ShareFuncs.GetInt(bInterface.BeamCutCounter); Employee_Id = ShareFuncs.GetInt(bInterface.Employee_Id); Schedule_Id = ShareFuncs.GetInt(bInterface.Schedule_Id); BeamCutPo_Id = ShareFuncs.GetInt(bInterface.BeamCutPo_Id); BeamCutStartSeq_Id = ShareFuncs.GetInt(bInterface.BeamCutStartSeq_Id); Component_Id = ShareFuncs.GetInt(bpo.Component_Id); BeamCutStopSeq_Id = ShareFuncs.GetInt(bInterface.BeamCutStopSeq_Id); Finish = bInterface.Finish != null ? (bool)bInterface.Finish : false; PoQty = ShareFuncs.GetInt(originalPo.Quantity); OriginalPo_Id = ShareFuncs.GetInt(bInterface.OriginalPo_Id); var component = ComponentQuery.GetShoeComponent(ShareFuncs.GetInt(bpo.Component_Id)); if (component != null) { string comp = ShareFuncs.ConvertToUnSign(component.Reference); Component = comp; } Exception = new RespException(false, "Get last cut: OK", EKB_SYS_REQUEST.BEAM_GET_LAST_CUT); } catch (Exception e) { Exception = new RespException(true, e.Message, EKB_SYS_REQUEST.BEAM_GET_LAST_CUT); } }
public Component_t(ShoeComponent _component) { id = _component.Id; Name = ShareFuncs.ConvertToUnSign(_component.Reference); }
public RespUserInfo(IDbName database, NewUser new_user) { employeeQuery = new EmployeeQuery(database); var checkUser = employeeQuery.GetEmployee(new_user.RFID); if (checkUser != null) { Exception = new RespException(true, "Worker has been added", EKB_SYS_REQUEST.GET_USER_INFO); return; } var temp1 = employeeQuery.GetEmployee(new_user.Code); int id = 0; if (temp1 != null) { temp1.RFID_Code = new_user.RFID; employeeQuery.UpdateEmployee(temp1); id = temp1.id; } else { var dep = employeeQuery.GetDepartment(new_user.Dep); if (dep == null) { dep = employeeQuery.AddNewDepartment(new_user.Dep); if (dep == null) { Exception = new RespException(true, "Can not add new department", EKB_SYS_REQUEST.GET_USER_INFO); return; } } Employee employee = new Employee { Name = new_user.Name, RFID_Code = new_user.RFID, Department_Id = dep.id, Position_Id = 3, JobTitle_Id = 2, Building_Id = 1, UserCode = new_user.Code, }; var NewEmployee = employeeQuery.AddNewBeamWorker(employee); if (NewEmployee == null) { Exception = new RespException(true, "Can not add new user", EKB_SYS_REQUEST.GET_USER_INFO); return; } id = NewEmployee.id; } var empl = employeeQuery.GetEmployee(id); id = empl.id; UserName = ShareFuncs.ConvertToUnSign(empl.Name); Pass = true; UserCode = empl.UserCode; UserRFID = empl.RFID_Code; Department = empl.Department.Code; JobTitle = empl.JobTitle.Job; }