快乐的昕的电脑
2025-10-18 9f815134b902d19605c753616765cedb598e323f
Services/MesOrderStaManager.cs
@@ -104,15 +104,18 @@
        // 如果标记为1,需要处理首检相关逻辑
        if (entity.Flag == 1)
        {
            // 调用存储过程执行自动首检
            // Db.Ado.ExecuteCommand(
            //     "BEGIN AUTOMATIC_IPQC_FIRST_CHECK(:BILL_NO); END;",
            //     new SugarParameter("BILL_NO", womdaa.Daa001,
            //         DbType.String));
            //调用存储过程执行自动首检
             Db.Ado.ExecuteCommand(
                 "BEGIN AUTOMATIC_IPQC_FIRST_CHECK(:BILL_NO); END;",
                 new SugarParameter("BILL_NO", womdaa.Daa001, System.Data.DbType.String));
            var automaticIpqcFirstCheck =
                mesQaItemsDetect02Manager
                    .AutomaticIpqcFirstCheck(womdaa.Daa001);
            if (!automaticIpqcFirstCheck) throw new Exception("首检生成失败");
            if (!automaticIpqcFirstCheck)
            {
                Console.WriteLine($"自动首检失败,工单号:{womdaa.Daa001}");
                throw new Exception("首检生成失败");
            }
            // 获取当前时间
            var s1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
@@ -135,7 +138,7 @@
        var editDate = DateTime.Now.ToString("yyyy-MM-dd");
        // 发送HTTP请求到数据刷新接口
        MesNumerical mesNumerical = null;
        MesNumericalBycl mesNumerical = null;
        try
        {
            using (var httpClient = new HttpClient())
@@ -162,7 +165,7 @@
                    if (responseObj != null && responseObj.code == 200)
                    {
                        // 请求成功,获取MesNumerical数据
                        mesNumerical = Db.Queryable<MesNumerical>()
                        mesNumerical = Db.Queryable<MesNumericalBycl>()
                            .Where(s => s.EditDate == editDate
                                        && s.MachineNo == entity.MachineNo)
                            .OrderByDescending(s => s.Id)
@@ -204,6 +207,9 @@
            // 如果有调机开始时间则更新
            .SetColumnsIF(entity.MaStartTime != null,
                s => s.MaStartTime == entity.MaStartTime)
            // 如果有调机完成时间则更新
            .SetColumnsIF(entity.MaEndTime != null,
                s => s.MaEndTime == entity.MaEndTime)
            // 如果标记为1则更新备注信息
            .SetColumnsIF(entity.Flag == 1,
                s => s.remark == "于" + entity.MaShoutTime + "时间有一次送检")
@@ -449,7 +455,7 @@
                        // var reportingOkQty =
                        //     Convert.ToDecimal(vOrder.todayOutput) -
                        //     reporting.OkQty;
                        var CjQty = Db.Queryable<MesNumerical>()
                        var CjQty = Db.Queryable<MesNumericalBycl>()
                            .Where(s => s.MachineNo == entity.MachineNo && s.EditDate == date)
                            .OrderByDescending(s=>s.CjTiem)
                            .Select<long?>(s=>s.CjNum).First();
@@ -581,7 +587,7 @@
        if (binding)
            return Db.Updateable<MesOrderSta>()
                .SetColumns(s => s.MaEndTime == endDate)
                .SetColumns(s => s.MaEndTime == endDate) // 自动写入调机完成时间
                .SetColumns(s => s.StartTime == entity.MaShoutTime)
                .Where(s => s.OrderId == query.OrderId).ExecuteCommand() > 0;
@@ -616,18 +622,4 @@
        // 更新工单时间和状态
        return UpdateTime(entity);
    }
    /// <summary>
    /// 刀具查询(支持编号或名称模糊查询)
    /// </summary>
    /// <param name="searchKey">查询关键字</param>
    /// <returns>刀具列表</returns>
    public List<MesCutterLedger> QueryTools(string searchKey)
    {
        return Db.Queryable<MesCutterLedger>()
            .WhereIF(!string.IsNullOrEmpty(searchKey),
                t => t.CutterId.Contains(searchKey) || t.CutterName.Contains(searchKey))
            .ToList();
    }
}