diff --git a/Admin.Core.Model/ViewModels/MesDownLoadPlanList.cs b/Admin.Core.Model/ViewModels/MesDownLoadPlanList.cs
index 56cc39a..c37613f 100644
--- a/Admin.Core.Model/ViewModels/MesDownLoadPlanList.cs
+++ b/Admin.Core.Model/ViewModels/MesDownLoadPlanList.cs
@@ -90,7 +90,7 @@ public class MesDownLoadPlanList
///
/// 反应釜编号
///
- public string MainId { get; set; }
+ public string MainId { get; set; } = string.Empty;
}
\ No newline at end of file
diff --git a/Admin.Core.Service/Service_New/Hw_WarehouseServices.cs b/Admin.Core.Service/Service_New/Hw_WarehouseServices.cs
index 5017230..4f9bfb1 100644
--- a/Admin.Core.Service/Service_New/Hw_WarehouseServices.cs
+++ b/Admin.Core.Service/Service_New/Hw_WarehouseServices.cs
@@ -46,7 +46,7 @@ namespace Admin.Core.Service
private readonly IXLPlan_weightRepository _XLPlan_weightRepository;
- public Hw_WarehouseServices(IBaseRepository dal, IHw_WarehouseRepository wareHouse,
+ public Hw_WarehouseServices(IBaseRepository dal, IHw_WarehouseRepository wareHouse,
IHw_WareHouse_SubRepository wareHouse_Sub, IHw_FeedReportRepository feed,
IHw_BarrelRepository barrel, Ixl_materialRepository materialRepository,
Ixl_recipeRepository recipeRepository, ILR_weighRepository lrWeighRepository, Ixl_planRepository planRepository, IXLPlan_weightRepository IXLPlan_weightRepository, IXLPlan_weightRepository xLPlan_weightRepository, IPmt_materialRepository PmtmaterialRepository, IHw_PumpRepository hwPumpRepository, IRT_planRepository rtplanRepository, IPmt_recipeRepository pmtRecipeRepository, IUnitOfWork unitOfWork, IPmt_weighRepository pmtWeighRepository, IPmt_BinRepository binRepository, Ixl_weighRepository xlWeighRepository)
@@ -107,7 +107,7 @@ namespace Admin.Core.Service
list.Add(childView);
}
var kettle = await _dal.FirstAsync(d => d.BarCode.Equals(kettleBarCode));
- var subList = await _wareHouse_Sub.QueryAsync(d => d.MainId == kettle.ID && d.PId.Equals(planId) &&d.MaterialType.Contains("尾料"));
+ var subList = await _wareHouse_Sub.QueryAsync(d => d.MainId == kettle.ID && d.PId.Equals(planId) && d.MaterialType.Contains("尾料"));
foreach (var check in list)
{
MaterialView childView = new MaterialView();
@@ -119,7 +119,7 @@ namespace Admin.Core.Service
if (pList == null)
{
childView.MatchOrNot = 0;
- materList.Add(childView);
+ materList.Add(childView);
continue;
}
foreach (var item in pList)
@@ -168,11 +168,11 @@ namespace Admin.Core.Service
/// 返回可用的序号
public int GetNextSerialNumAsync()
{
-
+
string strSql = "SELECT MAX(Plan_Serial) FROM RT_plan";
Expression> exp = s1 => true;
Expression> order = (x) => x.Plan_Serial;
- var result = _rtplanRepository.Query(exp,order,false).First();
+ var result = _rtplanRepository.Query(exp, order, false).First();
if (result == null)
{
return 1;
@@ -284,7 +284,7 @@ namespace Admin.Core.Service
list.ForEach((a) =>
{
Hw_WareHouse_Sub sb = new Hw_WareHouse_Sub();
- sb.MainId = int.TryParse(a.MainId, out int value) ? value : throw new Exception("MainID格式错误!请传入int类型的反应釜编号");
+ //sb.MainId = int.TryParse(a.MainId, out int value) ? value : throw new Exception("MainID格式错误!请传入int类型的反应釜编号");
sb.PId = a.PId;
sb.ProductName = a.ProductName;
sb.MaterialID = a.Material_Code;
@@ -492,7 +492,7 @@ namespace Admin.Core.Service
list.ForEach((a) =>
{
Hw_WareHouse_Sub sb = new Hw_WareHouse_Sub();
- sb.MainId = int.TryParse(a.MainId, out int value) ? value : throw new Exception("MainID格式错误!请传入int类型的反应釜编号");
+ //sb.MainId = int.TryParse(a.MainId, out int value) ? value : throw new Exception("MainID格式错误!请传入int类型的反应釜编号");
sb.PId = a.PId;
sb.ProductName = a.ProductName;
sb.MaterialID = a.Material_Code;
@@ -680,16 +680,16 @@ namespace Admin.Core.Service
try
{
var list = MesDownLoadPlanList;
- List subList = new List();
+ List subList = new List();
List recipeList = new List();
list.ForEach((a) =>
{
Hw_WareHouse_Sub sb = new Hw_WareHouse_Sub();
- sb.MainId = int.TryParse(a.MainId, out int value) ? value : throw new Exception("MainID格式错误!请传入int类型的反应釜编号");
+ //sb.MainId = int.TryParse(a.MainId, out int value) ? value : throw new Exception("MainID格式错误!请传入int类型的反应釜编号");
sb.PId = a.PId;
sb.ProductName = a.ProductName;
sb.BinId = a.BinId == "" || a.BinId == null ? 0 : int.Parse(a.BinId);
-
+
sb.MaterialID = a.Material_Code;
sb.Material_Code = a.Material_Code;
sb.MaterialName = a.MaterialName;
@@ -707,14 +707,14 @@ namespace Admin.Core.Service
//查询小料数据
var xlList = subList.Where(d => d.MaterialType.Contains("尾料")).ToList();
var xt = (from d in xlList
- select new
- {
- d.PId,
- d.ProductName,
- d.MaterialType,
- d.Recipe,
+ select new
+ {
+ d.PId,
+ d.ProductName,
+ d.MaterialType,
+ d.Recipe,
- }).Distinct();
+ }).Distinct();
foreach (var item in xt)
{
try
@@ -878,7 +878,7 @@ namespace Admin.Core.Service
///
///
///
- public bool SaveRecipe(Pmt_recipe recipeList, List pmt_weighList, RT_plan plan, List sub)
+ public bool SaveRecipe(Pmt_recipe recipeList, List pmt_weighList, RT_plan plan, List sub)
{
try
{
@@ -895,14 +895,14 @@ namespace Admin.Core.Service
var iflag2 = _pmtWeighRepository.Add(pmt_weighList);
if (iflag2 < 1)
throw new Exception("保存配方物料失败!");
-
+
return true;
}
catch (Exception ex)
{
return false;
}
-
+
}
public bool SaveXLRecipe(xl_recipe recipeList, List pmt_weighList, xl_plan plan, List sub)
{
@@ -954,7 +954,7 @@ namespace Admin.Core.Service
{
Hw_Warehouse wh = await _wareHouse.FirstAsync(d => d.BarCode == code);
if (wh == null) return null;
- var sub = await _wareHouse_Sub.QueryAsync(d => d.MainId == wh.ID&& d.PId== planId&&(d.MaterialType.Contains("整包")|| d.MaterialType.Contains("尾料")));
+ var sub = await _wareHouse_Sub.QueryAsync(d => d.MainId == wh.ID && d.PId == planId && (d.MaterialType.Contains("整包") || d.MaterialType.Contains("尾料")));
if (sub.Count == 0) return null;
sub.ForEach(sub =>
{
@@ -968,18 +968,18 @@ namespace Admin.Core.Service
view.MaterialName = sub.MaterialName;
view.BinId = sub.BinId;
view.MaterialType = sub.MaterialType;
- view.SetWeight = sub.SetWeight- sub.Tare;//设置重量减去皮重
+ view.SetWeight = sub.SetWeight - sub.Tare;//设置重量减去皮重
view.SetError = sub.SetError;
view.Tare = sub.Tare;
list.Add(view);
});
- WarehouseView warehouseView = new WarehouseView()
+ WarehouseView warehouseView = new WarehouseView()
{
ID = wh.ID,
Name = wh.Name,
BarCode = wh.BarCode,
Children = list
- };
+ };
return warehouseView;
}
@@ -1068,8 +1068,8 @@ namespace Admin.Core.Service
}
else
{
- log.Error(result.Message+",读取失败!");
- return WeightNo+"称,读取失败!";
+ log.Error(result.Message + ",读取失败!");
+ return WeightNo + "称,读取失败!";
}
//return WeightInfo;
@@ -1259,7 +1259,7 @@ namespace Admin.Core.Service
try
{
log.Info("开始投料");
-
+
#region 记录数据
//同时记录该扫码到数据库中
wh = await _wareHouse.FirstAsync(d => d.BarCode == view.KCode);
@@ -1306,13 +1306,13 @@ namespace Admin.Core.Service
return false;
}
var s7 = PlcConnect.Instance;
- var result = s7.Write(name,short.Parse(view.State.ToString()));//反应釜点位
+ var result = s7.Write(name, short.Parse(view.State.ToString()));//反应釜点位
log.Error($"反应釜开启点位状态:{result.IsSuccess},返回信息:{result.Message}");
if (result.IsSuccess)
{
if (view.State == 1)
{
- foreach (var item in view.Child.Where(d=>d.MatType== "散装"))
+ foreach (var item in view.Child.Where(d => d.MatType == "散装"))
{
}
@@ -1342,11 +1342,11 @@ namespace Admin.Core.Service
public async Task> GetWarehousePlan(string code)
{
- Hw_Warehouse wh = await _wareHouse.FirstAsync(d=>d.BarCode== code.Trim());
- if (wh==null) return null;
- var list = await _wareHouse_Sub.QueryAsync(d=>d.MainId== wh.ID);
+ Hw_Warehouse wh = await _wareHouse.FirstAsync(d => d.BarCode == code.Trim());
+ if (wh == null) return null;
+ var list = await _wareHouse_Sub.QueryAsync(d => d.MainId == wh.ID);
var planList = (from d in list
- select d.PId).Distinct();
+ select d.PId).Distinct();
return planList.ToList();
}
#endregion