|
|
using System.Collections;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Repository.IRepositories;
|
|
|
using Estsh.Core.Util;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.Dapper;
|
|
|
using Estsh.Core.Model.ExcelModel;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:报表模块条码查询BLL
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Services
|
|
|
{
|
|
|
public class SerialNumberQuery2Service : BaseService<GSnKeyparts>, ISerialNumberQuery2Service
|
|
|
{
|
|
|
private readonly ISerialNumberQuery2Repository repository;
|
|
|
|
|
|
public SerialNumberQuery2Service(ISerialNumberQuery2Repository _repository) : base(_repository)
|
|
|
{
|
|
|
repository = _repository;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 查找总成零件号
|
|
|
/// </summary>
|
|
|
/// <returns>数据集</returns>
|
|
|
public List<KeyValueResult> GetPartNo()
|
|
|
{
|
|
|
return repository.GetPartNo();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获得不绑定条码信息
|
|
|
/// </summary>
|
|
|
/// <param name="whereStr"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <returns></returns>
|
|
|
public List<GSnKeyparts> GetSNInfo(string wheres, Pager pager, ref int totalCount)
|
|
|
{
|
|
|
return repository.GetSNInfo(wheres, pager, ref totalCount);
|
|
|
}
|
|
|
public List<SerialNumberQuery2SN> GetSNInfoByList(string wheres, Pager pager, ref int totalCount)
|
|
|
{
|
|
|
return repository.GetSNInfoByList(wheres, pager, ref totalCount);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获得条码当前信息
|
|
|
/// </summary>
|
|
|
/// <param name="whereStr"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <returns></returns>
|
|
|
public List<GSnStatus> GetSNCurrentData(string whereStr, Pager pager, ref int totalCount)
|
|
|
{
|
|
|
return repository.GetSNCurrentData(whereStr, pager, ref totalCount);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获得历史信息
|
|
|
/// </summary>
|
|
|
/// <param name="whereStr"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <returns></returns>
|
|
|
public List<GSnTravel> GetSNTravelData(string whereStr, Pager pager, ref int totalCount)
|
|
|
{
|
|
|
return repository.GetSNTravelData(whereStr, pager, ref totalCount);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 关键数据
|
|
|
/// </summary>
|
|
|
/// <param name="serialNumber"></param>
|
|
|
/// <returns></returns>
|
|
|
public List<GSnKeydata> GetKeyData(string whereStr, Pager pager, ref int totalCount)
|
|
|
{
|
|
|
return repository.GetKeyData(whereStr, pager, ref totalCount);
|
|
|
}
|
|
|
|
|
|
public List<SerialNumberQuery2> getTableListByPage(string whereStr, Pager pager, ref int totalCount)
|
|
|
{
|
|
|
return repository.getTableListByPage(whereStr, pager, ref totalCount);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 绑定信息
|
|
|
/// </summary>
|
|
|
/// <param name="whereStr"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="totalCount"></param>
|
|
|
/// <returns></returns>
|
|
|
public List<GSnKeyparts> GetKeyParts(string whereStr, Pager pager, ref int totalCount)
|
|
|
{
|
|
|
return repository.GetKeyParts(whereStr, pager, ref totalCount);
|
|
|
}
|
|
|
|
|
|
public List<GSnKeyparts> GetKeyParts2(string whereStr, Pager pager, ref int totalCount)
|
|
|
{
|
|
|
List<GSnKeyparts> GetKeyParts = repository.GetKeyParts(whereStr, pager, ref totalCount);
|
|
|
if (GetKeyParts != null)
|
|
|
{
|
|
|
List<SysPartSnRule> PartSnRule = repository.getPartSnRule();
|
|
|
for (int i = 0; i < GetKeyParts.Count; i++)
|
|
|
{
|
|
|
string partNO = GetKeyParts[i].PartNo.ToString();
|
|
|
string kpsn = GetKeyParts[i].Kpsn.ToString();
|
|
|
if (string.IsNullOrEmpty(partNO))
|
|
|
{
|
|
|
for (int j = 0; j < PartSnRule.Count; j++)
|
|
|
{
|
|
|
int from1 = Convert.ToInt32(PartSnRule[j].From1.ToString()) - 1;
|
|
|
int to1 = Convert.ToInt32(PartSnRule[j].To1.ToString());
|
|
|
string fix1 = PartSnRule[j].Fix1.ToString();
|
|
|
string part_no = PartSnRule[j].PartNo.ToString();
|
|
|
string part_spec = PartSnRule[j].PartSpec.ToString();
|
|
|
|
|
|
if (kpsn.Length >= to1)
|
|
|
{
|
|
|
partNO = kpsn.Substring(from1, to1);
|
|
|
if (partNO.Trim().ToUpper() == fix1.Trim().ToUpper())
|
|
|
{
|
|
|
GetKeyParts[i].PartNo = part_no;
|
|
|
GetKeyParts[i].PartSpec = part_spec;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return GetKeyParts;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 电功能检测
|
|
|
/// </summary>
|
|
|
/// <param name="serialNumber"></param>
|
|
|
/// <returns></returns>
|
|
|
public List<GSnStatus> GetCheck(string whereStr, Pager pager, ref int totalCount)
|
|
|
{
|
|
|
return repository.GetCheck(whereStr, pager, ref totalCount);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 不良信息
|
|
|
/// </summary>
|
|
|
/// <param name="serialNumber">条码</param>
|
|
|
/// <returns></returns>
|
|
|
public List<GSnDefect> GetRepairDetials(string whereStr, Pager pager, ref int totalCount)
|
|
|
{
|
|
|
return repository.GetRepairDetials(whereStr, pager, ref totalCount);
|
|
|
}
|
|
|
|
|
|
public List<GSnKeyparts> GetKPSN(string srcSN)
|
|
|
{
|
|
|
return repository.GetKPSN(srcSN);
|
|
|
}
|
|
|
|
|
|
public List<GSnKeydata> valiDationKPSN(string strKPSN)
|
|
|
{
|
|
|
return repository.valiDationKPSN(strKPSN);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 通过任意有绑定信息的条码取回过程条码 g_sn_status.serial_number
|
|
|
/// </summary>
|
|
|
/// <param name="srcSN">已绑定的条码</param>
|
|
|
/// <returns>若返回值为空,则没有查到信息</returns>
|
|
|
public string GetPSN(string srcSN)
|
|
|
{
|
|
|
return repository.GetPSN(srcSN);
|
|
|
}
|
|
|
|
|
|
public List<SysModel> GetSNModelTypeInfo(string srcSN)
|
|
|
{
|
|
|
return repository.GetSNModelTypeInfo(srcSN);
|
|
|
}
|
|
|
public List<SysPart> GetSNPartInfo(string srcSN)
|
|
|
{
|
|
|
return repository.GetSNPartInfo(srcSN);
|
|
|
}
|
|
|
public List<GSnStatus> GetSNBasicInfo(string srcSN)
|
|
|
{
|
|
|
return repository.GetSNBasicInfo(srcSN);
|
|
|
}
|
|
|
public List<KeyValueResult> GetPDlineInfo()
|
|
|
{
|
|
|
return repository.GetPDlineInfo();
|
|
|
}
|
|
|
}
|
|
|
}
|