liuwf 1 year ago
commit 5e5b8c7a47

@ -5041,14 +5041,14 @@
工位
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetaHourDataView.Seq">
<member name="P:Admin.Core.Model.ViewModels.SheetMetaHourDataView.HourTime">
<summary>
排序
小时
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetaHourDataView.HourTime">
<member name="P:Admin.Core.Model.ViewModels.SheetMetaHourDataView.MaterialName">
<summary>
小时
物料名称
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetaHourDataView.FrontPlateAmount">
@ -5116,11 +5116,6 @@
物料名称
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetalTypeDataView.ProductLineCode">
<summary>
工位
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetalTypeDataView.FrontPlateAmount">
<summary>
前板数量
@ -5221,6 +5216,21 @@
物料名称
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetaSendPlanInfoView.ProductPlanCode">
<summary>
计划编码
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetaSendPlanInfoView.BeginTime">
<summary>
开始时间
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetaSendPlanInfoView.EndTime">
<summary>
开始时间
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.SheetMetaSendPlanInfoView.ExecuteStatus">
<summary>
执行状态

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.Common
build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.Common\
build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.Common\

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.EventBus
build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.EventBus\
build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.EventBus\

@ -12,14 +12,19 @@ namespace Admin.Core.Model.ViewModels
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnName = "SEQ")]
public int Seq { get; set; }
//[SugarColumn(ColumnName = "SEQ")]
//public int Seq { get; set; }
/// <summary>
/// 小时
/// </summary>
[SugarColumn(ColumnName = "HOUR_TIME")]
public string HourTime { get; set; }
/// <summary>
/// 物料名称
/// </summary>
[SugarColumn(ColumnName = "MATERIAL_CODE")]
public string MaterialName { get; set; }
/// <summary>
/// 前板数量
/// </summary>
[SugarColumn(ColumnName = "FRONTPLATE_AMOUNT")]

@ -40,7 +40,22 @@ namespace Admin.Core.Model.ViewModels
[SugarColumn(ColumnName = "MATERIAL_SPECIFICATIONS")]
public string MaterialSpecificatons { get; set; }
/// <summary>
/// 计划编码
/// </summary>
[SugarColumn(ColumnName = "PRODUCT_PLANCODE")]
public string ProductPlanCode { get; set; }
/// <summary>
/// 开始时间
/// </summary>
[SugarColumn(ColumnName = "BEGIN_TIME")]
public string BeginTime { get; set; }
/// <summary>
/// 开始时间
/// </summary>
[SugarColumn(ColumnName = "END_TIME")]
public string EndTime { get; set; }
/// <summary>
/// 执行状态
/// </summary>

@ -12,13 +12,9 @@ namespace Admin.Core.Model.ViewModels
/// <summary>
/// 物料名称
/// </summary>
[SugarColumn(ColumnName = "MATERIAL_SPECIFICATIONS")]
[SugarColumn(ColumnName = "MATERUALNAME")]
public string MaterialName { get; set; }
/// <summary>
/// 工位
/// </summary>
[SugarColumn(ColumnName = "PRODUCTLINE_CODE")]
public string ProductLineCode { get; set; }
/// <summary>
/// 前板数量
/// </summary>

@ -49,7 +49,7 @@ namespace Admin.Core.Repository
string sql = @"SELECT b.MATERIAL_NAME, r.PRODUCTLINE_CODE, SUM(r.complete_amount) AS PRODUCT_AMOUNT
FROM(select p.*, s.complete_amount from EXECUTE_PLANINFO p inner join RECORD_SIDEPANEL_COMPLATE s on p.TASK_CODE = s.PLAN_CODE) r
JOIN C##AUCMA_MES.BASE_BOMINFO b ON r.MATERIAL_CODE = b.MATERIAL_CODE
WHERE TRUNC(r.RECORD_TIME) = TRUNC(SYSDATE)
WHERE TRUNC(r.RECORD_TIME) = TRUNC(SYSDATE) WHERE e.IS_FLAG=0
GROUP BY b.MATERIAL_NAME, r.PRODUCTLINE_CODE";
result = Db.CopyNew().SqlQueryable<dynamic>(sql).Where("PRODUCTLINE_CODE = @stationCode", new { stationCode = stationCode }).ToList();
}
@ -67,13 +67,13 @@ namespace Admin.Core.Repository
select * from C##AUCMA_MES.PRODUCT_PLANINFO
),
S AS(
select e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME, COUNT(c.PLAN_CODE) as SIDEPANELAMOUNT from EXECUTE_PLANINFO e
inner join RECORD_SIDEPANEL_COMPLATE c on e.TASK_CODE=c.PLAN_CODE
select e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME, SUM(c.OUTPUT_AMOUNT) as SIDEPANELAMOUNT from EXECUTE_PLANINFO e
inner join RECORD_SIDEPANEL_COMPLATE c on e.TASK_CODE=c.PLAN_CODE WHERE e.IS_FLAG=0
GROUP BY e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME
),
B AS(
select e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME, COUNT(c.PLAN_CODE) BACKPANELAMOUNT from EXECUTE_PLANINFO e
inner join RECORD_BACKPANEL_COMPLATE c on e.TASK_CODE=c.PLAN_CODE
select e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME, SUM(c.OUTPUT_AMOUNT) BACKPANELAMOUNT from EXECUTE_PLANINFO e
inner join RECORD_BACKPANEL_COMPLATE c on e.TASK_CODE=c.PLAN_CODE WHERE e.IS_FLAG=0
GROUP BY e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME
)
select t.PLAN_CODE,t.ORDER_CODE,t.PRODUCTLINE_CODE,t.MATERIAL_CODE,t.MATERIAL_NAME,t.PLAN_AMOUNTt.COMPLETE_AMOUNT,
@ -89,12 +89,42 @@ namespace Admin.Core.Repository
/// <returns></returns>
public List<SheetMetaPlanInfoView> QuerySheetMetalPlanData(string stationCode)
{
string sql = $@"select P.OBJ_ID,P.PLAN_CODE,P.ORDER_CODE,P.MATERIAL_CODE,P.MATERIAL_NAME,P.PRODUCTLINE_CODE,
P.PLAN_AMOUNT,P.COMPLETE_AMOUNT,P.BEGIN_TIME,P.END_TIME,SPC.MATERIAL_SPECIFICATIONS from C##AUCMA_MES.PRODUCT_PLANINFO P
inner join (select SPC.*,ML.MATERIAL_SPECIFICATIONS FROM C##AUCMA_MES.PRODUCT_PLANINFO SPC
inner JOIN C##AUCMA_MES.BASE_MATERIALINFO ML ON ML.MATERIAL_CODE = SPC.MATERIAL_CODE where SPC.PRODUCTLINE_CODE ='{stationCode}'
) SPC on p.ORDER_CODE=SPC.ORDER_CODE
where p.PRODUCTLINE_CODE ='{stationCode}' ";
// string sql = $@"select P.OBJ_ID,P.PLAN_CODE,P.ORDER_CODE,P.MATERIAL_CODE,P.MATERIAL_NAME,P.PRODUCTLINE_CODE,
//P.PLAN_AMOUNT,P.COMPLETE_AMOUNT,P.BEGIN_TIME,P.END_TIME,SPC.MATERIAL_SPECIFICATIONS from C##AUCMA_MES.PRODUCT_PLANINFO P
//inner join (select SPC.*,ML.MATERIAL_SPECIFICATIONS FROM C##AUCMA_MES.PRODUCT_PLANINFO SPC
// inner JOIN C##AUCMA_MES.BASE_MATERIALINFO ML ON ML.MATERIAL_CODE = SPC.MATERIAL_CODE where SPC.PRODUCTLINE_CODE ='{stationCode}'
//) SPC on p.ORDER_CODE=SPC.ORDER_CODE
// where p.PRODUCTLINE_CODE ='{stationCode}' ";
string sql = $@"SELECT
P.OBJ_ID,
P.PLAN_CODE,
P.ORDER_CODE,
o.MATERIAL_CODE,
o.MATERIAL_NAME,
m.MATERIAL_SPECIFICATIONS,
P.PRODUCTLINE_CODE,
P.PLAN_AMOUNT,
P.COMPLETE_AMOUNT,
P.BEGIN_TIME,
P.END_TIME
FROM C##AUCMA_MES.PRODUCT_PLANINFO p INNER JOIN
C##AUCMA_MES.BASE_ORDERINFO o ON o.ORDER_CODE = p.ORDER_CODE
INNER JOIN C##AUCMA_MES.BASE_MATERIALINFO m ON o.MATERIAL_CODE = m.MATERIAL_CODE
WHERE
p.ORDER_CODE IN ( SELECT ORDER_CODE FROM C##AUCMA_MES.PRODUCT_PLANINFO p WHERE p.PRODUCTLINE_CODE = '{stationCode}' )
group by P.OBJ_ID,
P.PLAN_CODE,
P.ORDER_CODE,
o.MATERIAL_CODE,
o.MATERIAL_NAME,
m.MATERIAL_SPECIFICATIONS,
P.PRODUCTLINE_CODE,
P.PLAN_AMOUNT,
P.COMPLETE_AMOUNT,
P.BEGIN_TIME,
P.END_TIME
order by OBJ_ID";
return Db.CopyNew().SqlQueryable<SheetMetaPlanInfoView>(sql).Where("PRODUCTLINE_CODE = @stationCode", new { stationCode = stationCode }).ToList();
}
@ -105,14 +135,13 @@ namespace Admin.Core.Repository
/// <returns></returns>
public List<SheetMetaSendPlanInfoView> QuerySheetMetalSendPlanData(string stationCode)
{
string sql = $@"select *from (select e.OBJ_ID,e.EXECUTE_PLANCODE, e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME, e.MATERIAL_SPECIFICATIONS,
e.EXECUTE_STATUS,e.PLAN_TYPE,e.PLAN_AMOUNT,e.COMPLETE_AMOUNT,e.TASK_CODE,COUNT(c.PLAN_CODE) BACKPANELAMOUNT,COUNT(s.PLAN_CODE) SIDEPANELAMOUNT,e.EXECUTE_ORDER
string sql = $@"select *from (select e.OBJ_ID,e.EXECUTE_PLANCODE, e.ORDER_CODE, e.PRODUCT_PLANCODE,e.MATERIAL_CODE,e.MATERIAL_NAME,e.BEGIN_TIME,e.END_TIME, e.MATERIAL_SPECIFICATIONS,
e.EXECUTE_STATUS,e.PLAN_TYPE,e.PLAN_AMOUNT,e.COMPLETE_AMOUNT,e.TASK_CODE,SUM(c.OUTPUT_AMOUNT) BACKPANELAMOUNT,SUM(s.OUTPUT_AMOUNT) SIDEPANELAMOUNT,e.EXECUTE_ORDER
from EXECUTE_PLANINFO e left join RECORD_BACKPANEL_COMPLATE c on e.TASK_CODE=c.PLAN_CODE
left join RECORD_SIDEPANEL_COMPLATE s on e.TASK_CODE=s.PLAN_CODE
where e.PRODUCTLINE_CODE='{stationCode}' and EXECUTE_STATUS in (1,2)
GROUP BY e.OBJ_ID,e.EXECUTE_PLANCODE,e.ORDER_CODE, e.MATERIAL_CODE,e.MATERIAL_NAME,e.MATERIAL_SPECIFICATIONS, e.PLAN_TYPE,e.PLAN_AMOUNT,e.EXECUTE_STATUS,e.COMPLETE_AMOUNT, e.TASK_CODE,e.EXECUTE_ORDER ) t
order by t.EXECUTE_ORDER ";
where e.PRODUCTLINE_CODE='{stationCode}' AND e.IS_FLAG=0 and EXECUTE_STATUS in (1,2)
GROUP BY e.OBJ_ID,e.EXECUTE_PLANCODE,e.ORDER_CODE, e.PRODUCT_PLANCODE,e.MATERIAL_CODE,e.MATERIAL_NAME,e.BEGIN_TIME,e.END_TIME, e.MATERIAL_SPECIFICATIONS, e.PLAN_TYPE,e.PLAN_AMOUNT,e.EXECUTE_STATUS,e.COMPLETE_AMOUNT, e.TASK_CODE,e.EXECUTE_ORDER ) t
order by t.EXECUTE_ORDER ";
return Db.CopyNew().SqlQueryable<SheetMetaSendPlanInfoView>(sql).ToList();
}

@ -67,23 +67,16 @@ namespace Admin.Core.Repository
/// <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
string sql = @$" WITH CTT AS (SELECT MIN(START_TIME) START_TIME, MAX(END_TIME) END_TIME
FROM VIEW_CURRENT_TEAM_TIME)
SELECT FB.MATERIAL_CODE as MATERUALNAME,
SUM(CASE WHEN FB.BOX_TYPE = 1 THEN FB.OUTPUT_AMOUNT ELSE 0 END) FRONTPLATE_AMOUNT,
SUM(CASE WHEN FB.BOX_TYPE = 2 THEN FB.OUTPUT_AMOUNT ELSE 0 END) REARPANEL_AMOUNT
FROM VIEW_RECORD_FRONT_BACK_COMP FB
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";
WHERE FB.RECORD_TIME >= CTT.START_TIME
AND FB.RECORD_TIME < CTT.END_TIME
GROUP BY FB.MATERIAL_CODE";
return await Db.CopyNew().Ado.SqlQueryAsync<SheetMetalTypeDataView>(sql);
}
@ -98,51 +91,14 @@ namespace Admin.Core.Repository
/// <returns></returns>
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";
//string sql = $@"SELECT CTT.SEQCTT.HOUR_TIMECOUNT(SPC.PLAN_CODE) as FRONTPLATE_AMOUNT,COUNT(BACK.PLAN_CODE) as REARPANEL_AMOUNT
// FROM VIEW_CURRENT_TEAM_TIME CTT
// LEFT JOIN (select * from C##AUCMA_SCADA.EXECUTE_PLANINFO v inner join C##AUCMA_SCADA.RECORD_SIDEPANEL_COMPLATE c
//on v.TASK_CODE=c.PLAN_CODE where v.PRODUCTLINE_CODE='{productLineCode}' AND c.COMPLETE_AMOUNT!=0) SPC ON SPC.RECORD_TIME >= CTT.START_TIME AND SPC.RECORD_TIME < CTT.END_TIME
// LEFT JOIN (select * from C##AUCMA_SCADA.EXECUTE_PLANINFO v inner join C##AUCMA_SCADA.RECORD_BACKPANEL_COMPLATE c
//on v.TASK_CODE=c.PLAN_CODE where v.PRODUCTLINE_CODE='{productLineCode}' AND c.COMPLETE_AMOUNT!=0) BACK ON BACK.RECORD_TIME >= CTT.START_TIME AND BACK.RECORD_TIME < CTT.END_TIME
//group by CTT.SEQCTT.HOUR_TIME ORDER BY CTT.SEQ asc";
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";
if (GetConnectionState() == false) return null;
SUM(CASE WHEN FB.BOX_TYPE = 1 THEN FB.OUTPUT_AMOUNT ELSE 0 END) FRONTPLATE_AMOUNT,
SUM(CASE WHEN FB.BOX_TYPE = 2 THEN FB.OUTPUT_AMOUNT ELSE 0 END) REARPANEL_AMOUNT
FROM VIEW_CURRENT_TEAM_TIME CTT
LEFT JOIN VIEW_RECORD_FRONT_BACK_COMP FB
ON FB.RECORD_TIME >= CTT.START_TIME AND FB.RECORD_TIME < CTT.END_TIME
GROUP BY CTT.HOUR_TIME
ORDER BY CTT.HOUR_TIME";
return await Db.CopyNew().Ado.SqlQueryAsync<SheetMetaHourDataView>(sql);
}

@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Admin.Core.Serilog.Es
build_property.ProjectDir = E:\桌面\AUCMA_SCADA\Admin.Core.Serilog.Es\
build_property.ProjectDir = D:\Project\gitea\AUCMA\SCADA\Admin.Core.Serilog.Es\

@ -51,5 +51,7 @@ namespace Aucma.Core.OldBoxFoam.Models
public string MaterialCode { get; set; }
public string MaterialName { get; set; }
public string SpaceName { get; set; }
}
}

@ -125,26 +125,57 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
public async void InitData(object? sender, ElapsedEventArgs e)
{
List<OldBoxFoamType> list = await _oldBoxFoamTypeServices.QueryAsync();
if (list == null) return;
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
if(list != null)
{
ListItems.Clear();
foreach (OldBoxFoamType item in list)
if(list.Count > 0)
{
ListItems.Add(new OldBoxFoamTypeModel()
{
ObjId = item.ObjId,
Local = item.Local,
Status = item.Storeamount==3?"1":"0",
Storeamount = item.Storeamount,
MaterialCode = item.MaterialCode,
MaterialName = item.MaterialName,
Boxtype = item.Boxtype,
list = list.OrderBy(x=>x.ObjId).ToList();
int totalItems = list.Count;
int half = totalItems / 2;
}); ;
List<OldBoxFoamType> spaceInfoLeft = list.Take(half).ToList();
List<OldBoxFoamType> spaceInfoRight = list.Skip(half).ToList();
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
{
ListItems.Clear();
if (spaceInfoLeft == null) return;
for (int i = 0; i < spaceInfoLeft.Count; i++)
{
ListItems.Add(new OldBoxFoamTypeModel()
{
SpaceName = $"东线{i + 1}",
Local = spaceInfoLeft[i].Local,
Status = spaceInfoLeft[i].Storeamount == 3 ? "1" : "0",
Storeamount = spaceInfoLeft[i].Storeamount,
MaterialCode = spaceInfoLeft[i].MaterialCode,
MaterialName = spaceInfoLeft[i].MaterialName,
Boxtype = spaceInfoLeft[i].Boxtype,
});
}
if (spaceInfoRight == null) return;
for (int i = 0; i < spaceInfoRight.Count; i++)
{
ListItems.Add(new OldBoxFoamTypeModel()
{
SpaceName = $"西线{i + 1}",
Local = spaceInfoRight[i].Local,
Status = spaceInfoRight[i].Storeamount == 3 ? "1" : "0",
Storeamount = spaceInfoRight[i].Storeamount,
MaterialCode = spaceInfoRight[i].MaterialCode,
MaterialName = spaceInfoRight[i].MaterialName,
Boxtype = spaceInfoRight[i].Boxtype,
});
}
}));
}
}));
}
}
#region 初始化datagrid

@ -16,6 +16,7 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Documents;
namespace Aucma.Core.OldBoxFoam.ViewModels
{
@ -50,31 +51,93 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
public async void InitData()
{
Shapes.Clear();
//Shapes.Clear();
List<OldBoxFoamType> list = await _boxFoamTypeServices.QueryAsync();
if (list == null) return;
foreach(OldBoxFoamType item in list)
if(list.Count > 0)
{
OldBoxFoamTypeModel model= new OldBoxFoamTypeModel();
model.MaterialCode = item.MaterialCode;
string pattern = @",(.*)";
Regex regex = new Regex(pattern);
Match match = regex.Match(item.MaterialName);
list = list.OrderBy(x => x.ObjId).ToList();
int totalItems = list.Count;
int half = totalItems / 2;
if (match.Success)
{
string result = match.Groups[1].Value;
model.MaterialName = result;
}
else
List<OldBoxFoamType> spaceInfoLeft = list.Take(half).ToList();
List<OldBoxFoamType> spaceInfoRight = list.Skip(half).ToList();
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
{
model.MaterialName = item.MaterialName;
}
model.ObjId = item.ObjId;
model.Status = "1";
Shapes.Add(model);
Shapes.Clear();
if (spaceInfoLeft == null) return;
for (int i = 0; i < spaceInfoLeft.Count; i++)
{
OldBoxFoamTypeModel model = new OldBoxFoamTypeModel();
model.MaterialCode = spaceInfoLeft[i].MaterialCode;
string pattern = @",(.*)";
Regex regex = new Regex(pattern);
Match match = regex.Match(spaceInfoLeft[i].MaterialName);
if (match.Success)
{
string result = match.Groups[1].Value;
model.MaterialName = result;
}
else
{
model.MaterialName = spaceInfoLeft[i].MaterialName;
}
model.ObjId = spaceInfoLeft[i].ObjId;
model.Status = "1";
model.Local = $"东线{i + 1}";
Shapes.Add(model);
}
if (spaceInfoRight == null) return;
for (int i = 0; i < spaceInfoRight.Count; i++)
{
OldBoxFoamTypeModel model = new OldBoxFoamTypeModel();
model.MaterialCode = spaceInfoRight[i].MaterialCode;
string pattern = @",(.*)";
Regex regex = new Regex(pattern);
Match match = regex.Match(spaceInfoRight[i].MaterialName);
if (match.Success)
{
string result = match.Groups[1].Value;
model.MaterialName = result;
}
else
{
model.MaterialName = spaceInfoRight[i].MaterialName;
}
model.ObjId = spaceInfoRight[i].ObjId;
model.Status = "1";
model.Local = $"西线{i + 1}";
Shapes.Add(model);
}
}));
}
//foreach(OldBoxFoamType item in list)
//{
// OldBoxFoamTypeModel model= new OldBoxFoamTypeModel();
// model.MaterialCode = item.MaterialCode;
// string pattern = @",(.*)";
// Regex regex = new Regex(pattern);
// Match match = regex.Match(item.MaterialName);
// if (match.Success)
// {
// string result = match.Groups[1].Value;
// model.MaterialName = result;
// }
// else
// {
// model.MaterialName = item.MaterialName;
// }
// model.ObjId = item.ObjId;
// model.Status = "1";
// Shapes.Add(model);
//}
}
#region 初始化

@ -169,8 +169,8 @@
<lvc:CartesianChart Series="{Binding HourAchievement, UpdateSourceTrigger=PropertyChanged}" DisableAnimations="True">
<lvc:CartesianChart.AxisX>
<lvc:Axis Foreground="White" Labels="{Binding HourOutPutList}" FontSize="15">
<lvc:Axis.Separator>
<lvc:Separator Visibility="Hidden" StrokeThickness="1.5" StrokeDashArray="0" Stroke="Transparent" >
<lvc:Axis.Separator>
<lvc:Separator Step="1" Visibility="Hidden" StrokeThickness="1.5" StrokeDashArray="0" Stroke="Transparent" >
</lvc:Separator>
</lvc:Axis.Separator>
</lvc:Axis>
@ -202,7 +202,7 @@
<lvc:CartesianChart.AxisX >
<lvc:Axis Foreground="White" Labels="{Binding MaterialTypeOutPutList}" FontSize="15">
<lvc:Axis.Separator>
<lvc:Separator Visibility="Hidden" StrokeThickness="1.5" StrokeDashArray="0" Stroke="Transparent" >
<lvc:Separator Step="1" Visibility="Hidden" StrokeThickness="1.5" StrokeDashArray="0" Stroke="Transparent" >
</lvc:Separator>
</lvc:Axis.Separator>
</lvc:Axis>
@ -228,7 +228,7 @@
ScrollViewer.VerticalScrollBarVisibility="Auto" BorderThickness="0" CanUserAddRows="False" SelectionMode="Single" IsReadOnly="True"
Foreground="White" >
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding ObjId}" Header="货道号" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding SpaceName}" Header="货道号" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding Local}" Header="位置" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTemplateColumn Width="*" Header="状态">
<DataGridTemplateColumn.CellStyle>

@ -187,7 +187,7 @@
<ColumnDefinition Width="6*"/>
</Grid.ColumnDefinitions>-->
<Border Grid.Column="0" BorderBrush="White" BorderThickness="1" >
<TextBlock x:Name="spaceCodeText" Text="{Binding ObjId}" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock x:Name="spaceCodeText" Text="{Binding Local}" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Grid Grid.Column="1" >
<Grid.ColumnDefinitions>

@ -41,6 +41,14 @@ public class SheetMetalPlanTaskHandle
public static event RefreshChat RefreshChatEvent;
#endregion
#region 刷新创建计划
/// <summary>
/// 刷新创建计划
/// </summary>
public delegate void RefreshPlanInfo(SheetMetaSendPlanInfoView planInfo);
public static event RefreshPlanInfo RefreshPlanInfoEvent;
#endregion
#region 刷新当前正在执行的计划
/// <summary>
/// 刷新当前正在执行的计划
@ -168,8 +176,8 @@ public class SheetMetalPlanTaskHandle
obj_sidePanel.plc.WriteInt32("D6020", planInfo.PlanAmount);
obj_sidePanel.plc.WriteInt32("D6021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke($"等待板设备应答。。。。。。");
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke($"等待板设备应答。。。。。。");
#region PLC反馈信号逻辑处理
//循环读取PLC应答信号PLC应答后复位应答信号、更新计划状态为执行中
bool isFlag = true;
@ -179,8 +187,8 @@ public class SheetMetalPlanTaskHandle
if (obj_sidePanel.plc.ReadInt32("D6021") == 2)
{
obj_sidePanel.plc.WriteInt32("D6021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到背板板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke($"收到板板设备应答信号,复位应答地址");
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke($"收到板板设备应答信号,复位应答地址");
isFlag = false;
}
Thread.Sleep(2000);
@ -206,13 +214,14 @@ public class SheetMetalPlanTaskHandle
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
RefreshPlanInfoEvent?.Invoke(planInfo);//刷新计划执行
}
}
});
}
catch (Exception ex)
{
MessageBox.Show($"板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error,
MessageBox.Show($"板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error,
MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
}
}
@ -263,6 +272,7 @@ public class SheetMetalPlanTaskHandle
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
//RefreshPlanInfoEvent?.Invoke(planInfo);
}
#endregion
@ -313,22 +323,15 @@ public class SheetMetalPlanTaskHandle
if (planInfo.PlanType == 1)
{
if(planInfo.PlanAmount == sumBackPanelAmount)
if (sumSidePanelAmount <= sumBackPanelAmount)
{
if (sumSidePanelAmount<= sumBackPanelAmount)
{
sumAmount = sumSidePanelAmount;
isComplate = false;
}
else
{
sumAmount = planInfo.PlanAmount;
isComplate = false;
}
sumAmount = sumSidePanelAmount;
isComplate = false;
}
else
{
sumAmount = sumSidePanelAmount;
sumAmount = planInfo.PlanAmount;
isComplate = false;
}
}
@ -359,7 +362,12 @@ public class SheetMetalPlanTaskHandle
if (result)
{
//更新前端展示图表
// RefreshCreatePlanInfoEvent?.Invoke();//更新界面
// RefreshCreatePlanInfoEvent?.Invoke();//更新界面
if (planInfo.PlanType == 3)
{
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshPlanInfoEvent?.Invoke(planInfo);
}
RefreshChatEvent?.Invoke();//刷新图表
}
@ -396,20 +404,24 @@ public class SheetMetalPlanTaskHandle
List<RecordBackPanelComplate> backPanelComplates = _backPanelComplateServices.Query(x => x.ProductlineCode == "1001" && x.PlanCode == planInfo.TaskCode);
int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount);
Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount}板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount}板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount}板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount}板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
int sumAmount = 0;
if (planInfo.PlanType == 1)
{
if (sumSidePanelAmount >= sumBackPanelAmount)
if (sumSidePanelAmount >= sumBackPanelAmount && sumBackPanelAmount != 0)
{
sumAmount = sumBackPanelAmount;
}
else
if (sumBackPanelAmount == 0)
{
sumAmount = sumSidePanelAmount;
sumAmount = 0;
}
if (planInfo.PlanAmount == sumSidePanelAmount)
{
isComplate = false;
}
}
else if (planInfo.PlanType == 2)
{
@ -432,15 +444,18 @@ public class SheetMetalPlanTaskHandle
obj.CompleteAmount = planInfo.CompleteAmount;
obj.ExecuteStatus = planInfo.ExecuteStatus;
bool result = _executePlanInfoServices.UpdateExecutePlanInfo(obj).Result;
if (result)
{
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
Thread.Sleep(5000);
} while (isComplate);
if (!isComplate)
{
//更新前端展示图表
//RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
//SheetMetaSendPlanInfoView planInfo = planInfoList.FirstOrDefault(d => d.TaskCode == planCode);
RefreshPlanInfoEvent?.Invoke(planInfo);//刷新计划执行
}
}
}
catch (Exception ex)
@ -537,8 +552,8 @@ public class SheetMetalPlanTaskHandle
List<RecordBackPanelComplate> backPanelComplates = _backPanelComplateServices.Query(x => x.ProductlineCode == "1001" && x.PlanCode == planInfo.TaskCode);
int sumBackPanelAmount = backPanelComplates.Sum(x => x.OutPutAmount);
Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount}板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount}板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
Console.WriteLine($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount}板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
RefreshExecInfoEvent?.Invoke($"当前计划:{planInfo.TaskCode};计划产量:{planInfo.PlanAmount}板完成:{sumSidePanelAmount};背板完成:{sumBackPanelAmount}");
int sumAmount = 0;
if (planInfo.PlanType == 1)
@ -610,8 +625,8 @@ public class SheetMetalPlanTaskHandle
obj_sidePanel.plc.WriteInt32("D6020", planInfo.PlanAmount);
obj_sidePanel.plc.WriteInt32("D6021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke("等待板设备应答......");
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke("等待板设备应答......");
//下发完成后读取PLC应答应答后复位应答信号
#region PLC反馈信号逻辑处理
@ -623,8 +638,8 @@ public class SheetMetalPlanTaskHandle
if (obj_sidePanel.plc.ReadInt32("D6021") == 2)
{
obj_sidePanel.plc.WriteInt32("D6021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke("收到板设备应答信号,复位应答地址");
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke("收到板设备应答信号,复位应答地址");
isFlag = false;
}
Thread.Sleep(2000);
@ -703,14 +718,14 @@ public class SheetMetalPlanTaskHandle
}
catch (Exception ex)
{
MessageBox.Show($"板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error,
MessageBox.Show($"板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error,
MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
}
}
/// <summary>
/// 下发板生产计划
/// 下发板生产计划
/// </summary>
/// <param name="planInfo"></param>
/// <param name="obj"></param>
@ -729,8 +744,8 @@ public class SheetMetalPlanTaskHandle
obj_sidePanel.plc.WriteInt32("D6020", planInfo.PlanAmount);
obj_sidePanel.plc.WriteInt32("D6021", 1);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke("等待板设备应答......");
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>等待板设备应答。。。。。。");
RefreshExecInfoEvent?.Invoke("等待板设备应答......");
//下发完成后读取PLC应答应答后复位应答信号
#region PLC反馈信号逻辑处理
@ -741,8 +756,8 @@ public class SheetMetalPlanTaskHandle
if (obj_sidePanel.plc.ReadInt32("D6021") == 2)
{
obj_sidePanel.plc.WriteInt32("D6021", 0);
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke("收到板设备应答信号......");
Console.WriteLine($"{DateTime.Now.ToString("HH:m:s")}===>收到板设备应答信号,复位应答地址");
RefreshExecInfoEvent?.Invoke("收到板设备应答信号......");
isFlag = false;
}
Thread.Sleep(2000);
@ -773,13 +788,13 @@ public class SheetMetalPlanTaskHandle
}
catch (Exception ex)
{
MessageBox.Show($"板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error,
MessageBox.Show($"板⽣产计划下发异常:{ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error,
MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
}
}
/// <summary>
/// 读取板生产数据
/// 读取板生产数据
/// </summary>
/// <param name="obj"></param>
public void ReadDeviceComplate_SidePanel(PlcModel obj)
@ -813,8 +828,8 @@ public class SheetMetalPlanTaskHandle
//生产节拍
int productionBeat = short.Parse(bytesToHexStr(info.Skip(51).Take(4).ToArray(), 4), System.Globalization.NumberStyles.HexNumber);
Console.WriteLine($"板设备数据读取====>>>>当前计划:{planCode},物料编号:{materialCode},完成数量:{complateAmount},下线数量:{offLineAmount},设备状态:{deviceStatus},生产节拍:{productionBeat}");
RefreshExecInfoEvent?.Invoke($"板设备数据读取====>>>>当前计划:{planCode},物料编号:{materialCode},完成数量:{complateAmount},下线数量:{offLineAmount},设备状态:{deviceStatus},生产节拍:{productionBeat}");
Console.WriteLine($"板设备数据读取====>>>>当前计划:{planCode},物料编号:{materialCode},完成数量:{complateAmount},下线数量:{offLineAmount},设备状态:{deviceStatus},生产节拍:{productionBeat}");
RefreshExecInfoEvent?.Invoke($"板设备数据读取====>>>>当前计划:{planCode},物料编号:{materialCode},完成数量:{complateAmount},下线数量:{offLineAmount},设备状态:{deviceStatus},生产节拍:{productionBeat}");
//添加完工记录
RecordSidePanelComplate sidePanelComplate = new RecordSidePanelComplate()
@ -869,8 +884,8 @@ public class SheetMetalPlanTaskHandle
if (planInfo.PlanAmount - sumComplateAmount == 0)
{
isFlag = false;
Console.WriteLine($"板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}");
RefreshExecInfoEvent?.Invoke($"板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}");
Console.WriteLine($"板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}");
RefreshExecInfoEvent?.Invoke($"板计划执行完成,计划数量:{planInfo.PlanAmount};实际产量:{sumComplateAmount};差异值:{planInfo.PlanAmount - sumComplateAmount}");
}
}
}
@ -888,6 +903,13 @@ public class SheetMetalPlanTaskHandle
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
RefreshCreatePlanInfoEvent?.Invoke();
var planInfoList = _executePlanInfoServices.QuerySheetMetalSendPlanData("1001");
if (planInfoList != null&& planInfoList.Count != 0)
{
SheetMetaSendPlanInfoView planInfo = planInfoList.FirstOrDefault(d => d.TaskCode == planCode.Replace("\0","").Trim());
RefreshPlanInfoEvent?.Invoke(planInfo);//刷新计划执行
}
}
Thread.Sleep(5000);
} while (isFlag);
@ -897,12 +919,13 @@ public class SheetMetalPlanTaskHandle
//更新前端展示图表
RefreshCreatePlanInfoEvent?.Invoke();//更新界面
RefreshChatEvent?.Invoke();//刷新图表
}
}
catch (Exception e)
{
Console.WriteLine($"读取板设备完成数据异常:{e.Message}");
RefreshExecInfoEvent?.Invoke($"读取板设备完成数据异常:{e.Message}");
Console.WriteLine($"读取板设备完成数据异常:{e.Message}");
RefreshExecInfoEvent?.Invoke($"读取板设备完成数据异常:{e.Message}");
}
}

@ -13,6 +13,10 @@ namespace Aucma.Core.SheetMetal.Models
/// </summary>
public int No { get; set; }
/// <summary>
/// 订单编码
/// </summary>
public string OrderCode { get; set; }
/// <summary>
/// 计划编号
/// </summary>
public string? ProductPlanCode { get; set; }

@ -22,6 +22,7 @@ using Admin.Core.Model.ViewModels;
using NPOI.SS.Formula.Functions;
using log4net;
using Aucma.Core.HwPLc;
using static Npgsql.Replication.PgOutput.Messages.RelationMessage;
/*
*
*/
@ -49,6 +50,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
}};
public Func<double, string> Formatter { get; set; }
public HwPLc.PlcModel obj = null;
#region 构造函数
public IndexPageViewModel()
{
@ -67,7 +69,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
QuantityIssuedViewModel.RefreshCretaePlanInfoEvent += LoadData;
SheetMetalPlanTaskHandle.RefreshCreatePlanInfoEvent += LoadData;
SheetMetalPlanTaskHandle.RefreshChatEvent += RefreshChat;
SheetMetalPlanTaskHandle.RefreshPlanInfoEvent += RefreshPlanShow;
}
#endregion
@ -287,6 +289,38 @@ namespace Aucma.Core.SheetMetal.ViewModels
}
#endregion
public void RefreshPlanShow(SheetMetaSendPlanInfoView execPlan)
{
//更新首页显示信息
//ExecutePlanInfo execPlan = execList.SingleOrDefault(d => d.ExecuteStatus == 2);
if (execPlan != null)
{
OrderCode = execPlan.OrderCode;
MesMOrderCode = execPlan.ProductPlanCode;
ProductModel = execPlan.MaterialName;
BeginTime = execPlan.BeginTime.ToString();
PlanMaxNum = PlanNum = execPlan.PlanAmount;
RealQuantity = execPlan.CompleteAmount;
double diff = _planMaxNum - _realQuantity;
DiffQuantity = int.Parse(diff.ToString());
//CompletionRate = (_realQuantity/_planMaxNum).ToString("0%");
CompletionRate = (_realQuantity / _planMaxNum);
}
else
{
OrderCode = string.Empty;
MesMOrderCode = string.Empty;
ProductModel = string.Empty;
BeginTime = string.Empty;
PlanMaxNum = 0;
RealQuantity = 0.0;
DiffQuantity = 0;
CompletionRate = 0;
}
}
#region 向上
/// <summary>
/// 向上
@ -860,15 +894,31 @@ namespace Aucma.Core.SheetMetal.ViewModels
if (sheetMetalTypeList != null)
{
#region 按类型统计
ChartValues<double> achievement1 = new ChartValues<double>();
ChartValues<double> achievement2 = new ChartValues<double>();
for (int i = 0; i < sheetMetalTypeList.Count; i++)
{
double frontPlateAmount =Convert.ToDouble(sheetMetalTypeList[i].FrontPlateAmount);
ModelStatistics[0].Values[i] = frontPlateAmount;
double rearPanelAmount = Convert.ToDouble(sheetMetalTypeList[i].RearPanelAmount);
ModelStatistics[1].Values[i] = rearPanelAmount;
MaterialNameList[i]=sheetMetalTypeList[i].MaterialName;
if (ModelStatistics.Count==0)
{
RefreshMaterialStats();
}
else
{
if (sheetMetalTypeList.Count()>0)
{
//RefreshMaterialStats();
double frontPlateAmount = Convert.ToDouble(sheetMetalTypeList[i].FrontPlateAmount);
ModelStatistics[0].Values[i] = frontPlateAmount;
double rearPanelAmount = Convert.ToDouble(sheetMetalTypeList[i].RearPanelAmount);
ModelStatistics[1].Values[i] = rearPanelAmount;
MaterialNameList[i] = sheetMetalTypeList[i].MaterialName;
}
else
{
RefreshMaterialStats();
}
}
}
#endregion
}
}));
@ -889,5 +939,13 @@ namespace Aucma.Core.SheetMetal.ViewModels
}
return null;
}
/// <summary>
/// 循环查询成品数据
/// </summary>
public void QueryFinishProduct()
{
}
}
}

@ -15,6 +15,9 @@ using Aucma.Core.Scanner;
using System.Linq;
using System.Threading.Tasks;
using Aucma.Core.SheetMetal.Business;
using System.Threading;
using Admin.Core.IService;
using Microsoft.Extensions.DependencyInjection;
namespace Aucma.Core.SheetMetal.ViewModels
{
@ -25,9 +28,10 @@ namespace Aucma.Core.SheetMetal.ViewModels
private LogPageView logPage = new LogPageView();//日志
private StatisticsPageView statisticsPage = new StatisticsPageView();//统计
private SheetMetalPlanTaskHandle _taskHandle = new SheetMetalPlanTaskHandle();
ISysUserInfoServices _sysUserInfoServices;
public MainWindowViewModel()
{
_sysUserInfoServices = App.ServiceProvider.GetService<ISysUserInfoServices>();
UserContent = firstPage;
init();
Task.Run(() =>
@ -40,6 +44,10 @@ namespace Aucma.Core.SheetMetal.ViewModels
//_taskHandle.InitSendPlan();
_taskHandle.InitSendSidePanelPlan();
});
Task.Run(async () =>
{
await RefreshTeamTime();//班组时间
});
}
public void init()
{
@ -51,6 +59,23 @@ namespace Aucma.Core.SheetMetal.ViewModels
timer.Start();
}
public async Task RefreshTeamTime()
{
while (true)
{
var list= await _sysUserInfoServices.GetTeamData();
if (list!=null&& list.Count>0)
{
var sysUserInfo=list.First();
TeamTime = $"({list.Min(d=>d.StartTime).ToString("HH:mm")}~{list.Max(d => d.EndTime).ToString("HH:mm")})";
TeamName = $"{sysUserInfo.TeamName}";
}
Thread.Sleep(5000);
}
}
#region 设备状态刷新
/// <summary>
/// 设备状态刷新
@ -386,5 +411,25 @@ namespace Aucma.Core.SheetMetal.ViewModels
});
}
#endregion
/// <summary>
/// 班组时间
/// </summary>
public string _teamTime;
public string TeamTime
{
get => _teamTime;
set => SetProperty(ref _teamTime, value);
}
/// <summary>
/// 班组名称
/// </summary>
public string _teamName;
public string TeamName
{
get => _teamName;
set => SetProperty(ref _teamName, value);
}
}
}

@ -81,12 +81,17 @@ namespace Aucma.Core.SheetMetal.ViewModels
private async Task LoadData(string obj)
{
string station = Appsettings.app("StationInfo", "StationCode");
MaterialDataGrid.Clear();
int i = 1;
string station = Appsettings.app("StoreInfo", "StationCode");
var planlist = await _productPlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station));
var queryList = planlist.Where(d=>d.OrderCode.Contains(obj)|| d.MaterialCode.Contains(obj) || d.MaterialName.Contains(obj));
var execList = await _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station));
foreach (var item in queryList)
//var planlist = _productPlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station)).Result;
//if (planlist == null) return ;
//var execList = await _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station));
//if (execList == null) return;
var execList = _executePlanInfoServices.QuerySheetMetalPlanData(station);
if (execList == null) return;
execList=execList.Where(d => d.MaterialName.Contains(obj) || d.OrderCode.Contains(obj) || d.PlanCode.Contains(obj)).ToList();
foreach (var item in execList)
{
int residue = 0;
if (execList == null) residue = 0;
@ -101,6 +106,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
PlanAmount = item.PlanAmount,
ResidueAmount = item.PlanAmount - item.CompleteAmount,
SpliteResidueAmount = item.PlanAmount - residue,
MaterialSpecificatons = item.MaterialSpecificatons,
StartDate = item.BeginTime
});
i++;
@ -360,31 +366,15 @@ namespace Aucma.Core.SheetMetal.ViewModels
{
string productLineCode = Appsettings.app("StationInfo", "StationCode");
MaterialDataGrid.Clear();
int i = 1;
string station = Appsettings.app("StationInfo", "StationCode");
var planlist = _productPlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station)&&d.MaterialName.Contains(selectedOption)).Result;
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)
if (!string.IsNullOrEmpty(selectedOption))
{
int residue = 0;
if (execList == null) residue = 0;
else residue = (execList.Where(d => d.MaterialCode.Equals(item.MaterialCode))).Sum(d => d.PlanAmount);
MaterialDataGrid.Add(new ProductPlanInfoModel()
{
No = i,
PlanCode = item.PlanCode,
MaterialCode = item.MaterialCode,
MaterialName = item.MaterialName,
OrderCode = item.OrderCode,
PlanAmount = item.PlanAmount,
ResidueAmount = item.PlanAmount - item.CompleteAmount,
SpliteResidueAmount = item.PlanAmount - residue,
StartDate = item.BeginTime
});
i++;
await LoadData(selectedOption);
}
else
{
await LoadData();
}
}
#endregion

@ -46,6 +46,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
MaterialDataGrid.Add(new MaterialComplateInfo() {
No = i,
ProductPlanCode = item.PlanCode,
OrderCode = item.OrderCode,
MaterialCode = item.MaterialCode,
MaterialName = item.MaterialName,
PlanAmount = item.PlanAmount,

@ -70,7 +70,7 @@
<Setter Property="Foreground" Value="White"/>
</Trigger>
<DataTrigger Binding="{Binding ExecuteStatus}" Value="2">
<Setter Property="Background" Value="CadetBlue" />
<Setter Property="Background" Value="#0FD1E2" />
</DataTrigger>
</Style.Triggers>
</Style>
@ -132,7 +132,7 @@
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" >
<TextBlock Text="订单编号" FontSize="18" Foreground="White"/>
<TextBlock Text="SAP订单编号" FontSize="18" Foreground="White"/>
<TextBox FontSize="18" Text="{Binding OrderCode}" Foreground="White" BorderBrush="White" Width="300" IsReadOnly="True" Margin="30,0,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
</StackPanel>
@ -171,10 +171,10 @@
<RowDefinition Height="7*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,0,0" >
<TextBlock Text="订单数量" FontSize="18" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock Text="SAP订单数量" FontSize="18" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,0,0" >
<lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="{Binding PlanMaxNum,Mode=TwoWay}"
<lvc:Gauge Margin="5" DisableAnimations="True" Uses360Mode="True" From="0" To="{Binding PlanMaxNum,Mode=TwoWay}"
Value="{Binding PlanMaxNum,Mode=TwoWay}"
Foreground="White"/>
</Border>
@ -191,7 +191,7 @@
<TextBlock Text="生产数量" FontSize="18" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,0,0" >
<lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="{Binding PlanMaxNum,Mode=TwoWay}"
<lvc:Gauge Margin="5" DisableAnimations="True" Uses360Mode="True" From="0" To="{Binding PlanMaxNum,Mode=TwoWay}"
Value="{Binding RealQuantity,Mode=TwoWay}"
Foreground="White" />
</Border>
@ -208,7 +208,7 @@
<TextBlock Text="差异数量" FontSize="18" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="1" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,0,0" >
<lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="{Binding PlanMaxNum,Mode=TwoWay}"
<lvc:Gauge DisableAnimations="True" Margin="5" Uses360Mode="True" From="0" To="{Binding PlanMaxNum,Mode=TwoWay}"
Value="{Binding DiffQuantity,Mode=TwoWay}"
Foreground="White"/>
</Border>
@ -224,8 +224,8 @@
<Border Grid.Row="0" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,0,0" >
<TextBlock Text="订单完成率" FontSize="18" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="1" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,0,0" >
<lvc:Gauge Margin="5" Uses360Mode="True" From="0" To="1"
<Border Grid.Row="1" BorderThickness="0" CornerRadius="0" Background="Transparent" Margin="1,1,0,0" >
<lvc:Gauge Margin="5" DisableAnimations="True" Uses360Mode="True" From="0" To="1"
Value="{Binding CompletionRate,Mode=TwoWay}"
Foreground="White"/>
</Border>

@ -10,7 +10,7 @@
<Border Grid.Row="1" Grid.Column="1" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Background="Transparent" Margin="5 15 5 5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"/>
<RowDefinition Height="0.6*"/>
<RowDefinition Height="9*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Background="#1157b9" Margin="1,1,5,5" >

@ -37,16 +37,17 @@
<TextBlock Text="箱壳自动生产控制系统" FontSize="42" Foreground="White" FontWeight="Bold"/>
</StackPanel>
<StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right">
<StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0 20 0 0" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<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.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" >
<TextBlock Grid.Column="0" Text="{Binding TeamName}" FontSize="25" Foreground="White" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="{Binding TeamTime}" FontSize="25" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</Grid>
</StackPanel>
</Grid>

@ -35,28 +35,28 @@
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="计划编号" FontSize="18" Foreground="#FFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="MES计划编号" FontSize="18" Foreground="#FFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox x:Name="planCode" FontSize="18" Text="{Binding PlanInfo.PlanCode}" Foreground="#FFFFFF" BorderBrush="White" Width="150" IsReadOnly="True" />
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="工单编号" FontSize="18" Foreground="#FFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="SAP工单编号" FontSize="18" Foreground="#FFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox x:Name="orderCode" FontSize="18" Text="{Binding PlanInfo.OrderCode}" Foreground="#FFFFFF" BorderBrush="White" Width="150" IsReadOnly="True" Margin="5,0,10,0"/>
</StackPanel>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="产品型号" FontSize="18" Foreground="#FFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;产品型号" FontSize="18" Foreground="#FFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox x:Name="materialCode" FontSize="18" Text="{Binding PlanInfo.MaterialName}" Foreground="#FFFFFF" BorderBrush="White" Width="150" IsReadOnly="True" Margin="5,0,10,0"/>
</StackPanel>
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="产品简码" FontSize="18" Foreground="#FFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;产品简码" FontSize="18" Foreground="#FFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox x:Name="materialSpecificatons" FontSize="18" Text="{Binding PlanInfo.MaterialSpecificatons}" Foreground="#FFFFFF" BorderBrush="White" Width="150" IsReadOnly="True" Margin="5,0,10,0"/>
</StackPanel>
<StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="计划数量" FontSize="18" Foreground="#FFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;计划数量" FontSize="18" Foreground="#FFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox FontSize="18" Text="{Binding PlanInfo.PlanAmount}" Foreground="#FFFFFF" BorderBrush="White" Width="150" IsReadOnly="True" Margin="5,0,10,0"/>
</StackPanel>
<StackPanel Grid.Row="5" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="完成数量" FontSize="18" Foreground="#FFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;完成数量" FontSize="18" Foreground="#FFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox FontSize="18" Text="{Binding PlanInfo.CompleteAmount}" Foreground="#FFFFFF" BorderBrush="White" Width="150" IsReadOnly="True" Margin="5,0,10,0"/>
</StackPanel>
</Grid>

@ -26,13 +26,14 @@ namespace Aucma.Core.SheetMetal.Views
public QuantityIssuedView()
{
InitializeComponent();
this.TransmitAmount.Focus();
}
public QuantityIssuedView(ProductPlanInfoModel productPlanInfo)
{
InitializeComponent();
this.DataContext = new QuantityIssuedViewModel(productPlanInfo);
this.TransmitAmount.Focus();
}
}
}

@ -236,7 +236,7 @@
<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="3*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding MaterialSpecificatons}" Header="产品型号" Width="*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding MaterialSpecificatons}" Header="产品型号" Width="*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" Visibility="Collapsed"/>
<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}"/>

@ -87,7 +87,7 @@
<RowDefinition Height="9*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Background="#1157b9" Margin="1,1,5,5" Grid.ColumnSpan="3" >
<TextBlock Text="生产统计" FontSize="25" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock Text="生产明细" FontSize="25" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5" Grid.ColumnSpan="3">
<Grid Margin="10,5">
@ -117,7 +117,8 @@
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding No}" Header="序号" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding ProductPlanCode}" Header="计划编号" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding ProductPlanCode}" Header="MES计划编号" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding ProductPlanCode}" Header="SAP订单编码" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding MaterialName}" Header="物料名称" Width="3*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding PlanAmount}" Header="计划数量" Width="*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding SidePanelComplete}" Header="前板数量" Width="*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>

Loading…
Cancel
Save