diff --git a/Admin.Core.Api/Admin.Core.Api.csproj b/Admin.Core.Api/Admin.Core.Api.csproj
index 836d1f9..09a0a83 100644
--- a/Admin.Core.Api/Admin.Core.Api.csproj
+++ b/Admin.Core.Api/Admin.Core.Api.csproj
@@ -59,6 +59,6 @@
-
+
diff --git a/Admin.Core.Api/Controllers/Business/SolventController.cs b/Admin.Core.Api/Controllers/Business/SolventController.cs
index 8da7f23..6260195 100644
--- a/Admin.Core.Api/Controllers/Business/SolventController.cs
+++ b/Admin.Core.Api/Controllers/Business/SolventController.cs
@@ -72,7 +72,7 @@ namespace Admin.Core.Api
{
return Failed("传入参数为空!");
}
- view.Weighbridge = "1号地磅";
+
var result = await _solventServices.ExecPlcState(view);
if (result)
{
diff --git a/Admin.Core.Api/appsettings.Development.json b/Admin.Core.Api/appsettings.Development.json
index f8ae61e..3123b80 100644
--- a/Admin.Core.Api/appsettings.Development.json
+++ b/Admin.Core.Api/appsettings.Development.json
@@ -80,8 +80,8 @@
"DBType": 1,
"Enabled": true,
"HitRate": 50,
- //"Connection": "Data Source=121.36.58.109;Initial Catalog=cwss_xl;User ID=sa;Password=haiwei@123;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
"Connection": "Data Source=192.168.10.50;Initial Catalog=cwss_xl;User ID=sa;Password=sa;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+ //"Connection": "Data Source=192.168.10.50;Initial Catalog=cwss_xl;User ID=sa;Password=sa;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
"ProviderName": "System.Data.SqlClient"
}
],
diff --git a/Admin.Core.Api/appsettings.json b/Admin.Core.Api/appsettings.json
index 7e7f1e2..3123b80 100644
--- a/Admin.Core.Api/appsettings.json
+++ b/Admin.Core.Api/appsettings.json
@@ -81,6 +81,7 @@
"Enabled": true,
"HitRate": 50,
"Connection": "Data Source=192.168.10.50;Initial Catalog=cwss_xl;User ID=sa;Password=sa;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+ //"Connection": "Data Source=192.168.10.50;Initial Catalog=cwss_xl;User ID=sa;Password=sa;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
"ProviderName": "System.Data.SqlClient"
}
],
diff --git a/Admin.Core.Repository/Repository_New/RT_planRepository.cs b/Admin.Core.Repository/Repository_New/RT_planRepository.cs
index e195922..ab27c82 100644
--- a/Admin.Core.Repository/Repository_New/RT_planRepository.cs
+++ b/Admin.Core.Repository/Repository_New/RT_planRepository.cs
@@ -24,20 +24,14 @@ namespace Admin.Core.Repository
///
public async Task> GetDownLoadPlan(string cylinderBarCode,string weighbridge)
{
- string sql = @"select w.Weight_Id MID,p.Plan_Id,p.Plan_Num,p.Real_Num,p.Plan_Serial,p.Plan_State,p.Plan_Date,p.Plan_StateText,r.ID as RecipeID,r.Recipe_Serial,r.Recipe_Name,r.Version,r.Recipe_Verify,r.Total_Weight,r.Total_Error,
+ string sql = string.Empty;
+
+ sql = @"select w.Weight_Id MID,p.Plan_Id,p.Plan_Num,p.Real_Num,p.Plan_Serial,p.Plan_State,p.Plan_Date,p.Plan_StateText,r.ID as RecipeID,r.Recipe_Serial,r.Recipe_Name,r.Version,r.Recipe_Verify,r.Total_Weight,r.Total_Error,
m.ID as MaterialID,m.Material_name,m.Material_code,w.Set_Weight,w.Set_Error,p.Exec_Num
from RT_plan p left join Pmt_recipe r on p.Recipe_ID=r.ID left join Pmt_weigh w on r.ID=w.Recipe_ID
left join Pmt_material m on w.Material_ID=m.ID where p.Plan_State=3 and Weighbridge= @Weighbridge ORDER BY w.Weight_Id";
- SugarParameter[] parameters = new SugarParameter[]
- {
- //new SugarParameter($"@CylinderBarCode", cylinderBarCode),
- new SugarParameter($"@Weighbridge", weighbridge)
- };
-
- //var r = await Db.SqlQueryable(sql).AddParameters(new SugarParameter[]{
- // new SugarParameter("@Plan_Id", plan_Id)
- // });
+ SugarParameter[] parameters = new SugarParameter[] { new SugarParameter($"@Weighbridge", weighbridge) };
var r = await Db.Ado.SqlQueryAsync(sql, parameters);
return r;
}
diff --git a/Admin.Core.Service/Service_New/SolventServices.cs b/Admin.Core.Service/Service_New/SolventServices.cs
index 159fa0b..9928b49 100644
--- a/Admin.Core.Service/Service_New/SolventServices.cs
+++ b/Admin.Core.Service/Service_New/SolventServices.cs
@@ -61,13 +61,8 @@ namespace Admin.Core.Service
int rate = Convert.ToInt32(view.Rate * 100);
bool rr=plcList.plc.WriteInt16("DB110.DBW10.0", rate.ToString());//传入固率
bool barCode = plcList.plc.WriteInt16("DB110.DBW1768.0", "1");
- // bool matCode = plcList.plc.WriteInt16("DB110.DBW482.0", "1");//执行启动
-
if (barCode)
{
-
- //log.Info(view.Rate + "&" + rate);
-
Hw_SolventErrorPreventionReport report = new Hw_SolventErrorPreventionReport()
{
PlanId = view.Plan_Id,
@@ -82,6 +77,11 @@ namespace Admin.Core.Service
var rtPlanList = await _planRepository.QueryAsync(d => d.Plan_State == 3);
if (rtPlanList.Count > 0)
{
+ if (string.IsNullOrEmpty(view.Plan_Id))
+ {
+ var r= rtPlanList.FirstOrDefault();
+ view.Plan_Id = r.Plan_Id;
+ }
var rtPlan = rtPlanList.FirstOrDefault(d => d.Plan_Id == view.Plan_Id);
if (plcList.plc.ReadInt16("DB110.DBW8") != 250)
@@ -103,7 +103,16 @@ namespace Admin.Core.Service
// rtPlan.Exec_Num = 1;
// }
//}
- rtPlan.Exec_Num = plcList.plc.ReadInt16("DB110.DBW1758.0");
+ var num = plcList.plc.ReadInt16("DB110.DBW1758.0");
+ if (num==0)
+ {
+ rtPlan.Exec_Num = 1;
+ }
+ else
+ {
+ rtPlan.Exec_Num = num;
+ }
+ //rtPlan.Exec_Num = plcList.plc.ReadInt16("DB110.DBW1758.0");
//保存本次数据
int i = await _solventErrorPreventionReportRepository.AddAsync(report);
var cylinderList = _hwCylinderRepository.Query();
@@ -111,11 +120,22 @@ namespace Admin.Core.Service
{
return false;
}
- Hw_Cylinder hw_Cylinder = cylinderList.FirstOrDefault(d => d.BarCode == view.CylinderBarCode.Trim());
- rtPlan.CylinderName = hw_Cylinder.Name;
- rtPlan.CylinderBarCode = hw_Cylinder.BarCode;
- log.Info(view.CylinderBarCode);
- await _planRepository.UpdateExecDb(rtPlan);//更新数据库
+ if (view.CylinderBarCode.Trim()=="00000000")
+ {
+
+ rtPlan.CylinderName = "00000000";
+ rtPlan.CylinderBarCode = "00000000";
+ await _planRepository.UpdateExecDb(rtPlan);//更新数据库
+ }
+ else
+ {
+ Hw_Cylinder hw_Cylinder = cylinderList.FirstOrDefault(d => d.BarCode == view.CylinderBarCode.Trim());
+ rtPlan.CylinderName = hw_Cylinder.Name;
+ rtPlan.CylinderBarCode = hw_Cylinder.BarCode;
+ log.Info(view.CylinderBarCode);
+ await _planRepository.UpdateExecDb(rtPlan);//更新数据库
+ }
+
return true;
}
}
@@ -168,7 +188,16 @@ namespace Admin.Core.Service
// rtPlan.Exec_Num = 1;
// }
//}
- rtPlan.Exec_Num = plcList.plc.ReadInt16("DB110.DBW1758.0");
+ var num = plcList.plc.ReadInt16("DB110.DBW1758.0");
+ if (num == 0)
+ {
+ rtPlan.Exec_Num = 1;
+ }
+ else
+ {
+ rtPlan.Exec_Num = num;
+ }
+
//保存本次数据
int i = await _solventErrorPreventionReportRepository.AddAsync(report);
var cylinderList = _hwCylinderRepository.Query();
@@ -354,14 +383,14 @@ namespace Admin.Core.Service
var plcList = PlcHelper.siemensList.SingleOrDefault(d => d.EquipName.Equals("溶剂PLC"));
if (plcList.plc.IsConnected)
{
- if (weighbridge== "1号地磅")
+ if (weighbridge == "1号地磅")
{
int planNum = plcList.plc.ReadInt16("DB110.DBW2.0");//执行批次
if (plan.Plan_Num > planNum)
{
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;
+
int materialNo = plcList.plc.ReadInt16("DB110.DBW1758");//当前执行物料
if (materialNo == 0) materialNo = 1;
var hwWeigh = hwWeighList.FirstOrDefault(d => d.MID == materialNo);
@@ -371,13 +400,6 @@ namespace Admin.Core.Service
}
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;
- //int materialNo = plcList.plc.ReadInt16("DB110.DBW478.0");//当前执行物料
- //var hwWeigh = hwWeighList.FirstOrDefault(d => d.MID == materialNo);
- //if (hwWeigh == null) return null;
-
return null;
}
}
@@ -397,17 +419,9 @@ namespace Admin.Core.Service
}
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;
- //int materialNo = plcList.plc.ReadInt16("DB110.DBW478.0");//当前执行物料
- //var hwWeigh = hwWeighList.FirstOrDefault(d => d.MID == materialNo);
- //if (hwWeigh == null) return null;
-
return null;
}
}
-
}
else
{