@ -57,6 +57,7 @@ namespace Admin.Core.Service
if ( view . Weighbridge = = "1号地磅" )
{
bool matCode = plcList . plc . WriteInt16 ( "DB110.DBW400.0" , "1" ) ; //执行启动
bool writeDouble = plcList . plc . Writedouble ( "DB110.DBW401.0" , view . Rate ) ; //传入固率
if ( matCode )
{
Hw_SolventErrorPreventionReport report = new Hw_SolventErrorPreventionReport ( )
@ -327,39 +328,26 @@ namespace Admin.Core.Service
/// 拉缸查询
/// </summary>
/// <param name="code"></param>
/// <param name="weighbridge"></param>
/// <returns></returns>
public async Task < WaitePlanView > GetByCylinderCode ( string code , string weighbridge )
{
try
{
var list = await _planRepository . GetDownLoadPlan ( code , weighbridge ) ;
if ( list . Count = = 0 ) return null ;
var plan = list . FirstOrDefault ( ) ;
var hwWeighList = await _hwWeighRepository . GetWaiteMaterial ( plan . Plan_Id ) ;
if ( hwWeighList = = null ) return null ;
var plcList = PlcHelper . siemensList . SingleOrDefault ( d = > d . EquipName . Equals ( "溶剂PLC" ) ) ;
if ( plcList . plc . IsConnected )
{
var list = await _planRepository . GetDownLoadPlan ( code , weighbridge ) ;
if ( list . Count = = 0 ) return null ;
var plan = list . FirstOrDefault ( ) ;
var hwWeighList = await _hwWeighRepository . GetWaiteMaterial ( plan . Plan_Id ) ;
if ( hwWeighList = = null ) return null ;
if ( plcList . plc . IsConnected )
int endStatus = plcList . plc . ReadInt16 ( "DB110.DBW6.0" ) ; //完成信号
if ( endStatus = = 1 )
{
int endStatus = plcList . plc . ReadInt16 ( "DB110.DBW6.0" ) ; //完成信号
if ( endStatus = = 1 )
{
int planNum = plcList . plc . ReadInt16 ( "DB110.DBW2.0" ) ; //执行批次
if ( plan . Plan_Num > plan . Real_Num )
{
var rtPlanList = await _planRepository . QueryAsync ( d = > d . Plan_State = = 3 ) ;
var rtPlan = rtPlanList . FirstOrDefault ( d = > d . Plan_Id = = plan . Plan_Id ) ;
execNum = rtPlan . Exec_Num ;
var hwWeigh = hwWeighList . FirstOrDefault ( d = > d . MID = = execNum ) ;
if ( hwWeigh = = null ) return null ;
return hwWeigh ;
}
}
else
int planNum = plcList . plc . ReadInt16 ( "DB110.DBW2.0" ) ; //执行批次
if ( plan . Plan_Num > plan . Real_Num )
{
var rtPlanList = await _planRepository . QueryAsync ( d = > d . Plan_State = = 3 ) ;
var rtPlan = rtPlanList . FirstOrDefault ( d = > d . Plan_Id = = plan . Plan_Id ) ;
@ -371,8 +359,18 @@ namespace Admin.Core.Service
return hwWeigh ;
}
}
}
else
{
var rtPlanList = await _planRepository . QueryAsync ( d = > d . Plan_State = = 3 ) ;
var rtPlan = rtPlanList . FirstOrDefault ( d = > d . Plan_Id = = plan . Plan_Id ) ;
execNum = rtPlan . Exec_Num ;
var hwWeigh = hwWeighList . FirstOrDefault ( d = > d . MID = = execNum ) ;
if ( hwWeigh = = null ) return null ;
return hwWeigh ;
}
}
return null ;
}
catch ( System . Exception ex )