Esempio n. 1
0
        public object QueryGoodInventory(Dictionary <string, object> dicParas)
        {
            try
            {
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID;

                string   errMsg     = string.Empty;
                object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null;

                SqlParameter[] parameters = new SqlParameter[0];
                string         sqlWhere   = string.Empty;

                if (conditions != null && conditions.Length > 0)
                {
                    if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg))
                    {
                        return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                    }
                }

                string sql = @"select a.ID, c.DictKey as InventoryTypeStr, (case when a.InventoryType=1 then d.WorkStation when a.InventoryType=3 then e.HeadName else '' end) as InventoryIndexName, a.InventoryTime, a.UserID, b.RealName, a.InventoryCount, a.Note from Data_GoodInventory a " +
                             " left join Base_UserInfo b on a.UserID=b.UserID " +
                             " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='盘点类别' and a.PID=0) c on convert(varchar, a.InventoryType)=c.DictValue " +
                             " left join Data_Workstation d on a.InventoryType=1 and a.InventoryIndex=d.ID " +
                             " left join Data_Head e on a.InventoryType=3 and a.InventoryIndex=e.ID " +
                             " where a.StoreID='" + storeId + "'";
                sql = sql + sqlWhere;
                IData_GoodInventoryService data_GoodInventoryService = BLLContainer.Resolve <IData_GoodInventoryService>();
                var data_GoodInventory = data_GoodInventoryService.SqlQuery <Data_GoodInventoryList>(sql, parameters).ToList();

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_GoodInventory));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }