private void GetGoodsClassListXML() { int queryInt = WebUtils.GetQueryInt("id"); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); System.Collections.Generic.IList <GoodsClassInfo> list = GoodsClass.GetList(1000, "ParentID=" + queryInt); if (list != null && list.Count > 0) { foreach (GoodsClassInfo current in list) { stringBuilder.Append(string.Concat(new object[] { "{id:'", current.AutoID.ToString(), "',name:'", current.ClassName, "',isParent:", (current.ChildCount > 0) ? "true" : "false", (current.ChildCount > 0) ? "" : ",'iconSkin':'leaf'", ",'click':\"AppendVal(", current.AutoID, ",'", current.ClassName, "')\"}," })); } } base.Response.Write("[" + stringBuilder.ToString().TrimEnd(new char[] { ',' }) + "]"); }
public void AddGoodsClass(GoodsClassModel model) { if (model == null) { throw new ArgumentNullException(); } if (string.IsNullOrEmpty(model.Name)) { throw new Exception("商品分类名称不能为空"); } if (string.IsNullOrEmpty(model.Code)) { throw new Exception("商品编码无效"); } if (CodeExists(model.Code)) { throw new Exception("商品编码无效"); } var entity = new GoodsClass() { Code = model.Code, Name = model.Name, Desc = model.Desc, Disable = false, BizTypeID = model.BizTypeID }; var dbcontext = ServiceProvider.GetDbcontext <IPurocumentDbcontext>(); dbcontext.Add(entity); dbcontext.SaveChanges(); }
public async Task CalculateStock(List <ComponentView> components, List <int> storeId) { var allShouldBe = await _db.StockComponentInfos.Where(i => storeId.Contains(i.StoreID.Value)).ToListAsync(); foreach (var stock in allShouldBe) { var goodClass = stock.ComponentClass.HasValue ? GoodsClass.GetItemById(stock.ComponentClass.Value) : GoodsClass.Unknown; var currentStock = components.Where(t => t.GoodsClass == goodClass && t.PartNumber.Replace(" ", "").ToLower() == stock.PartNumber.Replace(" ", "").ToLower()).ToArray(); if (!currentStock.Any()) { continue; } var current = currentStock.Sum(component => component.Quantity <= 0 ? 1 : component.Quantity); foreach (var t in currentStock) { t.Current = current; t.ShouldBeOnStock = stock.Amount; } } }
/// <summary> /// 获取订单作业明细 /// </summary> /// <param name="paramGetSql"></param> /// <returns></returns> public static List <OrderWorkItemClass> GetOrderWorkItemList(string paramGetSql) { List <OrderWorkItemClass> list = new List <OrderWorkItemClass>(); DataTable dataTableBySql = Common.OracleDB.GetDataTableBySql(paramGetSql.ToString()); checked { if (dataTableBySql == null) { return(null); } else if (dataTableBySql.Rows.Count == 0) { return(null); } else { for (int i = 0; i < dataTableBySql.Rows.Count; i++) { GoodsClass goodsClass = new GoodsClass() { Id = Convert.ToInt32(dataTableBySql.Rows[i]["DEST_GOODS_ID"]), Code = dataTableBySql.Rows[i]["GOODS_CODE"].ToString(), Name = dataTableBySql.Rows[i]["GOODS_NAME"].ToString(), Spec = dataTableBySql.Rows[i]["GOODS_SPEC"].ToString(), Prod = dataTableBySql.Rows[i]["GOODS_MANU"].ToString(), Manu = dataTableBySql.Rows[i]["GOODS_MANU"].ToString(), ApprNo = dataTableBySql.Rows[i]["APPR_NO"].ToString() }; GoodsPackClass goodsPackClass = new GoodsPackClass() { Id = Convert.ToInt32(dataTableBySql.Rows[i]["DEST_GOODS_PACK_ID"]), Code = dataTableBySql.Rows[i]["GOODS_PACK_CODE"].ToString(), Name = dataTableBySql.Rows[i]["GOODS_PACK_NAME"].ToString(), UnitQty = Convert.ToDecimal(dataTableBySql.Rows[i]["GOODS_PACK_UNIT_QTY"]), PackBcode = dataTableBySql.Rows[i]["PACK_BCODE"].ToString(), Goods = goodsClass }; OrderWorkItemClass orderWorkItemClass = new OrderWorkItemClass() { WorkQty = Convert.ToDecimal(dataTableBySql.Rows[i]["DEST_QTY"]), WorkUnitPrice = Convert.ToDecimal(dataTableBySql.Rows[i]["DEST_UPRICE"]), DestLocCode = dataTableBySql.Rows[i]["DEST_LOC_CODE"].ToString(), SourLocCode = dataTableBySql.Rows[i]["SOUR_LOC_CODE"].ToString(), BatchNo = dataTableBySql.Rows[i]["DEST_BATCH_NO"].ToString(), ExpDate = dataTableBySql.Rows[i]["DEST_EXP_DATE"].ToString(), WorkByName = dataTableBySql.Rows[i]["WORK_BY_NAME"].ToString(), WorkDate = Convert.ToDateTime(dataTableBySql.Rows[i]["WORK_TIME"]), WorkDeviceCode = dataTableBySql.Rows[i]["WORK_DEVICE_NOTE"].ToString(), GoodsPack = goodsPackClass }; list.Add(orderWorkItemClass); } return(list); } } }
public override int GetHashCode() { int detailTypeHash = GoodsClass != null ? GoodsClass.GetHashCode() : -1; int standartHash = Standart != null ? Standart.GetHashCode() : -1; int partNumberHash = PartNumber.GetHashCode(); int descriptionHash = Description.GetHashCode(); return detailTypeHash ^ standartHash ^ partNumberHash ^ descriptionHash; }
///<summary> /// Сигнализирует о смене типа компонента ///</summary> private void InvokeComponentTypeChanged(GoodsClass value) { ValueChangedEventHandler handler = ComponentTypeChanged; if (handler != null) { handler(new ValueChangedEventArgs(value)); } }
protected void BindGoodsClassList(int ShopID) { PubFunction.BindShopSelect(this._UserShopID, this.sltShop, ShopID, this._UserShopID != 1); GoodsClass gdClass = new GoodsClass(); DataTable dtClass = gdClass.GetListByShopID(ShopID).Tables[0]; DataTable dtResult = this.GetTreeList(dtClass); this.rpGoodsClass.DataSource = dtResult; this.rpGoodsClass.DataBind(); }
///<summary> /// Изменяет доступные типы задач для переданного типа компонентов ///</summary> ///<param name="goodsClass">Тип компонента, для которого нужно определить типы задач</param> public void ChangeDirectivesTasksForComponentType(GoodsClass goodsClass) { foreach (Control c in flowLayoutPanelPerformances.Controls) { if (c is ComponentCompliancePerformanceControl) { ((ComponentCompliancePerformanceControl)c).UpdateWorkTypes(goodsClass); } if (c is ComponentAddCompliancePerformanceControl) { ((ComponentAddCompliancePerformanceControl)c).UpdateWorkTypes(goodsClass); } } }
///<summary> /// Изменяет доступные типы задач для переданного типа компонентов ///</summary> ///<param name="goodsClass">Тип компонента, для которого нужно определить типы задач</param> public void UpdateWorkTypes(GoodsClass goodsClass) { comboBoxWorkType.Items.Clear(); foreach (var t in ComponentRecordType.Items.OrderBy(x => x.FullName)) { comboBoxWorkType.Items.Add(t); if (_currentComponentDirective.DirectiveType == t) { comboBoxWorkType.SelectedItem = t; } } if (comboBoxWorkType.SelectedItem == null) { comboBoxWorkType.SelectedIndex = 0; } }
protected void AddZL_Load(object sender, EventArgs e) { //bh编号(max)、pm品名、dnm店内码(2位大类、4位中类、6位小类) command.CommandText = "select bh,pm,dnm from fl where char_length(dnm)=2 order by pm asc"; MySqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { GoodsClass gc = new GoodsClass(dr.GetInt32(0), dr.GetString(1), dr.GetString(2)); this.comboBox1.Items.Add(gc); } dr.Close(); if (this.comboBox1.Items.Count == 0) return; this.comboBox1.SelectedIndex = 0; }
public string GetAllGoods(GoodsClass goodsClass) { try { List <GoodsModel> list = thisData.GetAllGoods(goodsClass); return(new BaseResponseModel <List <GoodsModel> >() { StatusCode = Tools.ActionParams.code_ok, JsonData = list }.ToJson()); } catch (Exception) { return(JsonResponseModel.ErrorJson); throw; } }
/// <summary> /// 获取商品相关图片(HeaderPics:轮播图,BodyPics:详情图片;图片数组0、1、2:大、中、小图) /// </summary> /// <param name="goodsClass">商品类别(0:单张,1:套餐)</param> /// <returns></returns> public string GetGoodsPics(GoodsClass goodsClass) { try { GoodsPic goodsPic = thisData.GetGoodsPics(goodsClass); return(new BaseResponseModel <GoodsPic>() { StatusCode = Tools.ActionParams.code_ok, JsonData = goodsPic }.ToJson()); } catch (Exception) { return(JsonResponseModel.ErrorJson); throw; } }
///<summary> /// Изменяет доступные типы задач для переданного типа компонентов ///</summary> ///<param name="goodsClass">Тип компонента, для которого нужно определить типы задач</param> public void UpdateWorkTypes(GoodsClass goodsClass) { comboBoxWorkType.Items.Clear(); var directiveTypes = new CommonDictionaryCollection <ComponentRecordType>(ComponentRecordType.Items); if (goodsClass.IsNodeOrSubNodeOf(GoodsClass.ControlTestEquipment)) { directiveTypes.Remove(ComponentRecordType.Calibration); } comboBoxWorkType.Items.AddRange(directiveTypes.OrderBy(x => x.FullName).ToArray()); if (comboBoxWorkType.SelectedItem == null) { comboBoxWorkType.SelectedIndex = 0; } }
private void ComboBoxComponentTypeSelectedIndexChanged(object sender, EventArgs e) { GoodsClass dt = comboBoxComponentType.SelectedItem as GoodsClass; if (dt == null) { labelQuantity.Visible = numericUpDownQuantity.Visible = false; } else if (dt.IsNodeOrSubNodeOf(GoodsClass.AircraftComponentsEmergency)) { labelQuantity.Visible = numericUpDownQuantity.Visible = true; } else { labelQuantity.Visible = numericUpDownQuantity.Visible = false; } InvokeComponentTypeChanged(dt ?? GoodsClass.Unknown); }
/// <summary> /// Изменяет контрол в соотствествии с выбранным классом детали /// </summary> private void SetForDetailClass() { GoodsClass dc = comboBoxDetailClass.SelectedItem as GoodsClass; if (dc == null) { comboBoxMeasure.Enabled = true; comboBoxMeasure.SelectedItem = _stockComponentInfo.Measure; numericUpDownQuantity.DecimalPlaces = 2; } else if (dc.IsNodeOrSubNodeOf(GoodsClass.ComponentsAndParts)) { comboBoxMeasure.Enabled = false; comboBoxMeasure.SelectedItem = Measure.Unit; numericUpDownQuantity.DecimalPlaces = 0; } else if (dc.IsNodeOrSubNodeOf(GoodsClass.ComponentsAndParts)) { comboBoxMeasure.Enabled = false; comboBoxMeasure.SelectedItem = Measure.Unit; numericUpDownQuantity.DecimalPlaces = 0; } }
private void SetCombox1() { string s = "select bh,pm,dnm from fl where char_length(dnm)=2"; command.CommandText = s; MySqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { GoodsClass gc = new GoodsClass(dr.GetInt32(0), dr.GetString(1), dr.GetString(2)); this.comboBox大类.Items.Add(gc); } dr.Close(); if (this.comboBox大类.Items.Count > 0) this.comboBox大类.SelectedIndex = 0; }
internal GoodsPic GetGoodsPics(GoodsClass goodsClass) { var goodsPic = mongo.GetMongoCollection <GoodsPic>().Find(x => x.GoodsClass == goodsClass).FirstOrDefault(); return(goodsPic); }
internal List<GoodsModel> GetAllGoods(GoodsClass goodsClass) { return collection.Find(x => x.GoodsClass == goodsClass).ToList(); }
public int Add(GoodsClass model) { return(bll.Add(model)); }
private void SetCombox3() { GoodsClass g = (this.comboBox中类.SelectedItem as GoodsClass); if (g == null) return; string s = string.Format("select bh,pm,dnm from fl where char_length(dnm)=6 and substring(dnm,1,4)='{0}' order by pm asc", g.dnm); command.CommandText = s; MySqlDataReader dr = command.ExecuteReader(); this.comboBox小类.Items.Clear(); while (dr.Read()) { GoodsClass gc = new GoodsClass(dr.GetInt32(0), dr.GetString(1), dr.GetString(2)); this.comboBox小类.Items.Add(gc); } dr.Close(); if (this.comboBox小类.Items.Count > 0) this.comboBox小类.SelectedIndex = 0; }
///<summary> /// Проставляет товар и стандарт для комплектующего ///</summary> ///<returns>true - если удалось определеить и проставить продукт и стандарт для комплектующего</returns> public bool SetStandartAndProduct(AbstractAccessory accessory, string standartName, string partialNumber, string description, string remarks, string manufacturer, GoodsClass goodsClass, Measure measure, double costNew, double costOverhaul, double costServiceable, IEnumerable <Supplier> suppliers) { if (accessory == null) { throw new ArgumentException("must be not null", "accessory"); } if (accessory.Product != null && accessory.Product.ItemId > 0) { return(true); } string standart = standartName.Replace(" ", "").ToLower(); string partNumber = partialNumber.Replace(" ", "").ToLower(); bool needToSaveAccessory = false; bool result = true; GoodStandart goodStandart = null; List <GoodStandart> goodStandarts = _loader.GetObjectList <GoodStandart>(); List <Product> products; if (accessory is Entities.General.Accessory.Component) { products = new List <Product>(_loader.GetObjectList <ComponentModel>(loadChild: true).ToArray()); } else { products = _loader.GetObjectList <Product>(loadChild: true); } if (goodStandarts != null && !string.IsNullOrEmpty(standart)) { goodStandart = goodStandarts .FirstOrDefault(ad => ad.PartNumber.Replace(" ", "").ToLower() == partNumber && ad.FullName.Replace(" ", "").ToLower() == standart); if (goodStandart == null) { goodStandart = new GoodStandart { GoodsClass = goodsClass, PartNumber = partialNumber, Description = description, FullName = standartName, //CostNew = costNew, //CostServiceable = costServiceable, //CostOverhaul = costOverhaul, Remarks = remarks, //Measure = measure }; _newKeeper.Save(goodStandart); } accessory.Standart = goodStandart; needToSaveAccessory = true; } if ((manufacturer != "" || suppliers != null && suppliers.Any()) && products != null) { Product product = products .FirstOrDefault(p => p.PartNumber.Replace(" ", "").ToLower() == partNumber && p.Standart != null && p.Standart.FullName.Replace(" ", "").ToLower() == standart); if (product == null) { if (accessory is Entities.General.Accessory.Component) { ComponentModel dm = new ComponentModel { BatchNumber = "", CostNew = costNew, CostOverhaul = costOverhaul, CostServiceable = costServiceable, Description = description, GoodsClass = goodsClass, Manufacturer = manufacturer, Measure = measure, PartNumber = partNumber, Remarks = remarks, }; product = dm; } else { product = new Product { GoodsClass = goodsClass, PartNumber = partialNumber, Description = description, Manufacturer = manufacturer, Standart = goodStandart, CostNew = costNew, CostServiceable = costServiceable, CostOverhaul = costOverhaul, Remarks = remarks, Measure = measure }; } _newKeeper.Save(product); if (goodStandart != null && goodStandart.DefaultProductId <= 0) { goodStandart.DefaultProductId = product.ItemId; _newKeeper.Save(goodStandart); } product.SupplierRelations.Clear(); foreach (KitSuppliersRelation ksr in accessory.SupplierRelations) { if (ksr.SupplierId != 0) { product.SupplierRelations.Add(ksr); ksr.KitId = product.ItemId; ksr.ParentTypeId = product.SmartCoreObjectType.ItemId; _newKeeper.Save(ksr); } } } Entities.General.Accessory.Component component = accessory as Entities.General.Accessory.Component; if (component != null) { component.Model = product as ComponentModel; } else { accessory.Product = product; } needToSaveAccessory = true; } else { accessory.Product = null; result = false; } if (needToSaveAccessory) { _newKeeper.Save(accessory); } return(result); }
public ActionResult GoodsCreate(IEnumerable <HttpPostedFileBase> files) { //int mid = Convert.ToInt32(Request.Cookies["MEMBERID"].Value); int mid = (int)Session["MEMBERID"]; #region List <GoodsClass> gc = new List <GoodsClass>(); GoodsClass first = new GoodsClass(); first.GdsClassID = 10000; first.GdsClass = "請選擇類別"; gc.Add(first); var q = db.GoodsClass; foreach (var a in q) { gc.Add(a); } List <GdsSubClass> gsc = new List <GdsSubClass>(); GdsSubClass sbfirst = new GdsSubClass(); sbfirst.GdsSubClassID = 10000; sbfirst.GdsSubClass1 = "請先選擇大類別"; gsc.Add(sbfirst); ViewBag.GdsClassID = new SelectList(gc, "GdsClassID", "GdsClass", first.GdsClassID); ViewBag.GdsSubClassID = new SelectList(gsc, "GdsSubClassID", "GdsSubClass1", sbfirst.GdsSubClassID); List <City> ct = new List <City>(); City ctfirst = new City(); ctfirst.CityID = 10000; ctfirst.CityName = "請選擇縣市"; ct.Add(ctfirst); var z = db.City; foreach (var a in z) { ct.Add(a); } List <Region> rg = new List <Region>(); Region rgfirst = new Region(); rgfirst.RegionID = 10000; rgfirst.RegionName = "請先選擇縣市"; rg.Add(rgfirst); ViewBag.CityID = new SelectList(ct, "CityID", "CityName", ctfirst.CityID); ViewBag.RegionID = new SelectList(rg, "RegionID", "RegionName", rgfirst.RegionID); #endregion if (Request.Form.Count > 0) { db.Cases.Add(new Cases { CaseTitle = Request.Form["CaseTitle"], CaseContent = Request.Form["CaseContent"], StartDateTime = DateTime.Now, MemberID = mid, Recommendation = 0, Location = Request.Form["Location"], RegionID = Convert.ToInt32(Request.Form["RegionID"]), Contact = Request.Form["Contact"], StatusID = Convert.ToInt32(Request.Form["StatusID"]), }); db.SaveChanges(); int cid = db.Cases.Where(c => c.MemberID == mid).OrderByDescending(c => c.CaseID).First().CaseID; db.Goods.Add(new Goods { CaseID = cid, GdsPoint = 0, GdsName = Request.Form["CaseContent"], GdsCount = Convert.ToInt32(Request.Form["GdsCount"]), GdsDeadline = Convert.ToDateTime(Request.Form["GdsDeadline"]), GdsSubClassID = Convert.ToInt32(Request.Form["GdsSubClassID"]), }); if (files != null) { foreach (var file in files) { if (file != null) { var imagesSize = file.ContentLength; byte[] imageByte = new byte[imagesSize]; file.InputStream.Read(imageByte, 0, imagesSize); db.Picture.Add(new Picture { CaseID = cid, Images = imageByte }); db.SaveChanges(); TempData["message"] = "上傳成功"; } else { TempData["message"] = "請先選檔案"; } } } db.SaveChanges(); return(RedirectToAction("BrowseGoodsAll")); } else { return(View()); } }
/// <summary> /// Создает экземпляр объекта с определенным значением /// </summary> /// <param name="value">Значение</param> public ValueChangedEventArgs(GoodsClass value) { Value = value; }
public int Add(GoodsClass model) { return bll.Add(model); }