public object GetGoodStorage(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string id = dicParas.ContainsKey("id") ? (dicParas["id"] + "") : string.Empty; if (string.IsNullOrEmpty(id)) { errMsg = "入库流水号不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } int iId = Convert.ToInt32(id); IData_GoodStorageService data_GoodStorageService = BLLContainer.Resolve <IData_GoodStorageService>(); if (!data_GoodStorageService.Any(a => a.ID == iId)) { errMsg = "该入库信息不存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } var result = from a in data_GoodStorageService.GetModels(p => p.ID == iId).FirstOrDefault().AsDictionary() select new { name = a.Key, value = a.Value }; return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, result)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object QueryGoodStorage(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, a.RealTime, a.UserID, b.RealName, a.StorageCount, a.Note from Data_GoodStorage a " + " left join Base_UserInfo b on a.UserID=b.UserID " + " where a.StoreID='" + storeId + "'"; sql = sql + sqlWhere; IData_GoodStorageService data_GoodStorageService = BLLContainer.Resolve <IData_GoodStorageService>(); var data_GoodStorage = data_GoodStorageService.SqlQuery <Data_GoodStorageList>(sql, parameters).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_GoodStorage)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object AddGoodStorage(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; string logId = userTokenKeyModel.LogId; string errMsg = string.Empty; string barCode = dicParas.ContainsKey("barCode") ? (dicParas["barCode"] + "") : string.Empty; string price = dicParas.ContainsKey("price") ? (dicParas["price"] + "") : string.Empty; string storageCount = dicParas.ContainsKey("storageCount") ? (dicParas["storageCount"] + "") : string.Empty; string totalPrice = dicParas.ContainsKey("totalPrice") ? (dicParas["totalPrice"] + "") : string.Empty; string discount = dicParas.ContainsKey("discount") ? (dicParas["discount"] + "") : string.Empty; string note = dicParas.ContainsKey("note") ? (dicParas["note"] + "") : string.Empty; #region 参数验证 if (string.IsNullOrEmpty(barCode)) { errMsg = "商品条码barCode不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(price)) { errMsg = "入库单价price不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(storageCount)) { errMsg = "入库数量storageCount不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(totalPrice)) { errMsg = "入库总额totalPrice不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.isNumber(storageCount)) { errMsg = "入库数量storageCount格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.IsDecimal(price)) { errMsg = "入库单价price格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.IsDecimal(totalPrice)) { errMsg = "入库总额totalPrice格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!string.IsNullOrEmpty(discount) && !Utils.IsDecimal(discount)) { errMsg = "优惠金额discount格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } #endregion IData_GoodStorageService data_GoodStorageService = BLLContainer.Resolve <IData_GoodStorageService>(); var data_GoodStorage = new Data_GoodStorage(); Utils.GetModel(dicParas, ref data_GoodStorage); data_GoodStorage.StoreID = storeId; data_GoodStorage.RealTime = DateTime.Now; data_GoodStorage.UserID = Convert.ToInt32(logId); if (!data_GoodStorageService.Add(data_GoodStorage)) { errMsg = "添加商品入库信息失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn)); } catch (DbEntityValidationException e) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, e.EntityValidationErrors.ToErrors())); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }