xwt
2025-08-14 b289e477c13910c2814d89915342a7edabee5a8d
巡检入库检修改
已修改6个文件
157 ■■■■■ 文件已修改
StandardInterface/MES.Service/Modes/QsQaItemXj.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
StandardInterface/MES.Service/Modes/Womdaa.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
StandardInterface/MES.Service/service/QC/LljService.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StandardInterface/MES.Service/service/QC/XJService.cs 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StandardInterface/MESApplication/Controllers/QC/XJController.cs 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
StandardInterface/MESApplication/appsettings.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
StandardInterface/MES.Service/Modes/QsQaItemXj.cs
@@ -82,7 +82,7 @@
    /// <summary>
    ///     车间
    /// </summary>
    [SugarColumn(ColumnName = "WORKSHOP")]
    [SugarColumn(IsIgnore = true)]
    public string? WorkShop { get; set; }
    /// <summary>
StandardInterface/MES.Service/Modes/Womdaa.cs
@@ -12,7 +12,7 @@
    ///     自增列
    /// </summary>
    [SugarColumn(ColumnName = "ID", IsPrimaryKey = true)]
    public decimal? Id { get; set; }
    public decimal Id { get; set; }
    /// <summary>
    ///     排产ID
StandardInterface/MES.Service/service/QC/LljService.cs
@@ -67,8 +67,8 @@
                        .Contains(queryObj.SearchValue.ToLower()))
            //  .OrderByDescending((a, b,
            .OrderBy("CASE WHEN a.EMERGENCY = 1 THEN 0 ELSE 1 END, a.IQC_DATE desc, CASE WHEN a.STATUS = '已提交' THEN 0 ELSE 1 END, a.ID asc")
            .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
            .OrderBy("CASE WHEN a.EMERGENCY = 1 THEN 0 ELSE 1 END, CASE WHEN a.STATUS = '已提交' THEN 0 ELSE 1 END, a.IQC_DATE desc, a.ID asc")
            .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
        var emergencyValues = pageList.Select(item => item.EMERGENCY).ToList(); 
        return (pageList, totalCount);
StandardInterface/MES.Service/service/QC/XJService.cs
@@ -71,21 +71,43 @@
            }).OrderBy("b.LINE_NO").ToList();
    }
    public List<Womdaa> getDaa001(string daa020, string item)
    public List<Womdaa> getDaa001(string daa020)
    {
        var db = SqlSugarHelper.GetInstance();
        return db.Queryable<Womdaa, MesItems>((a, b) =>
                new JoinQueryInfos(JoinType.Inner, a.Daa002 == b.Id.ToString()))
            .Where((a, b) =>
                a.Daa015 == daa020 &&
                b.ItemNo == item &&
                statusArray.Contains(a.Daa018))
            .Select<Womdaa>(a => new Womdaa
        return db.Queryable<Womdaa>()
            .Where(a => a.Daa015 == daa020 && statusArray.Contains(a.Daa018))
            .Select(a => new Womdaa
            {
                Id = a.Id,
                Daa001 = a.Daa001,
                Daa003 = a.Daa003,
                Daa008 = a.Daa008
            }).ToList();
    }
    /// <summary>
    /// 获取工单详细信息(包含物料信息)
    /// </summary>
    /// <param name="daa020">线体编号</param>
    /// <returns>工单列表(包含物料信息)</returns>
    public List<WorkOrderWithItemDto> getWorkOrderWithItem(string daa020)
    {
        var db = SqlSugarHelper.GetInstance();
        return db.Queryable<Womdaa, MesItems>((a, b) =>
                new JoinQueryInfos(JoinType.Inner, a.Daa002 == b.Id.ToString()))
            .Where((a, b) => a.Daa015 == daa020 && statusArray.Contains(a.Daa018))
            .Select((a, b) => new WorkOrderWithItemDto
            {
                Id = a.Id,
                Daa001 = a.Daa001,
                Daa002 = a.Daa002,
                Daa003 = a.Daa003,
                Daa008 = a.Daa008,
                Daa015 = a.Daa015,
                Daa020 = a.Daa020,
                ItemNo = b.ItemNo,
                ItemName = b.ItemName,
                ItemModel = b.ItemModel
            }).ToList();
    }
@@ -137,7 +159,7 @@
            .WhereIF(
                StringUtil.IsNotNullOrEmpty(queryObj.result) &&
                !"未完成".Equals(queryObj.result),
                (s, a, c, b) => s.Fsubmit != 1)
                (s, a, c, b) => s.Fsubmit == 1)
            .WhereIF(id > 0, (s, a, c, b) => s.Id == id)
            .Select((s, a, c, b) => new QsQaItemXj
            {
@@ -259,6 +281,7 @@
            xj.CreateBy = userNo;
            xj.CreateDate = DateTime.Now;
            xj.Fsubmit = 0; // 设置默认状态为未提交
            var pid = db.Insertable(xj).ExecuteReturnIdentity();
@@ -273,8 +296,10 @@
            return commit;
        });
        // 重新获取检验项目(包含ID)
        xjDto.items = getJYItem(xj.Id, null);
        // 自动为没有上下限的检验项目生成默认的合格记录
        xjDto.items.ForEach(s =>
        {
            if (s.MaxValue != null || s.StandardValue != null ||
@@ -288,6 +313,9 @@
            detail.count = (int?)s.LevelNum;
            SetQSItemDetail(detail);
        });
        // 重新获取检验项目(包含自动生成的结果)
        xjDto.items = getJYItem(xj.Id, null);
        return Convert.ToInt32(xj.Id);
    }
@@ -563,39 +591,24 @@
    {
        try
        {
            // 定义输出参数
            var outputResult = new SugarParameter("c_res", null,
                System.Data.DbType.Int32, ParameterDirection.Output,
                4000);
            var outputMessage = new SugarParameter("c_msg", null,
                System.Data.DbType.String,
                ParameterDirection.Output, 4000);
            // 定义输入参数,固定FLAG为1(审核)
            var parameters = new List<SugarParameter>
            {
                new("P_ID", dto.id, System.Data.DbType.Decimal, ParameterDirection.Input),
                new("P_FLAG", 1, System.Data.DbType.Int32, ParameterDirection.Input),
                new("P_USER", dto.userNo, System.Data.DbType.String, ParameterDirection.Input),
                outputResult,
                outputMessage
            };
            var db = SqlSugarHelper.GetInstance();
            // 直接更新Fsubmit字段为1(已提交状态)
            var result = db.Updateable<QsQaItemXj>()
                .SetColumns(s => s.Fsubmit == 1)
                .SetColumns(s => s.FsubmitBy == dto.userNo)
                .SetColumns(s => s.FsubmitDate == DateTime.Now)
                .Where(s => s.Id == dto.id)
                .ExecuteCommand();
            // 使用 SqlSugar 执行存储过程
            db.Ado.ExecuteCommand(
                "BEGIN PRC_WOMDAA_XJ_UPDATE_RES(:P_ID, :P_FLAG, :P_USER, :c_res, :c_msg); END;",
                parameters.ToArray());
            // 获取输出参数的值
            var resultValue = outputResult.Value?.ToString();
            var messageValue = outputMessage.Value?.ToString();
            if ("1".Equals(resultValue)) throw new Exception(messageValue);
            return true;
            if (result > 0)
            {
                return true;
            }
            else
            {
                throw new Exception("提交失败:未找到对应的检验单");
            }
        }
        catch (Exception ex)
        {
StandardInterface/MESApplication/Controllers/QC/XJController.cs
@@ -15,7 +15,7 @@
    [HttpPost("getAll")]
    public ResponseResult getAll([FromBody] JObject data)
    {
        var modify1Flag = Convert.ToInt32(data["modify1Flag"].ToString());
        var modify1Flag = Convert.ToInt32(data["modify1Flag"]?.ToString() ?? "0");
        try
        {
            dynamic resultInfos = new ExpandoObject();
@@ -88,13 +88,36 @@
    [HttpPost("getDaa001")]
    public ResponseResult getDaa001([FromBody] JObject data)
    {
        var daa020 = data["daa020"].ToString();
        var item = data["item"].ToString();
        var daa020 = data["daa020"]?.ToString() ?? "";
        try
        {
            dynamic resultInfos = new ExpandoObject();
            var tbBillList =
                new XJService().getDaa001(daa020, item);
            var tbBillList = new XJService().getDaa001(daa020);
            resultInfos.tbBillList = tbBillList;
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                data = resultInfos
            };
        }
        catch (Exception ex)
        {
            return ResponseResult.ResponseError(ex);
        }
    }
    /// <summary>
    ///     获取工单详细信息(包含物料信息)
    /// </summary>
    [HttpPost("getWorkOrderWithItem")]
    public ResponseResult getWorkOrderWithItem([FromBody] JObject data)
    {
        var daa020 = data["daa020"]?.ToString() ?? "";
        try
        {
            dynamic resultInfos = new ExpandoObject();
            var tbBillList = new XJService().getWorkOrderWithItem(daa020);
            resultInfos.tbBillList = tbBillList;
            return new ResponseResult
            {
@@ -116,7 +139,7 @@
    [HttpPost("getBoardItem")]
    public ResponseResult getBoardItem([FromBody] JObject data)
    {
        var lineNo = data["lineNo"].ToString();
        var lineNo = data["lineNo"]?.ToString() ?? "";
        try
        {
            dynamic resultInfos = new ExpandoObject();
@@ -142,7 +165,7 @@
    [HttpPost("getItem")]
    public ResponseResult getItem([FromBody] JObject data)
    {
        var daa001 = data["daa001"].ToString();
        var daa001 = data["daa001"]?.ToString() ?? "";
        try
        {
            dynamic resultInfos = new ExpandoObject();
@@ -166,7 +189,7 @@
    [HttpPost("setJYItem")]
    public ResponseResult setJYItem([FromBody] JObject data)
    {
        var itemNo = data["itemNo"].ToString();
        var itemNo = data["itemNo"]?.ToString() ?? "";
        try
        {
            dynamic resultInfos = new ExpandoObject();
@@ -193,9 +216,12 @@
        try
        {
            dynamic resultInfos = new ExpandoObject();
            var tbBillList =
                new XJService().save(xjDto);
            resultInfos.tbBillList = tbBillList;
            var result = new XJService().save(xjDto);
            // 返回完整的XJDto对象,包含更新后的items
            resultInfos.tbBillList = result;
            resultInfos.xjDto = xjDto; // 包含完整的检验项目信息
            return new ResponseResult
            {
                status = 0,
@@ -529,8 +555,8 @@
        try
        {
            var id = Convert.ToDecimal(data["id"]);
            var departmentId = data["departmentId"].ToString();
            var departmentName = data["departmentName"].ToString();
                    var departmentId = data["departmentId"]?.ToString() ?? "";
        var departmentName = data["departmentName"]?.ToString() ?? "";
            dynamic resultInfos = new ExpandoObject();
            var result = new XJService().SaveDepartmentSelection(id, departmentId, departmentName);
@@ -556,7 +582,7 @@
    {
        try
        {
            var departmentId = data["departmentId"].ToString();
            var departmentId = data["departmentId"]?.ToString() ?? "";
            dynamic resultInfos = new ExpandoObject();
            var tbBillList = new XJService().GetLinesByDepartment(departmentId);
StandardInterface/MESApplication/appsettings.json
@@ -10,6 +10,6 @@
  "AppSettings": {
    "TestErpUrl": "http://192.168.11.120:8098/WebService1.asmx/mesToErpinfo",
    "ProductionErpUrl": "http://192.168.11.120:8098/WebService1.asmx/mesToErpinfoFormal",
    "DataBaseConn": "Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = hm_prd; Password=hmprd"
    "DataBaseConn": "Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.22)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = test_dev; Password=hmprd"
  }
}