|
|
|
|
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>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯʵ<D1AF><CAB5>
|
|
|
|
|
/// </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;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (MaterialType == "0")
|
|
|
|
|
{
|
|
|
|
|
traceState = _rep.GetFirst(x => x.semibarcode2 == ProductCode && x.isdis == "0");
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//ǰ<><C7B0>
|
|
|
|
|
else if (MaterialType == "2")
|
|
|
|
|
{
|
|
|
|
|
traceState = _rep.GetFirst(x => x.semibarcodeA == ProductCode && x.isdis == "0");
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
else if (MaterialType == "3")
|
|
|
|
|
{
|
|
|
|
|
traceState = _rep.GetFirst(x => x.semibarcodeB == ProductCode && x.isdis == "0");
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
else if (MaterialType == "4")
|
|
|
|
|
{
|
|
|
|
|
traceState = _rep.GetFirst(x => x.semibarcodeC == ProductCode && x.isdis == "0");
|
|
|
|
|
}
|
|
|
|
|
return traceState;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><EFBFBD>
|
|
|
|
|
/// </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>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="record"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<bool> InsertAsync(T_SY_TraceState record)
|
|
|
|
|
{
|
|
|
|
|
bool result = await _rep.InsertAsync(record);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|