public IEnumerable <SelectListItem> GetColorList() { //获取用户拥有权限的生产线。 IList <BaseAttributeValue> lstValues = new List <BaseAttributeValue>(); using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName='Color' AND Key.AttributeName='VALUE'"), OrderBy = "Key.ItemOrder" }; MethodReturnResult <IList <BaseAttributeValue> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null) { lstValues = result.Data; } } return(from item in lstValues select new SelectListItem() { Text = item.Value, Value = item.Value }); }
public IEnumerable <SelectListItem> GetPowerDifferenceList() { using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = "Key.CategoryName='ZPVM_PowerDifference' AND Key.AttributeName='VALUE'", OrderBy = "Key.ItemOrder" }; MethodReturnResult <IList <BaseAttributeValue> > result = client.Get(ref cfg); if (result.Code <= 0) { IEnumerable <SelectListItem> lst = from item in result.Data select new SelectListItem() { Text = item.Value, Value = item.Value }; return(lst); } } return(new List <SelectListItem>()); }
public IList <SelectListItem> GetShiftValue() { using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format(@"Key.CategoryName='{0}' AND Key.AttributeName='{1}'" , "ShiftValue" , "Value"), OrderBy = "Key.ItemOrder" }; MethodReturnResult <IList <BaseAttributeValue> > result = client.Get(ref cfg); if (result.Code <= 0) { IEnumerable <SelectListItem> lst = from item in result.Data select new SelectListItem() { Text = item.Value, Value = item.Value }; return(lst.ToList()); } } return(new List <SelectListItem>()); }
/// <summary> /// 根据电池片颜色来获取组件的颜色 /// </summary> /// <param name="colorOfCell"></param> /// <returns></returns> public string GetColorOfModule(string colorOfCell) { string strColorOfModule = colorOfCell; if (string.IsNullOrEmpty(colorOfCell) == false) { IList <BaseAttributeValue> lstValues = new List <BaseAttributeValue>(); using (BaseAttributeValueServiceClient client1 = new BaseAttributeValueServiceClient()) { PagingConfig cfg1 = new PagingConfig() { IsPaging = false, Where = string.Format(@" Key.AttributeName='MDesc' and EXISTS (from BaseAttributeValue as p where p.Key.CategoryName='Color_Cell' AND p.Key.AttributeName='CName' and p.Value='{0}' and self.Key.ItemOrder = p.Key.ItemOrder and self.Key.CategoryName = p.Key.CategoryName )", colorOfCell), OrderBy = "Key.ItemOrder" }; MethodReturnResult <IList <BaseAttributeValue> > result1 = client1.Get(ref cfg1); if (result1.Code <= 0 && result1.Data != null && result1.Data.Count > 0) { lstValues = result1.Data; strColorOfModule = lstValues.FirstOrDefault().Value; } } } return(strColorOfModule); }
/// <summary> /// 取得产品代码 /// </summary> /// <returns></returns> public IEnumerable <SelectListItem> GetProductName() { IList <BaseAttributeValue> lstValues = new List <BaseAttributeValue>(); using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName = 'RPTPerCapitaEfficiencyRatio' AND Key.AttributeName = 'ProcuctCode'"), OrderBy = "Key.ItemOrder" }; MethodReturnResult <IList <BaseAttributeValue> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null) { lstValues = result.Data; } } return(from item in lstValues select new SelectListItem() { Text = item.Value, Value = item.Value }); }
// // 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 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)); }
/// <summary> 取得工单类型名称 </summary> /// <param name="orderType">工单类型代码</param> /// <returns></returns> public string GetOrderTypeName(string orderType) { string orderTypeName = ""; using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { //取得对应的ID号 PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format(@"Key.CategoryName = '{0}' AND (Key.AttributeName = '{1}' AND Value = '{2}')" , "OrderType" , "VALUE" , orderType), OrderBy = "Key.ItemOrder" }; MethodReturnResult <IList <BaseAttributeValue> > itemid = client.Get(ref cfg); if (itemid.Code == 0 && itemid.Data.Count > 0) { //取得对应的ID号 cfg = new PagingConfig() { IsPaging = false, Where = string.Format(@"Key.CategoryName = '{0}' AND (Key.AttributeName = '{1}' AND Key.ItemOrder = {2})" , "OrderType" , "Name" , itemid.Data[0].Key.ItemOrder), OrderBy = "Key.ItemOrder" }; MethodReturnResult <IList <BaseAttributeValue> > result = client.Get(ref cfg); if (result.Code == 0 && result.Data.Count > 0) { orderTypeName = result.Data[0].Value; } } } return(orderTypeName); }
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 double GetFullChestQty() { double qty = 0; using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName='ChestInParameters' AND Key.AttributeName='FullChestQty'") }; MethodReturnResult <IList <BaseAttributeValue> > fullChestQty = client.Get(ref cfg); if (fullChestQty.Data != null && fullChestQty.Data.Count > 0) { qty = Convert.ToDouble(fullChestQty.Data[0].Value); } } return(qty); }
public IEnumerable <SelectListItem> GetColorOfCell() { IList <BaseAttributeValue> lstValues = new List <BaseAttributeValue>(); using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName='Color_Cell' AND Key.AttributeName='CName'"), OrderBy = "Key.ItemOrder" }; MethodReturnResult <IList <BaseAttributeValue> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null) { lstValues = result.Data; } } return(from item in lstValues select new SelectListItem() { Text = item.Value, Value = item.Value }); //var lnqValue = from item in lstValues // where item.Key.AttributeName == "VALUE" // select item; //var lnqName = from item in lstValues // where item.Key.AttributeName == "NAME" // select item; //return from item in lnqValue // join itemName in lnqName on item.Key.ItemOrder equals itemName.Key.ItemOrder // select new SelectListItem() // { // Text = string.Format("{0}-{1}", item.Value, itemName.Value), // Value = item.Value // }; }
public async Task <ActionResult> Delete(string categoryName, int?itemOrder) { MethodReturnResult result = new MethodReturnResult(); if (itemOrder == null) { result.Code = 1000; result.Message = StringResource.BaseAttributeValue_ParamterError; return(Json(result)); } using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { result = await client.DeleteAsync(categoryName, itemOrder.Value); if (result.Code == 0) { result.Message = StringResource.BaseAttributeValue_Delete_Success; } return(Json(result)); } }
public IEnumerable <SelectListItem> GetGradeList(string lotGrade) { if (string.IsNullOrEmpty(lotGrade) || lotGrade.Length == 0) { lotGrade = "A"; } IList <BaseAttributeValue> lstValues = new List <BaseAttributeValue>(); using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format(@"Key.CategoryName='Grade' AND Key.AttributeName='VALUE' AND Exists( from BaseAttributeValue as p where p.Key.CategoryName='Grade' AND p.Key.AttributeName='VALUE' AND p.Value='{0}' AND self.Key.ItemOrder >= p.Key.ItemOrder ) ", lotGrade), OrderBy = "Key.ItemOrder" }; MethodReturnResult <IList <BaseAttributeValue> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null) { lstValues = result.Data; } } return(from item in lstValues select new SelectListItem() { Text = item.Value, Value = item.Value }); }
public IEnumerable <SelectListItem> GetTechnologyList() { IList <BaseAttributeValue> lstValues = new List <BaseAttributeValue>(); using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName='Technology'"), OrderBy = "Key.ItemOrder" }; MethodReturnResult <IList <BaseAttributeValue> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null) { lstValues = result.Data; } } var lnqValue = from item in lstValues where item.Key.AttributeName == "VALUE" select item; var lnqName = from item in lstValues where item.Key.AttributeName == "NAME" select item; return(from item in lnqValue join itemName in lnqName on item.Key.ItemOrder equals itemName.Key.ItemOrder select new SelectListItem() { Text = string.Format("{0}-{1}", item.Value, itemName.Value), Value = item.Value }); }
//获取基础数据库位表 public IEnumerable <SelectListItem> GetStoreLocationList() { IList <BaseAttributeValue> lstResource = new List <BaseAttributeValue>(); using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName='StoreLocation' AND Key.AttributeName='StoreLocationName'") }; MethodReturnResult <IList <BaseAttributeValue> > lstStoreLocationName = client.Get(ref cfg); if (lstStoreLocationName.Data != null && lstStoreLocationName.Data.Count > 0) { lstResource = lstStoreLocationName.Data; } } return(from item in lstResource select new SelectListItem() { Text = item.Value, Value = item.Value }); }
MethodReturnResult GetLot(string lotNumber) { bool IsMapChkLotState = false; //获取是否允许无限制条件(批次状态)匹配优化器 using (BaseAttributeValueServiceClient ClientOfBASE = new BaseAttributeValueServiceClient()) { IList <BaseAttributeValue> lstBaseAttributeValue = new List <BaseAttributeValue>(); PagingConfig pg = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName='SystemParameters' and Key.AttributeName='MapChkLotState' ") }; MethodReturnResult <IList <BaseAttributeValue> > r = ClientOfBASE.Get(ref pg); if (r.Code <= 0 && r.Data != null) { lstBaseAttributeValue = r.Data; IsMapChkLotState = Convert.ToBoolean(lstBaseAttributeValue[0].Value); } } MethodReturnResult result = new MethodReturnResult(); MethodReturnResult <Lot> rst = null; 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(result); } } if (obj == null || obj.Status == EnumObjectStatus.Disabled) { result.Code = 2001; result.Message = string.Format(WIPResources.StringResource.LotIsNotExists, lotNumber); return(result); } if (IsMapChkLotState) { if (obj.StateFlag == EnumLotState.Finished) { result.Code = 2002; result.Message = string.Format("批次({0})已完成。", lotNumber); return(result); } else if (obj.Status == EnumObjectStatus.Disabled || obj.DeletedFlag == true) { result.Code = 2003; result.Message = string.Format("批次({0})已结束。", lotNumber); return(result); } else if (obj.HoldFlag == true) { string res = null; string res2 = null; string sql = string.Format(@"select ATTR_4 from WIP_LOT where LOT_NUMBER='{0}'", lotNumber); DataTable dt = new DataTable(); using (DBServiceClient client = new DBServiceClient()) { MethodReturnResult <DataTable> dtResult = client.ExecuteQuery(sql); if (result.Code == 0) { dt = dtResult.Data; res = dt.Rows[0][0].ToString(); } } string sql2 = string.Format(@"select top 1 t2.HOLD_DESCRIPTION from WIP_TRANSACTION t1 inner join [dbo].[WIP_TRANSACTION_HOLD_RELEASE] t2 on t1.TRANSACTION_KEY=t2.TRANSACTION_KEY inner join WIP_LOT t3 on t3.LOT_NUMBER = t1.LOT_NUMBER where t1.LOT_NUMBER='{0}' order by t2.HOLD_TIME desc", lotNumber); DataTable dt2 = new DataTable(); using (DBServiceClient client2 = new DBServiceClient()) { MethodReturnResult <DataTable> dtResult2 = client2.ExecuteQuery(sql2); if (result.Code == 0 && dtResult2.Data != null && dtResult2.Data.Rows.Count > 0) { dt2 = dtResult2.Data; res2 = dt2.Rows[0][0].ToString(); } } if (dt != null && dt.Rows.Count > 0 && res != null && res != "") { result.Code = 2004; result.Message = string.Format("批次({0})已暂停,原因为:{1}。", lotNumber, res); } else if (dt != null && dt.Rows.Count > 0 && res2 != null && res2 != "") { result.Code = 2004; result.Message = string.Format("批次({0})已暂停。", lotNumber); } else { result.Code = 2004; result.Message = string.Format("批次({0})已暂停。", lotNumber); } return(result); } } return(rst); }
/// <summary> 取得工单类型数组(类型值、类型名称) </summary> /// <returns></returns> public IEnumerable <SelectListItem> GetOrderTypeList() { using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format(@"Key.CategoryName = '{0}' AND (Key.AttributeName = '{1}' or Key.AttributeName = '{2}')" , "OrderType" , "VALUE" , "Name"), OrderBy = "Key.ItemOrder" }; MethodReturnResult <IList <BaseAttributeValue> > result = client.Get(ref cfg); if (result.Code == 0) { IList <SelectListItem> lst = new List <SelectListItem>(); int currItemOrder = 0; //记录当前项目序号 //循环创建列表对象 foreach (BaseAttributeValue baseAtrValue in result.Data) { if (baseAtrValue.Key.AttributeName == "VALUE" || baseAtrValue.Key.AttributeName == "Name") { if (lst.Count == 0) { SelectListItem NewItem = new SelectListItem() { Text = baseAtrValue.Value, Value = baseAtrValue.Value }; lst.Add(NewItem); currItemOrder = baseAtrValue.Key.ItemOrder; } else { //判断与当前列表节点主键是否一致 if (baseAtrValue.Key.ItemOrder == currItemOrder) { if (baseAtrValue.Key.AttributeName == "VALUE") { lst[lst.Count - 1].Value = baseAtrValue.Value; } else { lst[lst.Count - 1].Text = baseAtrValue.Value; } } else { SelectListItem NewItem = new SelectListItem() { Text = baseAtrValue.Value, Value = baseAtrValue.Value }; lst.Add(NewItem); currItemOrder = baseAtrValue.Key.ItemOrder; } } } } return(lst.ToList()); } } return(new List <SelectListItem>()); }
/// <summary> /// 获取颜色_通过抓取设备获取颜色_如果设备没有抓取则人工判断 /// </summary> /// <param name="lotNumber"></param> /// <returns></returns> public IEnumerable <SelectListItem> GetColorList(string lotNumber, string colorOfCell) { IList <BaseAttributeValue> lstValues = new List <BaseAttributeValue>(); string strColorOfModule = colorOfCell; if (string.IsNullOrEmpty(colorOfCell) == false) { IList <BaseAttributeValue> lstValuesColor = new List <BaseAttributeValue>(); using (BaseAttributeValueServiceClient client1 = new BaseAttributeValueServiceClient()) { PagingConfig cfg1 = new PagingConfig() { IsPaging = false, Where = string.Format(@" Key.AttributeName='MDesc' and EXISTS (from BaseAttributeValue as p where p.Key.CategoryName='Color_Cell' AND p.Key.AttributeName='CName' and p.Value='{0}' and self.Key.ItemOrder = p.Key.ItemOrder and self.Key.CategoryName = p.Key.CategoryName )", colorOfCell), OrderBy = "Key.ItemOrder" }; MethodReturnResult <IList <BaseAttributeValue> > result1 = client1.Get(ref cfg1); if (result1.Code <= 0 && result1.Data != null && result1.Data.Count > 0) { lstValuesColor = result1.Data; strColorOfModule = lstValuesColor.FirstOrDefault().Value; } } } using (BaseAttributeValueServiceClient client1 = new BaseAttributeValueServiceClient()) { PagingConfig cfg1 = new PagingConfig() { IsPaging = false, Where = string.Format("Key.CategoryName='Color' AND Key.AttributeName='VALUE'"), OrderBy = "Key.ItemOrder" }; MethodReturnResult <IList <BaseAttributeValue> > result1 = client1.Get(ref cfg1); if (result1.Code <= 0 && result1.Data != null) { lstValues = result1.Data; } } List <SelectListItem> listItemValue = new List <SelectListItem>(); if (lstValues != null && lstValues.Count > 0) { foreach (BaseAttributeValue item in lstValues) { SelectListItem listItem = new SelectListItem(); if (strColorOfModule == item.Value) { listItem.Selected = true; } listItem.Text = item.Value; listItem.Value = item.Value; listItemValue.Add(listItem); } } return(listItemValue); }