Пример #1
0
        public async Task <ActionResult> DetailQuery(MaterialLoadingDetailQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (MaterialLoadingServiceClient client = new MaterialLoadingServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            OrderBy = "CreateTime Desc,Key.LoadingKey,Key.ItemNo",
                            Where   = GetWhereCondition(model)
                        };
                        MethodReturnResult <IList <MaterialLoadingDetail> > result = client.GetDetail(ref cfg);

                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_DetailListPartial", new MaterialLoadingDetailViewModel()));
            }
            else
            {
                return(View("Detail", model));
            }
        }
Пример #2
0
        public MaterialLoading GetMaterialLoading(string loadingNo)
        {
            MaterialLoading obj = new MaterialLoading();

            using (MaterialLoadingServiceClient client = new MaterialLoadingServiceClient())
            {
                MethodReturnResult <MaterialLoading> result = client.Get(loadingNo);
                if (result.Code <= 0 && result.Data != null)
                {
                    obj = result.Data;
                }
            }
            return(obj);
        }
Пример #3
0
        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));
        }
Пример #4
0
        public ActionResult GetLoadingNo()
        {
            string prefix = string.Format("MLM{0:yyMM}", DateTime.Now);
            int    itemNo = 0;

            using (MaterialLoadingServiceClient client = new MaterialLoadingServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    PageNo   = 0,
                    PageSize = 1,
                    Where    = string.Format("Key LIKE '{0}%'", prefix),
                    OrderBy  = "Key Desc"
                };
                MethodReturnResult <IList <MaterialLoading> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null && result.Data.Count > 0)
                {
                    string sItemNo = result.Data[0].Key.Replace(prefix, "");
                    int.TryParse(sItemNo, out itemNo);
                }
            }
            return(Json(prefix + (itemNo + 1).ToString("000000"), JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public async Task <ActionResult> DetailPagingQuery(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 (MaterialLoadingServiceClient client = new MaterialLoadingServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <MaterialLoadingDetail> > result = client.GetDetail(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_DetailListPartial", new MaterialLoadingDetailViewModel()));
        }
Пример #6
0
        public async Task <ActionResult> Save(MaterialLoadingViewModel model)
        {
            MethodReturnResult rst = new MethodReturnResult();

            try
            {
                using (MaterialLoadingServiceClient client = new MaterialLoadingServiceClient())
                {
                    MaterialLoading obj = new MaterialLoading()
                    {
                        Key = model.LoadingNo.ToUpper(),
                        RouteOperationName = model.RouteOperationName,
                        ProductionLineCode = model.ProductionLineCode,
                        EquipmentCode      = model.EquipmentCode,
                        Operator           = model.Operator,
                        LoadingTime        = model.LoadingTime,
                        Description        = model.Description,
                        Editor             = User.Identity.Name,
                        Creator            = User.Identity.Name
                    };

                    char splitChar      = ',';
                    var  ItemNos        = Request["ItemNo"].Split(splitChar);
                    var  LineStoreNames = Request["LineStoreName"].Split(splitChar);
                    var  MaterialCodes  = Request["MaterialCode"].Split(splitChar);
                    var  MaterialLots   = Request["MaterialLot"].Split(splitChar);
                    var  Qtys           = Request["LoadingQty"].Split(splitChar);

                    List <MaterialLoadingDetail> lst = new List <MaterialLoadingDetail>();
                    for (int i = 0; i < ItemNos.Length; i++)
                    {
                        lst.Add(new MaterialLoadingDetail()
                        {
                            Key = new MaterialLoadingDetailKey()
                            {
                                LoadingKey = model.LoadingNo,
                                ItemNo     = i + 1
                            },
                            LineStoreName = LineStoreNames[i].ToUpper(),
                            OrderNumber   = model.OrderNumber,
                            MaterialCode  = MaterialCodes[i].ToUpper(),
                            MaterialLot   = MaterialLots[i].ToUpper(),
                            LoadingQty    = Convert.ToDouble(Qtys[i]),
                            CurrentQty    = Convert.ToDouble(Qtys[i]),
                            Editor        = User.Identity.Name,
                            Creator       = User.Identity.Name
                        });
                    }

                    rst = await client.AddAsync(obj, lst);

                    if (rst.Code == 0)
                    {
                        rst.Message = string.Format(LSMResources.StringResource.MaterialLoading_Save_Success
                                                    , obj.Key);
                    }
                }
            }
            catch (Exception ex)
            {
                rst.Code    = 1000;
                rst.Message = ex.Message;
                rst.Detail  = ex.ToString();
            }
            return(Json(rst));
        }
Пример #7
0
        public async Task <ActionResult> Query(MaterialLoadingQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (MaterialLoadingServiceClient client = new MaterialLoadingServiceClient())
                {
                    await Task.Run(() =>
                    {
                        StringBuilder where = new StringBuilder();
                        if (model != null)
                        {
                            if (!string.IsNullOrEmpty(model.LoadingNo))
                            {
                                where.AppendFormat(" {0} Key LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.LoadingNo);
                            }
                            if (!string.IsNullOrEmpty(model.RouteOperationName))
                            {
                                where.AppendFormat(" {0} RouteOperationName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.RouteOperationName);
                            }

                            if (!string.IsNullOrEmpty(model.ProductionLineCode))
                            {
                                where.AppendFormat(" {0} ProductionLineCode LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.ProductionLineCode);
                            }

                            if (!string.IsNullOrEmpty(model.EquipmentCode))
                            {
                                where.AppendFormat(" {0} EquipmentCode LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.EquipmentCode);
                            }

                            if (model.StartLoadingTime != null)
                            {
                                where.AppendFormat(" {0} LoadingTime >= '{1:yyyy-MM-dd HH:mm:ss}'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.StartLoadingTime);
                            }

                            if (model.EndLoadingTime != null)
                            {
                                where.AppendFormat(" {0} LoadingTime <= '{1:yyyy-MM-dd HH:mm:ss}'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.EndLoadingTime);
                            }
                        }

                        PagingConfig cfg = new PagingConfig()
                        {
                            OrderBy = "CreateTime Desc",
                            Where   = where.ToString()
                        };

                        MethodReturnResult <IList <MaterialLoading> > result = client.Get(ref cfg);

                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ListPartial", new MaterialLoadingViewModel()));
            }
            else
            {
                return(View("Index", new MaterialLoadingQueryViewModel()));
            }
        }
Пример #8
0
        public async Task <ActionResult> ExportToExcel(MaterialLoadingDetailQueryViewModel model)
        {
            IList <MaterialLoadingDetail> lst = new List <MaterialLoadingDetail>();

            using (MaterialLoadingServiceClient client = new MaterialLoadingServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        OrderBy  = "CreateTime Desc,Key.LoadingKey,Key.ItemNo",
                        Where    = GetWhereCondition(model)
                    };
                    MethodReturnResult <IList <MaterialLoadingDetail> > result = client.GetDetail(ref cfg);

                    if (result.Code == 0)
                    {
                        lst = result.Data;
                    }
                });
            }
            //创建工作薄。
            IWorkbook wb = new HSSFWorkbook();
            //设置EXCEL格式
            ICellStyle style = wb.CreateCellStyle();

            style.FillForegroundColor = 10;
            //有边框
            style.BorderBottom = BorderStyle.THIN;
            style.BorderLeft   = BorderStyle.THIN;
            style.BorderRight  = BorderStyle.THIN;
            style.BorderTop    = BorderStyle.THIN;
            IFont font = wb.CreateFont();

            font.Boldweight = 10;
            style.SetFont(font);
            ICell  cell = null;
            IRow   row  = null;
            ISheet ws   = null;

            for (int j = 0; j < lst.Count; j++)
            {
                if (j % 65535 == 0)
                {
                    ws  = wb.CreateSheet();
                    row = ws.CreateRow(0);
                    #region //列名
                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingViewModel_LoadingNo);  //上料号

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingDetailViewModel_ItemNo);  //项目号

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingViewModel_RouteOperationName);  //工序

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingViewModel_ProductionLineCode);  //生产线

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingViewModel_EquipmentCode);  //设备

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("上料日期");  //上料时间

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingViewModel_LoadingTime);  //上料时间

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingViewModel_Operator);  //操作人

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingDetailViewModel_LineStoreName);  //线边仓

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingViewModel_OrderNumber);  //工单号

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingDetailViewModel_MaterialCode);  //物料编码

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("物料名称");  //物料名称

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingDetailViewModel_MaterialLot);  //物料批号

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingDetailViewModel_LoadingQty);  //上料数量

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingDetailViewModel_UnloadingQty);  //下料数量

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(LSMResources.StringResource.MaterialLoadingDetailViewModel_CurrentQty);  //当前数量

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("编辑人");  //编辑人

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("编辑时间");  //编辑时间
                    #endregion
                    font.Boldweight = 5;
                }

                MaterialLoadingDetail obj = lst[j];
                MaterialLoading       objMaterialLoading = model.GetMaterialLoading(obj.Key.LoadingKey);
                Material m = model.GetMaterial(obj.MaterialCode);
                row = ws.CreateRow(j + 1);

                #region //数据
                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(obj.Key.LoadingKey);  //上料号

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(obj.Key.ItemNo);  //项目号

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(objMaterialLoading.RouteOperationName);  //工序

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(objMaterialLoading.ProductionLineCode);  //生产线

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(objMaterialLoading.EquipmentCode);  //设备

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(string.Format("{0:yyyy-MM-dd}", objMaterialLoading.LoadingTime));  //上料日期

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(string.Format("{0:yyyy-MM-dd HH:mm:ss}", objMaterialLoading.LoadingTime));  //上料时间

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(objMaterialLoading.Operator);  //操作人

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(obj.LineStoreName);  //线边仓

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(obj.OrderNumber);  //工单号

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(obj.MaterialCode);  //物料编码

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(m == null ? string.Empty : m.Name);  //物料名称

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(obj.MaterialLot);  //物料批号

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(obj.LoadingQty);  //上料数量

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(obj.UnloadingQty);  //下料数量

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(obj.CurrentQty);  //当前数量

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(obj.Editor);  //编辑人

                cell           = row.CreateCell(row.Cells.Count);
                cell.CellStyle = style;
                cell.SetCellValue(string.Format("{0:yyyy-MM-dd HH:mm:ss}", obj.EditTime));  //编辑时间
                #endregion
            }

            MemoryStream ms = new MemoryStream();
            wb.Write(ms);
            ms.Flush();
            ms.Position = 0;
            return(File(ms, "application/vnd.ms-excel", "MaterialLoadingData.xls"));
        }
Пример #9
0
        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));
        }