hao
2025-08-05 6723ff3984cba4ecac517566774eabe8f13b7d7a
StandardInterface/MESApplication/Controllers/QC/XJController.cs
@@ -122,6 +122,8 @@
            dynamic resultInfos = new ExpandoObject();
            var tbBillList =
                new XJService().getBoardItem(lineNo);
            // 按 itemNo 去重
            tbBillList = tbBillList.GroupBy(x => x.ItemNo).Select(g => g.First()).ToList();
            resultInfos.tbBillList = tbBillList;
            return new ResponseResult
            {
@@ -236,14 +238,14 @@
        try
        {
            dynamic resultInfos = new ExpandoObject();
            var tbBillList =
                new XJService().getPage(queryObj);
            resultInfos.tbBillList = tbBillList;
            var (item, totalCount) = new XJService().getPage(queryObj);
            resultInfos.tbBillList = item;
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = resultInfos
                data = resultInfos,
                TotalCount = totalCount
            };
        }
        catch (Exception ex)
@@ -442,4 +444,133 @@
            return ResponseResult.ResponseError(ex);
        }
    }
    //刷新检验项目
    [HttpPost("GenUpdate")]
    public ResponseResult GenUpdate([FromBody] JObject data)
    {
        try
        {
            decimal? id = data["id"]?.ToObject<decimal>();
            string? no = data["no"]?.ToString();
            string? user = data["user"]?.ToString();
            var (result, message) = new XJService().GenUpdate(id, no, user);
            dynamic resultInfos = new ExpandoObject();
            resultInfos.result = result;
            resultInfos.message = message;
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = resultInfos
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
    //提交检验
    [HttpPost("SjSubmit")]
    public ResponseResult SjSubmit([FromBody] SJDto sjDto)
    {
        try
        {
            dynamic resultInfos = new ExpandoObject();
            var tbBillList = new XJService().SjSubmit(sjDto);
            resultInfos.tbBillList = tbBillList;
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = resultInfos
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
    /// <summary>
    /// 获取有线体的部门列表
    /// </summary>
    [HttpPost("getDepartmentsWithLines")]
    public ResponseResult GetDepartmentsWithLines()
    {
        try
        {
            dynamic resultInfos = new ExpandoObject();
            var tbBillList = new XJService().GetDepartmentsWithLines();
            resultInfos.tbBillList = tbBillList;
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = resultInfos
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
    /// <summary>
    /// 保存部门选择
    /// </summary>
    [HttpPost("saveDepartmentSelection")]
    public ResponseResult SaveDepartmentSelection([FromBody] JObject data)
    {
        try
        {
            var id = Convert.ToDecimal(data["id"]);
            var departmentId = data["departmentId"].ToString();
            var departmentName = data["departmentName"].ToString();
            dynamic resultInfos = new ExpandoObject();
            var result = new XJService().SaveDepartmentSelection(id, departmentId, departmentName);
            resultInfos.tbBillList = result;
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = resultInfos
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
    /// <summary>
    /// 根据部门ID获取该部门下的线体列表
    /// </summary>
    [HttpPost("getLinesByDepartment")]
    public ResponseResult GetLinesByDepartment([FromBody] JObject data)
    {
        try
        {
            var departmentId = data["departmentId"].ToString();
            dynamic resultInfos = new ExpandoObject();
            var tbBillList = new XJService().GetLinesByDepartment(departmentId);
            resultInfos.tbBillList = tbBillList;
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = resultInfos
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
}