pan
2025-12-03 1b80ac5c10cd02ac0fac487b4ab9a2c6b935f8ad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
{
    /// <summary>
    /// 物料
    /// </summary>
    [Route("api/MaterielInfo")]
    [ApiController]
    public class MaterielInfoController : ApiBaseController<IMaterielInfoService, Dt_MaterielInfo>
    {
        public readonly IMaterialExpirationDateService _materialExpirationDateService;
        public MaterielInfoController(IMaterielInfoService service, IMaterialExpirationDateService materialExpirationDateService) : base(service)
        {
            _materialExpirationDateService = materialExpirationDateService;
        }
 
 
        /// <summary>
        /// 接收MES 物料有效期
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [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);
        }
    }
}