/// <summary> /// 查询分页 /// </summary> /// <returns></returns> public ActionResult GetPage() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); int PageIndex = WebUtil.GetFormValue <int>("PageIndex", 1); int PageSize = WebUtil.GetFormValue <int>("PageSize", 10); string MeasureName = WebUtil.GetFormValue <string>("MeasureName"); string MeasureNum = WebUtil.GetFormValue <string>("MeasureNum"); MeasureEntity entity = new MeasureEntity(); entity.MeasureName = MeasureName; entity.MeasureNum = MeasureNum; entity.CompanyID = CompanyID; PageInfo pageInfo = new PageInfo(); pageInfo.PageIndex = PageIndex; pageInfo.PageSize = PageSize; MeasureProvider provider = new MeasureProvider(CompanyID); List <MeasureEntity> list = provider.GetList(entity, ref pageInfo); DataListResult <MeasureEntity> result = new DataListResult <MeasureEntity>() { Code = (int)EResponseCode.Success, Message = "响应成功", Result = list, PageInfo = pageInfo }; return(Content(JsonHelper.SerializeObject(result))); }
/// <summary> /// 查询单位列表 /// </summary> /// <returns></returns> public ActionResult GetList() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); MeasureProvider provider = new MeasureProvider(CompanyID); List <MeasureEntity> list = provider.GetList(); DataListResult <MeasureEntity> result = new DataListResult <MeasureEntity>() { Code = (int)EResponseCode.Success, Message = "响应成功", Result = list }; return(Content(JsonHelper.SerializeObject(result))); }
/// <summary> /// 查询产品单位 /// </summary> /// <returns></returns> public ActionResult GetProductUnit() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); string ProductNum = WebUtil.GetFormValue <string>("ProductNum"); MeasureProvider provider = new MeasureProvider(CompanyID); List <MeasureEntity> listResult = provider.GetList(ProductNum); DataResult <List <MeasureEntity> > dataResult = new DataResult <List <MeasureEntity> >(); dataResult.Code = (int)EResponseCode.Success; dataResult.Message = "响应成功"; dataResult.Result = listResult; return(Json(dataResult, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 产品单位 /// </summary> /// <param name="MeasureNum"></param> /// <returns></returns> public static string GetMeasureNameList(string MeasureNum) { MeasureProvider provider = new MeasureProvider(); List <MeasureEntity> list = provider.GetList(); StringBuilder sb = new StringBuilder(); string template = "<option value='{0}' {1}>{2}</option>"; sb.AppendFormat(template, "", "", "请选择单位"); if (!list.IsNullOrEmpty()) { foreach (MeasureEntity measure in list) { sb.AppendFormat(template, measure.MeasureNum, measure.MeasureNum == MeasureNum ? "selected='selected'" : string.Empty, measure.MeasureName); } } return(sb.ToString()); }
public ActionResult GetMeasure() { string name = WebUtil.GetFormValue <string>("name", string.Empty); int pageIndex = WebUtil.GetFormValue <int>("pageIndex", 1); int pageSize = WebUtil.GetFormValue <int>("pageSize", 10); PageInfo pageInfo = new PageInfo() { PageIndex = 1, PageSize = pageSize }; MeasureProvider provider = new MeasureProvider(); MeasureEntity entity = new MeasureEntity(); entity.MeasureName = name; List <MeasureEntity> listResult = provider.GetList(entity, ref pageInfo); listResult = listResult.IsNull() ? new List <MeasureEntity>() : listResult; string json = ConvertJson.ListToJson <MeasureEntity>(listResult); this.ReturnJson.AddProperty("List", json); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return(Content(this.ReturnJson.ToString())); }
/// <summary> /// 修改 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Update(LocationEntity entity) { using (TransactionScope ts = new TransactionScope()) { string Key = string.Format(CacheKey.JOOSHOW_LOCATION_CACHE, this.CompanyID); if (entity.IsDefault == (int)EBool.Yes) { LocationEntity location = new LocationEntity(); location.IsDefault = (int)EBool.No; location.IncludeIsDefault(true); location.Where(a => a.LocalType == entity.LocalType) .And(a => a.CompanyID == this.CompanyID) ; this.Location.Update(location); LocationEntity temp = new LocationEntity(); temp.IsDefault = (int)EBool.No; temp.IncludeIsDefault(true); temp.Where(a => a.CompanyID == this.CompanyID); this.Location.Update(temp); } //绑定仓库信息 StorageProvider storageProvider = new StorageProvider(this.CompanyID); List <StorageEntity> listStorage = storageProvider.GetList(); listStorage = listStorage.IsNull() ? new List <StorageEntity>() : listStorage; if (entity.StorageNum.IsEmpty()) { StorageEntity storage = listStorage.FirstOrDefault(a => a.IsDefault == (int)EBool.Yes); if (storage != null) { entity.StorageNum = storage.StorageNum; entity.StorageType = storage.StorageType; } } else { StorageEntity storage = listStorage.FirstOrDefault(a => a.StorageNum == entity.StorageNum); if (storage != null) { entity.StorageType = storage.StorageType; } } if (entity.UnitName.IsEmpty() && !entity.UnitNum.IsEmpty()) { MeasureProvider provider = new MeasureProvider(this.CompanyID); List <MeasureEntity> listMeasure = provider.GetList(); listMeasure = listMeasure.IsNull() ? new List <MeasureEntity>() : listMeasure; MeasureEntity measureEntity = listMeasure.FirstOrDefault(a => a.SN == entity.UnitNum); entity.UnitName = measureEntity != null ? measureEntity.MeasureName : entity.UnitName; } entity.UnitNum = entity.UnitNum.IsEmpty() ? "" : entity.UnitNum; entity.UnitName = entity.UnitName.IsEmpty() ? "" : entity.UnitName; entity.Include(a => new { a.LocalBarCode, a.LocalName, a.StorageNum, a.StorageType, a.LocalType, a.Rack, a.Length, a.Width, a.Height, a.X, a.Y, a.Z, a.UnitNum, a.UnitName, a.Remark, a.IsForbid, a.IsDefault }); entity.Where(a => a.LocalNum == entity.LocalNum) .And(a => a.CompanyID == this.CompanyID) ; int line = this.Location.Update(entity); if (line > 0) { CacheHelper.Remove(Key); } ts.Complete(); return(line); } }