예제 #1
0
        public ActionResult GetEquipmentState(string equipmentCode)
        {
            string stateName = string.Empty;

            //根据生产线和工序获取设备。
            using (EquipmentServiceClient client = new EquipmentServiceClient())
            {
                MethodReturnResult <Equipment> result = client.Get(equipmentCode);
                if (result.Code <= 0 && result.Data != null)
                {
                    stateName = result.Data.StateName;
                }
            }
            string stateColor = string.Empty;

            if (!string.IsNullOrEmpty(stateName))
            {
                using (EquipmentStateServiceClient client = new EquipmentStateServiceClient())
                {
                    MethodReturnResult <EquipmentState> result = client.Get(stateName);
                    if (result.Code <= 0 && result.Data != null)
                    {
                        stateColor = result.Data.StateColor;
                    }
                }
            }
            return(Json(new
            {
                StateName = stateName,
                StateColor = stateColor
            }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        /// <summary>
        /// 取得设备代码
        /// </summary>
        /// <param name="routestepname">工序</param>
        /// <param name="productionLineCode">线别</param>
        /// <returns></returns>
        public ActionResult GetEquipmentName(string EquipmentCode, string LineCode)
        {
            IList <Equipment> lstEquipments = new List <Equipment>();

            //根据生产线和工序获取设备。
            using (EquipmentServiceClient client = new EquipmentServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    OrderBy = "LineCode",
                    Where   = string.Format(@" Key = '{0}'and LineCode='{1}' ",
                                            EquipmentCode,
                                            LineCode)
                };
                MethodReturnResult <IList <Equipment> > result = client.Get(ref cfg);

                if (result.Code <= 0 && result.Data != null)
                {
                    lstEquipments = result.Data;
                }
            }

            var lnq = from item in lstEquipments
                      select new
            {
                Value = item.Name,
                Text  = item.Name
            };

            return(Json(lnq, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        public ActionResult GetEquipments(string routeOperationName, string productionLineCode)
        {
            IList <Equipment> lstEquipments = new List <Equipment>();

            //根据生产线和工序获取设备。
            using (EquipmentServiceClient client = new EquipmentServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format(@"LineCode='{0}' AND EXISTS(FROM RouteOperationEquipment as p 
                                                                      WHERE p.Key.EquipmentCode=self.Key 
                                                                      AND p.Key.RouteOperationName='{1}')"
                                             , productionLineCode
                                             , routeOperationName)
                };
                MethodReturnResult <IList <Equipment> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null)
                {
                    lstEquipments = result.Data;
                }
            }

            var lnq = from item in lstEquipments
                      select new
            {
                Key  = item.Key,
                Text = item.Key + "-" + item.Name
            };

            return(Json(lnq, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
        public IEnumerable <SelectListItem> GetScanCodeList()
        {
            MethodReturnResult <IList <Equipment> > result = new MethodReturnResult <IList <Equipment> >();
            IList <Equipment> lst = new List <Equipment>();

            using (EquipmentServiceClient client = new EquipmentServiceClient())
            {
                StringBuilder where = new StringBuilder();
                where.AppendFormat(" {0} Name LIKE 'Reader%'"
                                   , where.Length > 0 ? "AND" : string.Empty);
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    OrderBy  = "Key",
                    Where    = where.ToString()
                };
                result = client.Get(ref cfg);
            }
            if (result.Code <= 0 && result.Data != null)
            {
                lst = result.Data;
            }
            return(from item in lst
                   select new SelectListItem()
            {
                Value = item.Key,
                Text = item.LineCode
            });
        }
 public ActionResult GetEquipmentName(string equipmentCode)
 {
     using (EquipmentServiceClient client = new EquipmentServiceClient())
     {
         MethodReturnResult <Equipment> result = client.Get(equipmentCode);
         if (result.Code <= 0)
         {
             return(Json(result.Data.Name, JsonRequestBehavior.AllowGet));
         }
     }
     return(Json(equipmentCode, JsonRequestBehavior.AllowGet));
 }
 public Equipment GetEquipment(string key)
 {
     using (EquipmentServiceClient client = new EquipmentServiceClient())
     {
         MethodReturnResult <Equipment> result = client.Get(key);
         if (result.Code <= 0)
         {
             return(result.Data);
         }
     }
     return(null);
 }
예제 #7
0
        public async Task <ActionResult> Query(EquipmentQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (EquipmentServiceClient client = new EquipmentServiceClient())
                {
                    await Task.Run(() =>
                    {
                        StringBuilder where = new StringBuilder();
                        if (model != null)
                        {
                            if (!string.IsNullOrEmpty(model.Code))
                            {
                                where.AppendFormat(" {0} Key LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.Code);
                            }
                            if (!string.IsNullOrEmpty(model.Name))
                            {
                                where.AppendFormat(" {0} Name LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.Name);
                            }
                            if (!string.IsNullOrEmpty(model.GroupName))
                            {
                                where.AppendFormat(" {0} GroupName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.GroupName);
                            }
                        }
                        PagingConfig cfg = new PagingConfig()
                        {
                            OrderBy = "Key",
                            Where   = where.ToString()
                        };
                        MethodReturnResult <IList <Equipment> > result = client.Get(ref cfg);

                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
예제 #8
0
        //
        // GET: /FMM/Equipment/
        public async Task <ActionResult> Index()
        {
            using (EquipmentServiceClient client = new EquipmentServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "Key"
                    };
                    MethodReturnResult <IList <Equipment> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }
            return(View(new EquipmentQueryViewModel()));
        }
예제 #9
0
        /// <summary> 获取设备信息 </summary>
        /// <param name="lotNumber">批次号</param>
        /// <returns></returns>
        public Equipment GetEquipment(string equipment)
        {
            Equipment Equipment = null;

            using (EquipmentServiceClient client = new EquipmentServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    PageNo   = 0,
                    PageSize = 1,
                    Where    = string.Format("Key='{0}'  ", equipment)
                };
                MethodReturnResult <IList <Equipment> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data.Count > 0)
                {
                    Equipment = result.Data[0];
                }

                return(Equipment);
            }
        }
예제 #10
0
        /// <summary>
        /// 取得设备组分类信息
        /// </summary>
        public IEnumerable <SelectListItem> GetEquipmentGroupList()
        {
            IList <Equipment> lst = new List <Equipment>();
            PagingConfig      cfg = new PagingConfig()
            {
                IsPaging = false
            };

            using (EquipmentServiceClient client = new EquipmentServiceClient())
            {
                MethodReturnResult <IList <Equipment> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null)
                {
                    lst = result.Data;
                }
            }
            var query = from item in lst
                        group item by new { t1 = item.GroupName }
            into m
                select new
            {
                Text  = m.First().GroupName,
                Value = m.First().Key,
            } into r
            orderby r.Text, r.Value
            select r;
            Dictionary <string, string> dic = new Dictionary <string, string>();

            foreach (var data in query)
            {
                dic.Add(data.Text, data.Value);
            }
            return(from item in dic
                   select new SelectListItem()
            {
                Value = item.Key,
                Text = item.Key
                       //Text = item.Key
            });
        }
예제 #11
0
        public IEnumerable <SelectListItem> GetEquipmentCodeList()
        {
            using (EquipmentServiceClient client = new EquipmentServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false
                };

                MethodReturnResult <IList <Equipment> > 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, item.Name),
                        Value = item.Key
                    };
                    return(lst);
                }
            }
            return(new List <SelectListItem>());
        }
예제 #12
0
        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 (EquipmentServiceClient client = new EquipmentServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <Equipment> > result = client.Get(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
예제 #13
0
        public ActionResult Save(LotBinViewModel model)
        {
            MethodReturnResult result = new MethodReturnResult();

            try
            {
                string IPAddress    = model.ScanIP;
                string packalgeLine = string.Empty;
                if (localName == "K01")
                {
                    MethodReturnResult <Equipment> resultEquipment = new MethodReturnResult <Equipment>();
                    using (EquipmentServiceClient client = new EquipmentServiceClient())
                    {
                        resultEquipment = client.Get(IPAddress);
                        if (resultEquipment.Code > 0)
                        {
                            result.Code    = resultEquipment.Code;
                            result.Message = resultEquipment.Message;
                            return(Json(result));
                        }
                        else
                        {
                            packalgeLine = resultEquipment.Data.LineCode;
                        }
                    }
                }
                if (localName == "G01")
                {
                    packalgeLine = model.ScanIP;
                }

                InBinParameter p = new InBinParameter()
                {
                    Creator         = User.Identity.Name,
                    OperateComputer = Request.UserHostAddress,
                    Operator        = User.Identity.Name,
                    BinNo           = model.BinNo,
                    //ReasonCodeCategoryName = model.ReasonCodeCategoryName,
                    //ReasonCodeName = model.ReasonCodeName,
                    //Remark = model.Description,
                    PackageLine   = packalgeLine,
                    ScanLotNumber = model.LotNumber,
                    ScanIP        = model.ScanIP,
                    ScanNo        = model.ScanNo,//
                    LotNumbers    = new List <string>()
                };

                //char splitChar = ',';
                ////获取批次号值。
                //string[] lotNumbers = Request["LotNumber"].ToUpper().Split(splitChar);
                //p.LotNumbers = lotNumbers.ToList();


                //for (int i = 0; i < p.LotNumbers.Count; i++)
                //{
                //    string lotNumber = p.LotNumbers[i];
                //    //result = GetLot(lotNumber);
                //    if (result.Code > 0)
                //    {
                //        return Json(result);
                //    }
                //}

                using (LotBinServiceClient client = new LotBinServiceClient())
                {
                    result = client.InBin(p);
                }
                if (result.Code == 0)
                {
                    result.Message = string.Format("批次{0}入Bin成功.{1}", model.LotNumber, result.Message);
                }
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }
            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return(Json(result));
        }