using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using WIDESEA_ISerialPortRepository;
|
using WIDESEA_SerialPortRepository;
|
using WIDESEAWCS_Core;
|
using WIDESEAWCS_Core.BaseServices;
|
using WIDESEAWCS_DTO.SerialPort;
|
using WIDESEAWCS_ITaskInfoService;
|
using WIDESEAWCS_Model.Models;
|
|
|
namespace WIDESEAWCS_TaskInfoService
|
{
|
public class TorqueOpServer : ServiceBase<Dt_TorqueOp, ITorqueOpRepository>,ITorqueOpServer
|
{
|
private IProcessRepository _iprocessRepository;
|
public TorqueOpServer(ITorqueOpRepository BaseDal, IProcessRepository iprocessRepository) : base(BaseDal)
|
{
|
_iprocessRepository = iprocessRepository;
|
}
|
|
public override PageGridData<Dt_TorqueOp> GetPageData(PageDataOptions options)
|
{
|
OrderByParameters = new Dictionary<string, SqlSugar.OrderByType> {
|
{
|
nameof(Dt_TorqueOp.ID),SqlSugar.OrderByType.Asc
|
} };
|
return base.GetPageData(options);
|
}
|
|
|
|
|
/// <summary>
|
/// 根据类型和当前步骤查找出扭力值
|
/// </summary>
|
/// <param name="getTorDTO"></param>
|
/// <returns></returns>
|
public WebResponseContent Checkvalue(GetTorDTO getTorDTO)
|
{
|
try
|
{
|
var op = BaseDal.QueryData(x => x.GroupOp == getTorDTO.grop && x.ProcessSte == getTorDTO.setnum &&x.TakeId==getTorDTO.takeid);
|
if (op==null)
|
{
|
return new WebResponseContent { Status = false, Message = "没有找到该任务号:"};
|
}
|
return new WebResponseContent { Status = true, Data = op };
|
}
|
catch (Exception ex)
|
{
|
|
return new WebResponseContent { Status = false,Message="查询失败:"+ex.Message };
|
}
|
}
|
|
public WebResponseContent AddTorqueOp(Dt_TorqueOp torqueOp)
|
{
|
try
|
{
|
var process = _iprocessRepository.QueryData(a => a.SetpNum == torqueOp.ProcessSte && a.CraftType == torqueOp.GroupOp).FirstOrDefault();
|
if (process != null)
|
{
|
if (torqueOp.TorqueSize == process.TorqueOne || torqueOp.TorqueSize == process.TorqueTwo)
|
{
|
BaseDal.AddData(torqueOp);
|
return new WebResponseContent { Status = true, Message = "添加成功" };
|
}
|
else
|
{
|
return new WebResponseContent { Status = false, Message = "扭力值不合格", Code = 400 };
|
}
|
}
|
return new WebResponseContent { Status = false, Message = "数据有误", Code = 400 };
|
}
|
catch (Exception ex)
|
{
|
return new WebResponseContent { Status = false, Message = "添加失败:" + ex.Message };
|
}
|
}
|
|
public WebResponseContent WhetherSaveValueData(string takeid, string group, int setpunm)
|
{
|
try
|
{
|
var tor = BaseDal.QueryData(x => x.TakeId == takeid && x.GroupOp == group && x.ProcessSte == setpunm);
|
return new WebResponseContent { Status = true,Data=tor };
|
}
|
catch (Exception ex)
|
{
|
|
return new WebResponseContent { Status = false, Message = "错误" + ex.Message };
|
}
|
}
|
}
|
}
|