change - 老线发泡夹具数据采集、计划完工、小时统计修改

dev
wenjy 1 year ago
parent 17481e6155
commit 5be0787959

@ -652,6 +652,11 @@ namespace Admin.Core.Repository
{
var insert = _db.Insertable(entity);
if(insert == null)
{
return 0;
}
return insert.ExecuteReturnIdentity();
}

@ -54,17 +54,17 @@ namespace Admin.Core.Service.Service_New
foreach(var item in fixture)
{
//获取当前工位,前一条数据
var lastFixtureList = _dal.Query(x => x.ProductionLine == "CX_01" && x.StationCode == "1002" && x.FixtureCode == item.FixtureCode);
var lastFixtureList = _dal.Query(x => x.ProductionLine == "CX_01" && x.StationCode == "1005" && x.FixtureCode == item.FixtureCode);
if(lastFixtureList != null)
{
if(lastFixtureList.Count > 0)
if (lastFixtureList.Count > 0)
{
RecordBoxFoamFixtureComplate lastFixtureComplate = lastFixtureList.OrderByDescending(x => x.RecordTime).First();
if(lastFixtureComplate != null)
if (lastFixtureComplate != null)
{
if(item.FixtureBoxType == lastFixtureComplate.FixtureBoxType)
if (item.FixtureBoxType == lastFixtureComplate.FixtureBoxType)
{
if (item.FixtureOutPut > lastFixtureComplate.FixtureOutPut)
{
@ -72,14 +72,20 @@ namespace Admin.Core.Service.Service_New
//更新生产计划
UpdatePlanInfo(item);
_dal.Add(item);
//更新小时数据
UpdateHourInfo(item);
break;
}
}
}
}
}
var addResult = _dal.Add(item);
_dal.Add(item);
//更新小时数据
UpdateHourInfo(item);
}
@ -102,15 +108,14 @@ namespace Admin.Core.Service.Service_New
{
try
{
//可以完工执行计划
var boxFoamTypeList = _boxFoamTypeServices.Query(x => x.Boxtype == item.FixtureBoxType); //MaterialCode物料型号
if (boxFoamTypeList != null)
{
if (boxFoamTypeList.Count > 0)
{
var boxFoamType = boxFoamTypeList.First();
if (boxFoamType != null)
foreach (var boxFoamType in boxFoamTypeList)
{
var boxPlanList = _boxFoamPlanServices.Query(x => x.MaterialCode == boxFoamType.MaterialCode && x.PlanAmount > x.CompleteAmount);
if (boxPlanList != null)
@ -132,11 +137,14 @@ namespace Admin.Core.Service.Service_New
{
Console.WriteLine("生产计划更新失败");
}
}
break;
}
}
}
}
}
}
}catch (Exception ex)

@ -111,7 +111,7 @@ namespace Aucma.Core.OldBoxFoam.Business
fixtureComplates.Add(new RecordBoxFoamFixtureComplate()
{
ProductionLine = "CX_01",
StationCode = "1002",
StationCode = "1005",
FixtureCode = x.ObjId,
FixtureBoxType = x.FixtureBoxType,
FixtureStatus = x.Status,

@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
@ -26,15 +27,33 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
{
protected readonly IBoxFoamPlanServices? _boxFoamPlanServices;
private readonly ICurrentTeamTimeServices _currentTeamTimeServices;
public Collection collect= new Collection();
private Collection collection = new Collection();
public FoamPlanPageViewModel()
{
_boxFoamPlanServices = App.ServiceProvider.GetService<IBoxFoamPlanServices>();
_currentTeamTimeServices = App.ServiceProvider.GetService<ICurrentTeamTimeServices>();
WeakReferenceMessenger.Default.Register<string>(this, Recive);
InitData();
//InitData();
Task.Run(() =>
{
while (true)
{
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
InitData();
}));
Thread.Sleep(1000 * 5);
};
});
}
#region 删除
/// <summary>
/// 删除
@ -53,17 +72,17 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
}
#endregion
public async void InitData()
private void InitData()
{
ListItems1.Clear();
ListItems.Clear();
int count = 0;
DateTime now=DateTime.Now;
CurrentTeamTime time = await _currentTeamTimeServices.FirstAsync(d => d.StartTime <= now && d.EndTime >= now);
CurrentTeamTime time = _currentTeamTimeServices.FirstAsync(d => d.StartTime <= now && d.EndTime >= now).Result;
if (time == null) return;
if (time.TeamName.Equals("早班"))
{
List<BoxFoamPlan> list = await _boxFoamPlanServices.QueryAsync(d=>d.ShiftType==1);
List<BoxFoamPlan> list = _boxFoamPlanServices.QueryAsync(d=>d.ShiftType==1).Result;
if (list == null) return;
foreach (BoxFoamPlan item in list)
{
@ -82,7 +101,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
if (time.TeamName.Equals("晚班"))
{
List<BoxFoamPlan> list = await _boxFoamPlanServices.QueryAsync(d => d.ShiftType == 1);
List<BoxFoamPlan> list = _boxFoamPlanServices.QueryAsync(d => d.ShiftType == 1).Result;
if (list == null) return;
foreach (BoxFoamPlan item in list)
{

@ -189,6 +189,8 @@
<DataGridTextColumn Binding="{Binding PlanCode}" Header="计划编号" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding OrderCode}" Header="工单编号" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding MaterialName}" Header="产品型号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="物料编号" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding PlanAmount}" Header="计划数量" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding CompleteAmount}" Header="完成数量" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding BeginTime,StringFormat=\{0:MM-dd HH:mm\}}" Header="开始时间" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>

@ -194,7 +194,7 @@
},
"StationInfo": {
"ProductLineCode": "CX_01",
"StationCode": "1100"
"StationCode": "1006"
},
"PLCServer": [

Loading…
Cancel
Save