change - 班组切换逻辑处理

dev
wenjy 1 year ago
parent b815378d86
commit 6a493fd46c

@ -1398,7 +1398,7 @@
</member>
<member name="P:Admin.Core.Model.BoxFoamDataRecord.Obj_Id">
<summary>
主键
主键SEQ_BOX_FOAMDATARECORD
</summary>
</member>
<member name="P:Admin.Core.Model.BoxFoamDataRecord.ProductLineCode">
@ -1661,6 +1661,11 @@
计划完成数量
</summary>
</member>
<member name="P:Admin.Core.Model.BoxFoamPlan.StationCode">
<summary>
工位编号
</summary>
</member>
<member name="T:Admin.Core.Model.BoxLastShotRecord">
<summary>
获取发泡机最后一枪记录

@ -14,9 +14,9 @@ namespace Admin.Core.Model
public class BoxFoamDataRecord
{
/// <summary>
/// 主键
/// 主键SEQ_BOX_FOAMDATARECORD
/// </summary>
[SugarColumn(ColumnName = "OBJ_ID", IsPrimaryKey = true, IsIdentity = true)]
[SugarColumn(ColumnName = "OBJ_ID", IsPrimaryKey = true, IsIdentity = true, OracleSequenceName = "SEQ_BOX_FOAMDATARECORD")]
public int Obj_Id { get; set; }
/// <summary>
/// 产线 1、2

@ -60,6 +60,12 @@ namespace Admin.Core.Model
/// 计划完成数量
/// </summary>
[SugarColumn(ColumnName = "COMPLATE_AMOUNT")]
public int CompleteAmount { get; set; }
public int CompleteAmount { get; set; }
/// <summary>
/// 工位编号
/// </summary>
[SugarColumn(ColumnName = "STATION_CODE")]
public string StationCode { get;set; }
}
}

@ -41,7 +41,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
{
while (true)
{
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
InitData();
@ -50,7 +50,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
Thread.Sleep(1000 * 5);
};
});
}
@ -77,12 +77,13 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
ListItems1.Clear();
ListItems.Clear();
int count = 0;
DateTime now=DateTime.Now;
CurrentTeamTime time = _currentTeamTimeServices.FirstAsync(d => d.StartTime <= now && d.EndTime >= now).Result;
if (time == null) return;
if (time.TeamName.Equals("早班"))
DateTime now = DateTime.Now;
// 判断当前是否是白班时间段
if (now.Hour >= 8 && now.Hour < 20)
{
List<BoxFoamPlan> list = _boxFoamPlanServices.QueryAsync(d=>d.ShiftType==1).Result;
List<BoxFoamPlan> list = _boxFoamPlanServices.QueryAsync(d => d.ShiftType == 1).Result;
if (list == null) return;
foreach (BoxFoamPlan item in list)
{
@ -95,12 +96,11 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
model.DifferenceValue = item.PlanAmount - item.CompleteAmount;
model.ObjId = item.ObjId;
ListItems.Add(model);
}
}
if (time.TeamName.Equals("晚班"))
else
{
List<BoxFoamPlan> list = _boxFoamPlanServices.QueryAsync(d => d.ShiftType == 1).Result;
if (list == null) return;
foreach (BoxFoamPlan item in list)
@ -113,11 +113,54 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
model.ComplateAmount = item.CompleteAmount;
model.DifferenceValue = item.PlanAmount - item.CompleteAmount;
model.ObjId = item.ObjId;
ListItems1.Add(model);
}
}
#region 原逻辑 Delete By wenjy 2024-01-07 12:24:00
//DateTime now=DateTime.Now;
//CurrentTeamTime time = _currentTeamTimeServices.FirstAsync(d => d.StartTime <= now && d.EndTime >= now).Result;
//if (time == null) return;
//if (time.TeamName.Equals("早班"))
//{
// List<BoxFoamPlan> list = _boxFoamPlanServices.QueryAsync(d=>d.ShiftType==1).Result;
// if (list == null) return;
// foreach (BoxFoamPlan item in list)
// {
// BoxFoamPlanModel model = new BoxFoamPlanModel();
// model.No = ++count;
// model.MaterialCode = item.MaterialCode;
// model.MaterialName = item.MaterialName;
// model.PlanAmount = item.PlanAmount;
// model.ComplateAmount = item.CompleteAmount;
// model.DifferenceValue = item.PlanAmount - item.CompleteAmount;
// model.ObjId = item.ObjId;
// ListItems.Add(model);
// }
//}
//if (time.TeamName.Equals("晚班"))
//{
// List<BoxFoamPlan> list = _boxFoamPlanServices.QueryAsync(d => d.ShiftType == 1).Result;
// if (list == null) return;
// foreach (BoxFoamPlan item in list)
// {
// BoxFoamPlanModel model = new BoxFoamPlanModel();
// model.No = ++count;
// model.MaterialCode = item.MaterialCode;
// model.MaterialName = item.MaterialName;
// model.PlanAmount = item.PlanAmount;
// model.ComplateAmount = item.CompleteAmount;
// model.DifferenceValue = item.PlanAmount - item.CompleteAmount;
// model.ObjId = item.ObjId;
// ListItems1.Add(model);
// }
//}
#endregion
}

@ -10,6 +10,7 @@ using Aucma.Core.OldBoxFoam.Models;
using CommunityToolkit.Mvvm.ComponentModel;
using log4net;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Log4Net.AspNetCore.Extensions;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@ -65,6 +66,9 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
// Thread.Sleep(1000 * 5);
// collection.startCollect();
//});
DayShiftInfoCut();
NightShiftInfoCut();
}
#region 初始化加载数据
@ -247,11 +251,6 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
//{
// ShiftChange(productLineCode);
//}
if(time == null)
{
ShiftChange(productLineCode);
}
}
catch (Exception ex)
{
@ -347,218 +346,442 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
await _boxFoamPlanServices.UpdateAsync(planList);
}
}
private async void ExecHourData(string productLineCode)
#endregion
#region 原计划完工逻辑 Delete By wenjy 2024-01-07 10:11:00
//private async void ExecHourData(string productLineCode)
//{
// try
// {
// List<FixtureStatus> bList = new List<FixtureStatus>();
// var collectionList = Collection.listFixtureStatus;
// if (collectionList.Count == 0) return;
// OldBoxFoamOnLoad(collectionList);
// bList.AddRange(collectionList);
// List<BoxFoamData> bfds = await _oldBoxFoamDataServices.QueryAsync();
// List<OldBoxFoamType> spaceList = await _oldBoxFoamTypeServices.QueryAsync();
// List<BoxFoamPlan> planList = await _boxFoamPlanServices.QueryAsync();
// for (int j = 0; j < bList.Count; j++)
// {
// try
// {
// OldBoxFoamType space = spaceList.FirstOrDefault(d => d.Boxtype == bList[j].FixtureBoxType);
// //根据夹具找货道,根据货道找物料
// if (space != null)
// {
// BoxFoamPlan plan = planList.FirstOrDefault(d => d.MaterialCode == space.MaterialCode && d.PlanAmount > d.CompleteAmount);
// if (plan != null)
// {
// int complateAmount = 0;
// //更新小时数据
// BoxFoamData bfd = bfds.FirstOrDefault(d => d.Fixtureboxtype == bList[j].FixtureBoxType && d.MainId == bList[j].ObjId);
// if (bfd != null)
// {
// //更新计划数量
// complateAmount = bList[j].Yield - bfd.Production;
// UpdateBoxData(bList[j], bfd);
// }
// else
// {
// SaveBoxData(productLineCode, bList[j]);
// }
// plan.CompleteAmount = plan.CompleteAmount + complateAmount;
// await _boxFoamPlanServices.UpdateAsync(plan);
// }
// else
// {
// //更新小时数据
// BoxFoamData bfd = bfds.FirstOrDefault(d => d.Fixtureboxtype == bList[j].FixtureBoxType && d.MainId == bList[j].ObjId);
// if (bfd != null)
// {
// UpdateBoxData(bList[j], bfd);
// }
// else
// {
// SaveBoxData(productLineCode, bList[j]);
// }
// }
// }
// else
// {
// //更新小时数据
// BoxFoamData bfd = bfds.FirstOrDefault(d => d.Fixtureboxtype == bList[j].FixtureBoxType && d.MainId == bList[j].ObjId);
// if (bfd != null)
// {
// UpdateBoxData(bList[j], bfd);
// }
// else
// {
// SaveBoxData(productLineCode, bList[j]);
// }
// }
// }
// catch { }
// }
// }
// catch (Exception ex)
// {
// Console.WriteLine(ex.Message);
// }
//}
//private async void UpdateBoxData(FixtureStatus item, BoxFoamData bfd)
//{
// int hour = GetTeamHour(DateTime.Now).Seq;
// switch (hour)
// {
// case 1:
// bfd.AnHour = item.Yield - bfd.Production;
// break;
// case 2:
// bfd.TwoHour = item.Yield - bfd.Production;
// break;
// case 3:
// bfd.ThreeHour = item.Yield - bfd.Production;
// break;
// case 4:
// bfd.FourHour = item.Yield - bfd.Production;
// break;
// case 5:
// bfd.FiveHour = item.Yield - bfd.Production;
// break;
// case 6:
// bfd.SixHour = item.Yield - bfd.Production;
// break;
// case 7:
// bfd.SevenHour = item.Yield - bfd.Production;
// break;
// case 8:
// bfd.EightHour = item.Yield - bfd.Production;
// break;
// case 9:
// bfd.NineHour = item.Yield - bfd.Production;
// break;
// case 10:
// bfd.TenHour = item.Yield - bfd.Production;
// break;
// case 11:
// bfd.ElevenHour = item.Yield - bfd.Production;
// break;
// case 12:
// bfd.TwelveHour = item.Yield - bfd.Production;
// break;
// default:
// break;
// }
// bfd.Production = item.Yield;
// await _oldBoxFoamDataServices.UpdateAsync(bfd);
//}
//private async void SaveBoxData(string productLineCode, FixtureStatus item)
//{
// BoxFoamData bfdata = new BoxFoamData();
// bfdata.MainId = item.ObjId;
// bfdata.ProductLineCode = productLineCode;
// bfdata.Fixtureboxtype = item.FixtureBoxType;
// bfdata.Fixturestatus = item.Status;
// bfdata.Production = item.Yield;
// bfdata.CuringTimeSettingValue = item.PlanCuringTime.ToString();
// bfdata.ActualValue = item.RealCuringTime.ToString();
// int hour = GetTeamHour(DateTime.Now).Seq;
// switch (hour)
// {
// case 1:
// bfdata.AnHour = item.Yield = bfdata.Production;
// break;
// case 2:
// bfdata.TwoHour = item.Yield = bfdata.Production;
// break;
// case 3:
// bfdata.ThreeHour = item.Yield = bfdata.Production;
// break;
// case 4:
// bfdata.FourHour = item.Yield = bfdata.Production;
// break;
// case 5:
// bfdata.FiveHour = item.Yield = bfdata.Production;
// break;
// case 6:
// bfdata.SixHour = item.Yield = bfdata.Production;
// break;
// case 7:
// bfdata.SevenHour = item.Yield = bfdata.Production;
// break;
// case 8:
// bfdata.EightHour = item.Yield = bfdata.Production;
// break;
// case 9:
// bfdata.NineHour = item.Yield = bfdata.Production;
// break;
// case 10:
// bfdata.TenHour = item.Yield = bfdata.Production;
// break;
// case 11:
// bfdata.ElevenHour = item.Yield = bfdata.Production;
// break;
// case 12:
// bfdata.TwelveHour = item.Yield = bfdata.Production;
// break;
// default:
// break;
// }
// bfdata.MainId = item.ObjId;
// await _oldBoxFoamDataServices.AddAsync(bfdata);
//}
//public CurrentTeamTimeView GetTeamHour()
//{
// DateTime now = DateTime.Now;
// var list = _sysUserInfoServices.GetTeamData().Result;
// if (list != null)
// {
// //var obj = list.FirstOrDefault().EndTime.ToString("HH:mm");
// var view = list.FirstOrDefault();
// return view;
// }
// return null;
//}
//public CurrentTeamTimeView GetTeamHour(DateTime now)
//{
// var obj = _sysUserInfoServices.GetTeamData(now).Result;
// if (obj != null)
// {
// return obj;
// }
// return null;
//}
#endregion
/// <summary>
/// 白班信息切换
/// </summary>
private void DayShiftInfoCut()
{
try
{
List<FixtureStatus> bList = new List<FixtureStatus>();
var collectionList = Collection.listFixtureStatus;
if (collectionList.Count == 0) return;
OldBoxFoamOnLoad(collectionList);
bList.AddRange(collectionList);
List<BoxFoamData> bfds = await _oldBoxFoamDataServices.QueryAsync();
List<OldBoxFoamType> spaceList = await _oldBoxFoamTypeServices.QueryAsync();
List<BoxFoamPlan> planList = await _boxFoamPlanServices.QueryAsync();
for (int j = 0; j < bList.Count; j++)
{
try
{
OldBoxFoamType space = spaceList.FirstOrDefault(d => d.Boxtype == bList[j].FixtureBoxType);
//根据夹具找货道,根据货道找物料
if (space != null)
{
BoxFoamPlan plan = planList.FirstOrDefault(d => d.MaterialCode == space.MaterialCode && d.PlanAmount > d.CompleteAmount);
if (plan != null)
{
int complateAmount = 0;
//更新小时数据
BoxFoamData bfd = bfds.FirstOrDefault(d => d.Fixtureboxtype == bList[j].FixtureBoxType && d.MainId == bList[j].ObjId);
if (bfd != null)
{
//更新计划数量
complateAmount = bList[j].Yield - bfd.Production;
UpdateBoxData(bList[j], bfd);
}
else
{
SaveBoxData(productLineCode, bList[j]);
}
plan.CompleteAmount = plan.CompleteAmount + complateAmount;
await _boxFoamPlanServices.UpdateAsync(plan);
}
else
{
//更新小时数据
BoxFoamData bfd = bfds.FirstOrDefault(d => d.Fixtureboxtype == bList[j].FixtureBoxType && d.MainId == bList[j].ObjId);
if (bfd != null)
{
UpdateBoxData(bList[j], bfd);
}
else
{
SaveBoxData(productLineCode, bList[j]);
}
}
}
else
{
//更新小时数据
BoxFoamData bfd = bfds.FirstOrDefault(d => d.Fixtureboxtype == bList[j].FixtureBoxType && d.MainId == bList[j].ObjId);
if (bfd != null)
{
UpdateBoxData(bList[j], bfd);
}
else
{
SaveBoxData(productLineCode, bList[j]);
}
}
}
catch { }
DateTime now = DateTime.Now;
}
}
catch (Exception ex)
DateTime scheduledTime = new DateTime(now.Year, now.Month, now.Day, 08, 00, 00);
if (now > scheduledTime)
{
Console.WriteLine(ex.Message);
scheduledTime = scheduledTime.AddDays(1);
}
TimeSpan timeToGo = scheduledTime - now;
int dueTime = (int)timeToGo.TotalMilliseconds;
System.Timers.Timer timer = new System.Timers.Timer();
timer.Elapsed += DayShiftTimerCallback;
timer.AutoReset = true;
timer.Interval = dueTime;
timer.Start();
}
private async void UpdateBoxData(FixtureStatus item, BoxFoamData bfd)
private void DayShiftTimerCallback(object sender, ElapsedEventArgs e)
{
int hour = GetTeamHour(DateTime.Now).Seq;
switch (hour)
Console.WriteLine("切换为白班!");
UpdateShiftInfo(1);
#region 重新定义Timer进行第二天执行
DateTime now = DateTime.Now;
DateTime scheduledTime = new DateTime(now.Year, now.Month, now.Day, 08, 00, 00);
if (now > scheduledTime)
{
case 1:
bfd.AnHour = item.Yield - bfd.Production;
break;
case 2:
bfd.TwoHour = item.Yield - bfd.Production;
break;
case 3:
bfd.ThreeHour = item.Yield - bfd.Production;
break;
case 4:
bfd.FourHour = item.Yield - bfd.Production;
break;
case 5:
bfd.FiveHour = item.Yield - bfd.Production;
break;
case 6:
bfd.SixHour = item.Yield - bfd.Production;
break;
case 7:
bfd.SevenHour = item.Yield - bfd.Production;
break;
case 8:
bfd.EightHour = item.Yield - bfd.Production;
break;
case 9:
bfd.NineHour = item.Yield - bfd.Production;
break;
case 10:
bfd.TenHour = item.Yield - bfd.Production;
break;
case 11:
bfd.ElevenHour = item.Yield - bfd.Production;
break;
case 12:
bfd.TwelveHour = item.Yield - bfd.Production;
break;
default:
break;
scheduledTime = scheduledTime.AddDays(1);
}
bfd.Production = item.Yield;
TimeSpan timeToGo = scheduledTime - now;
int dueTime = (int)timeToGo.TotalMilliseconds;
await _oldBoxFoamDataServices.UpdateAsync(bfd);
System.Timers.Timer timer = (System.Timers.Timer)sender;
timer.Elapsed += DayShiftTimerCallback;
timer.AutoReset = true;
timer.Interval = dueTime;
timer.Start();
#endregion
}
private async void SaveBoxData(string productLineCode, FixtureStatus item)
/// <summary>
/// 夜班班组切换
/// </summary>
private void NightShiftInfoCut()
{
BoxFoamData bfdata = new BoxFoamData();
bfdata.MainId = item.ObjId;
bfdata.ProductLineCode = productLineCode;
bfdata.Fixtureboxtype = item.FixtureBoxType;
bfdata.Fixturestatus = item.Status;
bfdata.Production = item.Yield;
bfdata.CuringTimeSettingValue = item.PlanCuringTime.ToString();
bfdata.ActualValue = item.RealCuringTime.ToString();
int hour = GetTeamHour(DateTime.Now).Seq;
switch (hour)
DateTime now = DateTime.Now;
DateTime scheduledTime = new DateTime(now.Year, now.Month, now.Day, 20, 00, 00);
if (now > scheduledTime)
{
case 1:
bfdata.AnHour = item.Yield = bfdata.Production;
break;
case 2:
bfdata.TwoHour = item.Yield = bfdata.Production;
break;
case 3:
bfdata.ThreeHour = item.Yield = bfdata.Production;
break;
case 4:
bfdata.FourHour = item.Yield = bfdata.Production;
break;
case 5:
bfdata.FiveHour = item.Yield = bfdata.Production;
break;
case 6:
bfdata.SixHour = item.Yield = bfdata.Production;
break;
case 7:
bfdata.SevenHour = item.Yield = bfdata.Production;
break;
case 8:
bfdata.EightHour = item.Yield = bfdata.Production;
break;
case 9:
bfdata.NineHour = item.Yield = bfdata.Production;
break;
case 10:
bfdata.TenHour = item.Yield = bfdata.Production;
break;
case 11:
bfdata.ElevenHour = item.Yield = bfdata.Production;
break;
case 12:
bfdata.TwelveHour = item.Yield = bfdata.Production;
break;
default:
break;
scheduledTime = scheduledTime.AddDays(1);
}
bfdata.MainId = item.ObjId;
await _oldBoxFoamDataServices.AddAsync(bfdata);
TimeSpan timeToGo = scheduledTime - now;
int dueTime = (int)timeToGo.TotalMilliseconds;
System.Timers.Timer timer = new System.Timers.Timer();
timer.Elapsed += NightShiftTimerCallback;
timer.AutoReset = true;
timer.Interval = dueTime;
timer.Start();
}
public CurrentTeamTimeView GetTeamHour()
private void NightShiftTimerCallback(object sender, ElapsedEventArgs e)
{
Console.WriteLine("切换为夜班!");
UpdateShiftInfo(2);
#region 重新定义Timer进行第二天执行
DateTime now = DateTime.Now;
var list = _sysUserInfoServices.GetTeamData().Result;
if (list != null)
DateTime scheduledTime = new DateTime(now.Year, now.Month, now.Day, 20, 00, 00);
if (now > scheduledTime)
{
//var obj = list.FirstOrDefault().EndTime.ToString("HH:mm");
var view = list.FirstOrDefault();
return view;
scheduledTime = scheduledTime.AddDays(1);
}
return null;
TimeSpan timeToGo = scheduledTime - now;
int dueTime = (int)timeToGo.TotalMilliseconds;
System.Timers.Timer timer = (System.Timers.Timer)sender;
timer.Elapsed += NightShiftTimerCallback;
timer.AutoReset = true;
timer.Interval = dueTime;
timer.Start();
#endregion
}
public CurrentTeamTimeView GetTeamHour(DateTime now)
/// <summary>
/// 班组切换
/// </summary>
/// <param name="shiftType">班组类型1-白班2-夜班</param>
private void UpdateShiftInfo(int shiftType)
{
var obj = _sysUserInfoServices.GetTeamData(now).Result;
if (obj != null)
log.Warn($"{(shiftType == 1 ? "" :"")}班组切换,开始处理切换逻辑");
try
{
return obj;
}
return null;
}
//下发PLC清空产量信号
#region 清空PLC产量
var obj1 = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1"));
if (obj1 != null)
{
if (obj1.plc.IsConnected)
{
var flag = obj1.plc.WriteInt16("M216", "1");//换班 数据清空
log.Warn($"班组切换清空A区产量数据{(flag == true ? "" : "")}");
}
}
var obj2 = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2"));
if (obj2 != null)
{
if (obj2.plc.IsConnected)
{
bool flag = obj2.plc.WriteInt16("M216", "1");//换班 数据清空
log.Warn($"班组切换清空B区产量数据{(flag == true ? "" : "")}");
}
}
var obj3 = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc3"));
if (obj3 != null)
{
if (obj3.plc.IsConnected)
{
var flag = obj3.plc.WriteInt16("M216", "1");//换班 数据清空
log.Warn($"班组切换清空C区产量数据{(flag == true ? "" : "")}");
}
}
var obj4 = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc4"));
if (obj4 != null)
{
if (obj4.plc.IsConnected)
{
var flag = obj4.plc.WriteInt16("M216", "1");//换班 数据清空
log.Warn($"班组切换清空D区产量数据{(flag == true ? "" : "")}");
}
}
#endregion
//小时统计报表数据存至记录表,清空小时统计报表
#endregion
var hourDataList = _oldBoxFoamDataServices.Query(x => x.ProductLineCode == "CX_01" && x.StationCode == "1005");
List<BoxFoamDataRecord> hourRecordList = new List<BoxFoamDataRecord>();
if (hourDataList != null)
{
foreach (var item in hourDataList)
{
BoxFoamDataRecord hourRecord = new BoxFoamDataRecord();
hourRecord.OrderCode = item.OrderCode;
hourRecord.ProductLineCode = item.ProductLineCode;
hourRecord.Fixturestatus = item.Production;
hourRecord.CuringTimeSettingValue = item.CuringTimeSettingValue;
hourRecord.ActualValue = item.ActualValue;
hourRecord.AnHour = item.AnHour;
hourRecord.TwoHour = item.TwoHour;
hourRecord.ThreeHour = item.ThreeHour;
hourRecord.FourHour = item.FourHour;
hourRecord.FiveHour = item.FiveHour;
hourRecord.SixHour = item.SixHour;
hourRecord.SevenHour = item.SevenHour;
hourRecord.EightHour = item.EightHour;
hourRecord.NineHour = item.NineHour;
hourRecord.TenHour = item.TenHour;
hourRecord.ElevenHour = item.ElevenHour;
hourRecord.TwelveHour = item.TwelveHour;
hourRecord.BoxFixturesideplate = item.BoxFixturesideplate;
hourRecord.BoxClosebetatemperature = item.BoxClosebetatemperature;
hourRecord.BoxBeat = item.BoxBeat;
hourRecord.CreateTime = DateTime.Now;
hourRecordList.Add(hourRecord);
bool deleteFlag = _oldBoxFoamDataServices.DeleteAsync(item).Result;
if (deleteFlag)
{
log.Warn($"{item.Fixtureboxtype}:小时数据清除成功");
}
else
{
log.Warn($"{item.Fixtureboxtype}:小时数据清除失败");
}
}
}
int addFlag = _boxFoamDataRecordServices.AddAsync(hourRecordList).Result;
if (addFlag > 0)
{
log.Warn("班组切换小时数据记录保存成功");
}
else
{
log.Warn("班组切换小时数据记录保存失败");
}
//当班计划班组计划设为0
var planInfoList = _boxFoamPlanServices.Query(x => x.ProductLineCode == "CX_01" && x.StationCode == "1005");
if (planInfoList != null)
{
foreach (var plan in planInfoList)
{
plan.ShiftType = 0;
bool updateFlag = _boxFoamPlanServices.UpdateAsync(plan).Result;
if (updateFlag)
{
log.Warn($"计划:{plan.OrderCode},班组切换标识更新成功");
}
else
{
log.Warn($"计划:{plan.OrderCode},班组切换标识更新失败");
}
}
}
}catch(Exception ex)
{
log.Warn($"{(shiftType == 1 ? "" : "")}班组切换,切换逻辑处理异常:{ex.Message}");
}
}
}
}

@ -107,6 +107,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
plan.MaterialName = _planInfo.MaterialName;
plan.PlanAmount = Convert.ToInt32(TransmitAmount);
plan.ProductLineCode = "CX_01";
plan.StationCode = "1005";
plan.UpdateTime = DateTime.Now;
plan.CreateTime = DateTime.Now;
plan.OrderCode = _planInfo.OrderCode;

@ -43,7 +43,7 @@
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="白班" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<!--<TextBlock Grid.Column="0" Text="白班" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>-->
<!--<TextBlock Grid.Column="1" Text="|" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<TextBlock Grid.Column="2" Text="SCADA" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,10,0"/>-->
</Grid>

Loading…
Cancel
Save