Example #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));
        }
Example #2
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);
        }
Example #3
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));
        }
Example #4
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));
        }