xwt
2025-08-03 3f7693504fdb48ab76fd41029859d84774b42a28
StandardInterface/MESApplication/Controllers/QC/XJController.cs
@@ -444,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);
        }
    }
}