You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
3.3 KiB
C#

using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SlnMesnac.Repository.service.Impl
{
public class T_SY_TraceStateServiceImpl : BaseServiceImpl<T_SY_TraceState>, IT_SY_TraceStateService
{
public T_SY_TraceStateServiceImpl(Repository<T_SY_TraceState> repository):base(repository)
{
}
/// <summary>
/// 根据条码查询实体
/// </summary>
/// <param name="ProductCode"></param>
/// <returns></returns>
public T_SY_TraceState GetByProductCode(string ProductCode)
{
T_SY_TraceState traceState = null;
traceState = _rep.GetFirst(x => x.productbarcode == ProductCode);
return traceState;
}
public T_SY_TraceState GetRelationShipByProductCodeAndIsdis(string ProductCode,string MaterialType,string StationCode)
{
T_SY_TraceState traceState = null;
//控制器
if (MaterialType == "0")
{
traceState = _rep.GetFirst(x => x.semibarcode2 == ProductCode && x.isdis == "0");
}
//壳体
else if (MaterialType == "1")
{
if (StationCode == "80_3")
{
traceState = _rep.GetFirst(x => x.productbarcode == ProductCode && x.semibarcodeA != null && x.isdis == "0");
}
else if (StationCode == "120_2")
{
traceState = _rep.GetFirst(x => x.productbarcode == ProductCode && x.semibarcodeB != null && x.isdis == "0");
}
else if (StationCode == "150")
{
traceState = _rep.GetFirst(x => x.productbarcode == ProductCode && x.semibarcodeC != null && x.isdis == "0");
}
else
{
traceState = _rep.GetFirst(x => x.productbarcode == ProductCode && x.semibarcode2 != null && x.isdis == "0");
}
}
//前盖
else if (MaterialType == "2")
{
traceState = _rep.GetFirst(x => x.semibarcodeA == ProductCode && x.isdis == "0");
}
//静盘
else if (MaterialType == "3")
{
traceState = _rep.GetFirst(x => x.semibarcodeB == ProductCode && x.isdis == "0");
}
//后盖
else if (MaterialType == "4")
{
traceState = _rep.GetFirst(x => x.semibarcodeC == ProductCode && x.isdis == "0");
}
return traceState;
}
/// <summary>
/// 修改
/// </summary>
/// <param name="record"></param>
/// <returns></returns>
public async Task<bool> UpdateAsync(T_SY_TraceState record)
{
bool result = await _rep.UpdateAsync(record);
return result;
}
/// <summary>
/// 新增
/// </summary>
/// <param name="record"></param>
/// <returns></returns>
public async Task<bool> InsertAsync(T_SY_TraceState record)
{
bool result = await _rep.InsertAsync(record);
return result;
}
}
}