合并代码

main
CaesarBao 1 month ago
commit 1495c20b1f

@ -90,7 +90,7 @@ public class MesDownLoadPlanList
/// <summary>
/// 反应釜编号
/// </summary>
public string MainId { get; set; }
public string MainId { get; set; } = string.Empty;
}

@ -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();
@ -172,7 +172,7 @@ namespace Admin.Core.Service
string strSql = "SELECT MAX(Plan_Serial) FROM RT_plan";
Expression<Func<RT_plan, bool>> exp = s1 => true;
Expression<Func<RT_plan, object>> 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,12 +680,12 @@ namespace Admin.Core.Service
try
{
var list = MesDownLoadPlanList;
List <Hw_WareHouse_Sub> subList = new List<Hw_WareHouse_Sub>();
List<Hw_WareHouse_Sub> subList = new List<Hw_WareHouse_Sub>();
List<xl_recipe> recipeList = new List<xl_recipe>();
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);
@ -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,7 +968,7 @@ 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);
@ -1068,8 +1068,8 @@ namespace Admin.Core.Service
}
else
{
log.Error(result.Message+",读取失败!");
return WeightNo+"称,读取失败!";
log.Error(result.Message + ",读取失败!");
return WeightNo + "称,读取失败!";
}
//return WeightInfo;
@ -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,9 +1342,9 @@ namespace Admin.Core.Service
public async Task<List<string>> 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();
return planList.ToList();

Loading…
Cancel
Save