/// <summary> /// 新增单位 /// </summary> /// <returns></returns> public ActionResult Add() { string MeasureName = WebUtil.GetFormValue <string>("MeasureName"); string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); MeasureEntity entity = new MeasureEntity(); entity.MeasureName = MeasureName; entity.CompanyID = CompanyID; entity.SN = ConvertHelper.NewGuid(); entity.MeasureNum = new TNumProvider(CompanyID).GetSwiftNum(typeof(MeasureEntity), 5); MeasureProvider provider = new MeasureProvider(CompanyID); int line = provider.AddMeasure(entity); DataResult result = new DataResult(); if (line > 0) { result.Code = (int)EResponseCode.Success; result.Message = "单位新增成功"; } else { result.Code = (int)EResponseCode.Exception; result.Message = "单位新增失败"; } return(Content(JsonHelper.SerializeObject(result))); }
/// <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 AddPackage() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); string MeasureSource = WebUtil.GetFormValue <string>("MeasureSource"); string MeasureTarget = WebUtil.GetFormValue <string>("MeasureTarget"); double Rate = WebUtil.GetFormValue <double>("Rate", 1); string ProductNum = WebUtil.GetFormValue <string>("ProductNum"); MeasureRelEntity entity = new MeasureRelEntity(); entity.CompanyID = CompanyID; entity.MeasureSource = MeasureSource; entity.MeasureTarget = MeasureTarget; entity.Rate = Rate; entity.ProductNum = ProductNum; entity.SN = ConvertHelper.NewGuid(); MeasureProvider provider = new MeasureProvider(CompanyID); int line = provider.AddMeasureRel(entity); DataResult dataResult = new DataResult(); dataResult.Code = (int)EResponseCode.Success; dataResult.Message = "新增成功"; return(Json(dataResult, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 添加产品 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Add(ProductEntity entity) { string Key = string.Format(CacheKey.JOOSHOW_PRODUCT_CACHE, this.CompanyID); entity.IncludeAll(); entity.InPrice = entity.AvgPrice; entity.OutPrice = entity.AvgPrice; entity.SnNum = ConvertHelper.NewGuid(); entity.BarCode = entity.BarCode.IsEmpty() ? new TNumProvider(CompanyID).GetSwiftNum(typeof(ProductEntity), 6) : entity.BarCode; //处理类别 if (!entity.CateNum.IsEmpty()) { ProductCategoryEntity category = new ProductCategoryProvider(this.CompanyID).GetSingle(entity.CateNum); entity.CateName = category != null ? category.CateName : ""; } if (!entity.UnitNum.IsEmpty()) { MeasureEntity meaure = new MeasureProvider(this.CompanyID).GetMeasure(entity.UnitNum); entity.UnitName = meaure != null ? meaure.MeasureName : ""; } int line = this.Product.Add(entity); if (line > 0) { CacheHelper.Remove(Key); } return(line); }
/// <summary> /// 修改 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Update(ProductEntity entity) { string Key = string.Format(CacheKey.JOOSHOW_PRODUCT_CACHE, this.CompanyID); entity.InPrice = entity.AvgPrice; entity.OutPrice = entity.AvgPrice; //处理类别 if (!entity.CateNum.IsEmpty()) { ProductCategoryEntity category = new ProductCategoryProvider(this.CompanyID).GetSingle(entity.CateNum); entity.CateName = category != null ? category.CateName : ""; } if (!entity.UnitNum.IsEmpty()) { MeasureEntity meaure = new MeasureProvider(this.CompanyID).GetMeasure(entity.UnitNum); entity.UnitName = meaure != null ? meaure.MeasureName : ""; } entity.Include(a => new { a.ProductName, a.BarCode, a.FactoryNum, a.InCode, a.MinNum, a.MaxNum, a.UnitNum, a.UnitName, a.CateNum, a.CateName, a.Size, a.InPrice, a.OutPrice, a.AvgPrice, a.GrossWeight, a.NetWeight, a.StorageNum, a.DefaultLocal, a.CusNum, a.CusName, a.SupNum, a.SupName, a.Description, a.Display, a.Remark }); entity.Where(a => a.SnNum == entity.SnNum) .And(a => a.CompanyID == this.CompanyID); int line = this.Product.Update(entity); if (line > 0) { CacheHelper.Remove(Key); } return(line); }
/// <summary> /// 编辑单位 /// </summary> /// <returns></returns> public ActionResult Edit() { string MeasureName = WebUtil.GetFormValue <string>("MeasureName"); string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); string SN = WebUtil.GetFormValue <string>("SN"); string MeasureNum = WebUtil.GetFormValue <string>("MeasureNum"); MeasureEntity entity = new MeasureEntity(); entity.MeasureName = MeasureName; entity.CompanyID = CompanyID; entity.SN = SN; entity.MeasureNum = MeasureNum; MeasureProvider provider = new MeasureProvider(CompanyID); int line = provider.EditMeasure(entity); DataResult result = new DataResult(); if (line > 0) { result.Code = (int)EResponseCode.Success; result.Message = "单位修改成功"; } else { result.Code = (int)EResponseCode.Exception; result.Message = "单位修改失败"; } 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))); }
public void Save(List <object> saveObjects) { foreach (Object[] saveObject in saveObjects) { DisciplineProvider.createDiscipline ( saveObject[0].ToString(), MeasureProvider.getMeasureById(Convert.ToInt32(saveObject[2])), CategoryProvider.getCategoryById(Convert.ToInt32(saveObject[1])) ); } DisciplinesGUIForm.renderDisciplinesGrid(DisciplineProvider.getAllDisciplines()); }
/// <summary> /// 查询单位信息 /// </summary> /// <returns></returns> public ActionResult Single() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); string SN = WebUtil.GetFormValue <string>("SN"); MeasureProvider provider = new MeasureProvider(CompanyID); MeasureEntity entity = provider.GetMeasure(SN); DataResult <MeasureEntity> result = new DataResult <MeasureEntity>() { Code = (int)EResponseCode.Success, Message = "响应成功", Result = entity }; return(Content(JsonHelper.SerializeObject(result))); }
internal void updateDisciplines(List <Discipline> availableDisciplines) { dgvDisciplines.Rows.Clear(); DataGridViewTextBoxColumn textBoxName = new DataGridViewTextBoxColumn(); dgvDisciplines.Columns.Add(textBoxName); DataGridViewComboBoxColumn comboBoxCategory = new DataGridViewComboBoxColumn(); comboBoxCategory.DataSource = CategoryProvider.getAllCategories(); comboBoxCategory.DataPropertyName = "categoryName"; comboBoxCategory.ValueMember = "categoryId"; comboBoxCategory.DisplayMember = "categoryName"; dgvDisciplines.Columns.Add(comboBoxCategory); List <Measure> allMeasures = MeasureProvider.getAllMeasures(); allMeasures.Insert(0, new Measure(0, "", "")); DataGridViewComboBoxColumn comboBoxMeasure = new DataGridViewComboBoxColumn(); comboBoxMeasure.DataSource = allMeasures; comboBoxMeasure.DataPropertyName = "name"; comboBoxMeasure.ValueMember = "measureId"; comboBoxMeasure.DisplayMember = "name"; dgvDisciplines.Columns.Add(comboBoxMeasure); int i = 0; foreach (Discipline discipline in availableDisciplines) { if (discipline == null) { continue; } object[] rowData = new object[] { discipline.Name, discipline.Category == null ? 0 : discipline.Category.CategoryId, discipline.Measure == null ? 0 : discipline.Measure.MeasureId }; dgvDisciplines.Rows.Add(rowData); dgvDisciplines.Rows[i].ReadOnly = true; i += 1; } }
/// <summary> /// 删除产品包装结构 /// </summary> /// <returns></returns> public ActionResult DeletePacage() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); string SnNum = WebUtil.GetFormValue <string>("SnNum"); MeasureProvider provider = new MeasureProvider(CompanyID); int line = provider.DeleteMeasureRel(SnNum); DataResult dataResult = new DataResult(); dataResult.Code = (int)EResponseCode.Success; dataResult.Message = "删除成功"; return(Json(dataResult, JsonRequestBehavior.AllowGet)); }
public WindowService(IAppSettingsService appSettingsService, IUserSettingsService userSettingsService, ITrayIcon trayIcon, [ImportMany] IEnumerable <ExportFactory <IShell, IShellMetaData> > shellFactories, MeasureProvider measureProvider) { this.appSettingsService = appSettingsService; this.userSettingsService = userSettingsService; this.trayIcon = trayIcon; this.shellFactories = shellFactories; this.measureProvider = measureProvider; limitNotifyWindow = GetShell("Limit toast window"); limitNotifyWindow.Show(); }
/// <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 Delete(string Num) { MeasureProvider provider = new MeasureProvider(); int line = provider.DeleteMeasure(Num); if (line > 0) { this.ReturnJson.AddProperty("Key", "1000"); this.ReturnJson.AddProperty("Value", "删除成功"); } else { this.ReturnJson.AddProperty("Key", "1001"); this.ReturnJson.AddProperty("Value", "删除失败"); } return(Content(this.ReturnJson.ToString())); }
/// <summary> /// 新增带SKU的产品 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Add(ProductEntity entity, List <ProductSkuEntity> listSku) { using (TransactionScope ts = new TransactionScope()) { entity.IncludeAll(); entity.InPrice = entity.AvgPrice; entity.OutPrice = entity.AvgPrice; entity.SnNum = ConvertHelper.NewGuid(); entity.BarCode = entity.BarCode.IsEmpty() ? new TNumProvider(CompanyID).GetSwiftNum(typeof(ProductEntity), 6) : entity.BarCode; //处理类别 if (!entity.CateNum.IsEmpty()) { ProductCategoryEntity category = new ProductCategoryProvider(this.CompanyID).GetSingle(entity.CateNum); entity.CateName = category != null ? category.CateName : ""; } if (!entity.UnitNum.IsEmpty()) { MeasureEntity meaure = new MeasureProvider(this.CompanyID).GetMeasure(entity.UnitNum); entity.UnitName = meaure != null ? meaure.MeasureName : ""; } int line = this.Product.Add(entity); if (!listSku.IsNullOrEmpty()) { foreach (ProductSkuEntity item in listSku) { item.SnNum = ConvertHelper.NewGuid(); item.ProductNum = entity.SnNum; item.BarCode = entity.BarCode + "-" + new TNumProvider(CompanyID).GetSwiftNum(entity.SnNum, 3); item.IsDelete = (int)EIsDelete.NotDelete; item.CreateTime = DateTime.Now; item.CompanyID = this.CompanyID; item.IncludeAll(); line += this.ProductSku.Add(item); } } ts.Complete(); return(line); } }
/// <summary> /// 编辑产品信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int EditProduct(ProductEntity entity) { if (!entity.CateNum.IsEmpty()) { ProductCategoryEntity category = new ProductCategoryProvider(this.CompanyID).GetSingle(entity.CateNum); entity.CateName = category != null ? category.CateName : ""; } if (!entity.UnitNum.IsEmpty()) { MeasureEntity meaure = new MeasureProvider(this.CompanyID).GetMeasure(entity.UnitNum); entity.UnitName = meaure != null ? meaure.MeasureName : ""; } entity.Include(a => new { a.ProductName, a.BarCode, a.FactoryNum, a.InCode, a.UnitNum, a.UnitName, a.CateNum, a.CateName, a.StorageNum, a.DefaultLocal, a.CusNum, a.CusName, a.SupNum, a.SupName, a.Description, a.Display, a.Remark }); entity.Where(a => a.SnNum == entity.SnNum) .And(a => a.CompanyID == this.CompanyID); int line = this.Product.Update(entity); return(line); }
/// <summary> /// 删除单位 /// </summary> /// <returns></returns> public ActionResult Delete() { List <string> list = WebUtil.GetFormObject <List <string> >("List"); string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); MeasureProvider provider = new MeasureProvider(CompanyID); int line = provider.DeleteMeasure(list, CompanyID); DataResult result = new DataResult(); if (line > 0) { result.Code = (int)EResponseCode.Success; result.Message = string.Format("单位删除成功,受影响行数{0}行", line); } else { result.Code = (int)EResponseCode.Exception; result.Message = "单位删除失败"; } return(Content(JsonHelper.SerializeObject(result))); }
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())); }
public LimitToastWindow(IUserSettingsService userSettingsService, IAppDurationCalc appDurationCalc, Mediator mediator, MeasureProvider measureProvider) { this.userSettingsService = userSettingsService; this.appDurationCalc = appDurationCalc; this.mediator = mediator; this.measureProvider = measureProvider; InitializeComponent(); mediator.Register <AppLimit>(MediatorMessages.APP_LIMIT_REACHED, OnAppLimitReached); var bounds = System.Windows.Forms.Screen.PrimaryScreen.Bounds; this.Left = bounds.Right - this.Width - 5; this.Top = bounds.Bottom + 5; timer = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Normal, OnTimerTick, this.Dispatcher); Loaded += (s, e) => HideHelper.RemoveFromAltTab(this); Deactivated += (s, e) => Topmost = true; }
public ActionResult Create(string Num, string Name) { if (Num.IsEmpty()) { MeasureEntity entity = new MeasureEntity(); entity.MeasureNum = SequenceProvider.GetSequence(typeof(MeasureEntity)); entity.MeasureName = Name; entity.SN = SequenceProvider.GetSequence(typeof(MeasureEntity)); MeasureProvider provider = new MeasureProvider(); int line = provider.AddMeasure(entity); if (line > 0) { this.ReturnJson.AddProperty("Key", "1000"); this.ReturnJson.AddProperty("Value", "添加成功"); } else { this.ReturnJson.AddProperty("Key", "1001"); this.ReturnJson.AddProperty("Value", "添加失败"); } } else { MeasureProvider provider = new MeasureProvider(); int line = provider.EditMeasure(Num, Name); if (line > 0) { this.ReturnJson.AddProperty("Key", "1000"); this.ReturnJson.AddProperty("Value", "编辑成功"); } else { this.ReturnJson.AddProperty("Key", "1001"); this.ReturnJson.AddProperty("Value", "编辑失败"); } } return(Content(this.ReturnJson.ToString())); }
/// <summary> /// 编辑带有SKU的产品 /// </summary> /// <param name="entity"></param> /// <param name="listSku"></param> /// <returns></returns> public int Edit(ProductEntity entity, List <ProductSkuEntity> listSku) { using (TransactionScope ts = new TransactionScope()) { if (!entity.CateNum.IsEmpty()) { ProductCategoryEntity category = new ProductCategoryProvider(this.CompanyID).GetSingle(entity.CateNum); entity.CateName = category != null ? category.CateName : ""; } if (!entity.UnitNum.IsEmpty()) { MeasureEntity meaure = new MeasureProvider(this.CompanyID).GetMeasure(entity.UnitNum); entity.UnitName = meaure != null ? meaure.MeasureName : ""; } entity.Include(a => new { a.ProductName, a.BarCode, a.FactoryNum, a.InCode, a.UnitNum, a.UnitName, a.CateNum, a.CateName, a.StorageNum, a.DefaultLocal, a.CusNum, a.CusName, a.SupNum, a.SupName, a.Description, a.Display, a.Remark }); entity.Where(a => a.SnNum == entity.SnNum) .And(a => a.CompanyID == this.CompanyID); int line = this.Product.Update(entity); if (!listSku.IsNullOrEmpty()) { ProductSkuEntity SkuEntity = new ProductSkuEntity(); SkuEntity.IncludeAll(); SkuEntity.Where(a => a.ProductNum == entity.SnNum) .And(a => a.IsDelete == (int)EIsDelete.NotDelete) .And(a => a.CompanyID == this.CompanyID) ; List <ProductSkuEntity> listSource = this.ProductSku.GetList(SkuEntity); listSource = listSource.IsNull() ? new List <ProductSkuEntity>() : listSource; listSku = listSku.IsNull() ? new List <ProductSkuEntity>() : listSku; foreach (ProductSkuEntity item in listSku) { item.SnNum = item.SnNum.IsEmpty() ? ConvertHelper.NewGuid() : item.SnNum; if (listSource.Exists(a => a.SnNum == item.SnNum)) { item.Include(b => new { b.Size, b.Color, b.NetWeight, b.GrossWeight, b.InPrice, b.AvgPrice, b.OutPrice }); item.Where(b => b.SnNum == item.SnNum).And(b => b.CompanyID == this.CompanyID); line += this.ProductSku.Update(item); } else { item.IsDelete = (int)EIsDelete.NotDelete; item.CreateTime = DateTime.Now; item.CompanyID = this.CompanyID; item.IncludeAll(); line += this.ProductSku.Add(item); } } foreach (ProductSkuEntity item in listSource) { if (!listSku.Exists(a => a.SnNum == item.SnNum)) { item.IsDelete = (int)EIsDelete.Deleted; item.IncludeIsDelete(true); item.Where(b => b.SnNum == item.SnNum).And(b => b.CompanyID == this.CompanyID); line += this.ProductSku.Update(item); } } } ts.Complete(); return(line); } }
/// <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); } }