コード例 #1
0
        public ActionResult Index(bool?showInRetrivel)
        {
            var model = new UnassignMaterialViewModel()
            {
                ShowInRetrivel = showInRetrivel ?? false
            };

            return(View(model));
        }
コード例 #2
0
        //[SubmitButtonSelector(Name = "Restorage")]
        public ActionResult Restorage(UnassignMaterialViewModel unassignMaterialViewModel)
        {
            try
            {
                var terminalNo = _identityDomain.FindTerminalNo(HttpContext.User.Identity);

                if (!_storageOfWarehousePalletDomain.CheckStatusForTX31())
                {
                    return(Json(new
                    {
                        Success = false,
                        Message = MaterialResource.MSG18
                    }, JsonRequestBehavior.AllowGet));
                }
                if (!_storageOfWarehousePalletDomain.CheckedRecordInTM05(terminalNo))
                {
                    return(Json(new
                    {
                        Success = false,
                        Message = MaterialResource.MSG15
                    }, JsonRequestBehavior.AllowGet));
                }
                //	If there is no [tm14_device] record whose [f14_devicecode] is “ATW001”
                //or [f14_devicestatus] is “1” (Offline), [f14_devicestatus] is “2” (Error)
                //or [f14_usepermitclass] is “1” (Prohibited), the system will show error message using template MSG 16
                if (!_restorageOfMaterialDomain.IsValidDevice())
                {
                    // This can be confused with the validation error response.
                    //Response.Headers["x-process-error"] = MessageResource.MSG16;
                    //return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
                    return(Json(new
                    {
                        Success = false,
                        Message = MaterialResource.MSG16
                    }, JsonRequestBehavior.AllowGet));
                }

                /*
                 * 	If there is no Material Master DB whose [Material Code] is current [Material Code],
                 * the system will show error message using template MSG 17
                 */
                if (!_storageOfWarehousePalletDomain.CheckedRecordInTM01(unassignMaterialViewModel.MaterialCode))
                {
                    return(Json(new
                    {
                        Success = false,
                        Message = MaterialResource.MSG17
                    }, JsonRequestBehavior.AllowGet));
                }


                /*
                 * If there is no [TX31_MtrShfSts] record whose [F31_ShelfStatus] is “0” (empty shelf)
                 * and [F31_CmnShfAgnOrd] or [F31_LqdShfAgnOrd] are not blank,
                 * the system will show error message using template MSG 18 "
                 *
                 */
                if (!_storageOfWarehousePalletDomain.CheckStatusForTX31_1())
                {
                    return(Json(new
                    {
                        Success = false,
                        Message = MaterialResource.MSG18
                    }, JsonRequestBehavior.AllowGet));
                }


                // Find total item inputed from client.

                var restorageMaterialItems = new List <RestorageMaterialItem>();

                restorageMaterialItems.Add(new RestorageMaterialItem()
                {
                    MaterialLotNo = unassignMaterialViewModel.MaterialLotNo01,
                    Fraction      = unassignMaterialViewModel.Fraction01,
                    PackQuantity  = unassignMaterialViewModel.PackQuantity01,
                    PackUnit      = unassignMaterialViewModel.PackUnit01
                });
                if (!string.IsNullOrEmpty(unassignMaterialViewModel.MaterialLotNo02))
                {
                    restorageMaterialItems.Add(new RestorageMaterialItem()
                    {
                        MaterialLotNo = unassignMaterialViewModel.MaterialLotNo02,
                        Fraction      = unassignMaterialViewModel.Fraction02,
                        PackQuantity  = unassignMaterialViewModel.PackQuantity02,
                        PackUnit      = unassignMaterialViewModel.PackUnit02
                    });
                }

                if (!string.IsNullOrEmpty(unassignMaterialViewModel.MaterialLotNo03))
                {
                    restorageMaterialItems.Add(new RestorageMaterialItem()
                    {
                        MaterialLotNo = unassignMaterialViewModel.MaterialLotNo03,
                        Fraction      = unassignMaterialViewModel.Fraction03,
                        PackQuantity  = unassignMaterialViewModel.PackQuantity03,
                        PackUnit      = unassignMaterialViewModel.PackUnit03
                    });
                }


                if (!string.IsNullOrEmpty(unassignMaterialViewModel.MaterialLotNo04))
                {
                    restorageMaterialItems.Add(new RestorageMaterialItem()
                    {
                        MaterialLotNo = unassignMaterialViewModel.MaterialLotNo04,
                        Fraction      = unassignMaterialViewModel.Fraction04,
                        PackQuantity  = unassignMaterialViewModel.PackQuantity04,
                        PackUnit      = unassignMaterialViewModel.PackUnit04
                    });
                }

                if (!string.IsNullOrEmpty(unassignMaterialViewModel.MaterialLotNo05))
                {
                    restorageMaterialItems.Add(new RestorageMaterialItem()
                    {
                        MaterialLotNo = unassignMaterialViewModel.MaterialLotNo05,
                        Fraction      = unassignMaterialViewModel.Fraction05,
                        PackQuantity  = unassignMaterialViewModel.PackQuantity05,
                        PackUnit      = unassignMaterialViewModel.PackUnit05
                    });
                }
                _restorageOfMaterialDomain.RestoreMaterial(unassignMaterialViewModel.PalletNo,
                                                           unassignMaterialViewModel.MaterialCode, terminalNo, restorageMaterialItems);
                return(Json(new
                {
                    Success = true,
                }, JsonRequestBehavior.AllowGet));
                // TODO: Function needed completing due to lack of SRS explainations.
                // return View();
            }
            catch (Exception e)
            {
                return(Json(new
                {
                    Success = false,
                    Message = e.ToString()
                }, JsonRequestBehavior.AllowGet));
            }
        }