/// <summary>
        /// Search inventory instrument.
        /// </summary>
        /// <param name="Cond"></param>
        /// <param name="SourceOffice"></param>
        /// <param name="IntAreaComboData"></param>
        /// <returns></returns>
        public ActionResult IVS060_SearchInventoryInstrumentList(IVS060_SearchInstCond Cond, string SourceOffice, string IntAreaComboData)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                IVS060_ScreenParameter prm = GetScreenObject <IVS060_ScreenParameter>();

                if (prm.lstTransferInstrument == null)
                {
                    prm.lstTransferInstrument = new List <IVS060INST>();
                }

                ValidatorUtil.BuildErrorMessage(res, this, new object[] { Cond });
                if (res.IsError)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    return(Json(res));
                }
                if (Cond.SourceOffice == Cond.DestinationOffice)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4014, null, new string[] { "SourceOffice", "DestinationOffice" });
                    return(Json(res));
                }

                prm.SourceOffice      = SourceOffice;
                prm.DestinationOffice = Cond.DestinationOffice;

                IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                doSearchInstrumentListCondition SearchCond = new doSearchInstrumentListCondition();
                SearchCond.OfficeCode   = Cond.SourceOffice;
                SearchCond.LocationCode = InstrumentLocation.C_INV_LOC_INSTOCK;
                if (Cond.AreaCode == null)
                {
                    SearchCond.AreaCode = IntAreaComboData;
                }
                else
                {
                    SearchCond.AreaCode = Cond.AreaCode;
                }
                SearchCond.ShelfType      = ShelfType.C_INV_SHELF_TYPE_NORMAL;
                SearchCond.Instrumentcode = Cond.InstrumentCode;
                SearchCond.InstrumentName = Cond.InstrumentName;
                List <dtSearchInstrumentListResult> lstResult = InvH.SearchInventoryInstrumentList(SearchCond);

                if (lstResult.Count <= 0)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                }

                UpdateScreenObject(prm);
                res.ResultData = CommonUtil.ConvertToXml <dtSearchInstrumentListResult>(lstResult, "Inventory\\IVS060_Instrument", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex); return(Json(res));
            }
        }
コード例 #2
0
        /// <summary>
        /// Search instrument information
        /// </summary>
        /// <param name="Cond">Search condition object</param>
        /// <returns></returns>
        public ActionResult IVS210_SearchInventoryInstrument(IVS210SearchCond Cond)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {    //Valid Cond
                ValidatorUtil.BuildErrorMessage(res, this, new object[] { Cond });
                if (res.IsError)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    return(Json(res));
                }

                if (!string.IsNullOrEmpty(Cond.ShelfNoFrom) && !string.IsNullOrEmpty(Cond.ShelfNoTo) &&
                    Cond.ShelfNoFrom.CompareTo(Cond.ShelfNoTo) > 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4015, null, new string[] { "ShelfNoFrom", "ShelfNoTo" });
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    return(Json(res));
                }

                IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;

                IVS210_ScreenParameter param = GetScreenObject <IVS210_ScreenParameter>();

                doSearchInstrumentListCondition searchCon = new doSearchInstrumentListCondition();
                searchCon.OfficeCode     = Cond.Office;
                searchCon.LocationCode   = Cond.Location;
                searchCon.AreaCode       = Cond.InstArea;
                searchCon.StartShelfNo   = Cond.ShelfNoFrom;
                searchCon.EndShelfNo     = Cond.ShelfNoTo;
                searchCon.Instrumentcode = Cond.InstCode;
                searchCon.InstrumentName = Cond.InstName;

                List <dtSearchInstrumentListResult> lstResult = InvH.SearchInventoryInstrumentListAllShelf(searchCon);

                if (lstResult.Count <= 0)
                {
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    return(Json(res));
                }
                else if (lstResult.Count > 1000)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4004);
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    return(Json(res));
                }

                res.ResultData = CommonUtil.ConvertToXml <dtSearchInstrumentListResult>(lstResult, "inventory\\IVS210_Instrument", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
                return(Json(res));
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex); return(Json(res));
            }
        }
        /// <summary>
        /// Search instrument in location returned w/h.
        /// </summary>
        /// <returns></returns>
        public ActionResult IVS140_SearchResponse(doSearchInstrumentListCondition cond)
        {
            List <dtSearchInstrumentListResult> list = new List <dtSearchInstrumentListResult>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                //Validate #1
                if (CommonUtil.IsNullAllField(cond))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                }

                // Business validate

                IVS140_ScreenParameter param = GetScreenObject <IVS140_ScreenParameter>();

                if (param != null)
                {
                    // Prepare search condition
                    cond.OfficeCode      = param.HeaderOffice[0].OfficeCode;
                    cond.LocationCode    = InstrumentLocation.C_INV_LOC_RETURNED;
                    cond.ShelfType       = ShelfType.C_INV_SHELF_TYPE_NORMAL;
                    cond.ExcludeAreaCode = new List <string>()
                    {
                        InstrumentArea.C_INV_AREA_SE_LENDING_DEMO
                    };

                    IInventoryHandler handlerInventory = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                    list = handlerInventory.SearchInventoryInstrumentList(cond);
                }
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            res.ResultData = CommonUtil.ConvertToXml <dtSearchInstrumentListResult>(list, "Inventory\\IVS140_SearchResult", CommonUtil.GRID_EMPTY_TYPE.SEARCH);
            return(Json(res));
        }