public JsonResult PickShelf(Constants.ExecutingClassification executingClassification, Constants.InquirySearchConditionWarehouseLocation type, string row, string bay, string level)
        {
            if (executingClassification == Constants.ExecutingClassification.Update)
            {
                var checkPermission = CheckPermission(type);
                if (!checkPermission.Item1)
                {
                    return(Json(new
                    {
                        Success = false,
                        Message = checkPermission.Item2
                    }, JsonRequestBehavior.AllowGet));
                }

                var shelfStatus = _inquiryCommonDomain.GetShelfStatus(type, row,
                                                                      bay, level);
                var shelfNo = string.Format("{0}-{1}-{2}", row, bay, level);
                var localtionMaterialStatusModelView = new InquiryByLocaltionMaterialStatusModelView
                {
                    ShelfNo         = shelfNo,
                    ShelfStatus     = shelfStatus,
                    ShelfRow        = row,
                    ShelfBay        = bay,
                    ShelfLevel      = level,
                    SearchCondition = type
                };
                if (type == Constants.InquirySearchConditionWarehouseLocation.Product)
                {
                    var sheftType = _inquiryCommonDomain.GetShelftypeTx51(row, bay,
                                                                          level);
                    if (sheftType == ((int)Constants.F51_ShelfType.BadUse).ToString())
                    {
                        localtionMaterialStatusModelView.ProductShelfType = Constants.F51_ShelfType.BadUse;
                    }
                    else
                    {
                        localtionMaterialStatusModelView.ProductShelfType = Constants.F51_ShelfType.Normal;
                    }
                }

                var result = RenderViewToString("_LocationMaterialStatusModal", localtionMaterialStatusModelView);
                return(Json(new
                {
                    Success = true,
                    Data = result
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                if (type == Constants.InquirySearchConditionWarehouseLocation.Material)
                {
                    var shelfStatus =
                        _inquiryCommonDomain.GetShelfStatus(Constants.InquirySearchConditionWarehouseLocation.Material,
                                                            row, bay, level);

                    if (string.IsNullOrEmpty(shelfStatus))
                    {
                        return(Json(new
                        {
                            Success = false,
                            Message = Constants.Messages.SystemManagement_TCSS000041
                        }, JsonRequestBehavior.AllowGet));
                    }

                    if (shelfStatus == ((int)Constants.TX31SheflStatus.TX31_MtrShfSts_Mtr).ToString()) //3
                    {
                        //Inquiry of Raw Material Shelf Status Picture2[TCFC032F]
                        #region TCFC032F
                        var result = CreateSubScreenTCF032F(executingClassification, type, row, bay, level, shelfStatus);
                        return(Json(new
                        {
                            Success = true,
                            Data = result
                        }, JsonRequestBehavior.AllowGet));

                        #endregion
                    }

                    if (shelfStatus == ((int)Constants.TX31SheflStatus.TX31_MtrShfSts_SplPlt).ToString()) //2
                    {
                        //Inquiry by Supplier Pallet [TCFC038F]
                        #region TCFC038F

                        var result = CreateSubScreenTCF038F(executingClassification, type, row, bay, level, shelfStatus);
                        return(Json(new
                        {
                            Success = true,
                            Data = result
                        }, JsonRequestBehavior.AllowGet));

                        #endregion
                    }

                    return(Json(new
                    {
                        Success = false,
                        Message = Constants.Messages.SystemManagement_TCSS000041
                    }, JsonRequestBehavior.AllowGet));
                }
                if (type == Constants.InquirySearchConditionWarehouseLocation.PreProduct)
                {
                    var shelfStatus = _inquiryCommonDomain.GetShelfStatus(type, row,
                                                                          bay, level);

                    if (shelfStatus == ((int)Constants.TX37SheflStatus.TX37_ShfSts_Stk).ToString())
                    {
                        //Pre-product Shelf Status Picture [TCFC034F] to continue
                        var result = CreateSubscreenTCFC034F(executingClassification, type, row, bay, level, shelfStatus);
                        return(Json(new
                        {
                            Success = true,
                            Data = result
                        }, JsonRequestBehavior.AllowGet));
                    }
                    else if (shelfStatus == ((int)Constants.TX37SheflStatus.TX37_ShfSts_EpyCtn).ToString())
                    {
                        //Pre-product Shelf Status Picture [Empty Container][TCFC03AF]
                        #region TCFC03AF

                        var result = CreateSubScreenTCF03AF(executingClassification, type, row, bay, level, shelfStatus);
                        return(Json(new
                        {
                            Success = true,
                            Data = result
                        }, JsonRequestBehavior.AllowGet));

                        #endregion
                    }

                    return(Json(new
                    {
                        Success = false,
                        Message = Constants.Messages.SystemManagement_TCSS000041
                    }, JsonRequestBehavior.AllowGet));
                }

                if (type == Constants.InquirySearchConditionWarehouseLocation.Product)
                {
                    var shelfStatus = _inquiryCommonDomain.GetShelfStatus(type, row,
                                                                          bay, level);
                    if (shelfStatus == Constants.TX51SheflStatus.TX51_ShfSts_Pdt.ToString("D"))
                    {
                        //Product Shelf Status Picture2[TCFC036F]
                        #region TCFC036F

                        var result = CreateSubScreenTCF036F(executingClassification, type, row, bay, level, shelfStatus);
                        return(Json(new
                        {
                            Success = true,
                            Data = result
                        }, JsonRequestBehavior.AllowGet));

                        #endregion
                    }

                    if (shelfStatus == ((int)Constants.TX51SheflStatus.TX51_ShfSts_ExtPrePdt).ToString())
                    {
                        //product Shelf Status Picture (External Pre-product) [TCFC037F]
                        #region TCFC037F

                        var result = CreateSubScreenTCF037F(executingClassification, type, row, bay, level, shelfStatus);
                        return(Json(new
                        {
                            Success = true,
                            Data = result
                        }, JsonRequestBehavior.AllowGet));

                        #endregion
                    }

                    if (shelfStatus == ((int)Constants.TX51SheflStatus.TX51_ShfSts_WhsPlt).ToString())
                    {
                        var shelfType = _inquiryCommonDomain.GetShelftypeTx51(row, bay, level);
                        if (shelfType == Constants.F51_ShelfType.Normal.ToString("D"))
                        {
                            //Product Shelf Status Picture (Empty Pallet) [TCFC03BF]
                            #region TCFC03BF

                            var result = CreateSubScreenTCF03BF(executingClassification, type, row, bay, level, shelfStatus);
                            return(Json(new
                            {
                                Success = true,
                                Data = result
                            }, JsonRequestBehavior.AllowGet));


                            #endregion
                        }
                        if (shelfType == Constants.F51_ShelfType.BadUse.ToString("D"))
                        {
                            var data = new InquiryOutOfSignPictureModelView
                            {
                                Grid = GenerateGrid()
                            };
                            var result = RenderViewToString("_OutOfSignPicture", data);
                            return(Json(new
                            {
                                Success = true,
                                Data = result
                            }, JsonRequestBehavior.AllowGet));
                        }
                    }

                    if (shelfStatus == ((int)Constants.TX51SheflStatus.TX51_ShfSts_BadPrePdt).ToString())
                    {
                        var data = new InquiryOutOfSignPictureModelView
                        {
                            Grid = GenerateGrid()
                        };
                        var result = RenderViewToString("_OutOfSignPicture", data);
                        return(Json(new
                        {
                            Success = true,
                            Data = result
                        }, JsonRequestBehavior.AllowGet));
                    }



                    return(Json(new
                    {
                        Success = false,
                        Message = Constants.Messages.SystemManagement_TCSS000041
                    }, JsonRequestBehavior.AllowGet));
                }

                return(Json(new
                {
                    Success = true,
                }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #2
0
        public ActionResult Search(InquiryByWarehouseLocationSearchViewModel model)
        {
            #region SearchCondition = Product & shelftype = 1
            if (model.SearchCondition == Constants.InquirySearchConditionWarehouseLocation.Product)
            {
                var shelftype = _inquiryCommonDomain.GetShelftypeTx51(model.ShelfNoRow, model.ShelfNoBay,
                                                                      model.ShelfNoLevel);
                if (shelftype == ((int)Constants.F51_ShelfType.BadUse).ToString())
                {
                    var data = new InquiryOutOfSignPictureModelView
                    {
                        Grid = GenerateGrid()
                    };
                    var result = RenderViewToString("_OutOfSignPicture", data);
                    return(Json(new
                    {
                        Success = true,
                        Data = result
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            #endregion
            #region ExecutingClassification = Update
            if (model.ExecutingClassification == Constants.ExecutingClassification.Update)
            {
                var checkPermission = CheckPermission(model.SearchCondition);
                if (!checkPermission.Item1)
                {
                    return(Json(new
                    {
                        Success = false,
                        Message = checkPermission.Item2
                    }, JsonRequestBehavior.AllowGet));
                }

                var shelfStatus = _inquiryCommonDomain.GetShelfStatus(model.SearchCondition, model.ShelfNoRow,
                                                                      model.ShelfNoBay, model.ShelfNoLevel);
                var shelfNo = string.Format("{0}-{1}-{2}", model.ShelfNoRow, model.ShelfNoBay, model.ShelfNoLevel);
                var localtionMaterialStatusModelView = new InquiryByLocaltionMaterialStatusModelView
                {
                    ShelfNo         = shelfNo,
                    ShelfStatus     = shelfStatus,
                    ShelfRow        = model.ShelfNoRow,
                    ShelfBay        = model.ShelfNoBay,
                    ShelfLevel      = model.ShelfNoLevel,
                    SearchCondition = model.SearchCondition
                };
                if (model.SearchCondition == Constants.InquirySearchConditionWarehouseLocation.Product)
                {
                    var sheftType = _inquiryCommonDomain.GetShelftypeTx51(model.ShelfNoRow, model.ShelfNoBay,
                                                                          model.ShelfNoLevel);
                    if (sheftType == Constants.F51_ShelfType.BadUse.ToString())
                    {
                        localtionMaterialStatusModelView.ProductShelfType = Constants.F51_ShelfType.BadUse;
                    }
                    else
                    {
                        localtionMaterialStatusModelView.ProductShelfType = Constants.F51_ShelfType.Normal;
                    }
                }

                var result = RenderViewToString("_LocationMaterialStatusModal", localtionMaterialStatusModelView);
                return(Json(new
                {
                    Success = true,
                    Data = result
                }, JsonRequestBehavior.AllowGet));
            }
            #endregion
            #region ExecutingClassification = Search
            if (model.ExecutingClassification == Constants.ExecutingClassification.Search)
            {
                if (model.SearchCondition == Constants.InquirySearchConditionWarehouseLocation.Material)
                {
                    var shelfStatus = _inquiryCommonDomain.GetShelfStatus(0, model.ShelfNoRow,
                                                                          model.ShelfNoBay, model.ShelfNoLevel);
                    if (shelfStatus == ((int)Constants.TX31SheflStatus.TX31_MtrShfSts_Mtr).ToString()) //3
                    {
                        #region TCFC032F
                        //Inquiry of Raw Material Shelf Status Picture2[TCFC032F]
                        var result = CreateSubScreenTCF032F(model.ExecutingClassification, model.SearchCondition, model.ShelfNoRow, model.ShelfNoBay,
                                                            model.ShelfNoLevel, shelfStatus);
                        return(Json(new
                        {
                            Success = true,
                            Data = result
                        }, JsonRequestBehavior.AllowGet));
                    }
                    #endregion
                    else if (shelfStatus == ((int)Constants.TX31SheflStatus.TX31_MtrShfSts_SplPlt).ToString()) //2
                    {
                        //Inquiry by Supplier Pallet [TCFC038F]
                        #region TCFC038F

                        var result = CreateSubScreenTCF038F(model.ExecutingClassification, model.SearchCondition, model.ShelfNoRow, model.ShelfNoBay,
                                                            model.ShelfNoLevel, shelfStatus);
                        return(Json(new
                        {
                            Success = true,
                            Data = result,
                        }, JsonRequestBehavior.AllowGet));

                        #endregion
                    }
                }
                if (model.SearchCondition == Constants.InquirySearchConditionWarehouseLocation.PreProduct)
                {
                    var shelfStatus = _inquiryCommonDomain.GetShelfStatus(model.SearchCondition, model.ShelfNoRow,
                                                                          model.ShelfNoBay, model.ShelfNoLevel);
                    #region TCFC034F
                    if (shelfStatus == ((int)Constants.TX37SheflStatus.TX37_ShfSts_Stk).ToString()) //"3"
                    {
                        //Pre-product Shelf Status Picture [TCFC034F] to continue
                        var result = CreateSubscreenTCFC034F(model.ExecutingClassification, model.SearchCondition, model.ShelfNoRow,
                                                             model.ShelfNoBay, model.ShelfNoLevel, shelfStatus);
                        return(Json(new
                        {
                            Success = true,
                            Data = result
                        }, JsonRequestBehavior.AllowGet));
                    }
                    #endregion
                    else if (shelfStatus == ((int)Constants.TX37SheflStatus.TX37_ShfSts_EpyCtn).ToString()) //"1"
                    {
                        //Pre-product Shelf Status Picture [Empty Container][TCFC03AF]
                        #region TCFC03AF

                        var result = CreateSubScreenTCF03AF(model.ExecutingClassification, model.SearchCondition, model.ShelfNoRow, model.ShelfNoBay, model.ShelfNoLevel, shelfStatus);
                        return(Json(new
                        {
                            Success = true,
                            Data = result
                        }, JsonRequestBehavior.AllowGet));

                        #endregion
                    }
                }
                if (model.SearchCondition == Constants.InquirySearchConditionWarehouseLocation.Product)
                {
                    var shelfStatus = _inquiryCommonDomain.GetShelfStatus(model.SearchCondition, model.ShelfNoRow,
                                                                          model.ShelfNoBay, model.ShelfNoLevel);
                    if (shelfStatus == ((int)Constants.TX51SheflStatus.TX51_ShfSts_Pdt).ToString()) // "2"
                    {
                        //Product Shelf Status Picture2[TCFC036F]
                        #region TCFC036F

                        var result = CreateSubScreenTCF036F(model.ExecutingClassification, model.SearchCondition, model.ShelfNoRow, model.ShelfNoBay,
                                                            model.ShelfNoLevel, shelfStatus);
                        return(Json(new
                        {
                            Success = true,
                            Data = result
                        }, JsonRequestBehavior.AllowGet));

                        #endregion
                    }

                    if (shelfStatus == ((int)Constants.TX51SheflStatus.TX51_ShfSts_ExtPrePdt).ToString()) // "8"
                    {
                        //product Shelf Status Picture (External Pre-product) [TCFC037F]
                        #region TCFC037F

                        var result = CreateSubScreenTCF037F(model.ExecutingClassification, model.SearchCondition, model.ShelfNoRow, model.ShelfNoBay,
                                                            model.ShelfNoLevel, shelfStatus);
                        return(Json(new
                        {
                            Success = true,
                            Data = result
                        }, JsonRequestBehavior.AllowGet));

                        #endregion
                    }

                    if (shelfStatus == ((int)Constants.TX51SheflStatus.TX51_ShfSts_WhsPlt).ToString()) //1
                    {
                        //Shelf Status Picture (Empty Pallet) [TCFC03BF]
                        #region TCFC03BF

                        var result = CreateSubScreenTCF03BF(model.ExecutingClassification, model.SearchCondition, model.ShelfNoRow, model.ShelfNoBay,
                                                            model.ShelfNoLevel, shelfStatus);
                        return(Json(new
                        {
                            Success = true,
                            Data = result
                        }, JsonRequestBehavior.AllowGet));

                        #endregion
                    }
                }

                return(Json(new
                {
                    Success = false,
                    Message = Constants.Messages.SystemManagement_TCSS000041
                }, JsonRequestBehavior.AllowGet));
            }

            #endregion
            return(Json(new
            {
                Success = false,
                Message = Constants.Messages.SystemManagement_TCSS000041
            }, JsonRequestBehavior.AllowGet));
        }