Exemplo n.º 1
0
        public ActionResult IsStoragable()
        {
            // Find terminal which sends the current request.
            var terminalNo = _identityService.FindTerminalNo(HttpContext.User.Identity);


            var checkConveyorStatus = _storageOfWarehousePalletDomain.CheckedRecordInTM05(terminalNo);

            if (!checkConveyorStatus)
            {
                return(Json(new { Success = false, Message = MaterialResource.MSG15 }));
            }

            // Check whether device is valid or not.
            var isValidDevice = _retrieveSupplierPalletDomain.IsValidDevice();

            if (!isValidDevice)
            {
                // The message can be confused with the validation error messages because of status 400.
                // Use this custom header to clarify it.
                //Response.Headers.Add("x-process-error", MessageResource.MSG16);

                //return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
                return(Json(new { Success = false, Message = MaterialResource.MSG16 }));
            }
            // TODO: _communicationService.FindConveyorCodeValidity(terminalNo);
            return(Json(new { Success = true }));
        }
        public ActionResult Retrieve(RetrievalOfSupplierPalletViewModel retrievalOfSupplierPalletViewModel)
        {
            var terminalNo          = _identityDomain.FindTerminalNo(HttpContext.User.Identity);
            var checkConveyorStatus = _storageOfWarehousePalletDomain.CheckedRecordInTM05(terminalNo);

            if (!checkConveyorStatus)
            {
                return(Json(new { Success = false, Message = MaterialResource.MSG15 }));
            }

            // Check whether device is valid or not.
            var isValidDevice = _retrieveSupplierPalletDomain.IsValidDevice();

            if (!isValidDevice)
            {
                // The message can be confused with the validation error messages because of status 400.
                // Use this custom header to clarify it.
                return(Json(new { Success = false, Message = MaterialResource.MSG16 }));
            }

            // As the parameters are valid. Analyze data and do Retrieval of Supplier Pallet function.
            _retrieveSupplierPalletDomain.ProcessSupplierPallet(retrievalOfSupplierPalletViewModel.SupplierCode,
                                                                retrievalOfSupplierPalletViewModel.RequestedRetrievalQuantity, terminalNo);

            // Nothing is wrong, tell the client the result is successful.
            return(Json(new { Success = true, Message = MaterialResource.MSG16 }));
        }