예제 #1
0
        private MethodReturnResult FinishChest(ChestViewModel model)
        {
            MethodReturnResult result = new MethodReturnResult();
            //进行批次包装作业。
            ChestParameter p = new ChestParameter()
            {
                Editor  = User.Identity.Name,
                ChestNo = model.ChestNo,
                IsFinishPackageInChest  = model.IsFinishPackage,
                IsLastestPackageInChest = model.IsLastestPackageInChest,
                ChestFullQty            = model.FullQuantity,
                StoreLocation           = model.StoreLocation,
                PackageNo = model.PackageNo.ToUpper().Trim(),
                isManual  = model.IsManual,
                ModelType = 0
            };

            using (PackageInChestServiceClient client = new PackageInChestServiceClient())
            {
                result = client.FinishChest(p);

                if (result.Code == 0 && model.IsFinishPackage == true)
                {
                    result.Message = string.Format("尾柜 {0} 已手动完成入柜。", model.ChestNo);
                }
            }
            return(result);
        }
예제 #2
0
        public ActionResult QueryChestDetail(String chestNo)
        {
            if (!string.IsNullOrEmpty(chestNo))
            {
                using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                {
                    MethodReturnResult <Chest> result2 = client.Get(chestNo.Trim().ToUpper());
                    if (result2.Code == 0)
                    {
                        ViewBag.Chest = result2.Data;
                    }
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        Where    = string.Format(@"Key.ChestNo='{0}'", chestNo.Trim().ToUpper()),
                        OrderBy  = "ItemNo"
                    };
                    MethodReturnResult <IList <ChestDetail> > result = client.GetDetail(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.ChestDetailList = result.Data;
                    }
                }
            }
            return(PartialView("_ListChestDetailQuery", new ChestMonitorViewModel()));
        }
예제 #3
0
 //获取柜信息
 public Chest GetChest(string key)
 {
     using (PackageInChestServiceClient client = new PackageInChestServiceClient())
     {
         MethodReturnResult <Chest> rst = client.Get(key);
         if (rst.Code <= 0)
         {
             return(rst.Data);
         }
     }
     return(null);
 }
예제 #4
0
 //获取柜明细
 public ChestDetail GetChestDetail(ChestDetailKey key)
 {
     using (PackageInChestServiceClient client = new PackageInChestServiceClient())
     {
         MethodReturnResult <ChestDetail> rst = client.GetDetail(key);
         if (rst.Code <= 0)
         {
             return(rst.Data);
         }
     }
     return(null);
 }
예제 #5
0
        // 获取柜信息--当前数量/是否尾包/库位
        public ActionResult GetChestInfo(string chestNo)
        {
            double currentQuantity  = 0;
            bool   isLastestPackage = false;
            string storeLocation    = "";
            double fullQuantity     = 0;
            int    code             = 0;

            if (!string.IsNullOrEmpty(chestNo))
            {
                //获取当前数量
                using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                {
                    MethodReturnResult <Chest> rst2 = client.Get(chestNo);
                    if (rst2.Code == 1000)
                    {
                        return(Json(rst2));
                    }
                    if (rst2.Code <= 0 && rst2.Data != null)
                    {
                        using (MaterialChestParameterServiceClient client1 = new MaterialChestParameterServiceClient())
                        {
                            MethodReturnResult <MaterialChestParameter> rst3 = client1.Get(rst2.Data.MaterialCode);
                            if (rst3.Data != null)
                            {
                                fullQuantity = rst3.Data.FullChestQty;
                            }
                            else
                            {
                                return(Json(rst3, JsonRequestBehavior.AllowGet));
                            }
                        }
                        currentQuantity  = rst2.Data.Quantity;
                        isLastestPackage = rst2.Data.IsLastPackage;
                        storeLocation    = rst2.Data.StoreLocation;
                    }
                }
            }

            return(Json(new
            {
                Code = code,
                CurrentQuantity = currentQuantity,
                IsLastestPackage = isLastestPackage,
                StoreLocation = storeLocation,
                FullQuantity = fullQuantity
            }, JsonRequestBehavior.AllowGet));
        }
예제 #6
0
        // 托号入柜作业---包装模型对象model
        private MethodReturnResult Chest(ChestViewModel model)
        {
            MethodReturnResult result = new MethodReturnResult();
            //进行包装入柜作业。
            ChestParameter p = new ChestParameter()
            {
                Editor  = User.Identity.Name,
                ChestNo = model.ChestNo,
                IsFinishPackageInChest  = model.IsFinishPackage,
                IsLastestPackageInChest = model.IsLastestPackageInChest,
                ChestFullQty            = model.FullQuantity,
                StoreLocation           = model.StoreLocation,
                PackageNo = model.PackageNo.ToUpper().Trim(),
                isManual  = model.IsManual,
                ModelType = 0
            };

            if (model.CurrentQuantity == model.FullQuantity)
            {
                p.IsFinishPackageInChest = true;
                model.IsFinishPackage    = true;
            }

            using (PackageInChestServiceClient client = new PackageInChestServiceClient())
            {
                result = client.Chest(p);
                string detailInfo = result.Detail;
                if (result.Code == 0 && model.IsFinishPackage == false)
                {
                    result.Message = string.Format("托号 {0} 成功入柜到({1})。"
                                                   , model.PackageNo.ToUpper().Trim()
                                                   , model.ChestNo);
                }
                else if (result.Code == 0 && model.IsFinishPackage == true)
                {
                    result = client.ChangeChest(model.ChestNo, User.Identity.Name);
                    if (result.Code <= 0)
                    {
                        result.Detail  = detailInfo;
                        result.Message = string.Format("托号 {0} 成功入柜到({1}),柜号{1}入柜完成。"
                                                       , model.PackageNo.ToUpper().Trim(), model.ChestNo);
                    }
                }
            }
            return(result);
        }
예제 #7
0
        public ActionResult QueryChecked(ChestViewModel model)
        {
            MethodReturnResult <DataSet> result = new MethodReturnResult <DataSet>();

            try
            {
                if (!string.IsNullOrEmpty(model.ChestNo))
                {
                    model.ChestNo = model.ChestNo.ToUpper().Trim();
                    ChestParameter param = new ChestParameter();
                    param.ChestNo = model.ChestNo;
                    using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                    {
                        MethodReturnResult <DataSet> ds = client.GetCheckedChestDetailByDB(ref param);
                        if (ds.Code > 0)
                        {
                            result.Code    = ds.Code;
                            result.Message = ds.Message;
                            result.Detail  = ds.Detail;

                            return(Json(result));
                        }

                        ViewBag.ListData = ds.Data.Tables[0];
                    }
                }
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }

            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ListPartialCheck", model));
            }
            else
            {
                return(View("check", model));
            }
        }
예제 #8
0
        public async Task <ActionResult> PagingQuery(string where, string orderBy, int?currentPageNo, int?currentPageSize)
        {
            if (ModelState.IsValid)
            {
                int pageNo   = currentPageNo ?? 0;
                int pageSize = currentPageSize ?? 20;
                if (Request["PageNo"] != null)
                {
                    pageNo = Convert.ToInt32(Request["PageNo"]);
                }
                if (Request["PageSize"] != null)
                {
                    pageSize = Convert.ToInt32(Request["PageSize"]);
                }

                using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <ChestDetail> > result = client.GetDetail(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig    = cfg;
                            ViewBag.ChestDetailList = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ChestDetailListPartial", new ChestDetailQueryViewModel()));
        }
예제 #9
0
        public ActionResult Finish(ChestViewModel model)
        {
            MethodReturnResult result = new MethodReturnResult();

            try
            {
                //如果柜号为空。
                if (string.IsNullOrEmpty(model.ChestNo))
                {
                    result.Code    = 1001;
                    result.Message = string.Format("柜号不能为空。");
                    return(Json(result));
                }
                else
                {
                    model.ChestNo = model.ChestNo.ToUpper().Trim();
                }
                Chest obj = null;
                //如果当前数量为空,获取当前数量
                using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                {
                    MethodReturnResult <Chest> rst2 = client.Get(model.ChestNo);
                    if (rst2.Code > 0)
                    {
                        return(Json(rst2));
                    }
                    if (rst2.Code <= 0 && rst2.Data != null)
                    {
                        //检查柜状态
                        if (rst2.Data.ChestState != EnumChestState.Packaging)
                        {
                            result.Code    = 1001;
                            result.Message = string.Format("柜 {0} 非{1}状态,不能执行手动完成入柜。"
                                                           , model.ChestNo.ToUpper()
                                                           , EnumChestState.Packaging.GetDisplayName());
                            return(Json(result));
                        }
                        //设置当前数量。
                        obj = rst2.Data;
                        model.CurrentQuantity = rst2.Data.Quantity;
                        if (model.CurrentQuantity == 0)
                        {
                            result.Code    = 1001;
                            result.Message = string.Format("柜 {0} 数量为0,不能执行手动完成入柜。", model.ChestNo.ToUpper());
                            return(Json(result));
                        }
                    }
                }
                //如果满柜数量为空,获取满柜数量
                if (model.FullQuantity == 0)
                {
                    using (MaterialChestParameterServiceClient client1 = new MaterialChestParameterServiceClient())
                    {
                        MethodReturnResult <MaterialChestParameter> rst3 = client1.Get(obj.MaterialCode);
                        if (rst3.Data != null)
                        {
                            model.FullQuantity = rst3.Data.FullChestQty;
                        }
                        else
                        {
                            return(Json(rst3));
                        }
                    }
                }
                //非尾柜,不能完成入柜
                if (model.IsLastestPackageInChest == false && obj.IsLastPackage == false)
                {
                    result.Code    = 1;
                    result.Message = string.Format("柜({0})非尾柜,不能手动完成入柜。", model.ChestNo);
                    return(Json(result));
                }
                //判断柜号所在库位和当前界面所选库位是否匹配。
                if (!string.IsNullOrEmpty(obj.StoreLocation))
                {
                    if (obj.StoreLocation != model.StoreLocation)
                    {
                        model.StoreLocation = obj.StoreLocation;
                    }
                }
                else
                {
                    ////获取柜内第一块组件
                    //ChestDetail chestDetail = new ChestDetail();
                    //PagingConfig cfg = new PagingConfig()
                    //{
                    //    IsPaging = false,
                    //    OrderBy = " ItemNo ",
                    //    Where = string.Format(@" Key = '{0}' and ItemNo = 1 ", obj.Key)
                    //};
                    //PackageInChestServiceClient client = new PackageInChestServiceClient();
                    //MethodReturnResult<IList<ChestDetail>> lstChestDetail = client.GetDetail(ref cfg);
                    //if (lstChestDetail.Data != null && lstChestDetail.Data.Count > 0)
                    //{
                    //    chestDetail = lstChestDetail.Data[0];
                    //    result.Code = 1;
                    //    result.Message = string.Format("柜({0})未设置库位,请使用包装清单打印界面选择库位并输入托号[{1}]查询按钮设置。"
                    //                                    , model.ChestNo,chestDetail.Key.ObjectNumber);
                    //    return Json(result);
                    //}
                    //else
                    //{
                    //    result.Code = 1;
                    //    result.Message = string.Format("柜({0})内无明细。", model.ChestNo);
                    //    return Json(result);
                    //}
                    if (model.StoreLocation == null || model.StoreLocation == "")
                    {
                        result.Code    = 1;
                        result.Message = string.Format("柜({0})未设置库位,请在界面选择所需的库位后再点击手动完成入柜按钮。"
                                                       , model.ChestNo);
                        return(Json(result));
                    }
                }
                model.IsFinishPackage = true;
                result = FinishChest(model);
                //result = Package(model);

                //返回包装结果。
                if (result.Code <= 0)
                {
                    MethodReturnResult <ChestViewModel> rstFinal = new MethodReturnResult <ChestViewModel>()
                    {
                        Code     = result.Code,
                        Data     = model,
                        Detail   = result.Detail,
                        HelpLink = result.HelpLink,
                        Message  = result.Message
                    };
                    return(Json(rstFinal));
                }
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }
            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return(Json(result));
        }
예제 #10
0
        public string GetQueryCondition(LotPackageSEModulesViewModel model)
        {
            StringBuilder where = new StringBuilder();
            where.AppendFormat(" Quantity > 0");
            if (model != null)
            {
                if (!string.IsNullOrEmpty(model.PackageNo) && !string.IsNullOrEmpty(model.PackageNo1))
                {
                    where.AppendFormat(" {0} Key >= '{1}' AND Key<='{2}'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , model.PackageNo
                                       , model.PackageNo1);
                }
                else if (!string.IsNullOrEmpty(model.PackageNo))
                {
                    char []  splitChars = new char[] { ',', '$' };
                    string[] packageNos = model.PackageNo.TrimEnd(splitChars).Split(splitChars);

                    #region 界面托号包含归档,则归档托号提取
                    if (packageNos.Length >= 1)
                    {
                        //若托号不存在当前库,提取归档托号数据
                        foreach (string item in packageNos)
                        {
                            Package package = null;
                            using (PackageQueryServiceClient clientOfPackage = new PackageQueryServiceClient())
                            {
                                if (clientOfPackage.Get(item.Trim().ToUpper()) != null && clientOfPackage.Get(item.Trim().ToUpper()).Data != null)
                                {
                                    package = clientOfPackage.Get(item.Trim().ToUpper()).Data;
                                }
                            }
                            if (package == null)
                            {
                                MethodReturnResult resultOfRePackage = new MethodReturnResult();
                                //若存在归档,则提取
                                using (PackageInChestServiceClient packageInChestServiceClient = new PackageInChestServiceClient())
                                {
                                    //返回已归档的(WIP_PACKAGE表)数据
                                    REbackdataParameter pre = new REbackdataParameter();
                                    pre.PackageNo     = item;
                                    pre.ErrorMsg      = "";
                                    pre.ReType        = 1;
                                    pre.IsDelete      = 0;
                                    resultOfRePackage = packageInChestServiceClient.GetREbackdata(pre);

                                    if (resultOfRePackage.Code > 0)
                                    {
                                    }
                                    else
                                    {
                                        //提取其他归档表数据到当前库,并删除从归档库
                                        pre               = new REbackdataParameter();
                                        pre.PackageNo     = item;
                                        pre.ReType        = 2;
                                        pre.IsDelete      = 1;
                                        resultOfRePackage = packageInChestServiceClient.GetREbackdata(pre);
                                    }
                                }
                            }
                        }
                    }
                    #endregion

                    if (packageNos.Length <= 1)
                    {
                        where.AppendFormat(" {0} Key = '{1}'"
                                           , where.Length > 0 ? "AND" : string.Empty
                                           , packageNos[0]);
                    }
                    else
                    {
                        where.AppendFormat(" {0} Key IN ("
                                           , where.Length > 0 ? "AND" : string.Empty);

                        foreach (string package in packageNos)
                        {
                            where.AppendFormat("'{0}',", package);
                        }
                        where.Remove(where.Length - 1, 1);
                        where.Append(")");
                    }
                }


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

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

                if (model.EndCreateTime != null)
                {
                    where.AppendFormat(" {0} CreateTime <= '{1:yyyy-MM-dd HH:mm:ss}'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , model.EndCreateTime);
                }
            }
            return(where.ToString());
        }
예제 #11
0
        public ActionResult UnPackageInChest(string chestNo, int itemNo, string packageNo)
        {
            MethodReturnResult result = new MethodReturnResult();

            if (packageNo == null || packageNo == "")
            {
                result.Code    = 1001;
                result.Message = string.Format("托号不可为空。");
                return(Json(result));
            }

            //进行批次包装作业。
            ChestParameter p = new ChestParameter()
            {
                Editor    = User.Identity.Name,
                ChestNo   = chestNo.ToUpper(),
                PackageNo = packageNo.ToUpper(),
                ModelType = 0
            };

            try
            {
                //获取包装记录
                using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                {
                    MethodReturnResult <Chest> rst1 = client.Get(chestNo);
                    if (rst1.Code > 0 || rst1.Data == null)
                    {
                        return(Json(rst1));
                    }
                    else
                    {
                        #region 注释--出柜条件
                        //if (rst1.Data.ChestState != EnumChestState.Packaging)
                        //{
                        //    result.Code = 1001;
                        //    result.Message = string.Format("柜[{0}]已完成入柜,不可出柜。", chestNo);
                        //    return Json(result);
                        //}
                        #endregion
                    }
                }
                using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                {
                    result = client.UnPackageInChest(p);

                    if (result.Code == 0)
                    {
                        result.Message = string.Format("托号[{0}]出柜({1})成功。"
                                                       , p.PackageNo, p.ChestNo);
                    }
                }
                return(Json(result));
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }
            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return(Json(result));
        }
예제 #12
0
        public ActionResult UnCheck(string chestNo, string packageNo)
        {
            MethodReturnResult result = new MethodReturnResult();

            try
            {
                using (PackageQueryServiceClient client = new PackageQueryServiceClient())
                {
                    //判断托号是否已检验
                    MethodReturnResult <Package> rst1 = client.Get(packageNo);
                    if (rst1.Code > 0)
                    {
                        return(Json(rst1));
                    }
                    else
                    {
                        if (rst1.Data.PackageState != EnumPackageState.Checked)
                        {
                            result.Code    = 2000;
                            result.Message = string.Format(@"托号{0}未检验", packageNo);
                        }
                        else
                        {
                            using (PackageInChestServiceClient clientOfChest = new PackageInChestServiceClient())
                            {
                                result = clientOfChest.UnCheckPackageInChest(packageNo, chestNo, User.Identity.Name);
                                if (result.Code > 0)
                                {
                                    return(Json(result));
                                }
                            }
                        }
                    }
                }
                ChestViewModel model = new ChestViewModel()
                {
                    PackageNo = packageNo,
                    ChestNo   = chestNo
                };

                //返回包装结果。
                if (result.Code <= 0)
                {
                    MethodReturnResult <ChestViewModel> rstFinal = new MethodReturnResult <ChestViewModel>()
                    {
                        Code     = result.Code,
                        Data     = model,
                        Detail   = result.Detail,
                        HelpLink = result.HelpLink,
                        Message  = result.Message,
                        ObjectNo = ((EnumChestState)Convert.ToInt32(result.ObjectNo)).GetDisplayName()
                    };
                    return(Json(rstFinal));
                }
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }
            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return(Json(result));
        }
예제 #13
0
        public ActionResult Query(ChestViewModel model)
        {
            MethodReturnResult <DataSet> result = new MethodReturnResult <DataSet>();

            try
            {
                if (!string.IsNullOrEmpty(model.ChestNo))
                {
                    model.ChestNo = model.ChestNo.ToUpper().Trim();
                    ChestParameter param = new ChestParameter();
                    param.ChestNo = model.ChestNo;
                    using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                    {
                        MethodReturnResult <DataSet> ds = client.GetRefreshChestDetailByDB(ref param);
                        if (ds.Code > 0)
                        {
                            result.Code    = ds.Code;
                            result.Message = ds.Message;
                            result.Detail  = ds.Detail;

                            return(Json(result));
                        }

                        ViewBag.ListData = ds.Data.Tables[0];

                        //MethodReturnResult<Chest> result1 = client.Get(model.ChestNo);
                        //if (result1.Code == 0)
                        //{
                        //    using (MaterialChestParameterServiceClient client1 = new MaterialChestParameterServiceClient())
                        //    {
                        //        MethodReturnResult<MaterialChestParameter> rst3 = client1.Get(result1.Data.MaterialCode);
                        //        if (rst3.Data != null)
                        //        {
                        //            model.FullQuantity = rst3.Data.FullChestQty;
                        //        }
                        //        else
                        //        {
                        //            return Json(rst3);
                        //        }
                        //    }
                        //    ViewBag.Chest = result1.Data;
                        //    model.StoreLocation = result1.Data.StoreLocation;
                        //    model.CurrentQuantity = result1.Data.Quantity;
                        //}
                    }
                }
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }

            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ListPartial", model));
            }
            else
            {
                return(View("Index", model));
            }
        }
예제 #14
0
        public ActionResult RefreshChestList(string orderNumber, string materialCode, string grade, string powerName, string color, string powerSubCode)
        {
            if (ModelState.IsValid)
            {
                StringBuilder where = new StringBuilder();
                where.AppendFormat(string.Format(@" (ChestState = 0 OR ChestState = 6)"));
                if (orderNumber != null && orderNumber != "")
                {
                    where.AppendFormat(" {0} OrderNumber = '{1}'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , orderNumber.Trim().ToUpper());
                }

                if (materialCode != null && materialCode != "")
                {
                    where.AppendFormat(" {0} MaterialCode = '{1}'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , materialCode.Trim().ToUpper());
                }

                if (powerName != null && powerName != "")
                {
                    where.AppendFormat(" {0} PowerName LIKE '{1}%'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , powerName.Trim().ToUpper());
                }

                if (grade != null && grade != "")
                {
                    where.AppendFormat(" {0} Grade LIKE '{1}%'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , grade.Trim().ToUpper());
                }

                if (color != null && color != "")
                {
                    where.AppendFormat(" {0} Color LIKE '{1}%'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , color.Trim().ToUpper());
                }

                if (powerSubCode != null && powerSubCode != "")
                {
                    where.AppendFormat(" {0} PowerSubCode = '{1}'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , powerSubCode.Trim().ToUpper());
                }
                using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        OrderBy  = "EditTime",
                        Where    = where.ToString()
                    };
                    MethodReturnResult <IList <Chest> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.List = result.Data;
                    }
                }
            }
            return(PartialView("_ListPartial", new ChestMonitorQueryViewModel()));
        }
예제 #15
0
        public ActionResult Save(ChestViewModel model)
        {
            MethodReturnResult result = new MethodReturnResult();

            //Package obj = null;
            if (model.PackageNo == null || model.PackageNo == "")
            {
                result.Code    = 1001;
                result.Message = string.Format("托号不可为空。");
                return(Json(result));
            }
            else
            {
                model.PackageNo = model.PackageNo.ToUpper().Trim();
            }
            try
            {
                using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                {
                    //取得最佳柜号
                    MethodReturnResult <string> rst1 = client.GetChestNo(model.PackageNo.ToUpper().Trim(), model.ChestNo, model.IsLastestPackageInChest, model.IsManual);
                    if (rst1.Code > 0)
                    {
                        return(Json(rst1));
                    }
                    else
                    {
                        model.ChestNo = rst1.Data;
                    }
                }
                MethodReturnResult <Chest> rst2 = null;
                //重新获取当前数量。
                using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                {
                    rst2 = client.Get(model.ChestNo);
                    if (rst2.Code == 1000)
                    {
                        return(Json(rst2));
                    }
                    //检查柜状态
                    if (rst2.Data != null && rst2.Data.ChestState != EnumChestState.Packaging && rst2.Data.ChestState != EnumChestState.InFabStore)
                    {
                        result.Code    = 1001;
                        result.Message = string.Format("柜 {0} 非 [{1}或{2}] 状态,不能入柜。"
                                                       , model.ChestNo.ToUpper()
                                                       , EnumChestState.Packaging.GetDisplayName()
                                                       , EnumChestState.InFabStore.GetDisplayName());
                        return(Json(result));
                    }
                    //设置满柜数量。
                    if (rst2.Code <= 0 && rst2.Data != null)
                    {
                        model.CurrentQuantity = rst2.Data.Quantity;
                    }
                    MethodReturnResult <Package> rstOfPackage = null;

                    using (PackageQueryServiceClient clientOfPackage = new PackageQueryServiceClient())
                    {
                        rstOfPackage = clientOfPackage.Get(model.PackageNo.ToUpper().Trim());
                    }
                    using (MaterialChestParameterServiceClient client1 = new MaterialChestParameterServiceClient())
                    {
                        MethodReturnResult <MaterialChestParameter> rst3 = client1.Get(rstOfPackage.Data.MaterialCode);
                        if (rst3.Data != null)
                        {
                            model.FullQuantity = rst3.Data.FullChestQty;
                        }
                        else
                        {
                            return(Json(rst3));
                        }
                    }
                }

                //如果满柜数量为空,提示
                if (model.FullQuantity == 0)
                {
                    result.Code    = 1001;
                    result.Message = string.Format("托号内产品编码【{0}】设置的满柜数量为0,请联系成柜规则设定人员修改。", rst2.Data.MaterialCode);
                    return(Json(result));
                }

                double newCurrentQuantity = model.CurrentQuantity + 1;
                //当前数量超过满柜数量,不能继续入柜。
                if (newCurrentQuantity > model.FullQuantity)
                {
                    result.Code    = 1;
                    result.Message = string.Format("柜({0}) 当前数量({1})加上该托号({2})数量({3}),超过满柜数量。"
                                                   , model.ChestNo.ToUpper()
                                                   , model.CurrentQuantity
                                                   , model.PackageNo.ToUpper().Trim()
                                                   , 1);
                    return(Json(result));
                }
                model.CurrentQuantity = newCurrentQuantity;
                result = Chest(model);
                //返回成柜结果。
                if (result.Code <= 0)
                {
                    model.StoreLocation = result.Detail.Split('-')[1];
                    MethodReturnResult <ChestViewModel> rstFinal = new MethodReturnResult <ChestViewModel>()
                    {
                        Code     = result.Code,
                        Data     = model,
                        Detail   = result.Detail,
                        HelpLink = result.HelpLink,
                        Message  = result.Message
                    };
                    return(Json(rstFinal));
                }
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }
            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return(Json(result));
        }
예제 #16
0
        public ActionResult ChestDetailQuery(ChestDetailQueryViewModel model)
        {
            string strErrorMessage = string.Empty;
            MethodReturnResult <DataSet> result = new MethodReturnResult <DataSet>();

            try
            {
                ChestParameter param = new ChestParameter();
                if (model.PackageNo != "" && model.PackageNo != null)
                {
                    param.PackageNo = model.PackageNo;
                }
                else
                {
                    param.PackageNo = "";
                }
                if (model.ChestNo != "" && model.ChestNo != null)
                {
                    param.ChestNo = model.ChestNo;
                }
                else
                {
                    param.ChestNo = "";
                }
                if (model.MaterialCode != "" && model.MaterialCode != null)
                {
                    param.MaterialCode = model.MaterialCode;
                }
                else
                {
                    param.MaterialCode = "";
                }
                if (model.ChestDate != "" && model.ChestDate != null)
                {
                    param.ChestDateStart = model.ChestDate;
                    param.ChestDateEnd   = Convert.ToDateTime(model.ChestDate).AddDays(1).ToString("yyyy-MM-dd");
                }
                else
                {
                    param.ChestDateStart = "";
                    param.ChestDateEnd   = "";
                }
                if (model.LotNumber != "" && model.LotNumber != null)
                {
                    param.LotNumber = model.LotNumber;
                }
                else
                {
                    param.LotNumber = "";
                }
                if (model.OrderNumber != "" && model.OrderNumber != null)
                {
                    param.OrderNumber = model.OrderNumber;
                }
                else
                {
                    param.OrderNumber = "";
                }
                param.PageSize = model.PageSize;
                param.PageNo   = model.PageNo;
                using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                {
                    MethodReturnResult <DataSet> ds = client.GetChestDetailByDB(ref param);
                    if (ds.Code > 0)
                    {
                        result.Code    = ds.Code;
                        result.Message = ds.Message;
                        result.Detail  = ds.Detail;

                        return(Json(result));
                    }

                    ViewBag.ListData     = ds.Data.Tables[0];
                    ViewBag.PagingConfig = new PagingConfig()
                    {
                        PageNo   = model.PageNo,
                        PageSize = model.PageSize,
                        Records  = param.TotalRecords
                    };
                    model.TotalRecords = param.TotalRecords;
                }
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }

            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ChestDetailListPartial", model));
            }
            else
            {
                return(View("ChestIndex", model));
            }
        }
예제 #17
0
        public async Task <ActionResult> ExportToExcelChest(ChestDetailQueryViewModel model)
        {
            //IList<ChestDetail> lstChestDetail = new List<ChestDetail>();
            //using (PackageInChestServiceClient client = new PackageInChestServiceClient())
            //{
            //    await Task.Run(() =>
            //    {
            //        PagingConfig cfg = new PagingConfig()
            //        {
            //            IsPaging = false,
            //            OrderBy = "Key.ChestNo Desc,ItemNo Asc",
            //            Where = GetQueryCondition(model)
            //        };
            //        MethodReturnResult<IList<ChestDetail>> result = client.GetDetail(ref cfg);

            //        if (result.Code == 0)
            //        {
            //            lstChestDetail = result.Data;
            //        }
            //    });
            //}

            DataTable      dt    = new DataTable();
            ChestParameter param = new ChestParameter();

            if (model.PackageNo != "" && model.PackageNo != null)
            {
                param.PackageNo = model.PackageNo;
            }
            else
            {
                param.PackageNo = "";
            }
            if (model.ChestNo != "" && model.ChestNo != null)
            {
                param.ChestNo = model.ChestNo;
            }
            else
            {
                param.ChestNo = "";
            }
            if (model.MaterialCode != "" && model.MaterialCode != null)
            {
                param.MaterialCode = model.MaterialCode;
            }
            else
            {
                param.MaterialCode = "";
            }
            if (model.ChestDate != "" && model.ChestDate != null)
            {
                param.ChestDateStart = model.ChestDate;
                param.ChestDateEnd   = Convert.ToDateTime(model.ChestDate).AddDays(1).ToString("yyyy-MM-dd");
            }
            else
            {
                param.ChestDateStart = "";
                param.ChestDateEnd   = "";
            }
            if (model.LotNumber != "" && model.LotNumber != null)
            {
                param.LotNumber = model.LotNumber;
            }
            else
            {
                param.LotNumber = "";
            }
            if (model.OrderNumber != "" && model.OrderNumber != null)
            {
                param.OrderNumber = model.OrderNumber;
            }
            else
            {
                param.OrderNumber = "";
            }
            param.PageSize = model.PageSize;
            param.PageNo   = -1;
            await Task.Run(() =>
            {
                using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                {
                    MethodReturnResult <DataSet> ds = client.GetChestDetailByDB(ref param);

                    if (ds.Code == 0 && ds.Data != null && ds.Data.Tables.Count > 0)
                    {
                        dt = ds.Data.Tables[0];
                    }
                }
            });

            //创建工作薄。
            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);

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

            for (int j = 0; j < dt.Rows.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("柜号");  //柜号

                    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;
                }
                //Package package = m.GetPackage(lstChestDetail[j].Key.ObjectNumber);
                //Chest chest = m.GetChest(lstChestDetail[j].Key.ChestNo);
                //WOReportDetail woReportDetail = m.GetWOReportDetail(lstChestDetail[j].Key.ObjectNumber);
                //WOReport woReport = null;
                //if (woReportDetail != null)
                //{
                //    woReport = m.GetWOReport(woReportDetail.Key.BillCode);
                //}

                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(dt.Rows[j]["柜号"].ToString());  //柜号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["库位"].ToString());  //库位

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["柜属性"].ToString());  //柜属性

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["项目号"].ToString());  //项目号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["包装号"].ToString());  //包装号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["托内数量"].ToString());  //托内数量

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["工单号"].ToString());  //工单号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["产品编码"].ToString());  //产品编码

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["等级"].ToString());  //等级

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["花色"].ToString());  //花色

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["功率档"].ToString());  //功率档

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["电流档"].ToString());  //电流档


                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["入柜时间"].ToString());  //入柜时间

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(((EnumPackageState)dt.Rows[j]["托号状态"]).GetDisplayName());  //托号状态

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["入库单号"].ToString());  //入库单号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                if (dt.Rows[j]["入库单状态"].ToString() == "")
                {
                    cellData.SetCellValue("");  //入库单状态
                }
                else
                {
                    cellData.SetCellValue(((EnumBillState)dt.Rows[j]["入库单状态"]).GetDisplayName());  //入库单状态
                }

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                if (dt.Rows[j]["入库接收核对状态"].ToString() == "")
                {
                    cellData.SetCellValue("");  //入库接收核对状态
                }
                else
                {
                    cellData.SetCellValue(((EnumPackageCheckState)dt.Rows[j]["入库接收核对状态"]).GetDisplayName());  //入库接收核对状态
                }
                #endregion
            }

            MemoryStream ms = new MemoryStream();
            wb.Write(ms);
            ms.Flush();
            ms.Position = 0;
            return(File(ms, "application/vnd.ms-excel", "柜明细数据.xls"));
        }
예제 #18
0
        public async Task <ActionResult> ExportToExcel(ChestDetailQueryViewModel model)
        {
            //JsonResult JsonResult = null;
            DataTable      dt    = new DataTable();
            ChestParameter param = new ChestParameter();

            if (model.PackageNo != "" && model.PackageNo != null)
            {
                param.PackageNo = model.PackageNo;
            }
            else
            {
                param.PackageNo = "";
            }
            if (model.ChestNo != "" && model.ChestNo != null)
            {
                param.ChestNo = model.ChestNo;
            }
            else
            {
                param.ChestNo = "";
            }
            if (model.MaterialCode != "" && model.MaterialCode != null)
            {
                param.MaterialCode = model.MaterialCode;
            }
            else
            {
                param.MaterialCode = "";
            }
            if (model.ChestDate != "" && model.ChestDate != null)
            {
                param.ChestDateStart = model.ChestDate;
                param.ChestDateEnd   = Convert.ToDateTime(model.ChestDate).AddDays(1).ToString("yyyy-MM-dd");
            }
            else
            {
                param.ChestDateStart = "";
                param.ChestDateEnd   = "";
            }
            if (model.LotNumber != "" && model.LotNumber != null)
            {
                param.LotNumber = model.LotNumber;
            }
            else
            {
                param.LotNumber = "";
            }
            if (model.OrderNumber != "" && model.OrderNumber != null)
            {
                param.OrderNumber = model.OrderNumber;
            }
            else
            {
                param.OrderNumber = "";
            }
            param.PageSize = model.PageSize;
            param.PageNo   = -1;
            await Task.Run(() =>
            {
                using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                {
                    MethodReturnResult <DataSet> ds = client.GetChestDetail(ref param);

                    if (ds.Code == 0 && ds.Data != null && ds.Data.Tables.Count > 0)
                    {
                        dt = ds.Data.Tables[0];
                    }
                }
            });

            string     template_path = Server.MapPath("~\\Labels\\");//模板路径
            string     template_file = template_path + "报检数据.xls";
            FileInfo   tempFileInfo  = new FileInfo(template_file);
            FileStream file          = new FileStream(template_file, FileMode.Open, FileAccess.Read);
            IWorkbook  hssfworkbook  = new HSSFWorkbook(file);

            //创建sheet
            NPOI.SS.UserModel.ISheet sheet1 = hssfworkbook.GetSheet("Sheet0");

            //创建单元格和单元格样式
            ICellStyle styles = hssfworkbook.CreateCellStyle();

            styles.FillForegroundColor = 10;
            styles.BorderBottom        = BorderStyle.Thin;
            styles.BorderLeft          = BorderStyle.Thin;
            styles.BorderRight         = BorderStyle.Thin;
            styles.BorderTop           = BorderStyle.Thin;
            styles.VerticalAlignment   = VerticalAlignment.Center;
            styles.Alignment           = HorizontalAlignment.Center;

            IFont font = hssfworkbook.CreateFont();

            font.Boldweight = 10;
            styles.SetFont(font);
            ICellStyle style = hssfworkbook.CreateCellStyle();

            style.FillForegroundColor = 10;
            style.BorderBottom        = BorderStyle.Thin;
            style.BorderLeft          = BorderStyle.Thin;
            style.BorderRight         = BorderStyle.Thin;
            style.BorderTop           = BorderStyle.Thin;
            style.VerticalAlignment   = VerticalAlignment.Center;
            IFont fonts = hssfworkbook.CreateFont();

            font.Boldweight = 10;

            for (int j = 0; j < dt.Rows.Count; j++)
            {
                ICell cellData = null;
                IRow  rowData  = null;
                //string isLast;

                rowData = sheet1.CreateRow(j + 1);

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

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["组件号"].ToString());//组件号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["入库日期"].ToString());//入库日期

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["托盘号"].ToString());//托盘号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["柜号"].ToString());//柜号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["组件型号"].ToString());//组件型号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["VOC (V)"].ToString());//VOC (V)

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["ISC(A)"].ToString());//ISC(A)

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["Vmpp (V)"].ToString());//Vmpp (V)

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["Impp(A)"].ToString());//Impp(A)

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["Pmpp(W)"].ToString());//Pmpp(W)

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["FF(%)"].ToString());//FF(%)

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["SurfTemp"].ToString());//SurfTemp

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["电流分档"].ToString());//电流分档

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["标称功率"].ToString());//标称功率

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["电池片厂家"].ToString());//电池片厂家

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["栅线数量"].ToString());//栅线数量

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["电池片档位"].ToString());//电池片档位

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["背板厂家+规格"].ToString());//背板厂家+规格

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["EVA厂家+型号"].ToString());//EVA厂家+型号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["玻璃厂家型号"].ToString());//玻璃厂家型号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["镀膜与否"].ToString());//镀膜与否

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["接线盒厂家+型号+承载电压"].ToString());//接线盒厂家+型号+承载电压

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["线缆长度"].ToString());//线缆长度

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["接线端子型号"].ToString());//接线端子型号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["铝框厂家+型号+颜色+有无加强筋"].ToString());//铝框厂家+型号+颜色+有无加强筋

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["涂锡带厂家"].ToString());//涂锡带厂家

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["硅胶厂家+型号"].ToString());//硅胶厂家+型号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["灌封胶厂家+型号"].ToString());//灌封胶厂家+型号

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["认证类型"].ToString());//认证类型

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["包装方式"].ToString());//包装方式

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["组件类型+耐压"].ToString());//组件类型+耐压

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["电池片数"].ToString());//电池片数

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["电池片类型"].ToString());//电池片类型

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["电池片工艺"].ToString());//电池片工艺

                cellData           = rowData.CreateCell(rowData.Cells.Count);
                cellData.CellStyle = style;
                cellData.SetCellValue(dt.Rows[j]["单位号"].ToString());//单位号

                #endregion
            }
            MemoryStream ms = new MemoryStream();
            hssfworkbook.Write(ms);
            ms.Flush();
            ms.Position = 0;
            return(File(ms, "application/vnd.ms-excel", "报检数据.xls"));
        }
예제 #19
0
        public ActionResult Query(ChestMonitorQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                StringBuilder where = new StringBuilder();
                where.AppendFormat(string.Format(@" (ChestState = 0 OR ChestState = 6)"));
                if (model.OrderNumber != null && model.OrderNumber != "")
                {
                    where.AppendFormat(" {0} OrderNumber = '{1}'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , model.OrderNumber.Trim().ToUpper());
                }

                if (model.MaterialCode != null && model.MaterialCode != "")
                {
                    where.AppendFormat(" {0} MaterialCode = '{1}'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , model.MaterialCode.Trim().ToUpper());
                }

                if (model.PowerName != null && model.PowerName != "")
                {
                    where.AppendFormat(" {0} PowerName LIKE '{1}%'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , model.PowerName.Trim().ToUpper());
                }

                if (model.Grade != null && model.Grade != "")
                {
                    where.AppendFormat(" {0} Grade LIKE '{1}%'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , model.Grade.Trim().ToUpper());
                }

                if (model.Color != null && model.Color != "")
                {
                    where.AppendFormat(" {0} Color LIKE '{1}%'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , model.Color.Trim().ToUpper());
                }

                if (model.PowerSubCode != null && model.PowerSubCode != "")
                {
                    where.AppendFormat(" {0} PowerSubCode = '{1}'"
                                       , where.Length > 0 ? "AND" : string.Empty
                                       , model.PowerSubCode.Trim().ToUpper());
                }
                using (PackageInChestServiceClient client = new PackageInChestServiceClient())
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        OrderBy  = "EditTime",
                        Where    = where.ToString()
                    };
                    MethodReturnResult <IList <Chest> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.List = result.Data;
                    }
                }
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ListPartial", model));
            }
            else
            {
                return(View(model));
            }
        }
예제 #20
0
        public ActionResult Check(ChestViewModel model)
        {
            MethodReturnResult result = new MethodReturnResult();

            if (model.PackageNo == null || model.PackageNo == "")
            {
                result.Code    = 1001;
                result.Message = string.Format("托号不可为空。");
                return(Json(result));
            }
            else
            {
                model.PackageNo = model.PackageNo.ToUpper().Trim();
            }
            try
            {
                using (PackageQueryServiceClient client = new PackageQueryServiceClient())
                {
                    //判断托号是否已检验
                    MethodReturnResult <Package> rst1 = client.Get(model.PackageNo);
                    if (rst1.Code > 0)
                    {
                        rst1.Message += string.Format(@"或托号{0}已归档", model.PackageNo);
                        return(Json(rst1));
                    }
                    else
                    {
                        if (rst1.Data != null)
                        {
                            #region 明细检验
                            if (rst1.Data.PackageState != EnumPackageState.Checked)
                            {
                                using (PackageInChestServiceClient clientOfChest = new PackageInChestServiceClient())
                                {
                                    result = clientOfChest.CheckPackageInChest(model.PackageNo, model.ChestNo, User.Identity.Name);
                                    if (result.Code <= 0)
                                    {
                                        result.Message = string.Format(@"托号{0}检验成功", model.PackageNo);
                                        model.ChestNo  = result.Detail;
                                    }
                                }
                            }
                            else
                            {
                                using (PackageInChestServiceClient clientOfChest = new PackageInChestServiceClient())
                                {
                                    MethodReturnResult <Chest> rst2 = clientOfChest.Get(rst1.Data.ContainerNo);
                                    if (rst2.Code > 0)
                                    {
                                        return(Json(rst2));
                                    }
                                    if (rst2.Code <= 0 && rst2.Data != null)
                                    {
                                        model.ChestNo   = rst2.Data.Key;
                                        result.Message  = string.Format(@"托号{0}已检验过,并检验成功", model.PackageNo);
                                        result.Detail   = rst2.Data.Key;
                                        result.ObjectNo = Convert.ToInt32(rst2.Data.ChestState).ToString();
                                    }
                                }
                            }
                            #endregion
                        }
                    }
                }
                //返回包装结果。
                if (result.Code <= 0)
                {
                    MethodReturnResult <ChestViewModel> rstFinal = new MethodReturnResult <ChestViewModel>()
                    {
                        Code     = result.Code,
                        Data     = model,
                        Detail   = result.Detail,
                        HelpLink = result.HelpLink,
                        Message  = result.Message,
                        ObjectNo = ((EnumChestState)Convert.ToInt32(result.ObjectNo)).GetDisplayName()
                    };
                    return(Json(rstFinal));
                }
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }
            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return(Json(result));
        }