liuwf 1 year ago
commit 944af2042c

@ -1631,6 +1631,11 @@
SAP订单编码
</summary>
</member>
<member name="P:Admin.Core.Model.BoxFoamPlan.PlanCode">
<summary>
MES计划编号
</summary>
</member>
<member name="P:Admin.Core.Model.BoxFoamPlan.PlanAmount">
<summary>
计划数量

@ -30,6 +30,13 @@ namespace Admin.Core.Model
/// </summary>
[SugarColumn(ColumnName = "ORDER_CODE")]
public string OrderCode { get; set; }
/// <summary>
/// MES计划编号
/// </summary>
[SugarColumn(ColumnName = "PLAN_CODE")]
public string PlanCode { get; set; }
/// <summary>
/// 计划数量
/// </summary>

@ -64,10 +64,17 @@ namespace Admin.Core.Service
ProductPlanInfo planInfo = null;
try
{
Expression<Func<ProductPlanInfo, bool>> exp = s1 => true;
exp = exp.And(x => x.PlanCode == planCode);
//Expression<Func<ProductPlanInfo, bool>> exp = s1 => true;
//exp = exp.And(x => x.PlanCode == planCode);
//var info = await _dal.QueryAsync(exp);
var info = _dal.Query(x=>x.PlanCode == planCode);
planInfo = await _dal.FirstAsync(exp);
if (info != null)
{
planInfo = info.OrderBy(x => x.CreatedTime).First();
}
logHelper.Info($"根据计划编号{planCode};获取到的计划信息:{planInfo.ToJson()}");
}

@ -28,7 +28,10 @@ namespace Admin.Core.Service.Service_New
private readonly ISysUserInfoServices _sysUserInfoServices;
private readonly IBaseSpaceInfoServices _baseSpaceInfoServices;
public RecordBoxFoamFixtureComplateServices(IBaseRepository<RecordBoxFoamFixtureComplate> dal, IOldBoxFoamTypeServices boxFoamTypeServices, IBoxFoamPlanServices boxFoamPlanServices, IBoxFoamDataServices oldBoxFoamDataServices, ISysUserInfoServices sysUserInfoServices, IBaseSpaceInfoServices baseSpaceInfoServices)
private readonly IProductPlanInfoServices _productPlanInfoServices;
public RecordBoxFoamFixtureComplateServices(IBaseRepository<RecordBoxFoamFixtureComplate> dal, IOldBoxFoamTypeServices boxFoamTypeServices, IBoxFoamPlanServices boxFoamPlanServices, IBoxFoamDataServices oldBoxFoamDataServices, ISysUserInfoServices sysUserInfoServices, IBaseSpaceInfoServices baseSpaceInfoServices, IProductPlanInfoServices productPlanInfoServices)
{
this._dal = dal;
base.BaseDal = dal;
@ -37,6 +40,7 @@ namespace Admin.Core.Service.Service_New
_oldBoxFoamDataServices = oldBoxFoamDataServices;
_sysUserInfoServices = sysUserInfoServices;
_baseSpaceInfoServices = baseSpaceInfoServices;
_productPlanInfoServices = productPlanInfoServices;
}
/// <summary>
@ -118,7 +122,7 @@ namespace Admin.Core.Service.Service_New
foreach (var boxFoamType in boxFoamTypeList)
{
var boxPlanList = _boxFoamPlanServices.Query(x => x.ProductLineCode == productLineCode && x.StationCode == stationCode && x.MaterialCode == boxFoamType && x.PlanAmount > x.CompleteAmount);
var boxPlanList = _boxFoamPlanServices.Query(x => x.ProductLineCode == productLineCode && x.StationCode == stationCode && x.MaterialCode == boxFoamType && x.PlanAmount > x.CompleteAmount && x.ShiftType == 1);
if (boxPlanList != null)
{
if (boxPlanList.Count > 0)
@ -133,6 +137,9 @@ namespace Admin.Core.Service.Service_New
if (planResult)
{
Console.WriteLine($"生产计划更新成功:{boxPlan.CompleteAmount}");
//更新MES计划
UpdateMesPlanInfo(boxPlan.PlanCode, item.RealOutPut);
}
else
{
@ -308,5 +315,31 @@ namespace Admin.Core.Service.Service_New
return result;
}
/// <summary>
/// 更新MES计划信息
/// </summary>
private void UpdateMesPlanInfo(string planCode,int complateAmount)
{
if (string.IsNullOrEmpty(planCode))
{
return;
}
var planInfo = _productPlanInfoServices.GetProductPlanByPlanCode(planCode).Result;
if(planInfo != null)
{
if(planInfo.PlanAmount > planInfo.CompleteAmount)
{
planInfo.CompleteAmount = planInfo.CompleteAmount + complateAmount;
if(planInfo.PlanAmount >= planInfo.CompleteAmount)
{
planInfo.EndTime = DateTime.Now;
}
_productPlanInfoServices.UpdateProductPlanInfo(planInfo);
}
}
}
}
}

@ -240,12 +240,13 @@ namespace Aucma.Core.BoxFoam.Business
log.Warn("班组切换小时数据记录保存失败");
}
//当班计划班组计划设为0
var planInfoList = _boxFoamPlanServices.QueryAsync(x => x.ProductLineCode == "CX_02" && x.StationCode == "1005").Result;
var planInfoList = _boxFoamPlanServices.QueryAsync(x => x.ProductLineCode == "CX_02" && x.StationCode == "1005" && x.ShiftType == 1).Result;
if (planInfoList != null)
{
foreach (var plan in planInfoList)
{
plan.ShiftType = 0;
bool updateFlag = _boxFoamPlanServices.UpdateAsync(plan).Result;
@ -274,7 +275,6 @@ namespace Aucma.Core.BoxFoam.Business
{
log.Warn($"计划:{plan.OrderCode},班组切换标识更新失败");
}
}
}
}

@ -111,6 +111,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
plan.UpdateTime = DateTime.Now;
plan.CreateTime = DateTime.Now;
plan.OrderCode = _planInfo.OrderCode;
plan.PlanCode = _planInfo.PlanCode;
plan.ShiftType = 1;
var result = _boxFoamPlanServices.AddAsync(plan).Result;
if (result>=0)

@ -63,6 +63,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
PlanAmount = item.PlanAmount,
ResidueAmount = item.PlanAmount - item.CompleteAmount,
SpliteResidueAmount = item.PlanAmount - residue,
CompleteAmount = item.CompleteAmount,
StartDate = item.BeginTime
});
i++;
@ -95,6 +96,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
PlanAmount = item.PlanAmount,
ResidueAmount = item.PlanAmount - item.CompleteAmount,
SpliteResidueAmount = item.PlanAmount - residue,
CompleteAmount = item.CompleteAmount,
StartDate = item.BeginTime
});
i++;

@ -189,6 +189,7 @@
<Border Grid.Column="0" BorderBrush="White" BorderThickness="1" >
<TextBlock x:Name="spaceCodeText" Text="{Binding Local}" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<TextBlock x:Name="ObjId" Text="{Binding ObjId}" FontSize="18" Foreground="Transparent" />
<Grid Grid.Column="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
@ -205,7 +206,7 @@
</Border>
<Border Grid.Column="1" Grid.Row="0" BorderBrush="White" BorderThickness="1" >
<Button Command="{Binding DataContext.SubmitCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding Text, ElementName=spaceCodeText}" Background="Transparent">
<Button Command="{Binding DataContext.SubmitCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding Text, ElementName=ObjId}" Background="Transparent">
<TextBlock Text="{Binding MaterialName}" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Left" />
</Button>
<!--<TextBlock x:Name="spaceCodeText2" Text="{Binding MaterialName}" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>-->

Loading…
Cancel
Save