|
|
|
@ -0,0 +1,598 @@
|
|
|
|
|
using WorkerSynReport.Data;
|
|
|
|
|
|
|
|
|
|
namespace WorkerSynReport.Plc;
|
|
|
|
|
|
|
|
|
|
public class ReportReadDb
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private IDbContextLocal _dbContext;
|
|
|
|
|
private LjLogControl _logControl;
|
|
|
|
|
|
|
|
|
|
public ReportReadDb(IDbContextLocal dbContext)
|
|
|
|
|
{
|
|
|
|
|
_dbContext = dbContext;
|
|
|
|
|
_logControl = new LjLogControl(_dbContext);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 干混料插入日志
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void ReadFeededDry()
|
|
|
|
|
{
|
|
|
|
|
Db2107Helper dB2107Helper = new Db2107Helper();
|
|
|
|
|
var nornalStatus = dB2107Helper.NormalStatus;
|
|
|
|
|
DB2111Helper dB2111Helper = new DB2111Helper();
|
|
|
|
|
//黑粉准备好信号
|
|
|
|
|
if (nornalStatus.spare1)
|
|
|
|
|
{
|
|
|
|
|
FeededDry(1, dB2111Helper.DryDosing_A);
|
|
|
|
|
DB2107WriteHelper.CleanSpare(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nornalStatus.spare2)
|
|
|
|
|
{
|
|
|
|
|
FeededDry(2, dB2111Helper.DryDosing_B);
|
|
|
|
|
DB2107WriteHelper.CleanSpare(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nornalStatus.spare3)
|
|
|
|
|
{
|
|
|
|
|
FeededDry(3, dB2111Helper.DryDosing_C);
|
|
|
|
|
DB2107WriteHelper.CleanSpare(3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nornalStatus.spare4)
|
|
|
|
|
{
|
|
|
|
|
FeededDry(4, dB2111Helper.DryDosing_D);
|
|
|
|
|
DB2107WriteHelper.CleanSpare(4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///热水秤A
|
|
|
|
|
|
|
|
|
|
if (nornalStatus.RdyRpt_W1)
|
|
|
|
|
{
|
|
|
|
|
FeededWaterHA(dB2111Helper.hwReport_A);
|
|
|
|
|
}
|
|
|
|
|
///冷水秤A
|
|
|
|
|
if (nornalStatus.RdyRpt_W2)
|
|
|
|
|
{
|
|
|
|
|
FeededWaterCA(dB2111Helper.cwReport_A);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//热水B
|
|
|
|
|
if (nornalStatus.RdyRpt_W3)
|
|
|
|
|
{
|
|
|
|
|
FeededWaterHB(dB2111Helper.hwReport_B);
|
|
|
|
|
}
|
|
|
|
|
///冷水秤B
|
|
|
|
|
if (nornalStatus.RdyRpt_W4)
|
|
|
|
|
{
|
|
|
|
|
FeededWaterCB(dB2111Helper.cwReport_B);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//热水A
|
|
|
|
|
private void FeededWaterHA(ReportDosEntity entity)
|
|
|
|
|
{
|
|
|
|
|
var actValue = Convert.ToInt32(entity.actValue);
|
|
|
|
|
string logName = $"热水秤A向 [{entity.eqNo}] 加水 {actValue}";
|
|
|
|
|
|
|
|
|
|
_logControl.ManualLogControl(logName, actValue, 2, entity.eqNo, 1);
|
|
|
|
|
DB2107WriteHelper.CleanWater(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FeededWaterCA(ReportDosEntity entity)
|
|
|
|
|
{
|
|
|
|
|
var actValue = Convert.ToInt32(entity.actValue);
|
|
|
|
|
string logName = $"冷水秤A向 [{entity.eqNo}] 加水 {actValue}";
|
|
|
|
|
|
|
|
|
|
_logControl.ManualLogControl(logName, actValue, 2, entity.eqNo, 1);
|
|
|
|
|
DB2107WriteHelper.CleanWater(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void FeededWaterHB(ReportDosEntity entity)
|
|
|
|
|
{
|
|
|
|
|
var actValue = Convert.ToInt32(entity.actValue);
|
|
|
|
|
string logName = $"热水秤B向 [{entity.eqNo+4}] 加水 {actValue}";
|
|
|
|
|
|
|
|
|
|
_logControl.ManualLogControl(logName, actValue, 2, entity.eqNo+4, 1);
|
|
|
|
|
DB2107WriteHelper.CleanWater(3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FeededWaterCB(ReportDosEntity entity)
|
|
|
|
|
{
|
|
|
|
|
var actValue = Convert.ToInt32(entity.actValue);
|
|
|
|
|
string logName = $"冷水秤B向 [{entity.eqNo + 4}] 加水 {actValue}";
|
|
|
|
|
|
|
|
|
|
_logControl.ManualLogControl(logName, actValue, 2, entity.eqNo + 4, 1);
|
|
|
|
|
DB2107WriteHelper.CleanWater(4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 解决算法有问题
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="deviceno"></param>
|
|
|
|
|
/// <param name="entity"></param>
|
|
|
|
|
|
|
|
|
|
private void FeededDry(int deviceno, ReportDosEntity entity)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
int no = deviceno * 2;
|
|
|
|
|
if (entity.eqNo == 1)
|
|
|
|
|
{
|
|
|
|
|
no = no - 1;
|
|
|
|
|
}
|
|
|
|
|
var actValue = Convert.ToInt32(entity.actValue);
|
|
|
|
|
string logName = $"用户[Admin] 螺旋{deviceno}向湿混机 [{no}] 投料 {actValue}";
|
|
|
|
|
|
|
|
|
|
_logControl.ManualLogControl(logName, actValue, 4, no, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ReadReport()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Db2107Helper dB2107Helper = new Db2107Helper();
|
|
|
|
|
NormalStatusEntity normal = dB2107Helper.NormalStatus;
|
|
|
|
|
if (normal.RdyRpt_D1)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertD(1);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.5.6", false);
|
|
|
|
|
}
|
|
|
|
|
if (normal.RdyRpt_D2)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertD(2);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.5.7", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_D3)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertD(3);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.6.0", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_D4)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertD(4);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.6.1", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_G1)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertG(1);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.6.2", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_G2)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertG(2);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.6.3", false);
|
|
|
|
|
}
|
|
|
|
|
if (normal.RdyRpt_G3)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertG(3);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.6.4", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_G4)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertG(4);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.6.5", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_G5)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertG(5);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.6.6", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_G6)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertG(6);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.6.7", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_G7)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertG(7);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.7.0", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_G8)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertG(8);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.7.1", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_M1)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertM(1);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.7.2", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_M2)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertM(2);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.7.3", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_M3)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertM(3);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.7.4", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_M4)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertM(4);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.7.5", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_M5)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertM(5);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.7.6", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_M6)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertM(6);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.7.7", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_M7)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertM(7);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.8.0", false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normal.RdyRpt_M8)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InsertM(8);
|
|
|
|
|
PlcConnect.Instance.Write("DB2107.8.1", false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void InsertD(int no)
|
|
|
|
|
{
|
|
|
|
|
DB2106Helper dB2106 = new DB2106Helper();
|
|
|
|
|
Dryer_ dryer = null;
|
|
|
|
|
switch (no)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
dryer = dB2106.DryReport.Dryer_A;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
dryer = dB2106.DryReport.Dryer_B;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
dryer = dB2106.DryReport.Dryer_C;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
dryer = dB2106.DryReport.Dryer_D;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Report_Dry dry = new Report_Dry();
|
|
|
|
|
List<Report_DryDos_Detail> lsDos = new List<Report_DryDos_Detail>();
|
|
|
|
|
List<Report_DryMixer_Detail> lsMix = new List<Report_DryMixer_Detail>();
|
|
|
|
|
|
|
|
|
|
dry.reportId = Guid.NewGuid().ToString("N");
|
|
|
|
|
dry.recipeCode = 0;
|
|
|
|
|
dry.recipeName = "";
|
|
|
|
|
dry.planCode = 0;
|
|
|
|
|
dry.planName = "";
|
|
|
|
|
dry.recordTime = DateTime.Now;
|
|
|
|
|
dry.dryNo = no;
|
|
|
|
|
dry.Batch = 0;
|
|
|
|
|
|
|
|
|
|
foreach (var item in dryer.Dos)
|
|
|
|
|
{
|
|
|
|
|
if (item.EqNo != 0)
|
|
|
|
|
{
|
|
|
|
|
lsDos.Add(new Report_DryDos_Detail()
|
|
|
|
|
{
|
|
|
|
|
reportId = dry.reportId,
|
|
|
|
|
eqNo = item.EqNo,
|
|
|
|
|
batch = item.Batch,
|
|
|
|
|
matCode = item.MatCode,
|
|
|
|
|
setToler = item.SetToler,
|
|
|
|
|
setValue = item.SetValue,
|
|
|
|
|
actToler = item.ActToler,
|
|
|
|
|
actValue = item.ActValue,
|
|
|
|
|
recordTime = DateTime.Now
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var item in dryer.Mix)
|
|
|
|
|
{
|
|
|
|
|
if (item.EqNo != 0)
|
|
|
|
|
{
|
|
|
|
|
lsMix.Add(new Report_DryMixer_Detail()
|
|
|
|
|
{
|
|
|
|
|
reportId = dry.reportId,
|
|
|
|
|
actCode = item.ActCode,
|
|
|
|
|
eqNo = item.EqNo,
|
|
|
|
|
mixBatch = item.MixBatch,
|
|
|
|
|
mixStep = item.MixStep,
|
|
|
|
|
mixSpeed = item.MixSpeed,
|
|
|
|
|
mixTemp = item.MixTemp,
|
|
|
|
|
mixTime = item.MixTime,
|
|
|
|
|
recordTime = DateTime.Now
|
|
|
|
|
}) ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (lsDos.Any())
|
|
|
|
|
{
|
|
|
|
|
dry.Batch=lsDos.Where(x=>x.batch>0).Select(x=>x.batch).First();
|
|
|
|
|
|
|
|
|
|
_dbContext.Insert(dry);
|
|
|
|
|
_dbContext.InsertRange(lsDos);
|
|
|
|
|
_dbContext.InsertRange(lsMix);
|
|
|
|
|
|
|
|
|
|
// FreeSqlUnit.Instance.Insert(dry).ExecuteAffrows();
|
|
|
|
|
// FreeSqlUnit.Instance.Insert(lsDos).ExecuteAffrows();
|
|
|
|
|
// FreeSqlUnit.Instance.Insert(lsMix).ExecuteAffrows();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void InsertG(int no)
|
|
|
|
|
{
|
|
|
|
|
DB2106Helper dB2106 = new DB2106Helper();
|
|
|
|
|
Gel_ gel = null;
|
|
|
|
|
switch (no)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
gel = dB2106.GelReport.Gel_A;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
gel = dB2106.GelReport.Gel_B;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
gel = dB2106.GelReport.Gel_C;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
gel = dB2106.GelReport.Gel_D;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
gel = dB2106.GelReport.Gel_E;
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
gel = dB2106.GelReport.Gel_F;
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
gel = dB2106.GelReport.Gel_G;
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
gel = dB2106.GelReport.Gel_H;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Report_Gel gelDb = new Report_Gel();
|
|
|
|
|
|
|
|
|
|
gelDb.reportId = Guid.NewGuid().ToString("N");
|
|
|
|
|
gelDb.recipeCode = 0;
|
|
|
|
|
gelDb.recipeName = "";
|
|
|
|
|
gelDb.planCode = 0;
|
|
|
|
|
gelDb.planName = "";
|
|
|
|
|
gelDb.recordTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
gelDb.gelNo = no;
|
|
|
|
|
gelDb.Batch = 0;
|
|
|
|
|
|
|
|
|
|
List<Report_GelDoser_Detail> lsdetail = new List<Report_GelDoser_Detail>();
|
|
|
|
|
List<Report_GelMixing_Detail> lsMixing = new List<Report_GelMixing_Detail>();
|
|
|
|
|
|
|
|
|
|
var dosList = gel.GelDosing;
|
|
|
|
|
foreach (var dos in dosList)
|
|
|
|
|
{
|
|
|
|
|
if (dos.EqNo != 0)
|
|
|
|
|
{
|
|
|
|
|
lsdetail.Add(new Report_GelDoser_Detail()
|
|
|
|
|
{
|
|
|
|
|
eqNo = dos.EqNo,
|
|
|
|
|
batch = dos.Batch,
|
|
|
|
|
matCode = dos.MatCode,
|
|
|
|
|
setValue = dos.SetValue,
|
|
|
|
|
setToler = dos.SetToler,
|
|
|
|
|
actToLer = dos.ActToler,
|
|
|
|
|
actValue = dos.ActValue,
|
|
|
|
|
reportId = gelDb.reportId,
|
|
|
|
|
recordTime = DateTime.Now,
|
|
|
|
|
kinds = 1
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var mixList = gel.GelMixing;
|
|
|
|
|
foreach (var mix in mixList)
|
|
|
|
|
{
|
|
|
|
|
if (mix.EqNo != 0)
|
|
|
|
|
{
|
|
|
|
|
lsMixing.Add(new Report_GelMixing_Detail()
|
|
|
|
|
{
|
|
|
|
|
eqNo = mix.EqNo,
|
|
|
|
|
mixBatch = mix.MixBatch,
|
|
|
|
|
mixStep = mix.MixStep,
|
|
|
|
|
actCode = mix.ActCode,
|
|
|
|
|
mixTime = mix.MixTime,
|
|
|
|
|
mixSpeed = mix.MixSpeed,
|
|
|
|
|
mixTemp = mix.MixTemp,
|
|
|
|
|
reportId = gelDb.reportId,
|
|
|
|
|
recordTime = DateTime.Now,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var hotWater = gel.HotWater;
|
|
|
|
|
if (hotWater != null)
|
|
|
|
|
{
|
|
|
|
|
lsdetail.Add(new Report_GelDoser_Detail()
|
|
|
|
|
{
|
|
|
|
|
eqNo = hotWater.EqNo,
|
|
|
|
|
batch = hotWater.Batch,
|
|
|
|
|
matCode = hotWater.MatCode,
|
|
|
|
|
setValue = hotWater.SetValue,
|
|
|
|
|
setToler = hotWater.SetToler,
|
|
|
|
|
actToLer = hotWater.ActToler,
|
|
|
|
|
actValue = hotWater.ActValue,
|
|
|
|
|
reportId = gelDb.reportId,
|
|
|
|
|
recordTime = DateTime.Now,
|
|
|
|
|
kinds = 2
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var coolWater = gel.CoolWater;
|
|
|
|
|
if (coolWater != null)
|
|
|
|
|
{
|
|
|
|
|
lsdetail.Add(new Report_GelDoser_Detail()
|
|
|
|
|
{
|
|
|
|
|
eqNo = coolWater.EqNo,
|
|
|
|
|
batch = coolWater.Batch,
|
|
|
|
|
matCode = coolWater.MatCode,
|
|
|
|
|
setValue = coolWater.SetValue,
|
|
|
|
|
setToler = coolWater.SetToler,
|
|
|
|
|
actToLer = coolWater.ActToler,
|
|
|
|
|
actValue = coolWater.ActValue,
|
|
|
|
|
reportId = gelDb.reportId,
|
|
|
|
|
recordTime = DateTime.Now,
|
|
|
|
|
kinds = 3
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(null!= lsdetail && lsdetail.Any())
|
|
|
|
|
{
|
|
|
|
|
gelDb.Batch = lsdetail.Select(x => x.batch).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_dbContext.Insert(gelDb);
|
|
|
|
|
_dbContext.InsertRange(lsdetail);
|
|
|
|
|
_dbContext.InsertRange(lsMixing);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void InsertM(int no)
|
|
|
|
|
{
|
|
|
|
|
DB2106Helper dB2106 = new DB2106Helper();
|
|
|
|
|
List<Report_WMixE> ls = null;
|
|
|
|
|
switch (no)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
ls = dB2106.WetReport.WetMixing_A;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
ls = dB2106.WetReport.WetMixing_B;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
ls = dB2106.WetReport.WetMixing_C;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
ls = dB2106.WetReport.WetMixing_D;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
ls = dB2106.WetReport.WetMixing_E;
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
ls = dB2106.WetReport.WetMixing_F;
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
ls = dB2106.WetReport.WetMixing_G;
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
|
|
|
|
ls = dB2106.WetReport.WetMixing_H;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Report_WetMixer report = new Report_WetMixer();
|
|
|
|
|
|
|
|
|
|
report.reportId = Guid.NewGuid().ToString("N");
|
|
|
|
|
report.recipeCode = 0;
|
|
|
|
|
report.recipeName = "";
|
|
|
|
|
report.planCode = 0;
|
|
|
|
|
report.planName = "";
|
|
|
|
|
report.recordTime = DateTime.Now;
|
|
|
|
|
report.reportTime = DateTime.Now;
|
|
|
|
|
report.WetNo = no;
|
|
|
|
|
report.Batch = report.Batch;
|
|
|
|
|
|
|
|
|
|
List<Report_WetMixer_Detail> lde = new List<Report_WetMixer_Detail>();
|
|
|
|
|
foreach (var item in ls)
|
|
|
|
|
{
|
|
|
|
|
if (item.EqNo != 0)
|
|
|
|
|
{
|
|
|
|
|
lde.Add(new Report_WetMixer_Detail()
|
|
|
|
|
{
|
|
|
|
|
recordTime = DateTime.Now,
|
|
|
|
|
reportId = report.reportId,
|
|
|
|
|
eqNo = item.EqNo,
|
|
|
|
|
mixBatch = item.MixBatch,
|
|
|
|
|
mixSpeed = item.MixSpeed,
|
|
|
|
|
actCode = item.ActCode,
|
|
|
|
|
mixTemp = item.MixTemp,
|
|
|
|
|
mixStep = item.MixStep,
|
|
|
|
|
mixTime = item.MixTime,
|
|
|
|
|
actTolerence = item.ActTolerence,
|
|
|
|
|
actWeight = item.ActWeight,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(lde.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
report.Batch=lde.Select(x=>x.mixBatch).First();
|
|
|
|
|
this._dbContext.Insert(report);
|
|
|
|
|
this._dbContext.InsertRange(lde);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|