//报废入库申请单修改 public ActionResult sModify(string key) { WOReportViewModel model = new WOReportViewModel(); using (WOReportClient client = new WOReportClient()) { MethodReturnResult <WOReport> result = client.GetWOReport(key); if (result.Code == 0) { model = new WOReportViewModel() { BillCode = result.Data.Key, BillDate = result.Data.BillDate, BillMakedDate = result.Data.BillMakedDate, MixType = result.Data.MixType, OrderNumber = result.Data.OrderNumber, MaterialCode = result.Data.MaterialCode, Creator = result.Data.Creator, Editor = User.Identity.Name, Note = result.Data.Note }; return(PartialView("_sModifyPartial", model)); } else { ModelState.AddModelError("", result.Message); } } return(PartialView("_sModifyPartial")); }
//报废入库申请单查询 public ActionResult sQuery(WOReportQueryViewModel model) { if (ModelState.IsValid) { using (WOReportClient client = new WOReportClient()) { StringBuilder where = new StringBuilder(); if (model != null) { where.AppendFormat("ScrapType ='1'"); //入库单号 if (!string.IsNullOrEmpty(model.BillCode)) { where.AppendFormat(" {0} Key LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.BillCode); } //入库类型 if (model.BillType != null && model.BillType != "") { where.AppendFormat(" {0} BillType = {1}" , where.Length > 0 ? "AND" : string.Empty , model.BillType); } //状态 if (model.BillState != null && model.BillState != "") { where.AppendFormat(" {0} BillState = {1}" , where.Length > 0 ? "AND" : string.Empty , model.BillState); } } PagingConfig cfg = new PagingConfig() { OrderBy = "CreateTime desc", Where = where.ToString() }; MethodReturnResult <IList <WOReport> > result = client.GetWOReport(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } } } return(PartialView("_sListPartial")); }
//获取托号所在入库单 public WOReport GetWOReport(string BillCode) { WOReportClient client = new WOReportClient(); WOReport woReport = null; MethodReturnResult <WOReport> mtWOReport = null; mtWOReport = client.GetWOReport(BillCode); if (mtWOReport != null) { woReport = mtWOReport.Data; } return(woReport); }
public async Task <ActionResult> sPagingQuery(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 (WOReportClient client = new WOReportClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { PageNo = pageNo, PageSize = pageSize, Where = where ?? string.Empty, OrderBy = orderBy ?? string.Empty }; MethodReturnResult <IList <WOReport> > result = client.GetWOReport(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_sListPartial")); }
public ActionResult Save(WOReportViewModel model) { MethodReturnResult result = new MethodReturnResult(); try { if (string.IsNullOrWhiteSpace(model.BillCode)) { string BillCode = string.Format("INC{0:yyMMdd}", DateTime.Now); int itemNo = 0; using (WOReportClient client = new WOReportClient()) { PagingConfig cfg = new PagingConfig() { PageNo = 0, PageSize = 1, Where = string.Format("Key LIKE '{0}%'" , BillCode), OrderBy = "Key Desc" }; MethodReturnResult <IList <WOReport> > rst = client.GetWOReport(ref cfg); if (rst.Code <= 0 && rst.Data.Count > 0) { string maxBillNo = rst.Data[0].Key.Replace(BillCode, ""); int.TryParse(maxBillNo, out itemNo); } itemNo++; model.BillCode = BillCode + itemNo.ToString("000"); } } using (WOReportClient client = new WOReportClient()) { WOReport woReport = new WOReport() { Key = model.BillCode, //入库单号 BillType = model.BillType, //入库类型 BillDate = model.BillDate, BillMaker = User.Identity.Name, BillMakedDate = model.BillMakedDate, MixType = model.MixType, ScrapType = ServiceCenter.MES.Model.ERP.EnumScrapType.False, OrderNumber = model.OrderNumber, MaterialCode = model.MaterialCode, Editor = User.Identity.Name, Creator = User.Identity.Name, Note = model.Note, }; result = client.AddWOReport(woReport); if (result.Code == 0) { result.Message = string.Format(StringResource.WOReport_Save_Success, model.BillCode); result.Detail = woReport.Key; } } } catch (Exception ex) { result.Code = 1000; result.Message = ex.Message; result.Detail = ex.ToString(); } return(Json(result)); }