示例#1
0
        private MethodReturnResult GetLot(string lotNumber)
        {
            //如果本次请求有成功获取到批次对象,直接返回。
            if (ViewBag.Lot != null)
            {
                return(ViewBag.Lot);
            }

            MethodReturnResult       result = new MethodReturnResult();
            MethodReturnResult <Lot> rst    = null;
            Lot obj = null;

            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                rst = client.Get(lotNumber);
                if (rst.Code <= 0 && rst.Data != null)
                {
                    obj         = rst.Data;
                    ViewBag.Lot = rst;
                }
                else
                {
                    result.Code    = rst.Code;
                    result.Message = rst.Message;
                    result.Detail  = rst.Detail;
                    return(result);
                }
            }
            if (obj == null || obj.Status == EnumObjectStatus.Disabled)
            {
                result.Code    = 2001;
                result.Message = string.Format(WIPResources.StringResource.LotIsNotExists, lotNumber);
                return(result);
            }
            else if (obj.StateFlag == EnumLotState.Finished)
            {
                result.Code    = 2002;
                result.Message = string.Format("批次({0})已完成。", lotNumber);
                return(result);
            }
            else if (obj.Status == EnumObjectStatus.Disabled || obj.DeletedFlag == true)
            {
                result.Code    = 2003;
                result.Message = string.Format("批次({0})已结束。", lotNumber);
                return(result);
            }
            else if (obj.HoldFlag == true)
            {
                result.Code    = 2004;
                result.Message = string.Format("批次({0})已暂停。", lotNumber);
                return(result);
            }
            else if (obj.PackageFlag == true)
            {
                result.Code    = 2005;
                result.Message = string.Format("批次({0})已包装到({1})。", lotNumber, obj.PackageNo);
                return(result);
            }
            return(rst);
        }
示例#2
0
        //
        // GET: /RPT/WIPDisplay/Detail
        public ActionResult Detail(WIPDisplayDetailQueryViewModel model)
        {
            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    OrderBy = "CreateTime DESC",
                    Where   = GetQueryCondition(model)
                };
                MethodReturnResult <IList <Lot> > result = client.Get(ref cfg);

                if (result.Code == 0)
                {
                    ViewBag.PagingConfig = cfg;
                    ViewBag.List         = result.Data;
                }
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_DetailListPartial"));
            }
            else
            {
                return(View(model));
            }
        }
示例#3
0
        public async Task <ActionResult> QueryWS(LotQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (LotQueryServiceClient client = new LotQueryServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            OrderBy = "CreateTime DESC,Key Desc",
                            Where   = GetQueryCondition(model)
                        };
                        MethodReturnResult <IList <Lot> > result = client.Get(ref cfg);

                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ListPartial_ws", new LotViewModel()));
            }
            else
            {
                return(View("Index_ws", model));
            }
        }
示例#4
0
        public MethodReturnResult GetLot(string lotNumber)
        {
            MethodReturnResult       result = new MethodReturnResult();
            MethodReturnResult <Lot> rst    = null;
            Lot obj = null;

            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                rst = client.Get(lotNumber);
                if (rst.Code <= 0 && rst.Data != null)
                {
                    obj = rst.Data;
                }
                else
                {
                    result.Code    = rst.Code;
                    result.Message = rst.Message;
                    result.Detail  = rst.Detail;
                    return(result);
                }
            }
            if (obj == null || obj.Status == EnumObjectStatus.Disabled)
            {
                result.Code    = 2001;
                result.Message = string.Format(WIPResources.StringResource.LotIsNotExists, lotNumber);
                return(result);
            }

            //判断用户生产线权限
            if (!string.IsNullOrEmpty(obj.PreLineCode))
            {
                IList <Resource> lstResource = new List <Resource>();
                using (UserAuthenticateServiceClient client = new UserAuthenticateServiceClient())
                {
                    MethodReturnResult <IList <Resource> > rst1 = client.GetResourceList(User.Identity.Name, ResourceType.ProductionLine);
                    if (rst1.Code <= 0 && rst1.Data != null)
                    {
                        lstResource = rst1.Data;
                    }
                    else
                    {
                        result.Code    = rst1.Code;
                        result.Message = rst1.Message;
                        result.Detail  = rst1.Detail;
                        return(result);
                    }
                }
                var lnq = from item in lstResource
                          where item.Data == obj.PreLineCode
                          select item;
                if (lnq.Count() == 0)
                {
                    result.Code    = 1;
                    result.Message = string.Format("用户({0})权限不足,对生产线({1})的操作不能撤销。", User.Identity.Name, obj.PreLineCode);
                    return(result);
                }
            }
            return(rst);
        }
示例#5
0
        public MethodReturnResult GetLot(LotPrintViewModel model)
        {
            MethodReturnResult result             = new MethodReturnResult();
            MethodReturnResult <IList <Lot> > rst = null;
            IList <Lot> lst = null;

            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    OrderBy  = "Key"
                };
                if (string.IsNullOrEmpty(model.LotNumber1))
                {
                    cfg.Where = string.Format("Key='{0}'", model.LotNumber);
                }
                else
                {
                    cfg.Where = string.Format("Key>='{0}' AND Key<='{1}'", model.LotNumber, model.LotNumber1);
                }
                rst = client.Get(ref cfg);
                if (rst.Code <= 0 && rst.Data != null)
                {
                    lst = rst.Data;
                }
                else
                {
                    result.Code    = rst.Code;
                    result.Message = rst.Message;
                    result.Detail  = rst.Detail;
                    return(result);
                }
            }

            if (lst == null || lst.Count == 0)
            {
                result.Code = 2001;
                string message = string.Format("{0}-{1}", model.LotNumber, model.LotNumber1);
                result.Message = string.Format(WIPResources.StringResource.LotIsNotExists, message);
                return(result);
            }
            //else if (obj.StateFlag == EnumLotState.Finished)
            //{
            //    result.Code = 2002;
            //    result.Message = string.Format("批次({0})已完成。", lotNumber);
            //    return result;
            //}
            //else if (obj.Status == EnumObjectStatus.Disabled || obj.DeletedFlag == true)
            //{
            //    result.Code = 2003;
            //    result.Message = string.Format("批次({0})已结束。", lotNumber);
            //    return result;
            //}
            return(rst);
        }
示例#6
0
        public MethodReturnResult GetLot(string lotNumber)
        {
            MethodReturnResult       result = new MethodReturnResult();
            MethodReturnResult <Lot> rst    = null;
            Lot obj = null;

            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                rst = client.Get(lotNumber);
                if (rst.Code <= 0 && rst.Data != null)
                {
                    obj = rst.Data;
                }
                else
                {
                    result.Code    = rst.Code;
                    result.Message = rst.Message;
                    result.Detail  = rst.Detail;
                    return(result);
                }
            }
            if (obj == null || obj.Status == EnumObjectStatus.Disabled)
            {
                result.Code    = 2001;
                result.Message = string.Format(WIPResources.StringResource.LotIsNotExists, lotNumber);
                return(result);
            }
            else if (obj.StateFlag == EnumLotState.Finished)
            {
                result.Code    = 2002;
                result.Message = string.Format("批次({0})已完成。", lotNumber);
                return(result);
            }
            else if (obj.Status == EnumObjectStatus.Disabled || obj.DeletedFlag == true)
            {
                result.Code    = 2003;
                result.Message = string.Format("批次({0})已结束。", lotNumber);
                return(result);
            }
            else if (obj.HoldFlag == true)
            {
                result.Code    = 2004;
                result.Message = string.Format("批次({0})已暂停。", lotNumber);
                return(result);
            }
            //判断批次状态是否已包装
            //else if (obj.PackageNo != null && obj.PackageNo != "" || obj.PackageFlag == true)
            else if (obj.PackageFlag == true)
            {
                result.Code    = 2005;
                result.Message = string.Format("批次({0})已包装。", lotNumber);
                return(result);
            }

            return(rst);
        }
示例#7
0
        public bool RerurnIsExecutePowerset(string lotNumber)
        {
            IList <RouteStepAttribute> lstRouteStepAttribute = new List <RouteStepAttribute>();   //工序属性
            MethodReturnResult <Lot>   rst    = new MethodReturnResult <Lot>();
            MethodReturnResult         result = new MethodReturnResult();
            Lot obj = null;

            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                rst = client.Get(lotNumber);
                if (rst.Code == 0 && rst.Data != null)
                {
                    obj = rst.Data;
                }
                else
                {
                    result.Code    = rst.Code;
                    result.Message = rst.Message;
                    result.Detail  = rst.Detail;
                    return(false);
                }
            }


            //获取工序控制属性列表
            using (RouteStepAttributeServiceClient client = new RouteStepAttributeServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format("Key.RouteName='{0}' AND Key.RouteStepName='{1}'"
                                             , obj.RouteName
                                             , obj.RouteStepName)
                };
                MethodReturnResult <IList <RouteStepAttribute> > r = client.Get(ref cfg);
                if (r.Code <= 0 && r.Data != null)
                {
                    lstRouteStepAttribute = r.Data;
                }
            }
            //是否显示电流档(利用功率分档显示电流档)yanshan.xiao
            bool IsExecutePowerset = false;
            var  lnq = from item in lstRouteStepAttribute
                       where item.Key.AttributeName == "IsExecutePowerset"
                       select item;
            RouteStepAttribute rsaTmp = lnq.FirstOrDefault();

            if (rsaTmp != null)
            {
                bool.TryParse(rsaTmp.Value, out IsExecutePowerset);
            }


            return(IsExecutePowerset);
        }
示例#8
0
 public Lot GetLot(string lotNumber)
 {
     using (LotQueryServiceClient client = new LotQueryServiceClient())
     {
         MethodReturnResult <Lot> result = client.Get(lotNumber);
         if (result.Code <= 0 && result.Data != null)
         {
             return(result.Data);
         }
     }
     return(null);
 }
示例#9
0
 public string GetEfficiency(string lotNumber)
 {
     using (LotQueryServiceClient client = new LotQueryServiceClient())
     {
         MethodReturnResult <Lot> result = client.Get(lotNumber);
         if (result.Code == 0)
         {
             return(result.Data.Attr1);
         }
     }
     return(string.Empty);
 }
示例#10
0
        private Lot GetLot(string lotNumber)
        {
            MethodReturnResult <Lot> rst = null;
            Lot obj = null;

            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                rst = client.Get(lotNumber);
                if (rst.Code <= 0 && rst.Data != null)
                {
                    obj = rst.Data;
                }
            }
            return(obj);
        }
        public Lot GetLotData(string packageNumber)
        {
            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    Where    = string.Format("PackageNo='{0}'", packageNumber),
                    IsPaging = false
                };
                MethodReturnResult <IList <Lot> > result = client.Get(ref cfg);

                if (result.Code == 0 && result.Data != null && result.Data.Count > 0)
                {
                    return(result.Data.FirstOrDefault());
                }
            }
            return(null);
        }
示例#12
0
        public Lot GetLot(string lotNumber)
        {
            Lot lot = null;

            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    PageNo   = 0,
                    PageSize = 1,
                    Where    = string.Format("Key='{0}'", lotNumber)
                };
                MethodReturnResult <IList <Lot> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null && result.Data.Count > 0)
                {
                    lot = result.Data[0];
                }
            }
            return(lot);
        }
示例#13
0
        //
        //POST: /WIP/LotQuery/Detail
        public async Task <ActionResult> DetailWS(string lotNumber)
        {
            if (ModelState.IsValid)
            {
                using (LotQueryServiceClient client = new LotQueryServiceClient())
                {
                    await Task.Run(() =>
                    {
                        MethodReturnResult <Lot> result = client.Get(lotNumber);

                        if (result.Code == 0)
                        {
                            ViewBag.Lot = result.Data;
                        }
                    });
                }
            }
            if (ViewBag.Lot == null)
            {
                ViewBag.Lot = new Lot();
            }
            return(View("Detail_ws", new LotViewModel()));
        }
示例#14
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 (LotQueryServiceClient client = new LotQueryServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <Lot> > result = client.Get(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_DetailListPartial"));
        }
示例#15
0
        //
        //POST: /WIP/LotQuery/GetLotMaterial
        public async Task <ActionResult> GetLotMaterialWS(string lotNumber)
        {
            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                await Task.Run(() =>
                {
                    MethodReturnResult <Lot> result = client.Get(lotNumber);

                    if (result.Code == 0)
                    {
                        ViewBag.Lot = result.Data;
                    }
                });
            }


            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        Where    = string.Format(@" Key.LotNumber='{0}'"
                                                 , lotNumber),
                        OrderBy = "Key.ItemNo"
                    };
                    MethodReturnResult <IList <LotBOM> > result = client.GetLotBOM(ref cfg);
                    if (result.Code == 0)
                    {
                        ViewBag.MaterialList = result.Data;
                    }
                });
            }
            return(PartialView("_MaterialListPartial_ws"));
        }
        public async Task <ActionResult> ExportToXML(LotPackageSEModulesViewModel model)
        {
            IList <Package> lstLotPackage = new List <Package>();
            string          ftpServerIP   = System.Configuration.ConfigurationManager.AppSettings["ftpServerIP"];
            string          ftpUserID     = System.Configuration.ConfigurationManager.AppSettings["ftpUserID"];
            string          ftpPassword   = System.Configuration.ConfigurationManager.AppSettings["ftpPassword"];
            string          fileDate      = DateTime.Now.ToString("yyyyMMdd");

            if (!GetFile(ftpServerIP, ftpUserID, ftpPassword, fileDate))//
            {
                MakeDir(ftpServerIP, ftpUserID, ftpPassword, fileDate);
            }
            LotPackageSEModulesViewModel SEModulesModel = new LotPackageSEModulesViewModel();

            try
            {
                using (PackageQueryServiceClient client = new PackageQueryServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            IsPaging = false,
                            OrderBy  = "Key",
                            Where    = GetQueryCondition(model)
                        };
                        MethodReturnResult <IList <Package> > resultPackage = client.Get(ref cfg);
                        if (resultPackage.Code == 0)
                        {
                            lstLotPackage = resultPackage.Data;
                        }
                    });
                }

                string successMessage = string.Empty;  //记录导出成功批次
                string failMessage    = string.Empty;; //记录导出失败批次
                for (int i = 0; i < lstLotPackage.Count; i++)
                {
                    string packageNo = lstLotPackage[i].Key;//包装号
                    MethodReturnResult <IList <Lot> > lotDetail = null;

                    using (LotQueryServiceClient client = new LotQueryServiceClient())//取得包装号对应的批次信息
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            Where    = string.Format("PackageNo='{0}'", packageNo),
                            IsPaging = false
                        };
                        lotDetail = client.Get(ref cfg);
                    }
                    //string productType = SEModulesModel.GetProductType();
                    //创建XML文件
                    #region 1.创建类型声明节点
                    XmlDocument xmlDoc = new XmlDocument();     //XML对象
                    XmlNode     node   = xmlDoc.CreateXmlDeclaration("1.0", "ISO-8859-1", "no");
                    xmlDoc.AppendChild(node);
                    #endregion

                    #region 2.创建根节点
                    XmlElement root = xmlDoc.CreateElement("Parts");
                    root.SetAttribute("xmlns:xsi", @"http://www.w3.org/2001/XMLSchema-instance");
                    xmlDoc.AppendChild(root);
                    #endregion

                    #region 3批次数据节点
                    for (int j = 0; j < lotDetail.Data.Count; j++)
                    {
                        string lotNumber = lotDetail.Data[j].Key;//批次号
                        //string packageNo = lotDetail.Data[j].PackageNo;//托号
                        string seModulesNo = string.Empty;
                        //if (lotDetail.Data[j].Attr3 != "" && lotDetail.Data[j].Attr3.Split('-').Length > 1)
                        //{
                        //    seModulesNo = lotDetail.Data[j].Attr3.Split('-')[1];
                        //}
                        //else
                        //{
                        //    seModulesNo = lotDetail.Data[j].Attr3;
                        //}
                        seModulesNo = lotDetail.Data[j].Attr3;

                        string orderNumber  = lotDetail.Data[j].OrderNumber;
                        string materialCode = lotDetail.Data[j].MaterialCode;

                        string pmp     = "";
                        string isc     = "";
                        string imp     = "";
                        string voc     = "";
                        string vmp     = "";
                        string ff      = "";
                        string pnom    = "";
                        string current = "";
                        string colour  = "";

                        if (lotDetail.Data[j].Color == "深蓝")
                        {
                            colour = "Dark Blue";
                        }
                        if (lotDetail.Data[j].Color == "浅蓝")
                        {
                            colour = "Light Blue";
                        }
                        if (lotDetail.Data[j].Color == "正蓝")
                        {
                            colour = "Blue";
                        }

                        IVTestData ivtest             = SEModulesModel.GetIVTestData(lotNumber);
                        RPTpackagelistParameter param = new RPTpackagelistParameter();
                        param.PackageNo = packageNo;
                        param.LotNumber = lotNumber;
                        param.PageSize  = 20;
                        using (PackageQueryServiceClient client = new PackageQueryServiceClient())
                        {
                            MethodReturnResult <DataSet> ds = client.GetRPTpackagelistQueryDb(ref param);
                            if (ds.Code > 0)
                            {
                                //return Content("批次{0}五大参数异常", lotNumber);
                            }
                            else
                            {
                                DataTable dtOfIV = ds.Data.Tables[0];
                                pmp = Convert.ToDecimal(dtOfIV.Rows[0]["COEF_PMAX"]).ToString("F3");
                                isc = Convert.ToDecimal(dtOfIV.Rows[0]["COEF_ISC"]).ToString("F3");
                                imp = Convert.ToDecimal(dtOfIV.Rows[0]["COEF_IMAX"]).ToString("F3");
                                voc = Convert.ToDecimal(dtOfIV.Rows[0]["COEF_VOC"]).ToString("F3");
                                vmp = Convert.ToDecimal(dtOfIV.Rows[0]["COEF_VMAX"]).ToString("F3");
                                if (Convert.ToDecimal(dtOfIV.Rows[0]["COEF_FF"]) < 1)
                                {
                                    ff = (Convert.ToDecimal(dtOfIV.Rows[0]["COEF_FF"]) * 100).ToString("F3");
                                }
                                else
                                {
                                    ff = Convert.ToDecimal(dtOfIV.Rows[0]["COEF_FF"]).ToString("F3");
                                }
                                pnom    = dtOfIV.Rows[0]["PM_NAME"].ToString();
                                current = dtOfIV.Rows[0]["PS_SUBCODE"].ToString();
                                if (current == "α")
                                {
                                    current = "A";
                                }
                                if (current == "β")
                                {
                                    current = "B";
                                }
                                if (current == "γ")
                                {
                                    current = "C";
                                }
                            }
                        }
                        string productType  = SEModulesModel.GetProductType(materialCode, orderNumber, ivtest.PowersetCode, ivtest.PowersetItemNo.Value, lotDetail.Data[j]);  //对应主铭牌上的产品型号
                        string productTypes = SEModulesModel.GetProductTypes(materialCode, orderNumber, ivtest.PowersetCode, ivtest.PowersetItemNo.Value, lotDetail.Data[j]); //对应副标签上的产品型号
                        if (productType == "" || productTypes == "")
                        {
                            return(Content("产片编码:{0}未设置产品对应属性", materialCode));
                        }
                        XmlNode PartDataNode = xmlDoc.CreateNode(XmlNodeType.Element, "PartData", null);
                        root.AppendChild(PartDataNode);
                        CreateNode(xmlDoc, PartDataNode, "ModuleSerialNumber", "JN" + lotNumber);
                        CreateNode(xmlDoc, PartDataNode, "SESerialNumber", seModulesNo);
                        CreateNode(xmlDoc, PartDataNode, "PartNumber", productTypes);
                        CreateNode(xmlDoc, PartDataNode, "PalletNumber", packageNo);

                        //CreateNode(xmlDoc, PartDataNode, "Pmp-W", pmp);
                        //CreateNode(xmlDoc, PartDataNode, "Isc-A", isc);
                        //CreateNode(xmlDoc, PartDataNode, "Imp-A", imp);
                        //CreateNode(xmlDoc, PartDataNode, "Voc-V", voc);
                        //CreateNode(xmlDoc, PartDataNode, "Vmp-V", vmp);
                        //CreateNode(xmlDoc, PartDataNode, "FF-%", ff);
                        //CreateNode(xmlDoc, PartDataNode, "Pnom-W", pnom);
                        //CreateNode(xmlDoc, PartDataNode, "Current-A", current);

                        CreateNode(xmlDoc, PartDataNode, "Pmp", pmp + "W");
                        CreateNode(xmlDoc, PartDataNode, "Isc", isc + "A");
                        CreateNode(xmlDoc, PartDataNode, "Imp", imp + "A");
                        CreateNode(xmlDoc, PartDataNode, "Voc", voc + "V");
                        CreateNode(xmlDoc, PartDataNode, "Vmp", vmp + "V");
                        CreateNode(xmlDoc, PartDataNode, "FF", ff + "%");
                        CreateNode(xmlDoc, PartDataNode, "Pnom", pnom);
                        CreateNode(xmlDoc, PartDataNode, "Current", current);
                        CreateNode(xmlDoc, PartDataNode, "Colour", colour);
                        CreateNode(xmlDoc, PartDataNode, "LabelPN", productType);
                    }
                    #endregion

                    //XML路径
                    string path = Server.MapPath("~/SEModules/");
                    if (Directory.Exists(path) == false)
                    {
                        Directory.CreateDirectory(path);
                    }
                    string fileName = "SEModules" + DateTime.Now.ToString("yyyyMMddHHmm") + packageNo + ".xml";
                    string pathFile = path + fileName;
                    xmlDoc.Save(pathFile);

                    //string ftpServerIP = "seftp.solaredge.com";
                    //string ftpUserID = "jinergy";
                    //string ftpPassword = "******";
                    if (UploadFtp(path, fileDate, fileName, ftpServerIP, ftpUserID, ftpPassword))
                    {
                        successMessage = successMessage + packageNo + ";";
                    }
                    else
                    {
                        failMessage = failMessage + packageNo + ";";
                    }
                }
                if (successMessage.Length > 0)
                {
                    successMessage = successMessage + "导出成功";
                }
                if (failMessage.Length > 0)
                {
                    failMessage = failMessage + "导出失败";
                }
                return(Content("批次号:" + successMessage + failMessage));
            }
            catch (Exception err)
            {
                return(Content(string.Format("导出XML报错:{0}", err.Message)));
            }
        }
示例#17
0
        public Supplier GetLotBBMaterialSupplier(string lotNumber)
        {
            LotBOM lotBOMGlass = null;

            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    PageNo   = 0,
                    PageSize = 1,
                    Where    = string.Format("Key.LotNumber='{0}' AND MaterialCode like'130308%'", lotNumber)
                };
                MethodReturnResult <IList <LotBOM> > result = client.GetLotBOM(ref cfg);
                if (result.Code <= 0 && result.Data != null && result.Data.Count > 0)
                {
                    lotBOMGlass = result.Data[0];
                }
            }

            Lot Lot = null;

            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    PageNo   = 0,
                    PageSize = 1,
                    Where    = string.Format("Key.LotNumber='{0}'", lotNumber)
                };
                MethodReturnResult <Lot> result = client.Get(lotNumber);
                if (result.Code <= 0 && result.Data != null)
                {
                    Lot = result.Data;
                }
            }

            Supplier sBB = null;

            using (SupplierServiceClient client = new SupplierServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    PageNo   = 0,
                    PageSize = 1,
                    Where    = string.Format(@"EXISTS (FROM LineStoreMaterialDetail as p
                                                      WHERE p.SupplierCode=self.Key
                                                      AND p.Key.MaterialLot='{0}'
                                                      AND p.Key.MaterialCode='{1}'
                                                      AND p.Key.LineStoreName='{2}'
                                                      AND p.Key.OrderNumber='{3}')"
                                             , lotBOMGlass.Key.MaterialLot
                                             , lotBOMGlass.MaterialCode
                                             , lotBOMGlass.LineStoreName
                                             , Lot.OrderNumber != null ? Lot.OrderNumber : string.Empty
                                             )
                };
                MethodReturnResult <IList <Supplier> > rst = client.Get(ref cfg);
                if (rst.Code <= 0 && rst.Data.Count > 0)
                {
                    sBB = rst.Data[0];
                }
                return(sBB);
            }
        }
示例#18
0
        public async Task <ActionResult> ExportToExcel(WIPDisplayDetailQueryViewModel model)
        {
            IList <Lot> lstLot = new List <Lot>();

            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        OrderBy  = "CreateTime DESC",
                        Where    = GetQueryCondition(model)
                    };
                    MethodReturnResult <IList <Lot> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        lstLot = 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);

            ISheet ws = null;

            for (int j = 0; j < lstLot.Count; j++)
            {
                if (j % 65535 == 0)
                {
                    ws = wb.CreateSheet();
                    IRow row = ws.CreateRow(0);
                    #region //列名
                    ICell cell = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("序号");  //序号

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("批次号(组件序列号)");  //批次号

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

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("物料编码");  //产品号

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("数量");  //数量

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("效率档");  //效率档

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("等级");  //等级

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("花色");  //花色

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("线别");  //线别代码

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("设备代码");  //设备代码


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

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("工艺流程");  //工艺流程

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

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("状态");  //状态


                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("批次类型");  //批次类型

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("暂停?");  //暂停标志


                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("包装号");  //包装号

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("返修?");  //返修标志

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("返工?");  //返工标志

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("返工时间");  //返工时间

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("返工操作人");  //返工操作人

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("创建时间");  //创建时间

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

                    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;
                }
                Lot  obj     = lstLot[j];
                IRow rowData = ws.CreateRow(j + 1);

                #region //数据
                ICell cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(j + 1);  //序号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Key);  //批次号


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

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.MaterialCode);  //产品号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Quantity);  //数量

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Attr1);  //效率档

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Grade);  //等级

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Color);  //花色

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.LineCode);  //线别代码

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.EquipmentCode);  //设备代码


                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.LocationName);  //车间名称


                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.RouteName);  //工艺流程

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.RouteStepName);  //工步

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.StateFlag.GetDisplayName());  //批次状态

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.LotType.GetDisplayName());  //批次类型

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.HoldFlag ? StringResource.Yes : StringResource.No);  //暂停标志

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.PackageNo);  //包装号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.RepairFlag);  //返修次数

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.ReworkFlag);  //返工次数

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(string.Format("{0:yyyy-MM-dd HH:mm:ss}", obj.ReworkTime));  //返工时间

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Reworker);  //返工操作人

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(string.Format("{0:yyyy-MM-dd HH:mm:ss}", obj.CreateTime));  //创建时间

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Creator);  //创建人

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

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Editor);  //编辑人
                #endregion
            }

            MemoryStream ms = new MemoryStream();
            wb.Write(ms);
            ms.Flush();
            ms.Position = 0;
            return(File(ms, "application/vnd.ms-excel", "WIPDetailData.xls"));
        }
示例#19
0
        MethodReturnResult GetLot(string lotNumber)
        {
            bool IsMapChkLotState = false;

            //获取是否允许无限制条件(批次状态)匹配优化器
            using (BaseAttributeValueServiceClient ClientOfBASE = new BaseAttributeValueServiceClient())
            {
                IList <BaseAttributeValue> lstBaseAttributeValue = new List <BaseAttributeValue>();
                PagingConfig pg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format("Key.CategoryName='SystemParameters' and Key.AttributeName='MapChkLotState' ")
                };
                MethodReturnResult <IList <BaseAttributeValue> > r = ClientOfBASE.Get(ref pg);
                if (r.Code <= 0 && r.Data != null)
                {
                    lstBaseAttributeValue = r.Data;
                    IsMapChkLotState      = Convert.ToBoolean(lstBaseAttributeValue[0].Value);
                }
            }
            MethodReturnResult       result = new MethodReturnResult();
            MethodReturnResult <Lot> rst    = null;
            Lot obj = null;

            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                rst = client.Get(lotNumber);
                if (rst.Code == 0 && rst.Data != null)
                {
                    obj = rst.Data;
                }
                else
                {
                    result.Code    = rst.Code;
                    result.Message = rst.Message;
                    result.Detail  = rst.Detail;
                    return(result);
                }
            }

            if (obj == null || obj.Status == EnumObjectStatus.Disabled)
            {
                result.Code    = 2001;
                result.Message = string.Format(WIPResources.StringResource.LotIsNotExists, lotNumber);
                return(result);
            }
            if (IsMapChkLotState)
            {
                if (obj.StateFlag == EnumLotState.Finished)
                {
                    result.Code    = 2002;
                    result.Message = string.Format("批次({0})已完成。", lotNumber);
                    return(result);
                }
                else if (obj.Status == EnumObjectStatus.Disabled || obj.DeletedFlag == true)
                {
                    result.Code    = 2003;
                    result.Message = string.Format("批次({0})已结束。", lotNumber);
                    return(result);
                }
                else if (obj.HoldFlag == true)
                {
                    string    res  = null;
                    string    res2 = null;
                    string    sql  = string.Format(@"select ATTR_4  from WIP_LOT where LOT_NUMBER='{0}'", lotNumber);
                    DataTable dt   = new DataTable();
                    using (DBServiceClient client = new DBServiceClient())
                    {
                        MethodReturnResult <DataTable> dtResult = client.ExecuteQuery(sql);
                        if (result.Code == 0)
                        {
                            dt  = dtResult.Data;
                            res = dt.Rows[0][0].ToString();
                        }
                    }

                    string    sql2 = string.Format(@"select top 1 t2.HOLD_DESCRIPTION  from  WIP_TRANSACTION  t1
                                                   inner join [dbo].[WIP_TRANSACTION_HOLD_RELEASE]  t2 on  t1.TRANSACTION_KEY=t2.TRANSACTION_KEY
                                                   inner join WIP_LOT t3  on t3.LOT_NUMBER = t1.LOT_NUMBER  
                                                   where t1.LOT_NUMBER='{0}'
                                                   order by t2.HOLD_TIME  desc", lotNumber);
                    DataTable dt2  = new DataTable();
                    using (DBServiceClient client2 = new DBServiceClient())
                    {
                        MethodReturnResult <DataTable> dtResult2 = client2.ExecuteQuery(sql2);
                        if (result.Code == 0 && dtResult2.Data != null && dtResult2.Data.Rows.Count > 0)
                        {
                            dt2  = dtResult2.Data;
                            res2 = dt2.Rows[0][0].ToString();
                        }
                    }

                    if (dt != null && dt.Rows.Count > 0 && res != null && res != "")
                    {
                        result.Code    = 2004;
                        result.Message = string.Format("批次({0})已暂停,原因为:{1}。", lotNumber, res);
                    }
                    else if (dt != null && dt.Rows.Count > 0 && res2 != null && res2 != "")
                    {
                        result.Code    = 2004;
                        result.Message = string.Format("批次({0})已暂停。", lotNumber);
                    }
                    else
                    {
                        result.Code    = 2004;
                        result.Message = string.Format("批次({0})已暂停。", lotNumber);
                    }
                    return(result);
                }
            }
            return(rst);
        }
示例#20
0
        public async Task <ActionResult> ExportToExcel(LotQueryViewModel model)
        {
            IList <Lot> lstLot = new List <Lot>();

            using (LotQueryServiceClient client = new LotQueryServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        OrderBy  = "CreateTime DESC,Key Desc",
                        Where    = GetQueryCondition(model)
                    };
                    MethodReturnResult <IList <Lot> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        lstLot = 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);

            LotViewModel m  = new LotViewModel();
            ISheet       ws = null;

            for (int j = 0; j < lstLot.Count; j++)
            {
                if (j % 65535 == 0)
                {
                    ws = wb.CreateSheet();
                    IRow row = ws.CreateRow(0);
                    #region //列名
                    ICell cell = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(StringResource.ItemNo);  //项目号

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotNumber);  //批次号

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_OriginalOrderNumber);  //原始工单号

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

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_MaterialCode);  //产品号

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_Quantity);  //数量

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("效率档");  //效率档

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_Grade);  //等级

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_Color);  //花色

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_LineCode);  //线别代码

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_EquipmentCode);  //设备代码


                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_LocationName);  //车间名称

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_RouteEnterpriseName);  //工艺流程组

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_RouteName);  //工艺流程

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_RouteStepName);  //工步

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_StartWaitTime);  //开始等待时间

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_StartProcessTime);  //开始处理时间

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_StateFlag);  //批次状态

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_LotType);  //批次类型

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_HoldFlag);  //暂停标志

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_DeletedFlag);  //结束标志

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_PackageFlag);  //包装标志

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_PackageNo);  //包装号

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_RepairFlag);  //返修标志

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_ReworkFlag);  //返工标志

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_ReworkTime);  //返工时间

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(WIPResources.StringResource.LotViewModel_Reworker);  //返工操作人

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

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("电池片物料");  //电池片物料

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("电池片批号");  //电池片批号

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue("电池片供应商");  //电池片供应商

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(StringResource.CreateTime);  //创建时间

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(StringResource.Creator);  //创建人

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(StringResource.EditTime);  //编辑时间

                    cell           = row.CreateCell(row.Cells.Count);
                    cell.CellStyle = style;
                    cell.SetCellValue(StringResource.Editor);  //编辑人
                    #endregion
                    font.Boldweight = 5;
                }
                Lot  obj     = lstLot[j];
                IRow rowData = ws.CreateRow(j + 1);

                LotBOM lotBOMObj = m.GetLotCellMaterial(obj.Key);

                #region //数据
                ICell cellData = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(j + 1);  //项目号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Key);  //批次号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.OriginalOrderNumber);  //原始工单号

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

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.MaterialCode);  //产品号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Quantity);  //数量

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Attr1);  //效率档

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Grade);  //等级

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Color);  //花色

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.LineCode);  //线别代码

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.EquipmentCode);  //设备代码


                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.LocationName);  //车间名称

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.RouteEnterpriseName);  //工艺流程组

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.RouteName);  //工艺流程

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.RouteStepName);  //工步

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(string.Format("{0:yyyy-MM-dd HH:mm:ss}", obj.StartWaitTime));  //开始等待时间

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(string.Format("{0:yyyy-MM-dd HH:mm:ss}", obj.StartProcessTime));  //开始处理时间

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.StateFlag.GetDisplayName());  //批次状态

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.LotType.GetDisplayName());  //批次类型

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.HoldFlag ? StringResource.Yes : StringResource.No);  //暂停标志

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.DeletedFlag ? StringResource.Yes : StringResource.No);  //结束标志

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.PackageFlag ? StringResource.Yes : StringResource.No);  //包装标志

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.PackageNo);  //包装号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.RepairFlag);  //返修次数

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.ReworkFlag);  //返工次数

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(string.Format("{0:yyyy-MM-dd HH:mm:ss}", obj.ReworkTime));  //返工时间

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Reworker);  //返工操作人

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(lotBOMObj != null ? lotBOMObj.MaterialCode : string.Empty);  //电池片物料编码

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(lotBOMObj != null ? lotBOMObj.MaterialName : string.Empty);  //电池片物料编码

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(lotBOMObj != null ? lotBOMObj.Key.MaterialLot : string.Empty);  //电池片批号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(lotBOMObj != null ? lotBOMObj.SupplierName : string.Empty);  //供应商名称

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(string.Format("{0:yyyy-MM-dd HH:mm:ss}", obj.CreateTime));  //创建时间

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Creator);  //创建人

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

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(obj.Editor);  //编辑人
                #endregion
            }

            MemoryStream ms = new MemoryStream();
            wb.Write(ms);
            ms.Flush();
            ms.Position = 0;
            return(File(ms, "application/vnd.ms-excel", "LotData.xls"));
        }