// // GET: /BaseData/BaseAttribute/Detail public async Task <ActionResult> Detail(string categoryName, string attributeName) { using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { MethodReturnResult <BaseAttribute> result = await client.GetAsync(new BaseAttributeKey() { CategoryName = categoryName, AttributeName = attributeName }); if (result.Code == 0) { BaseAttributeViewModel viewModel = new BaseAttributeViewModel() { CategoryName = result.Data.Key.CategoryName, AttributeName = result.Data.Key.AttributeName, Order = result.Data.Order, DataType = result.Data.DataType, IsPrimaryKey = result.Data.IsPrimaryKey, CreateTime = result.Data.CreateTime, Creator = result.Data.Creator, Description = result.Data.Description, Editor = result.Data.Editor, EditTime = result.Data.EditTime }; return(PartialView("_InfoPartial", viewModel)); } else { ModelState.AddModelError("", result.Message); } } return(PartialView("_InfoPartial")); }
public IEnumerable <SelectListItem> GetAttributeName() { using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName='{0}'", "RouteStepAttribute") }; MethodReturnResult <IList <BaseAttribute> > result = client.Get(ref cfg); if (result.Code <= 0) { IEnumerable <SelectListItem> lst = from item in result.Data select new SelectListItem() { //Text = item.Key.AttributeName + "-[" + item.Description + "]", Text = item.Description, Value = item.Key.AttributeName }; return(lst); } } return(new List <SelectListItem>()); }
public async Task <ActionResult> SaveModify(BaseAttributeViewModel model) { using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { MethodReturnResult <BaseAttribute> result = await client.GetAsync(new BaseAttributeKey() { CategoryName = model.CategoryName, AttributeName = model.AttributeName }); if (result.Code == 0) { result.Data.DataType = model.DataType; result.Data.IsPrimaryKey = model.IsPrimaryKey; result.Data.Order = model.Order; result.Data.Description = model.Description; result.Data.Editor = User.Identity.Name; result.Data.EditTime = DateTime.Now; MethodReturnResult rst = await client.ModifyAsync(result.Data); if (rst.Code == 0) { rst.Message = string.Format(StringResource.BaseAttribute_SaveModify_Success , result.Data.Key); } return(Json(rst)); } return(Json(result)); } }
public async Task <ActionResult> Save(BaseAttributeViewModel model) { using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { BaseAttribute obj = new BaseAttribute() { Key = new BaseAttributeKey() { CategoryName = model.CategoryName, AttributeName = model.AttributeName }, IsPrimaryKey = model.IsPrimaryKey, DataType = model.DataType, Order = model.Order, Description = model.Description, Editor = User.Identity.Name, EditTime = DateTime.Now, CreateTime = DateTime.Now, Creator = User.Identity.Name }; MethodReturnResult rst = await client.AddAsync(obj); if (rst.Code == 0) { rst.Message = string.Format(StringResource.BaseAttribute_Save_Success , obj.Key); } return(Json(rst)); } }
public async Task <ActionResult> Save() { MethodReturnResult rst = new MethodReturnResult(); int itemNo = Convert.ToInt32(Request["ItemNo"]); string categoryName = Request["CategoryName"]; IList <BaseAttributeValue> lstVal = new List <BaseAttributeValue>(); using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { MethodReturnResult <IList <BaseAttribute> > result = await Task.Run <MethodReturnResult <IList <BaseAttribute> > >(() => { string where = string.Format("Key.CategoryName='{0}'", categoryName); PagingConfig cfg = new PagingConfig() { IsPaging = false, OrderBy = "Key.CategoryName,Order", Where = where }; return(client.Get(ref cfg)); }); if (result.Code == 0) { foreach (BaseAttribute attr in result.Data) { string attrValue = Request[attr.Key.AttributeName] ?? string.Empty; BaseAttributeValue val = new BaseAttributeValue() { Key = new BaseAttributeValueKey() { CategoryName = attr.Key.CategoryName, AttributeName = attr.Key.AttributeName, ItemOrder = itemNo }, Value = attrValue.Split(',')[0], Editor = User.Identity.Name, EditTime = DateTime.Now }; lstVal.Add(val); } } } using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { rst = await client.AddAsync(lstVal); if (rst.Code == 0) { rst.Message = string.Format(StringResource.BaseAttributeValue_Save_Success); } } return(Json(rst)); }
// // GET: /BaseData/BaseAttributeValue/ public async Task <ActionResult> Index(string categoryName) { using (BaseAttributeCategoryServiceClient client = new BaseAttributeCategoryServiceClient()) { MethodReturnResult <BaseAttributeCategory> result = await client.GetAsync(categoryName ?? string.Empty); if (result.Code > 0 || result.Data == null) { return(RedirectToAction("Index", "BaseAttributeCategory")); } ViewBag.BaseAttributeCategory = result.Data; } using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { await Task.Run(() => { string where = string.Format("Key.CategoryName='{0}'", categoryName); PagingConfig cfg = new PagingConfig() { IsPaging = false, OrderBy = "Key.CategoryName,Order", Where = where }; MethodReturnResult <IList <BaseAttribute> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.BaseAttributeList = result.Data; } }); } using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { await Task.Run(() => { string where = string.Format("Key.CategoryName='{0}'", categoryName); PagingConfig cfg = new PagingConfig() { IsPaging = false, OrderBy = "Key.CategoryName,Key.ItemOrder", Where = where }; MethodReturnResult <IList <BaseAttributeValue> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.List = result.Data; } }); } if (Request.IsAjaxRequest()) { return(PartialView("_ListPartial")); } return(View()); }
public ActionResult Query(string packageNo) { //获取需要录入的批次号自定义特性 IList <BaseAttribute> lstAttribute = new List <BaseAttribute>(); using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName='{0}'", "LotPackageAttribute") }; MethodReturnResult <IList <BaseAttribute> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null && result.Data.Count > 0) { lstAttribute = result.Data; } } ViewBag.AttributeList = lstAttribute; if (!string.IsNullOrEmpty(packageNo)) { using (PackageQueryServiceClient client = new PackageQueryServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, OrderBy = "ItemNo", Where = string.Format(@"Key.PackageNo='{0}' AND EXISTS(FROM Package as p WHERE p.Key=self.Key.PackageNo AND ( PackageState='{1}' or PackageState='{2}') AND PackageType='{3}')" , packageNo.ToUpper() , Convert.ToInt32(EnumPackageState.Packaging) , Convert.ToInt32(EnumPackageState.Packaged) , Convert.ToInt32(EnumPackageType.Packet)) }; MethodReturnResult <Package> result2 = client.Get(packageNo.ToUpper()); if (result2.Code == 0) { ViewBag.Package = result2.Data; } MethodReturnResult <IList <PackageDetail> > result = client.GetDetail(ref cfg); if (result.Code == 0) { ViewBag.PackageDetailList = result.Data; } } } return(PartialView("_ListPartial", new ZPVMLotViewModel())); }
public IEnumerable <SelectListItem> GetAttributeName() { //using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) //{ // PagingConfig cfg = new PagingConfig() // { // IsPaging = false, // Where = string.Format("Key.CategoryName='{0}'", "MaterialAttribute") // }; // MethodReturnResult<IList<BaseAttribute>> result = client.Get(ref cfg); // if (result.Code <= 0) // { // IEnumerable<SelectListItem> lst = from item in result.Data // select new SelectListItem() // { // Text = item.Key.AttributeName, // Value = item.Key.AttributeName // }; // return lst; // } //} //return new List<SelectListItem>(); using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName='{0}'", "WorkOrderAttribute") }; MethodReturnResult <IList <BaseAttribute> > result = client.Get(ref cfg); if (result.Code <= 0) { IEnumerable <SelectListItem> lst = from item in result.Data select new SelectListItem() { Text = string.Format("{0}({1})", item.Key.AttributeName, item.Description), Value = item.Key.AttributeName }; return(lst); } } return(new List <SelectListItem>()); }
private async Task SetBaseAttributeValue(string categoryName, int?itemOrder) { ViewBag.ItemOrder = itemOrder; using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { await Task.Run(() => { string where = string.Format("Key.CategoryName='{0}'", categoryName); PagingConfig cfg = new PagingConfig() { IsPaging = false, OrderBy = "Key.CategoryName,Order", Where = where }; MethodReturnResult <IList <BaseAttribute> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.BaseAttributeList = result.Data; } }); } using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { await Task.Run(() => { string where = string.Format("Key.CategoryName='{0}' AND Key.ItemOrder='{1}'" , categoryName , itemOrder ?? 0); PagingConfig cfg = new PagingConfig() { IsPaging = false, OrderBy = "Key.CategoryName,Key.ItemOrder", Where = where }; MethodReturnResult <IList <BaseAttributeValue> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.List = result.Data; } }); } }
public async Task <ActionResult> Delete(string categoryName, string attributeName) { MethodReturnResult result = new MethodReturnResult(); using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { var key = new BaseAttributeKey() { CategoryName = categoryName, AttributeName = attributeName }; result = await client.DeleteAsync(key); if (result.Code == 0) { result.Message = string.Format(StringResource.BaseAttribute_Delete_Success , key); } return(Json(result)); } }
public async Task <ActionResult> Query(BaseAttributeQueryViewModel model) { if (ModelState.IsValid) { using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { await Task.Run(() => { StringBuilder where = new StringBuilder(); if (model != null) { if (!string.IsNullOrEmpty(model.CategoryName)) { where.AppendFormat(" Key.CategoryName = '{0}'", model.CategoryName); } if (!string.IsNullOrEmpty(model.AttributeName)) { where.AppendFormat("{0} Key.AttributeName LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.AttributeName); } } PagingConfig cfg = new PagingConfig() { OrderBy = "Key.CategoryName,Order", Where = where.ToString() }; MethodReturnResult <IList <BaseAttribute> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_ListPartial")); }
public string GetAttributeMemo(string sAttributeName) { string sMemo = ""; using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName='{0}' and Key.AttributeName = '{1}'", "RouteStepAttribute", sAttributeName) }; MethodReturnResult <IList <BaseAttribute> > result = client.Get(ref cfg); if (result.Code <= 0) { sMemo = result.Data[0].Description; } } return(sMemo); }
// // GET: /BaseData/BaseAttribute/ public async Task <ActionResult> Index(string categoryName) { using (BaseAttributeCategoryServiceClient client = new BaseAttributeCategoryServiceClient()) { MethodReturnResult <BaseAttributeCategory> result = await client.GetAsync(categoryName ?? string.Empty); if (result.Code > 0 || result.Data == null) { return(RedirectToAction("Index", "BaseAttributeCategory")); } ViewBag.BaseAttributeCategory = result.Data; } using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { await Task.Run(() => { string where = string.Format("Key.CategoryName='{0}'", categoryName); PagingConfig cfg = new PagingConfig() { OrderBy = "Key.CategoryName,Order", Where = where }; MethodReturnResult <IList <BaseAttribute> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } return(View(new BaseAttributeQueryViewModel() { CategoryName = categoryName })); }
public async Task <ActionResult> PagingQuery(string where, string orderBy, int?currentPageNo, int?currentPageSize) { if (ModelState.IsValid) { int pageNo = currentPageNo ?? 0; int pageSize = currentPageSize ?? 20; if (Request["PageNo"] != null) { pageNo = Convert.ToInt32(Request["PageNo"]); } if (Request["PageSize"] != null) { pageSize = Convert.ToInt32(Request["PageSize"]); } using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { PageNo = pageNo, PageSize = pageSize, Where = where ?? string.Empty, OrderBy = orderBy ?? string.Empty }; MethodReturnResult <IList <BaseAttribute> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_ListPartial")); }
// // POST: /WIP/LotCreate/Detail public ActionResult Detail(LotCreateMainViewModel model) { LotCreateDetailViewModel viewModel = new LotCreateDetailViewModel() { LineStoreName = model.LineStoreName, MaterialLot = model.MaterialLot, MaterialCode = model.MaterialCode, LotType = model.LotType, OrderNumber = model.OrderNumber, Count = model.Count, Description = string.Empty, MaterialQty = 0, ProductCode = string.Empty, Quantity = 0, RawQuantity = 0, RouteEnterpriseName = string.Empty, RouteName = string.Empty, RouteStepName = string.Empty, SupplierCode = string.Empty }; if (string.IsNullOrEmpty(model.MaterialLot)) { return(View(viewModel)); } //获取工单信息。 using (WorkOrderServiceClient client = new WorkOrderServiceClient()) { MethodReturnResult <WorkOrder> result = client.Get(model.OrderNumber); if (result.Code <= 0 && result.Data != null) { result.Code = 1000; result.Message = "工单号错误!"; return(Json(result)); //viewModel.ProductCode = result.Data.MaterialCode; } } //获取工单工艺信息。 using (WorkOrderRouteServiceClient client = new WorkOrderRouteServiceClient()) { PagingConfig cfg = new PagingConfig() { PageNo = 0, PageSize = 1, Where = string.Format("Key.OrderNumber='{0}'", model.OrderNumber), OrderBy = "Key.ItemNo" }; if (model.LotType == EnumLotType.Rework) { cfg.Where += " AND IsRework=1"; } else { cfg.Where += " AND IsRework=0"; } MethodReturnResult <IList <WorkOrderRoute> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null && result.Data.Count > 0) { viewModel.RouteEnterpriseName = result.Data[0].RouteEnterpriseName; viewModel.RouteName = result.Data[0].RouteName; viewModel.RouteStepName = result.Data[0].RouteStepName; } } //获取线边仓物料信息 using (LineStoreMaterialServiceClient client = new LineStoreMaterialServiceClient()) { LineStoreMaterialDetailKey key = new LineStoreMaterialDetailKey() { LineStoreName = model.LineStoreName, OrderNumber = model.OrderNumber, MaterialCode = model.MaterialCode, MaterialLot = model.MaterialLot }; MethodReturnResult <LineStoreMaterialDetail> result = client.GetDetail(key); if (result.Code <= 0 && result.Data != null) { viewModel.MaterialQty = result.Data.CurrentQty; viewModel.SupplierCode = result.Data.SupplierCode; } } //根据物料获取每批原材料建议数量和每批产品建议数量。 using (MaterialServiceClient client = new MaterialServiceClient()) { MethodReturnResult <Material> result = client.Get(viewModel.ProductCode); if (result.Code <= 0 && result.Data != null) { viewModel.RawQuantity = result.Data.MainRawQtyPerLot; viewModel.Quantity = result.Data.MainProductQtyPerLot; } } //根据工单号和批次个数生成批次号。 IList <string> lstLot = new List <string>(); using (LotCreateServiceClient client = new LotCreateServiceClient()) { MethodReturnResult <IList <string> > result = client.Generate(model.LotType, model.OrderNumber, model.Count, model.LineCode); if (result.Code <= 0 && result.Data != null && result.Data.Count > 0) { lstLot = result.Data; } } ViewBag.LotList = lstLot; //获取需要录入的批次号自定义特性 IList <BaseAttribute> lstAttribute = new List <BaseAttribute>(); using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName='{0}'", "LotCreateAttribute") }; MethodReturnResult <IList <BaseAttribute> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null && result.Data.Count > 0) { lstAttribute = result.Data; } } ViewBag.AttributeList = lstAttribute; return(View(viewModel)); }
public ActionResult Save(LotCreateDetailViewModel model) { MethodReturnResult result = new MethodReturnResult(); try { if (ModelState.IsValid) { CreateParameter p = new CreateParameter() { Creator = User.Identity.Name, LineStoreName = model.LineStoreName, LotType = model.LotType, OperateComputer = Request.UserHostAddress, Operator = User.Identity.Name, OrderNumber = model.OrderNumber, Quantity = model.Quantity, RawMaterialCode = model.MaterialCode, RawMaterialLot = model.MaterialLot, RawQuantity = model.RawQuantity, Remark = model.Description, RouteEnterpriseName = model.RouteEnterpriseName, RouteName = model.RouteName, RouteStepName = model.RouteStepName, LineCode = model.LineCode, LotNumbers = new List <string>() }; char splitChar = ','; //获取批次号值。 string[] lotNumbers = Request["LotNumber"].ToUpper().Split(splitChar); p.LotNumbers = lotNumbers.ToList(); //获取自定义属性值。 IList <BaseAttribute> lstAttribute = new List <BaseAttribute>(); using (BaseAttributeServiceClient client = new BaseAttributeServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName='{0}'", "LotCreateAttribute") }; MethodReturnResult <IList <BaseAttribute> > rst = client.Get(ref cfg); if (rst.Code <= 0 && rst.Data != null && rst.Data.Count > 0) { lstAttribute = rst.Data; } } p.Attributes = new Dictionary <string, IList <TransactionParameter> >(); foreach (BaseAttribute attr in lstAttribute) { string vals = Request["ATTR_" + attr.Key.AttributeName]; if (string.IsNullOrEmpty(vals)) { continue; } string[] attrValues = vals.Split(splitChar); for (int i = 0; i < p.LotNumbers.Count && i < attrValues.Length; i++) { string lotNumber = p.LotNumbers[i]; string tpVal = attrValues[i]; //如果没有设置值,则不进行数据存储。 if (string.IsNullOrEmpty(tpVal)) { continue; } if (!p.Attributes.ContainsKey(lotNumber)) { p.Attributes.Add(lotNumber, new List <TransactionParameter>()); } if (attr.DataType == EnumDataType.Boolean) { tpVal = tpVal == "on" ? "true" : "false"; } TransactionParameter tp = new TransactionParameter() { Index = attr.Order, Name = attr.Key.AttributeName, Value = tpVal }; p.Attributes[lotNumber].Add(tp); } } //创建批次。 using (LotCreateServiceClient client = new LotCreateServiceClient()) { result = client.Create(p); } //标签打印。 if (result.Code == 0) { result = PrintPrivate(model); } if (result.Code == 0) { result.Message = "保存成功。"; } } } catch (Exception ex) { result.Code = 1000; result.Message = ex.Message; result.Detail = ex.ToString(); } // 如果我们进行到这一步时某个地方出错,则重新显示表单 return(Json(result)); }