コード例 #1
0
        /// <summary>
        /// Weight Action
        /// </summary>
        /// <param name="uniqueGuid">Unique GUID</param>
        /// <param name="patientId">Patient ID</param>
        /// <returns></returns>
        public ActionResult Weight(string uniqueGuid, int patientId)
        {
            WeightDataViewModel weightDataViewModel = new WeightDataViewModel();

            try
            {
                weightDataViewModel = new WeightDataHelper(uniqueGuid, patientId).GetViewModel();
                ViewBag.Error       = "";
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
            }
            return(View(weightDataViewModel));
        }
コード例 #2
0
 public async Task <ResponseViewModel <WeightRecordViewModel> > UpdateWeightValue([FromBody] WeightDataViewModel weightDataViewModel)
 {
     return(await _weightService.UpdateWeightValue(weightDataViewModel));
 }
コード例 #3
0
        public async Task <ResponseViewModel <WeightRecordViewModel> > UpdateWeightValue(WeightDataViewModel weightDataViewModel)
        {
            ResponseViewModel <WeightRecordViewModel> response = new ResponseViewModel <WeightRecordViewModel>();

            try
            {
                WeightRecord weightRecord = new WeightRecord();
                Random       r            = new Random();
                //if (await _authService.CheckUserPermission(weightDataViewModel.employeeID, weightDataViewModel.employeeRFID, "UpdateWeightValue"))
                //{
                var weighNum = await _weightRecordRepository.GetManyAsync(wt => wt.gatepassID == weightDataViewModel.gatePassID && wt.isDelete == false);

                weightRecord.code          = r.Next().ToString();
                weightRecord.gatepassID    = weightDataViewModel.gatePassID;
                weightRecord.isDelete      = false;
                weightRecord.weighBridgeID = weightDataViewModel.weighBridgeID;
                weightRecord.weighBridge   = await _weighBridgeRepository.GetByIdAsync(weightDataViewModel.weighBridgeID);

                weightRecord.weightEmployeeID = weightDataViewModel.employeeID;
                weightRecord.employee         = await _employeeRepository.GetByIdAsync(weightDataViewModel.employeeID);

                weightRecord.weightTime                 = DateTime.Now;
                weightRecord.weightValue                = weightDataViewModel.weightValue;
                weightRecord.frontCameraCapturePath     = Constant.TruckCapturePath + weightDataViewModel.fontCameraName;
                weightRecord.gearCameraCapturePath      = Constant.TruckCapturePath + weightDataViewModel.gearCameraName;
                weightRecord.cabinCameraCapturePath     = Constant.TruckCapturePath + weightDataViewModel.cabinCameraName;
                weightRecord.containerCameraCapturePath = Constant.TruckCapturePath + weightDataViewModel.containerCameraName;
                weightRecord.weightNo = weighNum.Count() + 1;
                var gatePass = await _gatePassRepository.GetAsync(gt => gt.ID == weightDataViewModel.gatePassID && gt.isDelete == false);

                if (gatePass.stateID == GatepassState.STATE_FINISH_SECURITY_CHECK_IN)
                {
                    gatePass.stateID = GatepassState.STATE_FINISH_WEIGHT_IN;
                }
                else if (gatePass.stateID == GatepassState.STATE_FINISH_WAREHOUSE_CHECK_OUT)
                {
                    gatePass.stateID = GatepassState.STATE_FINISH_WEIGHT_OUT;
                }
                _gatePassRepository.Update(gatePass);
                _weightRecordRepository.Add(weightRecord);
                if (await _unitOfWork.SaveChangesAsync())
                {
                    response = ResponseConstructor <WeightRecordViewModel> .ConstructBoolRes(ResponseCode.SUCCESS, true);
                }
                else
                {
                    response = ResponseConstructor <WeightRecordViewModel> .ConstructBoolRes(ResponseCode.ERR_SEC_UNKNOW, false);
                }
                //}
                //else
                //{
                //    response = ResponseConstructor<WeightRecordViewModel>.ConstructBoolRes(ResponseCode.ERR_WEI_WEIGH_NOT_PERMITTED, false);
                //}
                return(response);
            }
            catch (Exception)
            {
                return(response = ResponseConstructor <WeightRecordViewModel> .ConstructBoolRes(ResponseCode.ERR_SEC_UNKNOW, false));
            }
        }