using Autofac.Core;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WIDESEA_Core;
using WIDESEA_Core.Attributes;
using WIDESEA_Core.BaseController;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.CodeConfigEnum;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Basic;
using WIDESEA_DTO.Outbound;
using WIDESEA_IBasicService;
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.Basic;
namespace WIDESEA_WMSServer.Controllers.Basic
{
///
/// 物料
///
[Route("api/MaterielInfo")]
[ApiController]
public class MaterielInfoController : ApiBaseController
{
public readonly IMaterialExpirationDateService _materialExpirationDateService;
public MaterielInfoController(IMaterielInfoService service, IMaterialExpirationDateService materialExpirationDateService) : base(service)
{
_materialExpirationDateService = materialExpirationDateService;
}
///
/// 接收MES 物料有效期
///
///
///
[HttpPost, Route("ReceiveMaterialExpirationDate"), AllowAnonymous, MethodParamsValidate]
public WebResponseContent ReceiveMaterialExpirationDate([FromBody] MaterialExpirationDateDTO model)
{
var data = new Dt_MaterialExpirationDate() { };
data.MaterialCode = model.materialCode;
data.ThreeExtensionDays = model.threeExtensionDays;
data.OneExtensionDays = model.oneExtensionDays;
data.TwoExtensionDays = model.twoExtensionDays;
data.Enable = model.enable;
data.ValidityDays = model.validityDays;
data.ModifyDate = DateTime.Now;
var content = _materialExpirationDateService.ReceiveMaterialExpirationDate(data, model.operationType);
if (content.Status) return WebResponseContent.Instance.OK(200);
else return WebResponseContent.Instance.Error(content.Message);
}
}
}