zhaowc
2025-04-07 b9f7560cbe0e562a40e9515a0559a3e951f0fee6
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Security.Claims;
using System;
using WMS.Entity.BllQualityEntity;
using WMS.IBLL.IBllQualityServer;
using Model.ModelVm;
 
namespace Wms.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]
    public class BllQualityController : ControllerBase
    {
 
        private readonly IQualityInspectServer _qualityServer; //质检信息
 
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="qualityServer">质检信息</param>
        public BllQualityController(IQualityInspectServer qualityServer)
        {
            _qualityServer = qualityServer;
        }
 
 
        #region 质检信息
 
        /// <summary>
        /// 获取质检信息
        /// </summary>
        /// <param name="model">质检信息实体模型</param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetBllQualityList(BllQualityInspect model)
        {
            try
            {
                var bolls = _qualityServer.GetBllQualityList(model);
 
                return Ok(new { code = 0,count = bolls.Count, msg = "质检信息", data = bolls });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, msg = e.Message });
            }
        }
 
 
        /// <summary>
        /// 添加物料质检信息
        /// </summary>
        /// <param name="model">质检信息实体模型</param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult InsertQuality(BllQualityInspect model)
        {
            try
            {
                //获取当前登录的用户ID
                var claimsIdentity = this.User.Identity as ClaimsIdentity;
                if (claimsIdentity == null)
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
                if (string.IsNullOrWhiteSpace(userId))
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                model.CreateUser = int.Parse(userId);
                _qualityServer.InsertQuality(model);
 
                return Ok(new { code = 0, count = 0, msg = "物料质检信息添加成功", data = "" });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, msg = e.Message });
            }
        }
 
 
 
        /// <summary>
        /// 添加复核信息
        /// </summary>
        /// <param name="model">质检信息实体模型</param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult InsertFuHe(FinshVm model)
        {
            try
            {
                //获取当前登录的用户ID
                var claimsIdentity = this.User.Identity as ClaimsIdentity;
                if (claimsIdentity == null)
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
                if (string.IsNullOrWhiteSpace(userId))
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                _qualityServer.FinshQuality(model.Id,model.UserNo,model.Password, int.Parse(userId));
 
                return Ok(new { code = 0, count = 0, msg = "物料质检信息操作成功", data = "" });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, msg = e.Message });
            }
        }
 
 
        #endregion
    }
}