// // GET: /FMM/RouteStepAttribute/Detail public async Task <ActionResult> Detail(string routeName, string routeStepName, string attributeName) { using (RouteStepAttributeServiceClient client = new RouteStepAttributeServiceClient()) { MethodReturnResult <RouteStepAttribute> result = await client.GetAsync(new RouteStepAttributeKey() { RouteName = routeName, RouteStepName = routeStepName, AttributeName = attributeName }); if (result.Code == 0) { RouteStepAttributeViewModel viewModel = new RouteStepAttributeViewModel() { RouteName = result.Data.Key.RouteName, RouteStepName = result.Data.Key.RouteStepName, AttributeName = result.Data.Key.AttributeName, Value = result.Data.Value, Editor = result.Data.Editor, EditTime = result.Data.EditTime }; return(PartialView("_InfoPartial", viewModel)); } else { ModelState.AddModelError("", result.Message); } } return(PartialView("_InfoPartial")); }
public async Task <ActionResult> Save(RouteStepAttributeViewModel model) { using (RouteStepAttributeServiceClient client = new RouteStepAttributeServiceClient()) { RouteStepAttribute obj = new RouteStepAttribute() { Key = new RouteStepAttributeKey() { RouteName = model.RouteName, RouteStepName = model.RouteStepName, AttributeName = model.AttributeName }, Value = model.Value, Editor = User.Identity.Name, EditTime = DateTime.Now, }; MethodReturnResult rst = await client.AddAsync(obj); if (rst.Code == 0) { rst.Message = string.Format(FMMResources.StringResource.RouteStepAttribute_Save_Success , obj.Key); } return(Json(rst)); } }
public async Task <ActionResult> SaveModify(RouteStepAttributeViewModel model) { using (RouteStepAttributeServiceClient client = new RouteStepAttributeServiceClient()) { MethodReturnResult <RouteStepAttribute> result = await client.GetAsync(new RouteStepAttributeKey() { RouteName = model.RouteName, RouteStepName = model.RouteStepName, AttributeName = model.AttributeName }); if (result.Code == 0) { result.Data.Value = model.Value; 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(FMMResources.StringResource.RouteStepAttribute_SaveModify_Success , result.Data.Key); } return(Json(rst)); } return(Json(result)); } }
public bool RerurnIsExecutePowerset(string lotNumber) { IList <RouteStepAttribute> lstRouteStepAttribute = new List <RouteStepAttribute>(); //工序属性 MethodReturnResult <Lot> rst = new MethodReturnResult <Lot>(); MethodReturnResult result = new MethodReturnResult(); Lot obj = null; using (LotQueryServiceClient client = new LotQueryServiceClient()) { rst = client.Get(lotNumber); if (rst.Code == 0 && rst.Data != null) { obj = rst.Data; } else { result.Code = rst.Code; result.Message = rst.Message; result.Detail = rst.Detail; return(false); } } //获取工序控制属性列表 using (RouteStepAttributeServiceClient client = new RouteStepAttributeServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.RouteName='{0}' AND Key.RouteStepName='{1}'" , obj.RouteName , obj.RouteStepName) }; MethodReturnResult <IList <RouteStepAttribute> > r = client.Get(ref cfg); if (r.Code <= 0 && r.Data != null) { lstRouteStepAttribute = r.Data; } } //是否显示电流档(利用功率分档显示电流档)yanshan.xiao bool IsExecutePowerset = false; var lnq = from item in lstRouteStepAttribute where item.Key.AttributeName == "IsExecutePowerset" select item; RouteStepAttribute rsaTmp = lnq.FirstOrDefault(); if (rsaTmp != null) { bool.TryParse(rsaTmp.Value, out IsExecutePowerset); } return(IsExecutePowerset); }
public async Task <ActionResult> Query(RouteStepAttributeQueryViewModel model) { if (ModelState.IsValid) { using (RouteStepAttributeServiceClient client = new RouteStepAttributeServiceClient()) { await Task.Run(() => { StringBuilder where = new StringBuilder(); if (model != null) { where.AppendFormat(" {0} Key.RouteName = '{1}'" , where.Length > 0 ? "AND" : string.Empty , model.RouteName); where.AppendFormat(" {0} Key.RouteStepName = '{1}'" , where.Length > 0 ? "AND" : string.Empty , model.RouteStepName); 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", Where = where.ToString() }; MethodReturnResult <IList <RouteStepAttribute> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_ListPartial")); }
// // GET: /FMM/RouteStepAttribute/ public async Task <ActionResult> Index(string routeName, string routeStepName) { using (RouteStepServiceClient client = new RouteStepServiceClient()) { MethodReturnResult <RouteStep> result = await client.GetAsync(new RouteStepKey() { RouteName = routeName, RouteStepName = routeStepName }); if (result.Code > 0 || result.Data == null) { return(RedirectToAction("Index", "RouteStep", new { @RouteName = routeName })); } ViewBag.RouteStep = result.Data; } using (RouteStepAttributeServiceClient client = new RouteStepAttributeServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { Where = string.Format(" Key.RouteName='{0}' AND Key.RouteStepName = '{1}'" , routeName , routeStepName), OrderBy = "Key.AttributeName" }; MethodReturnResult <IList <RouteStepAttribute> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } return(View(new RouteStepAttributeQueryViewModel() { RouteName = routeName, RouteStepName = routeStepName })); }
public async Task <ActionResult> Delete(string routeName, string routeStepName, string attributeName) { MethodReturnResult result = new MethodReturnResult(); using (RouteStepAttributeServiceClient client = new RouteStepAttributeServiceClient()) { result = await client.DeleteAsync(new RouteStepAttributeKey() { RouteName = routeName, RouteStepName = routeStepName, AttributeName = attributeName }); if (result.Code == 0) { result.Message = string.Format(FMMResources.StringResource.RouteStepAttribute_Delete_Success , attributeName); } return(Json(result)); } }
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 (RouteStepAttributeServiceClient client = new RouteStepAttributeServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { PageNo = pageNo, PageSize = pageSize, Where = where ?? string.Empty, OrderBy = orderBy ?? string.Empty }; MethodReturnResult <IList <RouteStepAttribute> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_ListPartial")); }
public ActionResult Save(LotTrackViewModel model) { MethodReturnResult result = new MethodReturnResult(); Response.StatusDescription = "JSON"; try { string lotNumber = model.LotNumber.ToUpper(); result = GetLot(lotNumber); if (result.Code > 0) { return(Json(result)); } MethodReturnResult <Lot> rst = result as MethodReturnResult <Lot>; Lot obj = rst.Data; //等待进站批次,设备代码必须选择。 if (obj.StateFlag == EnumLotState.WaitTrackIn && string.IsNullOrEmpty(model.EquipmentCode)) { result.Code = 1; result.Message = string.Format("设备代码不能为空。"); return(Json(result)); } //判断批次工序是否在当前工序。 if (obj.RouteStepName != model.RouteOperationName) { result.Code = 2; result.Message = string.Format("批次({0})当前所在工序({1}),不能在({2})工序上操作。" , obj.Key , obj.RouteStepName , model.RouteOperationName); return(Json(result)); } //判断批次所在车间和当前线边所在车间是否匹配。 //获取线别车间。 string locationName = string.Empty; using (ProductionLineServiceClient client = new ProductionLineServiceClient()) { MethodReturnResult <ProductionLine> r = client.Get(model.LineCode); if (r.Code <= 0) { locationName = r.Data.LocationName; } } if (!string.IsNullOrEmpty(locationName)) { using (LocationServiceClient client = new LocationServiceClient()) { MethodReturnResult <Location> r = client.Get(locationName); if (r.Code <= 0) { locationName = r.Data.ParentLocationName; } } } //检查批次车间和线别车间是否匹配。 if (obj.LocationName != locationName) { result.Code = 3; result.Message = string.Format("批次({0})属于({1})车间,不能在({2})车间线别上操作。" , lotNumber , obj.LocationName , locationName); return(Json(result)); } bool isShowModal = false; //获取工序参数列表。 IList <RouteStepParameter> lstRouteStepParameter = GetParameterList(obj.RouteName, obj.RouteStepName, obj.StateFlag); if (lstRouteStepParameter != null && lstRouteStepParameter.Count > 0) //需要显示工序参数录入表单。 { isShowModal = true; } //出站,判断是否显示不良和报废录入对话框。 if (obj.StateFlag == EnumLotState.WaitTrackOut) { IList <RouteStepAttribute> lstRouteStepAttribute = new List <RouteStepAttribute>(); using (RouteStepAttributeServiceClient client = new RouteStepAttributeServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.RouteName='{0}' AND Key.RouteStepName='{1}'" , obj.RouteName , obj.RouteStepName) }; MethodReturnResult <IList <RouteStepAttribute> > r = client.Get(ref cfg); if (r.Code <= 0 && r.Data != null) { lstRouteStepAttribute = r.Data; } } //是否输入等级。 bool isInputGrade = false; var lnq = from item in lstRouteStepAttribute where item.Key.AttributeName == "IsInputGrade" select item; RouteStepAttribute rsaTmp = lnq.FirstOrDefault(); if (rsaTmp != null) { bool.TryParse(rsaTmp.Value, out isInputGrade); } //是否输入花色。 bool isInputColor = false; lnq = from item in lstRouteStepAttribute where item.Key.AttributeName == "IsInputColor" select item; rsaTmp = lnq.FirstOrDefault(); if (rsaTmp != null) { bool.TryParse(rsaTmp.Value, out isInputColor); } //获取是否显示不良原因录入对话框。 bool isShowDefectModal = false; lnq = from item in lstRouteStepAttribute where item.Key.AttributeName == "IsShowDefectModal" select item; rsaTmp = lnq.FirstOrDefault(); if (rsaTmp != null) { bool.TryParse(rsaTmp.Value, out isShowDefectModal); } //获取是否显示报废原因录入对话框。 bool isShowScrapModal = false; lnq = from item in lstRouteStepAttribute where item.Key.AttributeName == "IsShowScrapModal" select item; rsaTmp = lnq.FirstOrDefault(); if (rsaTmp != null) { bool.TryParse(rsaTmp.Value, out isShowScrapModal); } //是否输入等级 if (isInputGrade) { ViewBag.IsInputGrade = isInputGrade; isShowModal = true; } //是否输入花色 if (isInputColor) { ViewBag.IsInputColor = isInputColor; isShowModal = true; } //是否显示不良原因录入对话框。 if (isShowDefectModal) { IList <ReasonCodeCategoryDetail> lstDefectReasonCodes = GetDefectReasonCodes(obj.RouteName, obj.RouteStepName); if (lstDefectReasonCodes != null && lstDefectReasonCodes.Count > 0) { isShowModal = true; } } //是否显示报废原因录入对话框。 if (isShowScrapModal) { IList <ReasonCodeCategoryDetail> lstScrapReasonCodes = GetScrapReasonCodes(obj.RouteName, obj.RouteStepName); if (lstScrapReasonCodes != null && lstScrapReasonCodes.Count > 0) { isShowModal = true; } } } //显示附加对话框。 if (isShowModal) { Response.StatusDescription = "Partial"; ViewBag.Lot = obj; return(PartialView("_ModalContentPartial", new LotTrackViewModel())); } result = Track(obj, model); } catch (Exception ex) { result.Code = 1000; result.Message = ex.Message; result.Detail = ex.ToString(); } // 如果我们进行到这一步时某个地方出错,则重新显示表单 return(Json(result)); }
public async Task <ActionResult> SaveCopy(RouteViewModel model) { Route obj = new Route() { Key = model.Name, RouteType = model.RouteType, Status = model.Status, Description = model.Description, Creator = User.Identity.Name, CreateTime = DateTime.Now, Editor = User.Identity.Name, EditTime = DateTime.Now }; MethodReturnResult result = new MethodReturnResult(); using (RouteServiceClient client = new RouteServiceClient()) { result = await client.AddAsync(obj); if (result.Code == 0) { result.Message = "复制工艺流程主体成功"; StringBuilder where = new StringBuilder(); using (RouteStepServiceClient routeStepServiceClient = new RouteStepServiceClient()) { where.AppendFormat(" Key.RouteName ='{0}'", model.ParentName); PagingConfig cfg = new PagingConfig() { IsPaging = false, OrderBy = "SortSeq", Where = where.ToString() }; MethodReturnResult <IList <RouteStep> > routeStep = routeStepServiceClient.Get(ref cfg); if (routeStep.Code == 0) { List <RouteStep> listOfRouteStep = routeStep.Data.ToList <RouteStep>(); foreach (RouteStep itemOfRouteStep in listOfRouteStep) { #region 制工步信息 RouteStep objRouteStep = new RouteStep() { Key = new RouteStepKey() { RouteName = model.Name, RouteStepName = itemOfRouteStep.Key.RouteStepName }, DefectReasonCodeCategoryName = itemOfRouteStep.DefectReasonCodeCategoryName, Duration = itemOfRouteStep.Duration, ScrapReasonCodeCategoryName = itemOfRouteStep.ScrapReasonCodeCategoryName, SortSeq = itemOfRouteStep.SortSeq, RouteOperationName = itemOfRouteStep.RouteOperationName, Description = itemOfRouteStep.Description, Editor = User.Identity.Name, EditTime = DateTime.Now, CreateTime = DateTime.Now, Creator = User.Identity.Name }; MethodReturnResult rstOfRouteStep = await routeStepServiceClient.AddAsync(objRouteStep); if (rstOfRouteStep.Code != 0) { result.Code = 1001; result.Message = "复制工步信息失败" + rstOfRouteStep.Message; return(Json(result)); } #endregion #region 制工步参数 using (RouteStepParameterServiceClient routeStepParameterServiceClient = new RouteStepParameterServiceClient()) { #region 除新增工艺流程工步带过来的工步参数 cfg = new PagingConfig() { Where = string.Format(" Key.RouteName='{0}' AND Key.RouteStepName = '{1}'" , model.Name , itemOfRouteStep.Key.RouteStepName), OrderBy = "ParamIndex" }; MethodReturnResult <IList <RouteStepParameter> > routeStepParameterNewAdd = routeStepParameterServiceClient.Get(ref cfg); if (routeStepParameterNewAdd.Code == 0) { List <RouteStepParameter> listOfRouteStepParameterNewAdd = routeStepParameterNewAdd.Data.ToList <RouteStepParameter>(); foreach (RouteStepParameter itemOfRouteStepParameterNewAdd in listOfRouteStepParameterNewAdd) { MethodReturnResult rstOfRouteStepParameterNewAdd = routeStepParameterServiceClient.Delete(itemOfRouteStepParameterNewAdd.Key); if (rstOfRouteStepParameterNewAdd.Code != 0) { result.Code = 1001; result.Message = "删除初始工步参数信息失败" + rstOfRouteStepParameterNewAdd.Message; return(Json(result)); } } } #endregion #region 制工步参数 cfg = new PagingConfig() { Where = string.Format(" Key.RouteName='{0}' AND Key.RouteStepName = '{1}'" , model.ParentName , itemOfRouteStep.Key.RouteStepName), OrderBy = "ParamIndex" }; MethodReturnResult <IList <RouteStepParameter> > routeStepParameter = routeStepParameterServiceClient.Get(ref cfg); if (routeStepParameter.Code == 0) { List <RouteStepParameter> listOfRouteStepParameter = routeStepParameter.Data.ToList <RouteStepParameter>(); foreach (RouteStepParameter itemOfRouteStepParameter in listOfRouteStepParameter) { RouteStepParameter objRouteStepParameter = new RouteStepParameter() { Key = new RouteStepParameterKey() { RouteName = model.Name, RouteStepName = itemOfRouteStepParameter.Key.RouteStepName, ParameterName = itemOfRouteStepParameter.Key.ParameterName }, MaterialType = itemOfRouteStepParameter.MaterialType, DataFrom = itemOfRouteStepParameter.DataFrom, DataType = itemOfRouteStepParameter.DataType, DCType = itemOfRouteStepParameter.DCType, IsDeleted = itemOfRouteStepParameter.IsDeleted, IsMustInput = itemOfRouteStepParameter.IsMustInput, IsReadOnly = itemOfRouteStepParameter.IsReadOnly, IsUsePreValue = itemOfRouteStepParameter.IsUsePreValue, ParamIndex = itemOfRouteStepParameter.ParamIndex, ValidateFailedMessage = itemOfRouteStepParameter.ValidateFailedMessage, ValidateFailedRule = itemOfRouteStepParameter.ValidateFailedRule, ValidateRule = itemOfRouteStepParameter.ValidateRule, Editor = User.Identity.Name, EditTime = DateTime.Now, }; MethodReturnResult rstOfRouteStepParameter = await routeStepParameterServiceClient.AddAsync(objRouteStepParameter); if (rstOfRouteStepParameter.Code != 0) { result.Code = 1001; result.Message = "复制工步参数信息失败" + rstOfRouteStepParameter.Message; return(Json(result)); } } } #endregion } #endregion #region 制工步属性 using (RouteStepAttributeServiceClient routeStepAttributeServiceClient = new RouteStepAttributeServiceClient()) { #region 除新增工艺流程工步带过来的工步属性 cfg = new PagingConfig() { Where = string.Format(" Key.RouteName='{0}' AND Key.RouteStepName = '{1}'" , model.Name , itemOfRouteStep.Key.RouteStepName), OrderBy = "Key.AttributeName" }; MethodReturnResult <IList <RouteStepAttribute> > routeStepAttributeNewAdd = routeStepAttributeServiceClient.Get(ref cfg); if (routeStepAttributeNewAdd.Code == 0) { List <RouteStepAttribute> listOfRouteStepAttributeNewAdd = routeStepAttributeNewAdd.Data.ToList <RouteStepAttribute>(); foreach (RouteStepAttribute itemOfRouteStepAttributeNewAdd in listOfRouteStepAttributeNewAdd) { MethodReturnResult rstOfRouteStepAttributeNewAdd = routeStepAttributeServiceClient.Delete(itemOfRouteStepAttributeNewAdd.Key); if (rstOfRouteStepAttributeNewAdd.Code != 0) { result.Code = 1001; result.Message = "删除初始工步属性信息失败" + rstOfRouteStepAttributeNewAdd.Message; return(Json(result)); } } } #endregion #region 制工步属性 cfg = new PagingConfig() { Where = string.Format(" Key.RouteName='{0}' AND Key.RouteStepName = '{1}'" , model.ParentName , itemOfRouteStep.Key.RouteStepName), OrderBy = "Key.AttributeName" }; MethodReturnResult <IList <RouteStepAttribute> > routeStepAttribute = routeStepAttributeServiceClient.Get(ref cfg); if (routeStepAttribute.Code == 0) { List <RouteStepAttribute> listOfRouteStepAttribute = routeStepAttribute.Data.ToList <RouteStepAttribute>(); foreach (RouteStepAttribute itemOfRouteStepAttribute in listOfRouteStepAttribute) { RouteStepAttribute objRouteStepAttribute = new RouteStepAttribute() { Key = new RouteStepAttributeKey() { RouteName = model.Name, RouteStepName = itemOfRouteStepAttribute.Key.RouteStepName, AttributeName = itemOfRouteStepAttribute.Key.AttributeName }, Value = itemOfRouteStepAttribute.Value, Editor = User.Identity.Name, EditTime = DateTime.Now, }; MethodReturnResult rstOfRouteStepAttribute = await routeStepAttributeServiceClient.AddAsync(objRouteStepAttribute); if (rstOfRouteStepAttribute.Code != 0) { result.Code = 1001; result.Message = "复制工步属性信息失败" + rstOfRouteStepAttribute.Message; return(Json(result)); } } } #endregion } #endregion } result.Message += " \r\n 复制工艺流程工步参数及工步属性成功"; } } } } return(Json(result)); }