完善钣金功能数据

dev
liulb@mesnac.com 1 year ago
parent 84797736fe
commit ef5f8dbdb1

@ -5046,6 +5046,41 @@
工位 工位
</summary> </summary>
</member> </member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetaHourDataView.HourTime">
<summary>
小时
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetaHourDataView.FrontPlateAmount">
<summary>
前板数量
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetaHourDataView.RearPanelAmount">
<summary>
后板数量
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetalTypeDataView.MaterialName">
<summary>
物料名称
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetalTypeDataView.ProductLineCode">
<summary>
工位
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetalTypeDataView.FrontPlateAmount">
<summary>
前板数量
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetalTypeDataView.RearPanelAmount">
<summary>
后板数量
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.StationHourAmountView.RowNum"> <member name="P:Admin.Core.Model.ViewModels.StationHourAmountView.RowNum">
<summary> <summary>
产线编码 产线编码

@ -28,5 +28,17 @@ namespace Admin.Core.IRepository
/// <returns></returns> /// <returns></returns>
Task<List<ProductLineInfoView>> GetProductLineInfo(string productLineCode); Task<List<ProductLineInfoView>> GetProductLineInfo(string productLineCode);
/// <summary>
/// 统计前后板型号数据
/// </summary>
/// <param name="productLineCode"></param>
/// <returns></returns>
Task<List<SheetMetalTypeDataView>> GetSheetMetalTypeData(string productLineCode);
/// <summary>
/// 统计前后板小时数据
/// </summary>
/// <param name="productLineCode"></param>
/// <returns></returns>
Task<List<SheetMetaHourDataView>> GetSheetMetaHourData(string productLineCode);
} }
} }

@ -36,6 +36,19 @@ namespace Admin.Core.IService
/// <param name="productLineCode"></param> /// <param name="productLineCode"></param>
/// <returns></returns> /// <returns></returns>
Task<ProductLineInfoView> GetProductLineInfo(string productLineCode); Task<ProductLineInfoView> GetProductLineInfo(string productLineCode);
/// <summary>
/// 统计前后板数据
/// </summary>
/// <param name="productLineCode"></param>
/// <returns></returns>
Task<List<SheetMetalTypeDataView>> GetSheetMetalTypeData(string productLineCode);
/// <summary>
/// 统计前后板小时数据
/// </summary>
/// <param name="productLineCode"></param>
/// <returns></returns>
Task<List<SheetMetaHourDataView>> GetSheetMetaHourData(string productLineCode);
} }
} }

@ -0,0 +1,28 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Admin.Core.Model.ViewModels
{
public class SheetMetaHourDataView
{
/// <summary>
/// 小时
/// </summary>
[SugarColumn(ColumnName = "HOUR_TIME")]
public string HourTime { get; set; }
/// <summary>
/// 前板数量
/// </summary>
[SugarColumn(ColumnName = "FRONTPLATE_AMOUNT")]
public string FrontPlateAmount { get; set; }
/// <summary>
/// 后板数量
/// </summary>
[SugarColumn(ColumnName = "REARPANEL_AMOUNT")]
public string RearPanelAmount { get; set; }
}
}

@ -0,0 +1,33 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Admin.Core.Model.ViewModels
{
public class SheetMetalTypeDataView
{
/// <summary>
/// 物料名称
/// </summary>
[SugarColumn(ColumnName = "MATERIAL_SPECIFICATIONS")]
public string MaterialName { get; set; }
/// <summary>
/// 工位
/// </summary>
[SugarColumn(ColumnName = "PRODUCTLINE_CODE")]
public string ProductLineCode { get; set; }
/// <summary>
/// 前板数量
/// </summary>
[SugarColumn(ColumnName = "FRONTPLATE_AMOUNT")]
public string FrontPlateAmount { get; set; }
/// <summary>
/// 后板数量
/// </summary>
[SugarColumn(ColumnName = "REARPANEL_AMOUNT")]
public string RearPanelAmount { get; set; }
}
}

@ -57,6 +57,57 @@ namespace Admin.Core.Repository
#endregion #endregion
#region 获取钣金型号统计数据
/// <summary>
/// 获取班组数据
/// </summary>
/// <returns></returns>
/// <exception cref="System.NotImplementedException"></exception>
public async Task<List<SheetMetalTypeDataView>> GetSheetMetalTypeData(string productLineCode)
{
string sql = @$"WITH CTT AS (SELECT MIN(START_TIME) START_TIME, MAX(END_TIME) END_TIME
FROM VIEW_CURRENT_TEAM_TIME)
SELECT ML.MATERIAL_SPECIFICATIONS,SPC.PRODUCTLINE_CODE,
SUM(CASE
WHEN SPC.PLAN_TYPE = 1 THEN SPC.COMPLETE_AMOUNT
WHEN SPC.PLAN_TYPE = 2 THEN SPC.COMPLETE_AMOUNT
ELSE 0 END) FRONTPLATE_AMOUNT,
SUM(CASE
WHEN SPC.PLAN_TYPE = 1 THEN SPC.COMPLETE_AMOUNT
WHEN SPC.PLAN_TYPE = 3 THEN SPC.COMPLETE_AMOUNT
ELSE 0 END) REARPANEL_AMOUNT
FROM VIEW_EXECUTE_PLANINFO SPC
LEFT JOIN BASE_MATERIALINFO ML ON ML.MATERIAL_CODE = SPC.MATERIAL_CODE
CROSS JOIN CTT
WHERE SPC.BEGIN_TIME > CTT.START_TIME
AND SPC.BEGIN_TIME <= CTT.END_TIME and SPC.PRODUCTLINE_CODE='{productLineCode}'
GROUP BY ML.MATERIAL_SPECIFICATIONS,SPC.PRODUCTLINE_CODE";
return await Db.Ado.SqlQueryAsync<SheetMetalTypeDataView>(sql);
}
#endregion
public async Task<List<SheetMetaHourDataView>> GetSheetMetaHourData(string productLineCode)
{
string sql = @$"SELECT CTT.HOUR_TIME,
SUM(CASE
WHEN SPC.PLAN_TYPE = 1 THEN SPC.COMPLETE_AMOUNT
WHEN SPC.PLAN_TYPE = 2 THEN SPC.COMPLETE_AMOUNT
ELSE 0 END) FRONTPLATE_AMOUNT,
SUM(CASE
WHEN SPC.PLAN_TYPE = 1 THEN SPC.COMPLETE_AMOUNT
WHEN SPC.PLAN_TYPE = 3 THEN SPC.COMPLETE_AMOUNT
ELSE 0 END) REARPANEL_AMOUNT
FROM VIEW_CURRENT_TEAM_TIME CTT
LEFT JOIN (select * from VIEW_EXECUTE_PLANINFO where PRODUCTLINE_CODE='{productLineCode}') SPC
ON SPC.BEGIN_TIME >= CTT.START_TIME AND SPC.BEGIN_TIME < CTT.END_TIME
GROUP BY CTT.HOUR_TIME
ORDER BY CTT.HOUR_TIME";
return await Db.Ado.SqlQueryAsync<SheetMetaHourDataView>(sql);
}
} }
} }

@ -68,6 +68,20 @@ namespace Admin.Core.IService
return obj; return obj;
} }
/// <summary>
/// 统计前后板数据
/// </summary>
/// <param name="productLineCode"></param>
/// <returns></returns>
public async Task<List<SheetMetalTypeDataView>> GetSheetMetalTypeData(string productLineCode)
{
return await _sysUserInfoRepository.GetSheetMetalTypeData(productLineCode);
}
public async Task<List<SheetMetaHourDataView>> GetSheetMetaHourData(string productLineCode)
{
return await _sysUserInfoRepository.GetSheetMetaHourData(productLineCode);
}
} }
} }

@ -63,6 +63,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
Task.WaitAll(LoadData()); Task.WaitAll(LoadData());
AddSelectData();//添加下拉菜单 AddSelectData();//添加下拉菜单
RefreshHourAmount();//小时产量 RefreshHourAmount();//小时产量
// InitEveryDayMethod();
RefreshMaterialStats();//型号产量 RefreshMaterialStats();//型号产量
SheetMetalPlanTaskHandle.RefreshCurrentPlanInfoEvent += RefreshCurrentPlanInfo; SheetMetalPlanTaskHandle.RefreshCurrentPlanInfoEvent += RefreshCurrentPlanInfo;
QuantityIssuedViewModel.RefreshCretaePlanInfoEvent += LoadData; QuantityIssuedViewModel.RefreshCretaePlanInfoEvent += LoadData;
@ -155,34 +156,34 @@ namespace Aucma.Core.SheetMetal.ViewModels
#endregion #endregion
#region 按类型统计 #region 按类型统计
ChartValues<double> achievement2 = new ChartValues<double>(); //ChartValues<double> achievement2 = new ChartValues<double>();
Random random2 = new Random(); //Random random2 = new Random();
for (int i = 0; i < 2; i++) //for (int i = 0; i < 2; i++)
{ //{
achievement2.Add(random2.Next(60, 100)); // achievement2.Add(random2.Next(60, 100));
} //}
var column2 = new ColumnSeries(); //var column2 = new ColumnSeries();
column2.DataLabels = true; //column2.DataLabels = true;
column2.Title = "前板"; //column2.Title = "前板";
column2.Values = achievement2; //column2.Values = achievement2;
column2.Foreground = Brushes.White; //column2.Foreground = Brushes.White;
column2.FontSize = 18; //column2.FontSize = 18;
ModelStatistics.Add(column2); //ModelStatistics.Add(column2);
ModelStatistics.Add(new ColumnSeries() //ModelStatistics.Add(new ColumnSeries()
{ //{
DataLabels = true, // DataLabels = true,
Title = "后板", // Title = "后板",
Values = achievement2, // Values = achievement2,
Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)), // Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)),
Foreground = Brushes.White, // Foreground = Brushes.White,
FontSize = 18 // FontSize = 18
}); //});
MaterialNameList = new List<string>() //MaterialNameList = new List<string>()
{ //{
"玻璃门,SC-439", "玻璃门,SC-439,AC" // "玻璃门,SC-439", "玻璃门,SC-439,AC"
}; //};
#endregion #endregion
//await InitExecMethod(); //await InitExecMethod();
return Task.CompletedTask; return Task.CompletedTask;
@ -199,7 +200,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
string stationCode = Appsettings.app("StationInfo", "StationCode"); string stationCode = Appsettings.app("StationInfo", "StationCode");
CurrentTeamTimeView view = GetTeamHour(); CurrentTeamTimeView view = GetTeamHour();
var list = _taskExecutionPlanInfoServices.QueryAsync(x => x.ProductLineCode == stationCode&& x.CreatedTime> view.StartTime && x.CreatedTime <view.EndTime).Result; var list = _taskExecutionPlanInfoServices.QueryAsync(x => x.ProductLineCode == stationCode&& x.CreatedTime> view.StartTime && x.CreatedTime <view.EndTime&& x.ExecuteStatus==2).Result;
if (list == null) return Task.CompletedTask; if (list == null) return Task.CompletedTask;
var execList = list.OrderByDescending(d => d.ExecuteOrder); var execList = list.OrderByDescending(d => d.ExecuteOrder);
@ -675,26 +676,48 @@ namespace Aucma.Core.SheetMetal.ViewModels
{ {
//获取小时产量 //获取小时产量
string stationCode = Appsettings.app("StationInfo", "StationCode"); string stationCode = Appsettings.app("StationInfo", "StationCode");
List<dynamic> hourAmount = _taskExecutionPlanInfoServices.GetStationSheetMetalHourAmountAsync(stationCode).Result; var hourAmount = _sysUserInfoServices.GetSheetMetaHourData(stationCode).Result;
if (hourAmount != null) if (hourAmount != null)
{ {
Achievement.Clear(); Achievement.Clear();
ProductionHourList = new List<string>(); ProductionHourList = new List<string>();
//ChartValues<double> hourAchievement = new ChartValues<double>(); ChartValues<ObservablePoint> hourAchievement1 = new ChartValues<ObservablePoint>();
ChartValues<ObservablePoint> hourAchievement = new ChartValues<ObservablePoint>(); ChartValues<ObservablePoint> hourAchievement2 = new ChartValues<ObservablePoint>();
int hour = 0;
foreach (var item in hourAmount) foreach (var item in hourAmount)
{ {
ObservablePoint point = new ObservablePoint(Convert.ToInt32(item.SIDPANELHOURAMOUNT), Convert.ToInt32(item.BACKPANELHOURAMOUNT)); hourAchievement1.Add(new ObservablePoint(hour,Convert.ToDouble(item.FrontPlateAmount)));
ProductionHourList.Add(item.PRODUCT_HOUR); hourAchievement2.Add(new ObservablePoint(hour,Convert.ToDouble(item.RearPanelAmount)));
hourAchievement.Add(point); ProductionHourList.Add(item.HourTime);
//hourAchievement.Add(Convert.ToDouble(item.PRODUCT_AMOUNT)); hour++;
} }
var houeColumn = new ColumnSeries();
houeColumn.DataLabels = true;
houeColumn.Title = "小时产量";
houeColumn.Values = hourAchievement; #region 按时间统计
houeColumn.Foreground = Brushes.White;
Achievement.Add(houeColumn);
var column = new ColumnSeries();
column.DataLabels = true;
column.Title = "前板";
column.Values = hourAchievement1;
column.Foreground = Brushes.White;
column.FontSize = 18;
Achievement.Add(column);
Achievement.Add(new ColumnSeries
{
DataLabels = true,
Title = "后板",
Values = hourAchievement2,
Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)),
Foreground = Brushes.CadetBlue,
FontSize = 18
});
#endregion
} }
})); }));
} }
@ -708,29 +731,41 @@ namespace Aucma.Core.SheetMetal.ViewModels
{ {
App.Current.Dispatcher.Invoke((Action)(() => App.Current.Dispatcher.Invoke((Action)(() =>
{ {
//获取物料型号统计 //获取物料型号统计
string stationCode = Appsettings.app("StationInfo", "StationCode"); string stationCode = Appsettings.app("StationInfo", "StationCode");
List<dynamic> materialStats = _taskExecutionPlanInfoServices.GetStationSheetMetalStats(stationCode); var sheetMetalTypeList = _sysUserInfoServices.GetSheetMetalTypeData(stationCode).Result;
if (sheetMetalTypeList != null)
{
#region 按类型统计
ChartValues<double> achievement1 = new ChartValues<double>();
ChartValues<double> achievement2 = new ChartValues<double>();
MaterialNameList = new List<string>();
foreach (var item in sheetMetalTypeList)
{
achievement1.Add(Convert.ToInt32(item.FrontPlateAmount));
achievement2.Add(Convert.ToInt32(item.RearPanelAmount));
MaterialNameList.Add(item.MaterialName);
}
var column2 = new ColumnSeries();
column2.DataLabels = true;
column2.Title = "前板";
column2.Values = achievement1;
column2.Foreground = Brushes.White;
column2.FontSize = 18;
ModelStatistics.Add(column2);
if (materialStats != null) ModelStatistics.Add(new ColumnSeries()
{ {
ModelStatistics.Clear(); DataLabels = true,
MaterialNameList = new List<string>(); Title = "后板",
ChartValues<double> materialAchievement = new ChartValues<double>(); Values = achievement2,
foreach (var item in materialStats) Fill = new SolidColorBrush(Color.FromRgb(15, 209, 226)),
{ Foreground = Brushes.White,
MaterialNameList.Add(item.MATERIAL_NAME); FontSize = 18
materialAchievement.Add(Convert.ToDouble(item.PRODUCT_AMOUNT)); });
}
var materialColumn = new ColumnSeries(); #endregion
materialColumn.DataLabels = true;
materialColumn.Title = "型号";
materialColumn.Values = materialAchievement;
materialColumn.Foreground = Brushes.White;
ModelStatistics.Add(materialColumn);
} }
})); }));
} }

@ -69,6 +69,16 @@ namespace Aucma.Core.SheetMetal.ViewModels
[RelayCommand] [RelayCommand]
private async Task PlanInfoTransmit() private async Task PlanInfoTransmit()
{ {
if (string.IsNullOrEmpty(TransmitAmount))
{
MessageBox.Show("计划数量不能为空!", "系统提醒");
return;
}
if (PlanInfo.PlanAmount<=Convert.ToInt32(TransmitAmount))
{
MessageBox.Show("下发数量不能大于计划数量!", "系统提醒");
return;
}
var productPlanInfo = _PlanInfo; var productPlanInfo = _PlanInfo;
if (productPlanInfo != null) if (productPlanInfo != null)
{ {

@ -356,28 +356,19 @@ namespace Aucma.Core.SheetMetal.ViewModels
[RelayCommand] [RelayCommand]
public async Task RadioButton(string selectedOption) public async Task RadioButton(string selectedOption)
{ {
string productLineCode = Appsettings.app("StoreInfo", "ProductLineCode"); string productLineCode = Appsettings.app("StationInfo", "StationCode");
List<ProductPlanInfo> planInfos = await _productPlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(productLineCode) && d.MaterialName.Contains(selectedOption));
if (planInfos != null)
{
if (planInfos.Count > 0)
{
MaterialDataGrid.Clear(); MaterialDataGrid.Clear();
int i = 1; int i = 1;
string station = Appsettings.app("StationInfo", "StationCode");
var execList = await _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(productLineCode)); var planlist = _productPlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station)&&d.MaterialName.Contains(selectedOption)).Result;
foreach (var item in planInfos) if (planlist == null) return;
var execList = await _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station)&& d.MaterialName.Contains(station));
if (execList == null) return;
foreach (var item in planlist)
{ {
int residue = 0; int residue = 0;
if (execList == null) if (execList == null) residue = 0;
{ else residue = (execList.Where(d => d.MaterialCode.Equals(item.MaterialCode))).Sum(d => d.PlanAmount);
residue = 0;
}
else
{
residue = (execList.Where(d => d.MaterialCode.Equals(item.MaterialCode))).Sum(d => d.PlanAmount);
}
MaterialDataGrid.Add(new ProductPlanInfoModel() MaterialDataGrid.Add(new ProductPlanInfoModel()
{ {
No = i, No = i,
@ -393,8 +384,6 @@ namespace Aucma.Core.SheetMetal.ViewModels
i++; i++;
} }
} }
}
}
#endregion #endregion

@ -182,9 +182,12 @@
<RowDefinition Height="2*"/> <RowDefinition Height="2*"/>
<RowDefinition Height="13*"/> <RowDefinition Height="13*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="发 泡 夹 具 状 态" Foreground="#FFFFFF" FontSize="18"/> <TextBlock Text="发 泡 夹 具 状 态" Foreground="#FFFFFF" FontSize="18"/>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
</StackPanel>
</Grid> </Grid>
</Border> </Border>

@ -232,10 +232,10 @@
Foreground="White" SelectedItem="{Binding SelectedDataItem}" MouseLeftButtonDown="dgvMH_MouseLeftButtonDown"> Foreground="White" SelectedItem="{Binding SelectedDataItem}" MouseLeftButtonDown="dgvMH_MouseLeftButtonDown">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Binding="{Binding No}" Header="序号" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding No}" Header="序号" Width="0.3*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding PlanCode}" Header="计划编号" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <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 OrderCode}" Header="工单编号" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding MaterialName}" Header="产品型号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding MaterialName}" Header="产品型号" Width="3*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding PlanAmount}" 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 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}"/> <DataGridTextColumn Binding="{Binding BeginTime,StringFormat=\{0:MM月dd日 HH:mm\}}" Header="开始时间" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>

@ -115,11 +115,11 @@
}, },
"StationInfo": { "StationInfo": {
"StationName": "箱壳前后板生产", "StationName": "箱壳前后板生产",
"StationCode": "1001", "StationCode": "1001", //
"ShellStoreCode": "XKJCK-001", "ShellStoreCode": "XKK-001",
"LinerStoreCode": "NDJCK-001", "LinerStoreCode": "NDK-001",
"FoamBeforeStoreCode": "PBSCK-001", "FoamBeforeStoreCode": "PQK-001",
"ProductLineCode": "CX_01" "ProductLineCode": "CX_02"
}, },
"PLCServer": [ "PLCServer": [
{ {

Loading…
Cancel
Save