Exemplo 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));
        }
Exemplo 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"));
        }
Exemplo n.º 3
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));
        }