20260831功能同步:

1. 不同车间区分料框查询、料框解绑接口
2. 注释电池型号逻辑
3. 打开电池状况界面
This commit is contained in:
Administrator
2026-08-31 13:54:07 +08:00
parent 6dfac6d986
commit c2ed98d52d
26 changed files with 1646 additions and 13 deletions
@@ -0,0 +1,87 @@
using JinYuan.DAL.Models;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JinYuan.DAL.Service
{
public interface IWorkshopInterCfgService : IBaseService<WorkshopInterfaceConfig>
{
string GetUrl(string workshopCode, string interfaceKey);
}
public class WorkshopInterCfgService : BaseService<WorkshopInterfaceConfig>, IWorkshopInterCfgService
{
public WorkshopInterCfgService(ISqlSugarClient db) : base(db)
{
}
public override List<WorkshopInterfaceConfig> GetList()
{
return _db.Queryable<WorkshopInterfaceConfig>()
.Where(x => !x.Is_Deleted)
.OrderBy(x => x.Workshop_Code)
.OrderBy(x => x.Interface_Flag)
.ToList();
}
public override DataTable GetDataTable()
{
return _db.Queryable<WorkshopInterfaceConfig>()
.Where(x => !x.Is_Deleted)
.OrderBy(x => x.Workshop_Code)
.OrderBy(x => x.Interface_Flag)
.ToDataTable();
}
public override bool Add(WorkshopInterfaceConfig model)
{
// 车间 + 接口标识 + isDeleted = 0 的唯一性校验
bool isExist = _db.Queryable<WorkshopInterfaceConfig>()
.Where(x => x.Workshop_Code == model.Workshop_Code && x.Interface_Flag == model.Interface_Flag && !x.Is_Deleted)
.Any();
if (isExist)
{
throw new ArgumentException($"该车间{model.Workshop_Code}已存在该接口{model.Interface_Flag}");
}
return base.Add(model);
}
public override bool Update(WorkshopInterfaceConfig model)
{
// 车间 + 接口标识 + isDeleted = 0 的唯一性校验
bool isExist = _db.Queryable<WorkshopInterfaceConfig>()
.Where(x => x.Workshop_Code == model.Workshop_Code && x.Interface_Flag == model.Interface_Flag && !x.Is_Deleted)
.Any();
if (isExist)
{
return false;
}
return base.Update(model);
}
public override bool SoftDelete(int id)
{
return _db.Updateable<WorkshopInterfaceConfig>()
.SetColumns(x => x.Is_Deleted == true)
.SetColumns(x => x.Update_Time == DateTime.Now)
.Where(x => x.Id == id)
.ExecuteCommand() > 0;
}
public string GetUrl(string workshopCode, string interfaceKey)
{
return _db.Queryable<WorkshopInterfaceConfig>()
.Where(x => x.Workshop_Code == workshopCode && x.Interface_Flag == interfaceKey && !x.Is_Deleted)
.Select(x => x.Interface_Url)
.First();
}
}
}