Ejemplo n.º 1
0
        public ActionResult sSaveModify(WOReportViewModel model)
        {
            MethodReturnResult result = new MethodReturnResult();

            using (WOReportClient client = new WOReportClient())
            {
                WOReport woReport = new WOReport()
                {
                    Key          = model.BillCode,
                    BillDate     = model.BillDate,
                    MixType      = model.MixType,
                    OrderNumber  = model.OrderNumber,
                    MaterialCode = model.MaterialCode,
                    Creator      = model.Creator,
                    Editor       = User.Identity.Name,
                    Note         = model.Note,
                };

                result = client.EditWOReport(woReport);

                if (result.Code == 0)
                {
                    result.Message = string.Format(StringResource.WOReport_Edit_Success, model.BillCode);
                }
            }
            return(Json(result));
        }
Ejemplo n.º 2
0
        //报废入库申请单修改
        public ActionResult sModify(string key)
        {
            WOReportViewModel model = new WOReportViewModel();

            using (WOReportClient client = new WOReportClient())
            {
                MethodReturnResult <WOReport> result = client.GetWOReport(key);
                if (result.Code == 0)
                {
                    model = new WOReportViewModel()
                    {
                        BillCode      = result.Data.Key,
                        BillDate      = result.Data.BillDate,
                        BillMakedDate = result.Data.BillMakedDate,
                        MixType       = result.Data.MixType,
                        OrderNumber   = result.Data.OrderNumber,
                        MaterialCode  = result.Data.MaterialCode,
                        Creator       = result.Data.Creator,
                        Editor        = User.Identity.Name,
                        Note          = result.Data.Note
                    };
                    return(PartialView("_sModifyPartial", model));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }

            return(PartialView("_sModifyPartial"));
        }
Ejemplo n.º 3
0
        //报废入库申请单查询
        public ActionResult sQuery(WOReportQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (WOReportClient client = new WOReportClient())
                {
                    StringBuilder where = new StringBuilder();
                    if (model != null)
                    {
                        where.AppendFormat("ScrapType ='1'");

                        //入库单号
                        if (!string.IsNullOrEmpty(model.BillCode))
                        {
                            where.AppendFormat(" {0} Key LIKE '{1}%'"
                                               , where.Length > 0 ? "AND" : string.Empty
                                               , model.BillCode);
                        }

                        //入库类型
                        if (model.BillType != null && model.BillType != "")
                        {
                            where.AppendFormat(" {0} BillType = {1}"
                                               , where.Length > 0 ? "AND" : string.Empty
                                               , model.BillType);
                        }

                        //状态
                        if (model.BillState != null && model.BillState != "")
                        {
                            where.AppendFormat(" {0} BillState = {1}"
                                               , where.Length > 0 ? "AND" : string.Empty
                                               , model.BillState);
                        }
                    }
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "CreateTime desc",
                        Where   = where.ToString()
                    };

                    MethodReturnResult <IList <WOReport> > result = client.GetWOReport(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                }
            }
            return(PartialView("_sListPartial"));
        }
Ejemplo n.º 4
0
        //获取托号所在入库单
        public WOReport GetWOReport(string BillCode)
        {
            WOReportClient client   = new WOReportClient();
            WOReport       woReport = null;
            MethodReturnResult <WOReport> mtWOReport = null;

            mtWOReport = client.GetWOReport(BillCode);
            if (mtWOReport != null)
            {
                woReport = mtWOReport.Data;
            }
            return(woReport);
        }
Ejemplo n.º 5
0
        //获取托号所在入库单明细
        public WOReportDetail GetWOReportDetail(string PackageNo)
        {
            WOReportClient client = new WOReportClient();
            MethodReturnResult <IList <WOReportDetail> > lstWOReportDetail = null;
            WOReportDetail woReportDetail = null;
            PagingConfig   cfg            = new PagingConfig()
            {
                IsPaging = false,
                Where    = string.Format(" ObjectNumber = '{0}'", PackageNo)
            };

            lstWOReportDetail = client.GetWOReportDetail(ref cfg);
            if (lstWOReportDetail.Data != null && lstWOReportDetail.Data.Count > 0)
            {
                woReportDetail = lstWOReportDetail.Data[0];
            }
            return(woReportDetail);
        }
Ejemplo n.º 6
0
        public ActionResult Delete(string key, string ScrapType)
        {
            MethodReturnResult result = new MethodReturnResult();

            using (WOReportClient client = new WOReportClient())
            {
                WOReport woReport = new WOReport()
                {
                    Key     = key,                      //入库单号
                    Creator = User.Identity.Name,       //编辑人
                    Editor  = User.Identity.Name,       //修改人
                };

                result = client.DeleteWOReport(woReport, key);
                if (result.Code == 0)
                {
                    result.Message = string.Format(StringResource.WOReport_Delete_Success, key);
                }
            }

            return(Json(result));
        }
Ejemplo n.º 7
0
        public async Task <ActionResult> sPagingQuery(string where, string orderBy, int?currentPageNo, int?currentPageSize)
        {
            if (ModelState.IsValid)
            {
                int pageNo   = currentPageNo ?? 0;
                int pageSize = currentPageSize ?? 20;
                if (Request["PageNo"] != null)
                {
                    pageNo = Convert.ToInt32(Request["PageNo"]);
                }
                if (Request["PageSize"] != null)
                {
                    pageSize = Convert.ToInt32(Request["PageSize"]);
                }

                using (WOReportClient client = new WOReportClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <WOReport> > result = client.GetWOReport(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_sListPartial"));
        }
Ejemplo n.º 8
0
        public ActionResult Save(WOReportViewModel model)
        {
            MethodReturnResult result = new MethodReturnResult();

            try
            {
                if (string.IsNullOrWhiteSpace(model.BillCode))
                {
                    string BillCode = string.Format("INC{0:yyMMdd}", DateTime.Now);
                    int    itemNo   = 0;

                    using (WOReportClient client = new WOReportClient())
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = 0,
                            PageSize = 1,
                            Where    = string.Format("Key LIKE '{0}%'"
                                                     , BillCode),
                            OrderBy = "Key Desc"
                        };

                        MethodReturnResult <IList <WOReport> > rst = client.GetWOReport(ref cfg);

                        if (rst.Code <= 0 && rst.Data.Count > 0)
                        {
                            string maxBillNo = rst.Data[0].Key.Replace(BillCode, "");
                            int.TryParse(maxBillNo, out itemNo);
                        }

                        itemNo++;

                        model.BillCode = BillCode + itemNo.ToString("000");
                    }
                }

                using (WOReportClient client = new WOReportClient())
                {
                    WOReport woReport = new WOReport()
                    {
                        Key           = model.BillCode,             //入库单号
                        BillType      = model.BillType,             //入库类型
                        BillDate      = model.BillDate,
                        BillMaker     = User.Identity.Name,
                        BillMakedDate = model.BillMakedDate,
                        MixType       = model.MixType,
                        ScrapType     = ServiceCenter.MES.Model.ERP.EnumScrapType.False,
                        OrderNumber   = model.OrderNumber,
                        MaterialCode  = model.MaterialCode,
                        Editor        = User.Identity.Name,
                        Creator       = User.Identity.Name,
                        Note          = model.Note,
                    };

                    result = client.AddWOReport(woReport);

                    if (result.Code == 0)
                    {
                        result.Message = string.Format(StringResource.WOReport_Save_Success, model.BillCode);
                        result.Detail  = woReport.Key;
                    }
                }
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }
            return(Json(result));
        }