/// <summary> /// 取得物料消耗量 /// </summary> /// <param name="materialcode"></param> /// <param name="orderNumber"></param> /// <returns></returns> public decimal GetMaterialBOMUseLevel(string materialcode, string orderNumber) { //IList<WorkOrderBOM> lstWorkOrderBOM = new List<WorkOrderBOM>(); using (WorkOrderBOMServiceClient client = new WorkOrderBOMServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format(@"Key.OrderNumber='{0}' AND MaterialCode LIKE '{1}%'", orderNumber, materialcode) }; MethodReturnResult <IList <WorkOrderBOM> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null && result.Data.Count > 0) { return((decimal)result.Data[0].Qty); //BOM消耗量 } else { return(0); } } }
public ActionResult GetMaterialCode(string q, string orderNumber, string lineStoreName) { string routeOperationName = string.Empty; using (LineStoreServiceClient client = new LineStoreServiceClient()) { MethodReturnResult <LineStore> result = client.Get(lineStoreName); if (result.Code <= 0 && result.Data != null) { routeOperationName = result.Data.RouteOperationName; } } IList <WorkOrderBOM> lstBOM = new List <WorkOrderBOM>(); using (WorkOrderBOMServiceClient client = new WorkOrderBOMServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format(@"MaterialCode LIKE '{0}%' AND Key.OrderNumber='{1}'" , q , orderNumber), OrderBy = "Key.ItemNo" }; //工作中心为空的可以领到任何线边仓。 //线边仓对应工序为空的可以领任何料。 if (!string.IsNullOrEmpty(routeOperationName)) { cfg.Where += string.Format(" AND (WorkCenter='' OR WorkCenter IS NULL Or WorkCenter='{0}')", routeOperationName); } MethodReturnResult <IList <WorkOrderBOM> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null) { lstBOM = result.Data; } } return(Json(from item in lstBOM select new { @label = string.Format("{0}[{1}]", item.MaterialCode, item.Description), @value = item.MaterialCode, @desc = item.Description }, JsonRequestBehavior.AllowGet)); }
public ActionResult GetMaxItemNo(string orderNumber) { using (WorkOrderBOMServiceClient client = new WorkOrderBOMServiceClient()) { PagingConfig cfg = new PagingConfig() { PageNo = 0, PageSize = 1, Where = string.Format("Key.OrderNumber='{0}'", orderNumber), OrderBy = "Key.ItemNo Desc" }; MethodReturnResult <IList <WorkOrderBOM> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null && result.Data.Count > 0) { return(Json(result.Data[0].Key.ItemNo + 1, JsonRequestBehavior.AllowGet)); } } return(Json(1, JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> Query(WorkOrderBOMQueryViewModel model) { //if (ModelState.IsValid) //{ using (WorkOrderBOMServiceClient client = new WorkOrderBOMServiceClient()) { await Task.Run(() => { StringBuilder where = new StringBuilder(); if (model != null) { where.AppendFormat(" {0} Key.OrderNumber = '{1}'" , where.Length > 0 ? "AND" : string.Empty , model.OrderNumber); if (!string.IsNullOrEmpty(model.MaterialCode)) { where.AppendFormat(" {0} MaterialCode LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.MaterialCode); } } PagingConfig cfg = new PagingConfig() { OrderBy = "Key.ItemNo", Where = where.ToString() }; MethodReturnResult <IList <WorkOrderBOM> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } //} return(PartialView("_ListPartial", new WorkOrderBOMViewModel() { OrderNumber = model.OrderNumber })); }
// // GET: /PPM/WorkOrderBOM/ public async Task <ActionResult> Index(string orderNumber) { using (WorkOrderServiceClient client = new WorkOrderServiceClient()) { MethodReturnResult <WorkOrder> result = await client.GetAsync(orderNumber ?? string.Empty); if (result.Code > 0 || result.Data == null) { return(RedirectToAction("Index", "WorkOrder")); } ViewBag.WorkOrder = result.Data; } using (WorkOrderBOMServiceClient client = new WorkOrderBOMServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { Where = string.Format(" Key.OrderNumber = '{0}'" , orderNumber), OrderBy = "Key.ItemNo" }; MethodReturnResult <IList <WorkOrderBOM> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } //return View(new WorkOrderBOMViewModel() { OrderNumber = orderNumber }); return(View(new WorkOrderBOMQueryViewModel() { OrderNumber = orderNumber })); }
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 (WorkOrderBOMServiceClient client = new WorkOrderBOMServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { PageNo = pageNo, PageSize = pageSize, Where = where ?? string.Empty, OrderBy = orderBy ?? string.Empty }; MethodReturnResult <IList <WorkOrderBOM> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } //} return(PartialView("_ListPartial")); }