|
|
|
@ -18,6 +18,7 @@ using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Numerics;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
@ -361,37 +362,43 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
|
|
|
|
|
collection.startCollect();
|
|
|
|
|
bLis = collection.listFixtureStatus;
|
|
|
|
|
if (bLis.Count == 0) return;
|
|
|
|
|
|
|
|
|
|
int total = 0;
|
|
|
|
|
List<BoxFoamData> bfds = await _oldBoxFoamDataServices.QueryAsync();
|
|
|
|
|
List<OldBoxFoamType> spaceList = await _oldBoxFoamTypeServices.QueryAsync();
|
|
|
|
|
List < BoxFoamPlan> planList = await _boxFoamPlanServices.QueryAsync();
|
|
|
|
|
for (int j = 0; j < bLis.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
OldBoxFoamType space = await _oldBoxFoamTypeServices.FirstAsync(d => d.Boxtype == bLis[j].FixtureBoxType);
|
|
|
|
|
OldBoxFoamType space = spaceList.FirstOrDefault(d => d.Boxtype == bLis[j].FixtureBoxType);
|
|
|
|
|
//根据夹具找货道,根据货道找物料
|
|
|
|
|
if (space != null)
|
|
|
|
|
{
|
|
|
|
|
BoxFoamPlan plan = _boxFoamPlanServices.FirstAsync(d => d.MaterialCode == space.MaterialCode).Result;
|
|
|
|
|
BoxFoamPlan plan = planList.FirstOrDefault(d => d.MaterialCode == space.MaterialCode && d.PlanAmount > d.CompleteAmount);
|
|
|
|
|
if (plan != null)
|
|
|
|
|
{
|
|
|
|
|
plan.CompleteAmount = plan.CompleteAmount + 1;
|
|
|
|
|
await _boxFoamPlanServices.UpdateAsync(plan);
|
|
|
|
|
int complateAmount = 0;
|
|
|
|
|
//更新小时数据
|
|
|
|
|
BoxFoamData bfd = await _oldBoxFoamDataServices.FirstAsync(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
|
|
|
|
|
BoxFoamData bfd = bfds.FirstOrDefault(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
|
|
|
|
|
if (bfd != null)
|
|
|
|
|
{
|
|
|
|
|
UpdateBoxData(bLis[j], bfd);
|
|
|
|
|
//更新计划数量
|
|
|
|
|
complateAmount = bLis[j].Yield - bfd.Production;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SaveBoxData(productLineCode, bLis[j]);
|
|
|
|
|
}
|
|
|
|
|
plan.CompleteAmount = plan.CompleteAmount + complateAmount;
|
|
|
|
|
await _boxFoamPlanServices.UpdateAsync(plan);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//更新小时数据
|
|
|
|
|
List<BoxFoamData> bfd = await _oldBoxFoamDataServices.QueryAsync(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
|
|
|
|
|
if (bfd.Count > 0)
|
|
|
|
|
//List<BoxFoamData> bfd = await _oldBoxFoamDataServices.QueryAsync(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
|
|
|
|
|
BoxFoamData bfd = bfds.FirstOrDefault(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
|
|
|
|
|
if (bfd!=null)
|
|
|
|
|
{
|
|
|
|
|
var obj = bfd.FirstOrDefault();
|
|
|
|
|
UpdateBoxData(bLis[j], obj);
|
|
|
|
|
UpdateBoxData(bLis[j], bfd);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -403,11 +410,12 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//更新小时数据
|
|
|
|
|
List<BoxFoamData> bfd = await _oldBoxFoamDataServices.QueryAsync(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
|
|
|
|
|
if (bfd.Count > 0)
|
|
|
|
|
//List<BoxFoamData> bfd = await _oldBoxFoamDataServices.QueryAsync(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
|
|
|
|
|
|
|
|
|
|
BoxFoamData bfd = bfds.FirstOrDefault(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
|
|
|
|
|
if (bfd != null)
|
|
|
|
|
{
|
|
|
|
|
var obj = bfd.FirstOrDefault();
|
|
|
|
|
UpdateBoxData(bLis[j], obj);
|
|
|
|
|
UpdateBoxData(bLis[j], bfd);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -420,13 +428,12 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void UpdateBoxData(FixtureStatus item, BoxFoamData bfd)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
switch (GetTeamHour().Seq)
|
|
|
|
|
int hour = GetTeamHour(DateTime.Now).Seq;
|
|
|
|
|
switch (hour)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
bfd.AnHour = item.Yield - bfd.Production;
|
|
|
|
@ -467,7 +474,9 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bfd.Production = item.Yield;
|
|
|
|
|
|
|
|
|
|
await _oldBoxFoamDataServices.UpdateAsync(bfd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -481,7 +490,8 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
|
|
|
|
|
bfdata.Production = item.Yield;
|
|
|
|
|
bfdata.CuringTimeSettingValue = item.PlanCuringTime.ToString();
|
|
|
|
|
bfdata.ActualValue = item.RealCuringTime.ToString();
|
|
|
|
|
switch (GetTeamHour().Seq)
|
|
|
|
|
int hour = GetTeamHour(DateTime.Now).Seq;
|
|
|
|
|
switch (hour)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
bfdata.AnHour = item.Yield = bfdata.Production;
|
|
|
|
@ -538,5 +548,15 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CurrentTeamTimeView GetTeamHour(DateTime now)
|
|
|
|
|
{
|
|
|
|
|
var obj = _sysUserInfoServices.GetTeamData(now).Result;
|
|
|
|
|
if (obj != null)
|
|
|
|
|
{
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|