添加项目文件。
This commit is contained in:
@@ -0,0 +1,712 @@
|
||||
using JY.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JY.DAL
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class OpSqlDataBase : IDbHelper
|
||||
{
|
||||
#region SQLServer
|
||||
/// <summary>
|
||||
/// 保存报警数据
|
||||
/// </summary>
|
||||
/// <param name="m"></param>
|
||||
/// <returns></returns>
|
||||
public int AddAlarmData(AlarmData m)
|
||||
{
|
||||
string strSql = string.Format(@"INSERT INTO [tb_alarm] ([AlarmGuid],[PLCAdress],[AlarmCode],[AlarmContent]
|
||||
,[AlarmType],[AlarmDesc],[AlarmState],[StartTime],[EndTime],[Flag])
|
||||
values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}',{9})"
|
||||
, m.AlarmGuid, m.PLCAdress, m.AlarmCode, m.AlarmContent, m.AlarmType, m.AlarmDesc, m.AlarmState
|
||||
, m.StartTime, m.EndTime, m.Flag);
|
||||
int result = SqlHelper<AlarmData>.Execute(strSql);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存报警数据至缓存表
|
||||
/// </summary>
|
||||
/// <param name="m"></param>
|
||||
/// <returns></returns>
|
||||
public int AddAlarmCacheData(string tablename, List<AlarmData> m)
|
||||
{
|
||||
try
|
||||
{
|
||||
int list = SqlHelper<AlarmData>.BulkToDB(tablename, m);
|
||||
return list;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw ex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询缓存表报警信息
|
||||
/// </summary>
|
||||
/// <param name="strDate1">开始时间</param>
|
||||
/// <param name="strDate2">结束时间</param>
|
||||
/// <returns></returns>
|
||||
///
|
||||
public List<AlarmData> GetAlarmCacheData()
|
||||
{
|
||||
string strSql = $@" SELECT [AlarmGuid]
|
||||
,[PLCAdress]
|
||||
,[AlarmCode]
|
||||
,[AlarmContent]
|
||||
,[AlarmType]
|
||||
,[AlarmDesc]
|
||||
,[AlarmState]
|
||||
,[StartTime]
|
||||
,[EndTime]
|
||||
,[Flag]
|
||||
FROM tb_alarm where Flag =0";
|
||||
var list = SqlHelper<AlarmData>.Query(strSql);
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除未更新数据
|
||||
/// </summary>
|
||||
/// <param name="strDate1">开始时间</param>
|
||||
/// <param name="strDate2">结束时间</param>
|
||||
/// <returns></returns>
|
||||
public int DeleteAlarmCacheData()
|
||||
{
|
||||
string strSql = $@"DELETE FROM[dbo].[tb_alarm] WHERE [Flag]=0";
|
||||
int result = SqlHelper<object>.Execute(strSql);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询报警信息
|
||||
/// </summary>
|
||||
/// <param name="strDate1">开始时间</param>
|
||||
/// <param name="strDate2">结束时间</param>
|
||||
/// <returns></returns>
|
||||
public List<AlarmData> GetAlarmData(string strDate1, string strDate2)
|
||||
{
|
||||
string strSql = $@" SELECT AlarmGuid,PLCAdress ,AlarmContent,AlarmCode,AlarmType,StartTime ,EndTime
|
||||
FROM tb_alarm where StartTime >= '{ strDate1 }' and StartTime <= '{ strDate2 }' ";
|
||||
var list = SqlHelper<AlarmData>.Query(strSql);
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询进站信息
|
||||
/// </summary>
|
||||
/// <param name="strCode"></param>
|
||||
/// <returns></returns>
|
||||
public List<FeedingData> GetFeedingData(string strCode)
|
||||
{
|
||||
string strSql = $@" SELECT * FROM FeedingData where BarCode = '{strCode}' ORDER BY CreateTime desc";
|
||||
var list = SqlHelper<FeedingData>.Query(strSql);
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增产品型号
|
||||
/// </summary>
|
||||
/// <param name="entity">机型信息</param>
|
||||
/// <returns></returns>
|
||||
public int AddProductModel(ProductModel entity)
|
||||
{
|
||||
string strSql = $@"INSERT INTO tb_productmodel (ModelName, Remark)
|
||||
VALUES ('{entity.ModelName}', '{entity.Remark}')";
|
||||
int result = SqlHelper<object>.Execute(strSql);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除本地型号
|
||||
/// </summary>
|
||||
/// <param name="modeltype">型号</param>
|
||||
/// <returns></returns>
|
||||
public void DelProductModel(string modeltype)
|
||||
{
|
||||
string strSql = $"delete from tb_productmodel where ModelName='{modeltype}'";
|
||||
SqlHelper<object>.Execute(strSql);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取产品型号列表
|
||||
/// </summary>
|
||||
/// <param name="strProdType">产品型号</param>
|
||||
/// <returns></returns>
|
||||
public List<ProductModel> GetProductModelList(string strProdType = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
string strSql = @"SELECT * FROM tb_productmodel ";
|
||||
if (strProdType != "")
|
||||
{
|
||||
strSql += string.Format(" where ModelName='{0}'", strProdType);
|
||||
}
|
||||
strSql += " order by ModelName";
|
||||
var list = SqlHelper<ProductModel>.Query(strSql);
|
||||
return list;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存产品类型配置参数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool AddProductParaList(List<ProductPara> list)
|
||||
{
|
||||
List<string> listSql = new List<string>();
|
||||
listSql.Add($@"delete from tb_paralist where ModelName='{list[0].ModelName}'");
|
||||
foreach (var item in list)
|
||||
{
|
||||
listSql.Add($@"INSERT INTO tb_paralist (ModelName, ParaName, ParaValue, Remark, UpdateTime)
|
||||
VALUES ('{item.ModelName}', '{item.ParaName}', '{item.ParaValue}', '{item.Remark}', '{item.UpdateTime}')");
|
||||
}
|
||||
var result = SqlHelper<object>.ExecuteTransaction(listSql.ToArray());
|
||||
|
||||
if (result > 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取产品参数通过产品型号
|
||||
/// </summary>
|
||||
/// <param name="strModelType">产品型号</param>
|
||||
/// <returns></returns>
|
||||
public List<ProductPara> GetProductParaByProdModel(string strModelType)
|
||||
{
|
||||
string strSql = $@"SELECT pb.ParaName, '{strModelType}' ModelName,pl.ParaValue,pl.Remark,pl.UpdateTime
|
||||
FROM tb_parabase pb
|
||||
left join (select * from tb_paralist where ModelName = '{strModelType}' ) as pl
|
||||
on pb.ParaName = pl.ParaName; ";
|
||||
|
||||
var list = SqlHelper<ProductPara>.Query(strSql);
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标准轴参数保存
|
||||
/// </summary>
|
||||
/// <param name="dt"></param>
|
||||
/// <param name=""></param>
|
||||
/// <param name="strErr"></param>
|
||||
/// <returns></returns>
|
||||
public bool InsertPLCConfigBase(List<PLCConfigBase> list)
|
||||
{
|
||||
List<string> listSql = new List<string>();
|
||||
listSql.Add("delete from tb_plcconfigbase;");
|
||||
foreach (var item in list)
|
||||
{
|
||||
listSql.Add($@"Insert into tb_plcconfigbase (PLCAddress,PLCRemark,OrderNum)
|
||||
Values ('{item.PLCAddress}','{item.PLCRemark}',{item.OrderNum});");
|
||||
}
|
||||
var result = SqlHelper<object>.ExecuteTransaction(listSql.ToArray());
|
||||
if (result > 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取换型操作的基本参数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<PLCConfigBase> GetPLCConfigBases()
|
||||
{
|
||||
string strSql = string.Format(@"SELECT * FROM tb_plcconfigbase
|
||||
ORDER BY OrderNum");
|
||||
var list = SqlHelper<PLCConfigBase>.Query(strSql);
|
||||
return list;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取PLC换型参数绑定值
|
||||
/// </summary>
|
||||
/// <param name="modelName">产品型号</param>
|
||||
/// <returns></returns>
|
||||
public List<PLCConfigPara> GetPLCConfigPara(string modelName)
|
||||
{
|
||||
string strSql = $@"SELECT '{modelName}' ModelName,pb.PLCAddress,pc.PLCValue,pc.UpdateDate,pb.PLCRemark,pb.OrderNum
|
||||
FROM tb_plcconfigbase pb
|
||||
left join (select * from tb_plcconfig where ModelName='{modelName}') pc
|
||||
on pb.PLCAddress = pc.PLCAddress
|
||||
order by pb.OrderNum;";
|
||||
var list = SqlHelper<PLCConfigPara>.Query(strSql);
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 具体型号轴参数保存
|
||||
/// </summary>
|
||||
/// <param name="dt"></param>
|
||||
/// <param name=""></param>
|
||||
/// <param name="strErr"></param>
|
||||
/// <returns></returns>
|
||||
public bool InsertPLCConfigParam(List<PLCConfigPara> list)
|
||||
{
|
||||
List<string> listSql = new List<string>();
|
||||
listSql.Add($"delete from tb_plcconfig where ModelName='{list[0].ModelName}';");
|
||||
foreach (var item in list)
|
||||
{
|
||||
listSql.Add($@"INSERT INTO tb_plcconfig (ModelName, PLCAddress, PLCValue, UpdateDate)
|
||||
Values ('{item.ModelName}','{item.PLCAddress}',{item.PLCValue},'{item.UpdateData}');");
|
||||
}
|
||||
var result = SqlHelper<object>.ExecuteTransaction(listSql.ToArray());
|
||||
if (result > 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询历史数据
|
||||
/// </summary>
|
||||
/// <param name="strBarCode"></param>
|
||||
/// <param name="strDate1"></param>
|
||||
/// <param name="strDate2"></param>
|
||||
/// <returns></returns>
|
||||
public DataTable GetTestData(int type, string strBarCode, string strDate1, string strDate2, string flag)
|
||||
{
|
||||
string strSql = "";
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
strSql = @"SELECT [ID] ID
|
||||
,[TD] 通道
|
||||
,[BarCode] 入站条码
|
||||
,CONVERT(varchar, [CreateTime], 120) 进站时间
|
||||
,[Result] 结果
|
||||
,[Remark] 备注
|
||||
,[Flag] 状态
|
||||
FROM [dbo].[FeedingData]
|
||||
where CreateTime >= '" + strDate1 + "' and CreateTime <= '" + strDate2 + "' ";
|
||||
if (strBarCode != "")
|
||||
{
|
||||
strSql += " and BarCode like '%" + strBarCode + "%' ";
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
strSql = @" SELECT [ID] ID
|
||||
,[TD] 序号
|
||||
,[WorkShift] 班次
|
||||
,[ArrivalBarCode] 入站条码
|
||||
,[DepartureBarCode] 出站条码
|
||||
,[TMDB] 条码对比
|
||||
,CONVERT(varchar, [OutTime], 120) 出站时间
|
||||
,[CCD1] '正面(2D/3D)'
|
||||
,[CCD2] '反面(2D/3D)'
|
||||
,[CCD3] '左侧面(2D/3D)'
|
||||
,[CCD4] '右侧面(2D/3D)'
|
||||
,[CCD5] '顶面(2D/3D)'
|
||||
,[CCD6] '底面(2D/3D)'
|
||||
,[CCD7] 底WE1
|
||||
,[CCD8] 底WE2
|
||||
,[CCD9] 底WE3
|
||||
,[CCD10] 底WE4
|
||||
,[CCD11] 中ME1
|
||||
,[CCD12] 中ME2
|
||||
,[CCD13] 中ME3
|
||||
,[CCD14] 中ME4
|
||||
,[CCD15] '极柱(POS/NEG)'
|
||||
,[CCD16] '防爆阀(PRO)'
|
||||
,[Result] 综合结果
|
||||
,[Remark] 备注
|
||||
,[Flag] 状态
|
||||
FROM [dbo].[BlankingData] where OutTime >= '" + strDate1 + "' and OutTime <= '" + strDate2 + "' ";
|
||||
if (strBarCode != "")
|
||||
{
|
||||
strSql += " and DepartureBarCode like '%" + strBarCode + "' ";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
DataTable dt = SqlHelper<object>.QueryTable(strSql);
|
||||
return dt;
|
||||
}
|
||||
/// <summary>
|
||||
/// 查询历史数据
|
||||
/// </summary>
|
||||
/// <param name="strBarCode"></param>
|
||||
/// <param name="strDate1"></param>
|
||||
/// <param name="strDate2"></param>
|
||||
/// <returns></returns>
|
||||
public DataTable GetTestData2(int type,int resultType, string strBarCode, string strDate1, string strDate2, string flag)
|
||||
{
|
||||
string strSql = "";
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
strSql = @"SELECT [ID] ID
|
||||
,[TD] 通道
|
||||
,[TDGroup] 主道
|
||||
,[BarCode] 入站条码
|
||||
,CONVERT(varchar, [CreateTime], 120) 进站时间
|
||||
,[Result] 结果
|
||||
,[Remark] 备注
|
||||
,[Flag] 状态
|
||||
FROM [dbo].[FeedingData]
|
||||
where CreateTime >= '" + strDate1 + "' and CreateTime <= '" + strDate2 + "' ";
|
||||
if (strBarCode != "")
|
||||
{
|
||||
strSql += " and BarCode like '%" + strBarCode + "%' ";
|
||||
}
|
||||
if (resultType == 1)
|
||||
{
|
||||
strSql += " and Result ='OK' ";
|
||||
}
|
||||
else if (resultType == 2)
|
||||
{
|
||||
strSql += " and Result = 'NG' ";
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
strSql = @" SELECT [ID] ID
|
||||
,[TD] 序号
|
||||
,[WorkShift] 班次
|
||||
,[TDGroup] 主道
|
||||
,[ArrivalBarCode] 入站条码
|
||||
,[DepartureBarCode] 出站条码
|
||||
,[TMDB] 条码对比
|
||||
,CONVERT(varchar, [OutTime], 120) 出站时间
|
||||
,[CCD1] '正面(2D/3D)'
|
||||
,[CCD2] '反面(2D/3D)'
|
||||
,[CCD3] '左侧面(2D/3D)'
|
||||
,[CCD4] '右侧面(2D/3D)'
|
||||
,[CCD5] '顶面(2D/3D)'
|
||||
,[CCD6] '底面(2D/3D)'
|
||||
,[CCD7] 底WE1
|
||||
,[CCD8] 底WE2
|
||||
,[CCD9] 底WE3
|
||||
,[CCD10] 底WE4
|
||||
,[CCD11] 中ME1
|
||||
,[CCD12] 中ME2
|
||||
,[CCD13] 中ME3
|
||||
,[CCD14] 中ME4
|
||||
,[CCD15] '极柱(POS/NEG)'
|
||||
,[CCD16] '防爆阀(PRO)'
|
||||
,[Result] 综合结果
|
||||
,[Remark] 备注
|
||||
,[Flag] 状态
|
||||
FROM [dbo].[BlankingData] where OutTime >= '" + strDate1 + "' and OutTime <= '" + strDate2 + "' ";
|
||||
if (strBarCode != "")
|
||||
{
|
||||
strSql += " and DepartureBarCode like '%" + strBarCode + "' ";
|
||||
}
|
||||
if(resultType == 1)
|
||||
{
|
||||
strSql += " and Result ='OK' ";
|
||||
}
|
||||
else if (resultType == 2)
|
||||
{
|
||||
strSql += " and Result like '%NG%' ";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
DataTable dt = SqlHelper<object>.QueryTable(strSql);
|
||||
return dt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询CCD数据
|
||||
/// </summary>
|
||||
/// <param name="strWorkerNum"></param>
|
||||
/// <param name="strDate1"></param>
|
||||
/// <param name="strDate2"></param>
|
||||
/// <returns></returns>
|
||||
public DataTable GetCCDData(string strWorkerNum, string strDate1, string strDate2)
|
||||
{
|
||||
|
||||
|
||||
string strSql = string.Format(@"SELECT
|
||||
|
||||
data_run.OrderNum 工单号
|
||||
,data_run.Customer 客户名称
|
||||
,sum(IFNULL(data_run.TotalNum,0)) 投入总数
|
||||
,sum(IFNULL(data_run.OK,0)) 良品总数
|
||||
,sum(IFNULL(data_run.NG,0)) 不良总数
|
||||
,CAST(IFNULL(CONVERT(((CONVERT((sum(IFNULL(data_run.NG,0))),FLOAT)/CONVERT((sum(IFNULL(data_run.TotalNum,0))),FLOAT))*100),DOUBLE),0) as CHAR(10))+'%' 不良率
|
||||
,sum(IFNULL(data_run.CanRepaired,0)) 质量缺陷
|
||||
,sum(IFNULL(data_run.NotRepaired,0)) 非质量缺陷
|
||||
,sum(IFNULL(data_run.OtherNG,0)) 其他不良
|
||||
,sum(IFNULL(data_run.SideNG,0)) 侧面不良
|
||||
,sum(IFNULL(data_run.PositiveNG,0)) 正极不良
|
||||
,sum(IFNULL(data_run.NegativeNG,0)) 负极不良
|
||||
,sum(IFNULL(data_run.ChongheNG,0)) 重合不良
|
||||
,sum(IFNULL(data_run.CodeNG,0)) 喷码不良
|
||||
,sum(IFNULL(data_run.SideDrumpack,0)) 侧面凹坑鼓包、变形
|
||||
,sum(IFNULL(data_run.SideDirty,0)) 侧面脏污漏液
|
||||
,sum(IFNULL(data_run.SideScratches,0)) 侧面凸点、划痕、破皮、膜内异物
|
||||
,sum(IFNULL(data_run.DPNG,0)) 正极面垫不良多放、漏放
|
||||
,sum(IFNULL(data_run.PositiveDamage,0)) 正极套膜不良含热缩不良、破损、褶皱、面垫翘起
|
||||
,sum(IFNULL(data_run.PositiveDirty,0)) 正极套膜脏污
|
||||
,sum(IFNULL(data_run.PositiveScratches,0)) 盖帽不良含漏液、盖帽脏污氧化生锈,划痕,变形
|
||||
,sum(IFNULL(data_run.SizeNG,0)) 负极套膜尺寸不良
|
||||
,sum(IFNULL(data_run.NegativeDamage,0)) 负极套膜不良含套膜褶皱变形、破损、褶皱
|
||||
,sum(IFNULL(data_run.NegativeDirty,0)) 负极套膜脏污
|
||||
,sum(IFNULL(data_run.NegativeScratches,0)) 底部不良含漏液、脏污、氧化生锈、划痕、变形
|
||||
,data_run.Operator 操作员
|
||||
from data_run where data_run.OrderNum='{0}'", strWorkerNum);
|
||||
//from data_run where data_run.Date>='{0}' and data_run.Date<='{1}'", strDate1, strDate2);
|
||||
//if (strWorkerNum != "")
|
||||
//{
|
||||
// strSql += string.Format(@" and data_run.OrderNum='{0}'", strWorkerNum);
|
||||
//}
|
||||
//strSql += " GROUP BY data_run.Class";
|
||||
//date_format(data_run.Date, '%m-%d') 日期
|
||||
// ,data_run.Class 班次
|
||||
// , data_run.Classtype 班别
|
||||
DataTable dt = MySqlHelper<object>.QueryTable(strSql);
|
||||
return dt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按日期查询和时间查询投入产出信息
|
||||
/// </summary>
|
||||
/// <param name="strDate"></param>
|
||||
/// <param name="Hour"></param>
|
||||
/// <returns></returns>
|
||||
public List<HourprodEntity> GetProdTotal(string strDate, int Hour)
|
||||
{
|
||||
string strSql = string.Format(@"SELECT
|
||||
FDate
|
||||
,FHour
|
||||
,ProdIn
|
||||
,ProdOut
|
||||
,TestTime
|
||||
FROM Tb_HourProd where FDate = '{0}'", strDate);
|
||||
if (Hour > 0)
|
||||
{
|
||||
strSql += string.Format(" and FHour={0}", Hour);
|
||||
}
|
||||
var list = SqlHelper<HourprodEntity>.Query(strSql);
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新指定时间的小时产出
|
||||
/// </summary>
|
||||
/// <param name="enity">小时产出数据</param>
|
||||
/// <returns></returns>
|
||||
public int UpdateHourprodData(HourprodEntity enity)
|
||||
{
|
||||
try
|
||||
{
|
||||
string strSql = $@"select 1 from tb_hourprod where FDate='{enity.FDate}' and FHour={enity.FHour}";
|
||||
var obj = SqlHelper<object>.ExecuteScalar(strSql, null);
|
||||
if (obj != null && obj.ToString().Trim() != "")
|
||||
{
|
||||
|
||||
strSql = $@"update tb_hourprod set ProdIn='{enity.ProdIn}',ProdOut='{enity.ProdOut}', TestTime='{DateTime.Now}'
|
||||
where FDate='{enity.FDate}' and FHour={enity.FHour}";
|
||||
}
|
||||
else
|
||||
{
|
||||
strSql = $@"Insert into tb_hourprod(FDate, FHour, ProdIn, ProdOut, TestTime)
|
||||
values ('{enity.FDate}', '{enity.FHour}', '{enity.ProdIn}', '{enity.ProdOut}', '{DateTime.Now}')";
|
||||
}
|
||||
int iresult = SqlHelper<object>.Execute(strSql);
|
||||
return iresult;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存进托盘数据
|
||||
/// </summary>
|
||||
/// <param name="strDate"></param>
|
||||
/// <param name="Hour"></param>
|
||||
/// <returns></returns>
|
||||
public int AddInPutTrayID(TrayTestEntry m, ref string strErr)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存空托盘排出数据
|
||||
/// </summary>
|
||||
/// <param name="strDate"></param>
|
||||
/// <param name="Hour"></param>
|
||||
/// <returns></returns>
|
||||
public int AddOutTrayID(TrayTestEntry m, ref string strErr)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取电芯进站时间
|
||||
/// </summary>
|
||||
/// <param name="m"></param>
|
||||
/// <returns></returns>
|
||||
public DataTable GetBarInTime(string strBar)
|
||||
{
|
||||
DataTable dt = null;
|
||||
try
|
||||
{
|
||||
string strsql = string.Format(@"SELECT Top(1) [BarCode] 条码
|
||||
,CONVERT(varchar, [CreateTime], 120) 进站时间
|
||||
FROM [dbo].[FeedingData]
|
||||
where BarCode='{0}' order by ID DESC", strBar);
|
||||
dt = SqlHelper<object>.QueryTable(strsql);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw ex;
|
||||
}
|
||||
return dt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新获取时间
|
||||
/// </summary>
|
||||
/// <param name="strBar"></param>
|
||||
/// <returns></returns>
|
||||
public int UparInTime(string strBar)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
string strsql = string.Format(@"UPDATE [dbo].[FeedingData] SET [Flag] = 1 WHERE [BarCode]='{0}' and Flag=0", strBar);
|
||||
int iresult = SqlHelper<object>.Execute(strsql);
|
||||
return iresult;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw ex;
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 出站外观数据保存
|
||||
/// </summary>
|
||||
/// <param name="strDate"></param>
|
||||
/// <param name="Hour"></param>
|
||||
/// <returns></returns>
|
||||
public int AddBlankingData(BlankingData m, ref string strErr)
|
||||
{
|
||||
string strSql = string.Format(@"INSERT INTO [dbo].[BlankingData]
|
||||
([TD]
|
||||
,[WorkShift]
|
||||
,[ArrivalBarCode]
|
||||
,[DepartureBarCode]
|
||||
,[TMDB]
|
||||
,[OutTime]
|
||||
,[CCD1]
|
||||
,[CCD2]
|
||||
,[CCD3]
|
||||
,[CCD4]
|
||||
,[CCD5]
|
||||
,[CCD6]
|
||||
,[CCD7]
|
||||
,[CCD8]
|
||||
,[CCD9]
|
||||
,[CCD10]
|
||||
,[CCD11]
|
||||
,[CCD12]
|
||||
,[CCD13]
|
||||
,[CCD14]
|
||||
,[CCD15]
|
||||
,[CCD16]
|
||||
,[Result]
|
||||
,[Remark]
|
||||
,[Flag]
|
||||
,[TDGroup])
|
||||
VALUES");
|
||||
strSql += string.Format("({0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}',{24},{25})",
|
||||
m.TD, m.WorkShift, m.ArrivalBarCode, m.DepartureBarCode, m.TMDB, m.OutTime, m.CCD1, m.CCD2, m.CCD3, m.CCD4, m.CCD5, m.CCD6, m.CCD7, m.CCD8, m.CCD9, m.CCD10, m.CCD11, m.CCD12, m.CCD13, m.CCD14, m.CCD15, m.CCD16
|
||||
, m.Result, m.Remark, m.Flag,m.TDGroup);
|
||||
int list = SqlHelper<BlankingData>.Execute(strSql);
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 电芯分档数据保存
|
||||
/// </summary>
|
||||
/// <param name="strDate"></param>
|
||||
/// <param name="Hour"></param>
|
||||
/// <returns></returns>
|
||||
public int AddFeedingData(FeedingData m, ref string strErr)
|
||||
{
|
||||
string strSql = string.Format(@"INSERT INTO [dbo].[FeedingData] ([TD],[BarCode],[CreateTime],[Result],[Remark],[Flag],[TDGroup])");
|
||||
strSql += string.Format(@" values({0},'{1}','{2}','{3}','{4}',{5},{6})", m.TD, m.BarCode, m.CreateTime, m.Result, m.Remark, m.Flag,m.TDGroup);
|
||||
int list = SqlHelper<FeedingData>.Execute(strSql);
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public int AddCamInforData(CamInfor m, ref string strErr)
|
||||
{
|
||||
string strSql = string.Format(@"INSERT INTO [dbo].[CamInforData] ([TD],[BarCode],[CreateTime],
|
||||
[CCD15],[CCD16],[CCD17],[CCD18],,[CCD19],[CCD20],[CCD21],[CCD22],[CCD23],[CCD24],[CCD25],[CCD26],[CCD27],[CCD28],[CCD29,[CCD30],[CCD31],[CCD32],[CCD33],[CCD34],[CCD35],[CCD36],[CCD37],[CCD38],[Result],[Remark],[Flag])");
|
||||
strSql += string.Format(@" values({0},''{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}','{24}','{25}','{26}','{27}',{28})"
|
||||
, m.TD, m.BarCode, m.CreateTime, m.CCD15, m.CCD16, m.CCD17, m.CCD18, m.CCD19, m.CCD20, m.CCD21, m.CCD22, m.CCD23, m.CCD24, m.CCD25, m.CCD26, m.CCD27, m.CCD28, m.CCD29, m.CCD30, m.CCD31, m.CCD32, m.CCD33, m.CCD34, m.CCD35, m.CCD36, m.CCD37, m.CCD38
|
||||
, m.Result, m.Remark, m.Flag);
|
||||
int list = SqlHelper<CamInfor>.Execute(strSql);
|
||||
return list;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据工位编码获取异常播报内容
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public string GetAbnormalVoice(string code, bool needInsert = false)
|
||||
{
|
||||
string remark = "";
|
||||
try
|
||||
{
|
||||
string strSql = $"select Remark from tb_AbnormalVoice where code='{code}' order by ID desc";
|
||||
DataTable dt = SqlHelper<object>.QueryTable(strSql);
|
||||
if (dt != null && dt.Rows.Count > 0)
|
||||
{
|
||||
remark = Convert.ToString(dt.Rows[0][0]);
|
||||
}
|
||||
else if (needInsert)
|
||||
{
|
||||
strSql = $"insert tb_AbnormalVoice(Code,Remark) values('{code}','')";
|
||||
SqlHelper<object>.Execute(strSql);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
if (string.IsNullOrEmpty(remark))
|
||||
{
|
||||
remark = "没有播报内容,编码" + code;
|
||||
}
|
||||
return remark;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user