/// <summary> /// 主界面初始化 /// </summary> /// <returns></returns> public async Task <ActionResult> Index() { using (MaterialServiceClient client = new MaterialServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { Where = string.Format(" Status = '{0}'" , EnumObjectStatus.Available.GetHashCode()), OrderBy = "Key" }; MethodReturnResult <IList <Material> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } return(View(new MaterialQueryViewModel())); }
public String GetType(String materialCode) { MaterialQueryViewModel model = new MaterialQueryViewModel(); model.Code = materialCode; StringBuilder where = new StringBuilder(); using (MaterialServiceClient client = new MaterialServiceClient()) { where.AppendFormat(" Key = '{0}'", model.Code); PagingConfig cfg = new PagingConfig() { OrderBy = "Key", Where = where.ToString() }; MethodReturnResult <IList <Material> > result = client.Get(ref cfg); //List<Material> MaterialList =result.Data.ToList<Material>(); String ProductType = null; if (result.Code == 0) { string barcode = result.Data[0].Key; string qty = result.Data[0].MainRawQtyPerLot.ToString(); ProductType = string.Format("JNM{0}{1}" , barcode.StartsWith("1201") ? "M" : "P" , qty); } return(ProductType); } }
public static CswNbtChemWatchRequest MaterialSearch(ICswResources CswResources, CswNbtChemWatchRequest Request) { CswNbtChemWatchRequest Return = new CswNbtChemWatchRequest(); CswNbtResources NbtResources = (CswNbtResources)CswResources; string errorMsg; if (_authenticate(NbtResources, out errorMsg)) { MaterialServiceClient cwMaterialClient = new MaterialServiceClient(); cwMaterialClient.Endpoint.Behaviors.Add(_cookieBehavior); List <ChemWatchListItem> Materials = new List <ChemWatchListItem>(); ListResultOfMaterial cwMaterials = cwMaterialClient.GetMaterialsByVendorGroupId(Request.Supplier, Request.MaterialName, Request.PartNo, false, 1, 100, "", 0); foreach (Material cwMaterial in cwMaterials.Rows) { Materials.Add(new ChemWatchListItem() { Id = CswConvert.ToString(cwMaterial.MaterialID), Name = cwMaterial.Name }); } IEnumerable <ChemWatchListItem> SortedMaterials = Materials.OrderBy(si => si.Name); Return.Materials = SortedMaterials.ToList(); } else { throw new CswDniException(CswEnumErrorType.Error, "There was a problem authenticating with ChemWatch", errorMsg); } return(Return); }
public async Task <ActionResult> SaveModify(MaterialViewModel model) { using (MaterialServiceClient client = new MaterialServiceClient()) { MethodReturnResult <Material> result = await client.GetAsync(model.Code); if (result.Code == 0) { result.Data.MainProductQtyPerLot = model.MainProductQtyPerLot; result.Data.MainRawQtyPerLot = model.MainRawQtyPerLot; result.Data.Name = model.Name; result.Data.Spec = model.Spec; result.Data.Class = model.Class; result.Data.Status = model.Status; result.Data.Type = model.Type; result.Data.Unit = model.Unit; result.Data.IsRaw = model.IsRaw; result.Data.IsProduct = model.IsProduct; result.Data.BarCode = model.BarCode; result.Data.Description = model.Description; 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.Material_SaveModify_Success , model.Code); } return(Json(rst)); } return(Json(result)); } }
public ActionResult GetMaterialAttribute(string materialCode) { MethodReturnResult <Material> result = null; var item = new { @Name = string.Empty, @Unit = string.Empty }; using (MaterialServiceClient client = new MaterialServiceClient()) { result = client.Get(materialCode); if (result.Code <= 0 && result.Data != null) { item = new { @Name = result.Data.Name, @Unit = result.Data.Unit }; } } return(Json(item, JsonRequestBehavior.AllowGet)); }
private static void _getMatchingSuppliers(string SearchString, CswNbtChemWatchRequest Return) { MaterialServiceClient cwMaterialClient = new MaterialServiceClient(); cwMaterialClient.Endpoint.Behaviors.Add(_cookieBehavior); SearchVendorRequest cwSearchVend = new SearchVendorRequest(); cwSearchVend.Name = SearchString; cwSearchVend.PageNumber = 1; cwSearchVend.PageSize = 100; List <ChemWatchListItem> Suppliers = new List <ChemWatchListItem>(); ListResultOfVendor cwVendors = cwMaterialClient.SearchVendors(cwSearchVend); foreach (Vendor cwVendor in cwVendors.Rows) { ChemWatchListItem cwSupplier = new ChemWatchListItem(); cwSupplier.Name = cwVendor.Name; cwSupplier.Id = cwVendor.VendorGroup.Gid; if (false == Suppliers.Any(supplier => supplier.Id == cwVendor.VendorGroup.Gid && supplier.Name == cwVendor.Name)) { Suppliers.Add(cwSupplier); } } IEnumerable <ChemWatchListItem> SortedSuppliers = Suppliers.OrderBy(si => si.Name); Return.Suppliers = SortedSuppliers.ToList(); }
public async Task <ActionResult> Save(MaterialViewModel model) { using (MaterialServiceClient client = new MaterialServiceClient()) { Material obj = new Material() { Key = model.Code.ToUpper(), BarCode = model.BarCode, Name = model.Name, Class = model.Class, Spec = model.Spec, Status = model.Status, Type = model.Type, Unit = model.Unit, IsProduct = model.IsProduct, IsRaw = model.IsRaw, MainProductQtyPerLot = model.MainProductQtyPerLot, MainRawQtyPerLot = model.MainRawQtyPerLot, Description = model.Description, Editor = User.Identity.Name, EditTime = DateTime.Now, CreateTime = DateTime.Now, Creator = User.Identity.Name }; MethodReturnResult rst = await client.AddAsync(obj); if (rst.Code == 0) { rst.Message = string.Format(FMMResources.StringResource.Material_Save_Success , model.Code); } return(Json(rst)); } }
public CMaterialRepository(MaterialServiceClient service) { _service = service; _materials = new BindingListWithDeleteDetecting <CMaterial>(); _toSave = new List <CMaterial>(); _toDelete = new List <int>(); _converter = new Client.Converter <material, CMaterial>(); _materials.ListChanged += Materials_ListChanged; _materials.RemovingItem += Materials_ListRemove; }
public string GetProductType(string materialCode, string orderNumber, string powersetCode, int itemNo, Lot lot) { string productType = string.Empty; Material material = null; string wop = ""; wop = GetPowersetName(lot.Key, powersetCode, itemNo); using (MaterialServiceClient client = new MaterialServiceClient()) { MethodReturnResult <Material> result = client.Get(materialCode); MethodReturnResult <MaterialAttribute> resultOfMaterialAttr = new MethodReturnResult <MaterialAttribute>(); MaterialAttributeServiceClient clientOfMattr = new MaterialAttributeServiceClient(); if (result.Code == 0) { material = result.Data; if (wop != "") { int indexOfType = material.Name.IndexOf('-'); if (indexOfType >= 0) { productType = material.Name.Substring(0, indexOfType) + "-" + wop.Substring(0, 3); } else { productType = material.Name.Substring(0, 6) + "-" + wop.Substring(0, 3); } if (material.Name.Contains("PV")) { MaterialAttributeKey materialAttributeKey = new MaterialAttributeKey() { MaterialCode = material.Key, AttributeName = "ProductType" }; resultOfMaterialAttr = clientOfMattr.Get(materialAttributeKey); if (resultOfMaterialAttr.Data != null) { string valueOf = resultOfMaterialAttr.Data.Value.Trim(); int indexOfType1 = valueOf.IndexOf('*'); productType = string.Format("{0}{1}-{2}{3}" , valueOf.Substring(0, indexOfType1) , wop.Substring(0, 3) , material.MainRawQtyPerLot , valueOf.Substring(valueOf.Length - 3)); } else { productType = ""; } } } } } return(productType); }
// public ActionResult GetLoadingNo(string q,string orderNumber, string equipmentCode) // { // IList<MaterialLoadingDetail> lstDetail = new List<MaterialLoadingDetail>(); // using (MaterialLoadingServiceClient client = new MaterialLoadingServiceClient()) // { // PagingConfig cfg = new PagingConfig() // { // IsPaging = false, // Where = string.Format(@"(Key.LoadingKey LIKE '{0}%' // OR MaterialCode LIKE '{0}%' // OR MaterialLot LIKE '{0}%') // AND EXISTS(FROM MaterialLoading as p // WHERE p.Key=self.Key.LoadingKey // AND p.EquipmentCode='{1}') // AND CurrentQty>0 // AND OrderNumber='{2}'" // , q // , equipmentCode // , orderNumber), // OrderBy = "Key" // }; // MethodReturnResult<IList<MaterialLoadingDetail>> result = client.GetDetail(ref cfg); // if (result.Code <= 0 && result.Data != null) // { // lstDetail = result.Data; // } // } // return Json(from item in lstDetail // select new // { // @value = item.MaterialLot, // @label = @LSMResources.StringResource.MaterialUnloadingDetailViewModel_LoadingNo +":"+ item.Key.LoadingKey // + " " + @LSMResources.StringResource.MaterialUnloadingDetailViewModel_LoadingItemNo + ":" + item.Key.ItemNo // + " " + @LSMResources.StringResource.MaterialUnloadingDetailViewModel_MaterialLot + ":" + item.MaterialLot // + " " + GetMaterialName(item.MaterialCode), // @LoadingNo = item.Key.LoadingKey, // @LoadingItemNo = item.Key.ItemNo, // @LineStoreName = item.LineStoreName, // @MaterialCode = item.MaterialCode, // @CurrentQty = item.CurrentQty // }, JsonRequestBehavior.AllowGet); // } private string GetMaterialName(string materialCode) { using (MaterialServiceClient client = new MaterialServiceClient()) { MethodReturnResult <Material> result = client.Get(materialCode); if (result.Code <= 0 && result.Data != null) { return(result.Data.Name); } } return(string.Empty); }
public ActionResult GetMaterialUnit(string materialCode) { using (MaterialServiceClient client = new MaterialServiceClient()) { MethodReturnResult <Material> result = client.Get(materialCode); if (result.Code <= 0 && result.Data != null) { return(Json(result.Data.Unit, JsonRequestBehavior.AllowGet)); } } return(Json(string.Empty, JsonRequestBehavior.AllowGet)); }
/// <summary> 取得物料描述 </summary> /// <param name="materialCode">物料代码</param> /// <returns>物料描述</returns> public string GetMaterialDescription(string materialCode) { using (MaterialServiceClient client = new MaterialServiceClient()) { MethodReturnResult <Material> result = client.Get(materialCode); if (result.Code <= 0 && result.Data != null) { return(result.Data.Description); } } return(string.Empty); }
public async Task <ActionResult> Delete(string key) { MethodReturnResult result = new MethodReturnResult(); using (MaterialServiceClient client = new MaterialServiceClient()) { result = await client.DeleteAsync(key); if (result.Code == 0) { result.Message = string.Format(FMMResources.StringResource.Material_Delete_Success , key); } return(Json(result)); } }
public async Task <ActionResult> Query(MaterialQueryViewModel model) { if (ModelState.IsValid) { using (MaterialServiceClient client = new MaterialServiceClient()) { 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.Name)) { where.AppendFormat(" {0} Type LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.Type); } } PagingConfig cfg = new PagingConfig() { OrderBy = "Key", Where = where.ToString() }; MethodReturnResult <IList <Material> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_ListPartial")); }
/// <summary> 初始化列表 </summary> /// <param name="materialType"></param> /// <returns></returns> public async Task <ActionResult> Index(string materialCode) { //取得产品物料对象 using (MaterialServiceClient client = new MaterialServiceClient()) { MethodReturnResult <Material> result = await client.GetAsync(materialCode ?? string.Empty); if (result.Code > 0 || result.Data == null) { return(RedirectToAction("Index", "MaterialCode")); } ViewBag.Material = result.Data; } //取得产品工艺流程设置 using (MaterialRouteServiceClient client = new MaterialRouteServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { Where = string.Format(" Key.MaterialCode = '{0}'" , materialCode), OrderBy = "Key.LocationName" }; MethodReturnResult <IList <MaterialRoute> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } return(View(new MaterialRouteQueryViewModel() { MaterialCode = materialCode })); }
public Material GetLotCellMaterialName(string MaterialCode) { Material Material = null; using (MaterialServiceClient client = new MaterialServiceClient()) { //PagingConfig cfg = new PagingConfig() //{ // PageNo = 0, // PageSize = 1, // Where = string.Format("Key.LotNumber='{0}' AND MaterialCode like'110%'", lotNumber) //}; MethodReturnResult <Material> result = client.Get(MaterialCode); if (result.Code <= 0 && result.Data != null) { Material = result.Data; } } return(Material); }
// // GET: /FMM/Material/ public async Task <ActionResult> Index() { using (MaterialServiceClient client = new MaterialServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { OrderBy = "Key" }; MethodReturnResult <IList <Material> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } return(View(new MaterialQueryViewModel())); }
// // GET: /FMM/Material/Modify public async Task <ActionResult> Modify(string key) { MaterialViewModel viewModel = new MaterialViewModel(); using (MaterialServiceClient client = new MaterialServiceClient()) { MethodReturnResult <Material> result = await client.GetAsync(key); if (result.Code == 0) { viewModel = new MaterialViewModel() { Code = result.Data.Key, Name = result.Data.Name, ModelName = result.Data.ModelName, //型号 BarCode = result.Data.BarCode, Status = result.Data.Status, Class = result.Data.Class, Spec = result.Data.Spec, Unit = result.Data.Unit, MainRawQtyPerLot = result.Data.MainRawQtyPerLot, MainProductQtyPerLot = result.Data.MainProductQtyPerLot, Type = result.Data.Type, IsProduct = result.Data.IsProduct, IsRaw = result.Data.IsRaw, CreateTime = result.Data.CreateTime, Creator = result.Data.Creator, Description = result.Data.Description, Editor = result.Data.Editor, EditTime = result.Data.EditTime }; return(PartialView("_ModifyPartial", viewModel)); } else { ModelState.AddModelError("", result.Message); } } return(PartialView("_ModifyPartial")); }
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 (MaterialServiceClient client = new MaterialServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { PageNo = pageNo, PageSize = pageSize, Where = where ?? string.Empty, OrderBy = orderBy ?? string.Empty }; MethodReturnResult <IList <Material> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_ListPartial")); }
//GET: /FMM/MaterialChestParameter/ public async Task <ActionResult> Index(string productCode) { using (MaterialServiceClient client = new MaterialServiceClient()) { MethodReturnResult <Material> result = await client.GetAsync(productCode ?? string.Empty); if (result.Code > 0 || result.Data == null) { return(RedirectToAction("Index", "Material")); } ViewBag.Material = result.Data; } using (MaterialChestParameterServiceClient client = new MaterialChestParameterServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { OrderBy = " Key ", Where = string.Format(" Key = '{0}'", productCode) }; MethodReturnResult <IList <MaterialChestParameter> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } return(View(new MaterialChestParameterQueryViewModel() { ProductCode = productCode })); }
public ActionResult GetProductMaterialCode(string q) { using (MaterialServiceClient client = new MaterialServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format("Key LIKE '{0}%' AND IsProduct='1' AND Status='1'", q) }; MethodReturnResult <IList <Material> > result = client.Get(ref cfg); if (result.Code <= 0) { return(Json(from item in result.Data select new { @label = string.Format("{0}[{1}]", item.Key, item.Name), @value = item.Key }, JsonRequestBehavior.AllowGet));; } } return(Json(null, JsonRequestBehavior.AllowGet));; }
public ActionResult GetMaterialLot(string materialLot, string orderNumber, string lineStoreName) { IList <LineStoreMaterialDetail> lstDetail = new List <LineStoreMaterialDetail>(); using (LineStoreMaterialServiceClient client = new LineStoreMaterialServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format(@"Key.LineStoreName='{0}' AND Key.MaterialLot LIKE '{1}%' AND Key.OrderNumber='{2}' AND CurrentQty>0" , lineStoreName , materialLot , orderNumber), OrderBy = "Key" }; MethodReturnResult <IList <LineStoreMaterialDetail> > result = client.GetDetail(ref cfg); if (result.Code <= 0 && result.Data != null) { lstDetail = result.Data; } } IList <Material> lstMaterial = new List <Material>(); using (MaterialServiceClient client = new MaterialServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format(@" EXISTS(FROM LineStoreMaterial as p WHERE p.Key.MaterialCode=self.Key AND p.Key.LineStoreName='{0}')" , lineStoreName) }; MethodReturnResult <IList <Material> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null) { lstMaterial = result.Data; } } var lnq = from item in lstDetail where item.Key.MaterialCode.StartsWith("11") == false select new { @label = string.Format("{0}[{1} {2}]" , item.Key.MaterialLot , item.Key.MaterialCode , (lstMaterial.Where(m => m.Key == item.Key.MaterialCode).SingleOrDefault() != null ? lstMaterial.Where(m => m.Key == item.Key.MaterialCode).SingleOrDefault().Name : string.Empty)), @value = item.Key.MaterialLot, @materialCode = item.Key.MaterialCode, @qty = item.CurrentQty, @desc = (lstMaterial.Where(m => m.Key == item.Key.MaterialCode).SingleOrDefault() != null ? lstMaterial.Where(m => m.Key == item.Key.MaterialCode).SingleOrDefault().Name : string.Empty) }; return(Json(lnq, JsonRequestBehavior.AllowGet)); }
public ActionResult Save(PackageViewModel model) { MethodReturnResult result = new MethodReturnResult(); try { if (!string.IsNullOrEmpty(model.PackageNo)) { model.PackageNo = model.PackageNo.Trim().ToUpper(); } Package p = new Package() { Key = model.PackageNo, CreateTime = DateTime.Now, Creator = User.Identity.Name, IsLastPackage = false, Editor = User.Identity.Name, EditTime = DateTime.Now, MaterialCode = model.MaterialCode, OrderNumber = model.OrderNumber, PackageState = EnumPackageState.Packaging, PackageType = EnumPackageType.Packet, Quantity = model.Qty.Value }; PackageInfo obj = new PackageInfo() { Key = model.PackageNo, Color = model.Color, CreateTime = DateTime.Now, Creator = User.Identity.Name, Editor = User.Identity.Name, EditTime = DateTime.Now, ConfigGroup = model.Group, ConfigCode = model.Code.Trim(), Grade = model.Grade, LineCode = model.LineCode, EfficiencyLower = model.Lower, EfficiencyUpper = model.Upper, EfficiencyName = model.Name, PNType = model.PNType }; //根据物料号获取产品编号。 Material m = null; using (MaterialServiceClient client = new MaterialServiceClient()) { MethodReturnResult <Material> rst = client.Get(model.MaterialCode); if (rst.Code == 0) { m = rst.Data; } } if (m != null) { obj.ProductId = string.Format("{0}{1}{2}", m.Spec, model.Style, model.Technology); } //新增包装数据。 using (PackageInfoServiceClient client = new PackageInfoServiceClient()) { result = client.Add(p, obj); if (result.Code <= 0) { result.Message = string.Format("保存 {0} 成功。", p.Key); } else { return(Json(result)); } } MethodReturnResult result1 = PrintPrivate(model, obj); result.Message += result1.Message; result.Code = result1.Code; } catch (Exception ex) { result.Code = 1000; result.Detail = ex.ToString(); result.Message = ex.Message; } return(Json(result)); }
public async Task <ActionResult> Query(MaterialQueryViewModel model) { if (ModelState.IsValid) { using (MaterialServiceClient client = new MaterialServiceClient()) { 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.Type)) { where.AppendFormat(" {0} Type LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.Type); } //是否有效条件 if (model.Status != "" && model.Status != null) { where.AppendFormat(" {0} Status = '{1}'" , where.Length > 0 ? "AND" : string.Empty , model.Status); } //物料归属类型(物料、产品) if (model.Ascription != "" && model.Ascription != null) { //产品 if (model.Ascription == "P") { where.AppendFormat(" {0} IsProduct = {1}" , where.Length > 0 ? "AND" : string.Empty , "true"); } //材料 if (model.Ascription == "M") { where.AppendFormat(" {0} IsRaw = {1}" , where.Length > 0 ? "AND" : string.Empty , "true"); } } } PagingConfig cfg = new PagingConfig() { OrderBy = "Key", Where = where.ToString() }; MethodReturnResult <IList <Material> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_ListPartial")); }
public ActionResult GetLoadingNo(string q, string orderNumber, string equipmentCode) { //设备尚余上料明细 IList <MaterialLoadingDetail> lstDetail = new List <MaterialLoadingDetail>(); using (MaterialLoadingServiceClient client = new MaterialLoadingServiceClient()) { // Where = string.Format(@"(Key.LoadingKey LIKE '{0}%' // OR MaterialCode LIKE '{0}%' // OR MaterialLot LIKE '{0}%') // AND EXISTS(FROM MaterialLoading as p // WHERE p.Key = self.Key.LoadingKey // AND p.EquipmentCode = '{1}') // AND CurrentQty > 0 // AND OrderNumber = '{2}'" // , q // , equipmentCode // , orderNumber), PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format(@" MaterialLot LIKE '{0}%' AND EXISTS(FROM MaterialLoading as p WHERE p.Key = self.Key.LoadingKey AND p.EquipmentCode = '{1}') AND CurrentQty > 0 AND OrderNumber = '{2}'" , q , equipmentCode , orderNumber), OrderBy = "Key" }; MethodReturnResult <IList <MaterialLoadingDetail> > result = client.GetDetail(ref cfg); if (result.Code <= 0 && result.Data != null) { lstDetail = result.Data; } } //线边仓物料明细 // IList<LineStoreMaterialDetail> lstLSMDetail = new List<LineStoreMaterialDetail>(); // using (LineStoreMaterialServiceClient client = new LineStoreMaterialServiceClient()) // { // PagingConfig cfg = new PagingConfig() // { // IsPaging = false, // Where = string.Format(@"Key.MaterialLot LIKE '{0}%' // AND Key.OrderNumber = '{1}' // AND EXISTS(FROM MaterialLoadingDetail as mloaddetail // WHERE mloaddetail.LineStoreName = self.Key.LineStoreName // AND mloaddetail.OrderNumber = self.Key.OrderNumber // AND mloaddetail.MaterialCode = self.Key.MaterialCode // AND mloaddetail.MaterialLot = self.Key.MaterialLot // AND mloaddetail.OrderNumber = '{1}' // AND mloaddetail.CurrentQty > 0 // AND EXISTS(FROM MaterialLoading as mload // WHERE mload.Key = mloaddetail.Key.LoadingKey // AND mload.EquipmentCode = '{2}'))" // , q // , orderNumber // , equipmentCode) // }; // MethodReturnResult<IList<LineStoreMaterialDetail>> result = client.GetDetail(ref cfg); // if (result.Code <= 0 && result.Data != null) // { // lstLSMDetail = result.Data; // } // } //取得对应物料明细 IList <Material> lstMaterial = new List <Material>(); using (MaterialServiceClient client = new MaterialServiceClient()) { PagingConfig cfg = new PagingConfig() { IsPaging = false, Where = string.Format(@" EXISTS(FROM MaterialLoadingDetail as mloaddetail WHERE mloaddetail.MaterialCode = self.Key AND mloaddetail.OrderNumber = '{0}' AND mloaddetail.CurrentQty > 0 AND EXISTS(FROM MaterialLoading as mload WHERE mload.Key = mloaddetail.Key.LoadingKey AND mload.EquipmentCode = '{1}'))" , orderNumber , equipmentCode) }; MethodReturnResult <IList <Material> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null) { lstMaterial = result.Data; } } //取得对应供应商明细 // IList<Supplier> lstSupplier = new List<Supplier>(); // using (SupplierServiceClient client = new SupplierServiceClient()) // { // PagingConfig cfg = new PagingConfig() // { // IsPaging = false, // Where = string.Format(@" EXISTS(FROM LineStoreMaterialDetail as p // WHERE p.SupplierCode = self.Key // AND p.Key.OrderNumber = '{0}' // AND EXISTS(FROM MaterialLoadingDetail as mloaddetail // WHERE mloaddetail.LineStoreName = p.Key.LineStoreName // AND mloaddetail.OrderNumber = p.Key.OrderNumber // AND mloaddetail.MaterialCode = p.Key.MaterialCode // AND mloaddetail.MaterialLot = p.Key.MaterialLot // AND mloaddetail.OrderNumber = '{0}' // AND mloaddetail.CurrentQty > 0 // AND EXISTS(FROM MaterialLoading as mload // WHERE mload.Key = mloaddetail.Key.LoadingKey // AND mload.EquipmentCode = '{1}')))" // , orderNumber // , equipmentCode) // }; // MaterialLoading dd = new MaterialLoading(); // MethodReturnResult<IList<Supplier>> result = client.Get(ref cfg); // if (result.Code <= 0 && result.Data != null) // { // lstSupplier = result.Data; // } // } //var lnq = from item in lstDetail // select new // { // @value = item.MaterialLot, // @label = "上料号:[ " + item.Key.LoadingKey // + "," + item.Key.ItemNo + " ]" // + " 批次:[ " + item.MaterialLot + " ]" // + " 物料:[ " + item.MaterialCode // + "," + GetMaterialName(item.MaterialCode) + " ]" // + " 供应商:[" + (lstLSMDetail.Where(m => m.Key.MaterialLot == item.MaterialLot).SingleOrDefault() != null // ? lstLSMDetail.Where(m => m.Key.MaterialLot == item.MaterialLot).SingleOrDefault().SupplierCode // : string.Empty) // + "," + (lstSupplier.Where(m => m.Key == (lstLSMDetail.Where(n => n.Key.MaterialLot == item.MaterialLot).SingleOrDefault() != null // ? lstLSMDetail.Where(n => n.Key.MaterialLot == item.MaterialLot).SingleOrDefault().SupplierCode // : string.Empty)).SingleOrDefault() != null // ? lstSupplier.Where(m => m.Key == (lstLSMDetail.Where(n => n.Key.MaterialLot == item.MaterialLot).SingleOrDefault() != null // ? lstLSMDetail.Where(n => n.Key.MaterialLot == item.MaterialLot).SingleOrDefault().SupplierCode // : string.Empty)).SingleOrDefault().Name // : string.Empty) + "]", // @LoadingNo = item.Key.LoadingKey, // @LoadingItemNo = item.Key.ItemNo, // @LineStoreName = item.LineStoreName, // @MaterialCode = item.MaterialCode, // @CurrentQty = item.CurrentQty, // @MaterialDesc = (lstMaterial.Where(m => m.Key == item.MaterialCode).SingleOrDefault() != null // ? lstMaterial.Where(m => m.Key == item.MaterialCode).SingleOrDefault().Name // : string.Empty), // @SupplierCode = (lstLSMDetail.Where(m => m.Key.MaterialLot == item.MaterialLot).SingleOrDefault() != null // ? lstLSMDetail.Where(m => m.Key.MaterialLot == item.MaterialLot).SingleOrDefault().SupplierCode // : string.Empty), // @SupplierDesc = (lstSupplier.Where(m => m.Key == (lstLSMDetail.Where(n => n.Key.MaterialLot == item.MaterialLot).SingleOrDefault() != null // ? lstLSMDetail.Where(n => n.Key.MaterialLot == item.MaterialLot).SingleOrDefault().SupplierCode // : string.Empty)).SingleOrDefault() != null // ? lstSupplier.Where(m => m.Key == (lstLSMDetail.Where(n => n.Key.MaterialLot == item.MaterialLot).SingleOrDefault() != null // ? lstLSMDetail.Where(n => n.Key.MaterialLot == item.MaterialLot).SingleOrDefault().SupplierCode // : string.Empty)).SingleOrDefault().Name // : string.Empty) // }; var lnq = from item in lstDetail select new { @value = item.MaterialLot, @label = "上料号:[ " + item.Key.LoadingKey + "," + item.Key.ItemNo + " ]" + " 批次:[ " + item.MaterialLot + " ]" + " 物料:[ " + item.MaterialCode + "," + GetMaterialName(item.MaterialCode) + " ]", @LoadingNo = item.Key.LoadingKey, @LoadingItemNo = item.Key.ItemNo, @LineStoreName = item.LineStoreName, @MaterialCode = item.MaterialCode, @CurrentQty = item.CurrentQty, @MaterialDesc = (lstMaterial.Where(m => m.Key == item.MaterialCode).SingleOrDefault() != null ? lstMaterial.Where(m => m.Key == item.MaterialCode).SingleOrDefault().Name : string.Empty) }; return(Json(lnq, JsonRequestBehavior.AllowGet)); }