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, IT_SY_TraceStateService { public T_SY_TraceStateServiceImpl(Repository repository):base(repository) { } /// /// 根据条码查询实体 /// /// /// 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; } /// /// 修改 /// /// /// public async Task UpdateAsync(T_SY_TraceState record) { bool result = await _rep.UpdateAsync(record); return result; } /// /// 新增 /// /// /// public async Task InsertAsync(T_SY_TraceState record) { bool result = await _rep.InsertAsync(record); return result; } } }