public async Task UpdateTruckOnWarehouseCheckOut() { TheoryWeighValueModel viewModel = new TheoryWeighValueModel(); var actualResult = await _warehouseService.UpdateTruckOnWarehouseCheckOut(null); Assert.IsFalse(actualResult.booleanResponse); }
public async Task UpdateTruckOnWarehouseCheckIn_NoRFID() { TheoryWeighValueModel viewModel = new TheoryWeighValueModel() { gatePassID = 1, employeeID = 1, theoryWeighValue = 1 }; var actualResult = await _warehouseService.UpdateTruckOnWarehouseCheckIn(viewModel); Assert.IsFalse(actualResult.booleanResponse); }
public async Task UpdateTheoryWeighValue_NoEmployeeId() { TheoryWeighValueModel viewModel = new TheoryWeighValueModel() { gatePassID = 1, employeeRFID = "0123", theoryWeighValue = 1 }; var actualResult = await _warehouseService.UpdateTheoryWeighValue(viewModel); Assert.IsFalse(actualResult.booleanResponse); }
public async Task <ResponseViewModel <GenericResponseModel> > UpdateTruckOnWarehouseCheckIn(TheoryWeighValueModel theoryWeighValueModel) { ResponseViewModel <GenericResponseModel> response = new ResponseViewModel <GenericResponseModel>(); try { if (await _authService.CheckUserPermission(theoryWeighValueModel.employeeID, theoryWeighValueModel.employeeRFID, "UpdateTruckOnWarehouseCheckIn")) { var gatePass = await _gatePassRepository.GetAsync(gt => gt.ID == theoryWeighValueModel.gatePassID && gt.isDelete == false); if (gatePass == null) { response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.ERR_QUE_NO_GATEPASS_FOUND, false); } else { if (gatePass.stateID == GatepassState.STATE_FINISH_WEIGHT_IN) { gatePass.stateID = GatepassState.STATE_FINISH_WAREHOUSE_CHECK_IN; var queue = await _queueListRepository.GetAsync(qu => qu.gatePassID == gatePass.ID); var lane = await _laneRepository.GetAsync(ln => ln.ID == queue.laneID); lane.usingStatus = LaneStatus.OCCUPIED; _laneRepository.Update(lane); _gatePassRepository.Update(gatePass); if (await _unitOfWork.SaveChangesAsync()) { response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.SUCCESS, true); } else { response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.ERR_SEC_UNKNOW, false); } } else { response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.ERR_QUE_GATEPASS_WRONG_STATE, false); } } } else { response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.ERR_USER_PERMISSION, false); } return(response); } catch (Exception) { return(response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.ERR_SEC_UNKNOW, false)); } }
public async Task <ResponseViewModel <GenericResponseModel> > UpdateTheoryWeighValue(TheoryWeighValueModel theoryWeighValueModel) { ResponseViewModel <GenericResponseModel> response = new ResponseViewModel <GenericResponseModel>(); try { if (await _authService.CheckUserPermission(theoryWeighValueModel.employeeID, theoryWeighValueModel.employeeRFID, "UpdateTheoryWeighValue")) { var gatePass = await _gatePassRepository.GetAsync(gt => gt.ID == theoryWeighValueModel.gatePassID && gt.isDelete == false); if (gatePass == null) { response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.ERR_QUE_NO_GATEPASS_FOUND, false); } else { gatePass.theoryWeightValue = theoryWeighValueModel.theoryWeighValue; _gatePassRepository.Update(gatePass); if (await _unitOfWork.SaveChangesAsync()) { response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.SUCCESS, true); } else { response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.ERR_SEC_UNKNOW, false); } } } else { response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.ERR_USER_PERMISSION, false); } return(response); } catch (Exception) { return(response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.ERR_SEC_UNKNOW, false)); } }
public async Task <ResponseViewModel <GenericResponseModel> > UpdateTruckOnWarehouseCheck(TheoryWeighValueModel theoryWeighValueModel) { ResponseViewModel <GenericResponseModel> response = new ResponseViewModel <GenericResponseModel>(); try { var gatePass = await _gatePassRepository.GetAsync(gt => gt.ID == theoryWeighValueModel.gatePassID && gt.isDelete == false, QueryIncludes.GATEPASSFULLINCLUDES); if (gatePass == null) { return(response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.ERR_SEC_UNKNOW, false)); } else { switch (gatePass.stateID) { case GatepassState.STATE_FINISH_WEIGHT_IN: return(await this.UpdateTruckOnWarehouseCheckIn(theoryWeighValueModel)); case GatepassState.STATE_FINISH_WAREHOUSE_CHECK_IN: return(await this.UpdateTruckOnWarehouseCheckOut(theoryWeighValueModel)); default: return(response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.ERR_SEC_UNKNOW, false)); } } } catch (Exception) { return(response = ResponseConstructor <GenericResponseModel> .ConstructBoolRes(ResponseCode.ERR_SEC_UNKNOW, false)); } }
public async Task <ResponseViewModel <GenericResponseModel> > UpdateTruckOnWarehouseCheck(TheoryWeighValueModel theoryWeighValueModel) { return(await _warehouseService.UpdateTruckOnWarehouseCheck(theoryWeighValueModel)); }