liulb@mesnac.com 1 year ago
parent 3392d61d2b
commit 6a529d1b09

@ -0,0 +1,624 @@
using Admin.Core.IService.ISys;
using Admin.Core.IService;
using Quartz;
using System;
using System.Threading.Tasks;
using log4net;
using Admin.Core.Common;
using System.Linq;
using Admin.Core.Model.Model_New;
using Aucma.Core.HwPLc;
using System.Collections.Generic;
using Admin.Core.Model;
/// <summary>
/// 老发泡数据采集
/// </summary>
namespace Admin.Core.Tasks
{
public class Job_OldBoxFoamStore_Quartz : JobBase, IJob
{
#region 事件
/// <summary>
/// 发泡线新事件
/// </summary>
/// <returns></returns>
public delegate Task RefreshBoxFoamDataDelegate();
public static event RefreshBoxFoamDataDelegate RefreshBoxFoamDataDelegateEvent;
/// <summary>
/// 老发泡线更新事件
/// </summary>
/// <returns></returns>
public delegate Task RefreshOldBoxFoamDataDelegate(List<OldBoxFoamData> list);
public static event RefreshOldBoxFoamDataDelegate RefreshOldBoxFoamDataDelegateEvent;
/// <summary>
/// 老泡前库更新事件
/// </summary>
/// <returns></returns>
public delegate Task RefreshOldBoxFoamTypeDataDelegate(List<OldBoxFoamType> list);
public static event RefreshOldBoxFoamTypeDataDelegate RefreshOldBoxFoamTypeDataDelegateEvent;
#endregion
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(Job_BoxFoamData_Quartz));
private readonly IOldBoxFoamTypeServices _oldBoxFoamTypeServices;
private readonly IOldBoxFoamDataServices _oldBoxFoamDataServices;
public Job_OldBoxFoamStore_Quartz(ISysTasksQzService SysTasksQzService, ISysJobLogService sysJobLogService,
IOldBoxFoamTypeServices oldBoxFoamTypeServices, IOldBoxFoamDataServices oldBoxFoamDataServices)
{
_SysTasksQzService = SysTasksQzService;
_oldBoxFoamTypeServices = oldBoxFoamTypeServices;
_oldBoxFoamDataServices = oldBoxFoamDataServices;
}
public async Task Execute(IJobExecutionContext context)
{
//await ExecuteJob(context, async () => await OldBoxFoamDataRun(context));//发泡线
await ExecuteJob(context, async () => await OldBoxFoamStoreDataRun(context));
}
/// <summary>
/// 发泡线
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public async Task OldBoxFoamDataRun(IJobExecutionContext context)
{
await OldBoxFoamData();
}
public async Task OldBoxFoamStoreDataRun(IJobExecutionContext context)
{
await OldBoxFoamStoreData();
}
#region PLC 老泡前库任务处理表
/// <summary>
/// PLC 任务处理表
/// </summary>
/// <param name="storeCode">仓库编码</param>
/// <param name="materialBarCode">物料编码</param>
/// <returns></returns>
public async Task OldBoxFoamStoreData()
{
try
{
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldTypePlc1"));
if (obj == null) { return; }
if (obj.plc.IsConnected)
{
var taskList = await _oldBoxFoamTypeServices.QueryAsync();
int i = taskList.Count();
foreach (var item in taskList)
{
await UpdateRealOldBoxFoamTypeData(obj, item);
i--;
if (i==0)
{
var list = await _oldBoxFoamTypeServices.QueryAsync();
RefreshOldBoxFoamTypeDataDelegateEvent?.Invoke(list);
}
}
}
}
catch (Exception ex)
{
logHelper.Error($"入库数据处理异常:{ex.Message}");
}
}
/// <summary>
/// 泡前库更新
/// </summary>
/// <param name="obj"></param>
/// <param name="item"></param>
/// <returns></returns>
private async Task<OldBoxFoamType> UpdateRealOldBoxFoamTypeData(PlcModel obj, OldBoxFoamType item)
{
try
{
#region 更新PLC数据
if (item.ObjId == 1)
{
int amount = 0;
var str = $"{obj.plc.ReadInt16("L101")}{obj.plc.ReadInt16("L102")}{obj.plc.ReadInt16("L103")}";
if (str.IsNotEmptyOrNull())
{
int r=Convert.ToInt32(str);
switch (r)
{
case 0:
amount = 0;
break;
case 1:
amount=1;
break;
case 11:
amount = 2;
break;
case 111:
amount = 3;
break;
default:
break;
}
item.Boxtype = obj.plc.ReadString("D2010");
item.Storeamount = amount;
item.UpdatedTime = DateTime.Now;
}
}
if (item.ObjId == 2)
{
int amount = 0;
var str = obj.plc.ReadInt16("L201").ToString() + obj.plc.ReadInt16("L202").ToString() + obj.plc.ReadInt16("L303").ToString();
if (str.IsNotEmptyOrNull())
{
int r = Convert.ToInt32(str);
switch (r)
{
case 0:
amount = 0;
break;
case 1:
amount = 1;
break;
case 11:
amount = 2;
break;
case 111:
amount = 3;
break;
default:
amount = r;
break;
}
item.Boxtype = obj.plc.ReadString("D2020");
item.Storeamount = amount;
item.UpdatedTime = DateTime.Now;
}
}
if (item.ObjId == 3)
{
int amount = 0;
var str = obj.plc.ReadInt16("L301").ToString() + obj.plc.ReadInt16("L302").ToString() + obj.plc.ReadInt16("L303").ToString();
if (str.IsNotEmptyOrNull())
{
int r = Convert.ToInt32(str);
switch (r)
{
case 0:
amount = 0;
break;
case 1:
amount = 1;
break;
case 11:
amount = 2;
break;
case 111:
amount = 3;
break;
default:
break;
}
item.Boxtype = obj.plc.ReadString("D2030");
item.Storeamount = amount;
item.UpdatedTime = DateTime.Now;
}
}
if (item.ObjId == 4)
{
int amount = 0;
var str = obj.plc.ReadInt16("L401").ToString() + obj.plc.ReadInt16("L402").ToString() + obj.plc.ReadInt16("L403").ToString();
if (str.IsNotEmptyOrNull())
{
int r = Convert.ToInt32(str);
switch (r)
{
case 0:
amount = 0;
break;
case 1:
amount = 1;
break;
case 11:
amount = 2;
break;
case 111:
amount = 3;
break;
default:
break;
}
item.Boxtype = obj.plc.ReadString("D2040");
item.Storeamount = amount;
item.UpdatedTime = DateTime.Now;
}
}
if (item.ObjId == 5)
{
int amount = 0;
var str = obj.plc.ReadInt16("L501").ToString() + obj.plc.ReadInt16("L502").ToString() + obj.plc.ReadInt16("L503").ToString();
if (str.IsNotEmptyOrNull())
{
int r = Convert.ToInt32(str);
switch (r)
{
case 0:
amount = 0;
break;
case 1:
amount = 1;
break;
case 11:
amount = 2;
break;
case 111:
amount = 3;
break;
default:
break;
}
item.Boxtype = obj.plc.ReadString("D2010");
item.Storeamount = amount;
item.UpdatedTime = DateTime.Now;
}
}
if (item.ObjId == 6)
{
int amount = 0;
var str = obj.plc.ReadInt16("L601").ToString() + obj.plc.ReadInt16("L602").ToString() + obj.plc.ReadInt16("L603").ToString();
if (str.IsNotEmptyOrNull())
{
int r = Convert.ToInt32(str);
switch (r)
{
case 0:
amount = 0;
break;
case 1:
amount = 1;
break;
case 11:
amount = 2;
break;
case 111:
amount = 3;
break;
default:
break;
}
item.Boxtype = obj.plc.ReadString("D2020");
item.Storeamount = amount;
item.UpdatedTime = DateTime.Now;
}
}
if (item.ObjId == 7)
{
int amount = 0;
var str = obj.plc.ReadInt16("L701").ToString() + obj.plc.ReadInt16("L702").ToString() + obj.plc.ReadInt16("L703").ToString();
if (str.IsNotEmptyOrNull())
{
int r = Convert.ToInt32(str);
switch (r)
{
case 0:
amount = 0;
break;
case 1:
amount = 1;
break;
case 11:
amount = 2;
break;
case 111:
amount = 3;
break;
default:
break;
}
item.Boxtype = obj.plc.ReadString("D2030");
item.Storeamount = amount;
item.UpdatedTime = DateTime.Now;
}
}
if (item.ObjId == 8)
{
int amount = 0;
var str = obj.plc.ReadInt16("L801").ToString() + obj.plc.ReadInt16("L802").ToString() + obj.plc.ReadInt16("L803").ToString();
if (str.IsNotEmptyOrNull())
{
int r = Convert.ToInt32(str);
switch (r)
{
case 0:
amount = 0;
break;
case 1:
amount = 1;
break;
case 11:
amount = 2;
break;
case 111:
amount = 3;
break;
default:
break;
}
item.Boxtype = obj.plc.ReadString("D2040");
item.Storeamount = amount;
item.UpdatedTime = DateTime.Now;
}
}
#endregion
bool result = await _oldBoxFoamTypeServices.UpdateAsync(item);
if (result)
{
//var list = await _oldBoxFoamTypeServices.QueryAsync();
//RefreshOldBoxFoamTypeDataDelegateEvent?.Invoke(list);
}
else
{
// LogDelegateEvent?.Invoke($"物料[{planInfo.MaterialName}], 入库[{baseSpace.SpaceName}]失败,任务回滚!");
}
}
catch (Exception ex)
{
logHelper.Error($"更新老箱体发泡数据失败");
}
return await Task.FromResult(item);
}
#endregion
#region 老泡线体夹具任务处理表
public async Task OldBoxFoamData()
{
var list = await _oldBoxFoamDataServices.QueryAsync();
int i = list.Count();
foreach (var item in list)
{
UpdateRealOldBoxFoamData(item);
i--;
if (i == 0)
{
List<OldBoxFoamData> old = await _oldBoxFoamDataServices.QueryAsync();
RefreshOldBoxFoamDataDelegateEvent?.Invoke(old);
}
}
}
private async void UpdateRealOldBoxFoamData(OldBoxFoamData item)
{
if (item.ObjId == 1)
{
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1"));
if (obj == null) { return; }
if (obj.plc.IsConnected)
{
var type1 = $"{obj.plc.ReadInt32("D3140")}";
if (type1.ToString()!="0")
{
item.Fixtureboxtype = type1;
}
//var type2 = $"{obj.plc.ReadInt16("D3141")}";
//if (type1.ToString() != "0")
//{
// item.Fixtureboxtype = item.Fixtureboxtype+type2;
//}
//string type = $"{obj.plc.ReadInt16("D3140")}{obj.plc.ReadInt16("D3141")}";
//item.Fixtureboxtype = type;
if (obj.plc.ReadBool("Y0F0"))
{
item.Fixturestatus = "手动";
}
else if (obj.plc.ReadBool("Y0F1"))
{
item.Fixturestatus = "手动";
}
else if (obj.plc.ReadBool("Y110"))
{
item.Fixturestatus = "停止";
}
item.Production = obj.plc.ReadInt16("D182");
item.CuringTimeSettingValue = obj.plc.ReadInt16("D910").ToString();
item.ActualValue = obj.plc.ReadInt16("T3").ToString();
item.UpdatedTime = DateTime.Now;
}
}
if (item.ObjId == 2)
{
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1"));
if (obj == null) { return; }
if (obj.plc.IsConnected)
{
//string type = $"{obj.plc.ReadInt16("D3142")}{obj.plc.ReadInt16("D3141")}";
//item.Fixtureboxtype = type;
var type1 = $"{obj.plc.ReadInt32("D3142")}";
if (type1.ToString() != "0")
{
item.Fixtureboxtype = type1;
}
if (obj.plc.ReadBool("Y0F5"))
{
item.Fixturestatus = "手动";
}
if (obj.plc.ReadBool("Y0F6"))
{
item.Fixturestatus = "手动";
}
if (obj.plc.ReadBool("Y111"))
{
item.Fixturestatus = "停止";
}
item.Production = obj.plc.ReadInt16("D183");
item.CuringTimeSettingValue = obj.plc.ReadInt16("D912").ToString();
item.ActualValue = obj.plc.ReadInt16("T13").ToString();
item.UpdatedTime = DateTime.Now;
}
}
if (item.ObjId == 3)
{
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1"));
if (obj == null) { return; }
if (obj.plc.IsConnected)
{
//string type = $"{obj.plc.ReadInt16("D3142")}{obj.plc.ReadInt16("D3143")}";
//item.Fixtureboxtype = type;
var type1 = $"{obj.plc.ReadInt32("D3144")}";
if (type1.ToString() != "0")
{
item.Fixtureboxtype = type1;
}
if (obj.plc.ReadBool("Y0FA"))
{
item.Fixturestatus = "手动";
}
if (obj.plc.ReadBool("Y0FB"))
{
item.Fixturestatus = "手动";
}
if (obj.plc.ReadBool("Y112"))
{
item.Fixturestatus = "停止";
}
item.Production = obj.plc.ReadInt16("D184");
item.CuringTimeSettingValue = obj.plc.ReadInt16("D912").ToString();
item.ActualValue = obj.plc.ReadInt16("T23").ToString();
item.UpdatedTime = DateTime.Now;
}
}
if (item.ObjId == 4)
{
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1"));
if (obj == null) { return; }
if (obj.plc.IsConnected)
{
// string type = $"{obj.plc.ReadInt16("D3144")}{obj.plc.ReadInt16("D3145")}";
var type1 = $"{obj.plc.ReadInt32("D3146")}";
if (type1.ToString() != "0")
{
item.Fixtureboxtype = type1;
}
item.Production = obj.plc.ReadInt16("D185");
item.CuringTimeSettingValue = obj.plc.ReadInt16("D913").ToString();
item.ActualValue = obj.plc.ReadInt16("T33").ToString();
item.UpdatedTime = DateTime.Now;
}
var objStatus = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2"));
if (objStatus != null) {
if (objStatus.plc.ReadBool("Y100"))
{
item.Fixturestatus = "手动";
}
if (objStatus.plc.ReadBool("Y101"))
{
item.Fixturestatus = "手动";
}
if (objStatus.plc.ReadBool("Y113"))
{
item.Fixturestatus = "停止";
}
}
}
if (item.ObjId == 5)
{
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1"));
if (obj == null) { return; }
if (obj.plc.IsConnected)
{
//string type = $"{obj.plc.ReadInt16("D3150")}{obj.plc.ReadInt16("D3151")}";
//item.Fixtureboxtype = type;
var type1 = $"{obj.plc.ReadInt32("D3148")}";
if (type1.ToString() != "0")
{
item.Fixtureboxtype = type1;
}
item.Production = obj.plc.ReadInt16("D186");
item.CuringTimeSettingValue = obj.plc.ReadInt16("D913").ToString();
item.ActualValue = obj.plc.ReadInt16("T43").ToString();
item.UpdatedTime = DateTime.Now;
}
var objStatus = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2"));
if (objStatus != null&& objStatus.plc.IsConnected)
{
if (objStatus.plc.ReadBool("Y105"))
{
item.Fixturestatus = "手动";
}
if (objStatus.plc.ReadBool("Y106"))
{
item.Fixturestatus = "手动";
}
if (objStatus.plc.ReadBool("Y114"))
{
item.Fixturestatus = "停止";
}
}
}
if (item.ObjId == 6)
{
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc1"));
if (obj == null) { return; }
if (obj.plc.IsConnected)
{
//string type = $"{obj.plc.ReadInt16("D3152")}{obj.plc.ReadInt16("D3143")}";
//item.Fixtureboxtype = type;
var type1 = $"{obj.plc.ReadInt32("D3150")}";
if (type1.ToString() != "0")
{
item.Fixtureboxtype = type1;
}
else
{
item.Fixtureboxtype = "";
}
item.CuringTimeSettingValue = obj.plc.ReadInt16("D915").ToString();
item.Production = obj.plc.ReadInt16("D187");
item.UpdatedTime = DateTime.Now;
}
var objStatus = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2"));
if (objStatus != null)
{
if (objStatus.plc.ReadBool("Y10A"))
{
item.Fixturestatus = "手动";
}
if (objStatus.plc.ReadBool("Y10B"))
{
item.Fixturestatus = "手动";
}
if (objStatus.plc.ReadBool("Y115"))
{
item.Fixturestatus = "停止";
}
item.ActualValue = objStatus.plc.ReadInt16("T53").ToString();
}
}
bool result = await _oldBoxFoamDataServices.UpdateAsync(item);
if (result)
{
//var list = await _oldBoxFoamTypeServices.QueryAsync();
//RefreshOldBoxFoamDataDelegateEvent?.Invoke(list);
}
else
{
// RefreshOldBoxFoamDataDelegateEvent?.Invoke($"物料[{planInfo.MaterialName}], 入库[{baseSpace.SpaceName}]失败,任务回滚!");
}
}
#endregion
}
}

@ -56,7 +56,7 @@ namespace Admin.Core.Tasks
public async Task Execute(IJobExecutionContext context)
{
await ExecuteJob(context, async () => await OldBoxFoamDataRun(context));//发泡线
await ExecuteJob(context, async () => await OldBoxFoamStoreDataRun(context));
//await ExecuteJob(context, async () => await OldBoxFoamStoreDataRun(context));
}
/// <summary>
/// 发泡线
@ -241,7 +241,7 @@ namespace Admin.Core.Tasks
if (item.ObjId == 5)
{
int amount = 0;
var str = obj.plc.ReadInt16("L101").ToString() + obj.plc.ReadInt16("L102").ToString() + obj.plc.ReadInt16("L103").ToString();
var str = obj.plc.ReadInt16("L501").ToString() + obj.plc.ReadInt16("L502").ToString() + obj.plc.ReadInt16("L503").ToString();
if (str.IsNotEmptyOrNull())
{
int r = Convert.ToInt32(str);
@ -270,7 +270,7 @@ namespace Admin.Core.Tasks
if (item.ObjId == 6)
{
int amount = 0;
var str = obj.plc.ReadInt16("L201").ToString() + obj.plc.ReadInt16("L202").ToString() + obj.plc.ReadInt16("L203").ToString();
var str = obj.plc.ReadInt16("L601").ToString() + obj.plc.ReadInt16("L602").ToString() + obj.plc.ReadInt16("L603").ToString();
if (str.IsNotEmptyOrNull())
{
int r = Convert.ToInt32(str);
@ -299,7 +299,7 @@ namespace Admin.Core.Tasks
if (item.ObjId == 7)
{
int amount = 0;
var str = obj.plc.ReadInt16("L301").ToString() + obj.plc.ReadInt16("L302").ToString() + obj.plc.ReadInt16("L303").ToString();
var str = obj.plc.ReadInt16("L701").ToString() + obj.plc.ReadInt16("L702").ToString() + obj.plc.ReadInt16("L703").ToString();
if (str.IsNotEmptyOrNull())
{
int r = Convert.ToInt32(str);
@ -328,7 +328,7 @@ namespace Admin.Core.Tasks
if (item.ObjId == 8)
{
int amount = 0;
var str = obj.plc.ReadInt16("L401").ToString() + obj.plc.ReadInt16("L402").ToString() + obj.plc.ReadInt16("L403").ToString();
var str = obj.plc.ReadInt16("L801").ToString() + obj.plc.ReadInt16("L802").ToString() + obj.plc.ReadInt16("L803").ToString();
if (str.IsNotEmptyOrNull())
{
int r = Convert.ToInt32(str);
@ -401,8 +401,18 @@ namespace Admin.Core.Tasks
if (obj == null) { return; }
if (obj.plc.IsConnected)
{
string type = $"{obj.plc.ReadInt16("D3140")}{obj.plc.ReadInt16("D3141")}";
item.Fixtureboxtype = type;
var type1 = $"{obj.plc.ReadInt32("D3140")}";
if (type1.ToString()!="0")
{
item.Fixtureboxtype = type1;
}
//var type2 = $"{obj.plc.ReadInt16("D3141")}";
//if (type1.ToString() != "0")
//{
// item.Fixtureboxtype = item.Fixtureboxtype+type2;
//}
//string type = $"{obj.plc.ReadInt16("D3140")}{obj.plc.ReadInt16("D3141")}";
//item.Fixtureboxtype = type;
if (obj.plc.ReadBool("Y0F0"))
{
item.Fixturestatus = "手动";
@ -415,18 +425,11 @@ namespace Admin.Core.Tasks
{
item.Fixturestatus = "停止";
}
item.Production = obj.plc.ReadInt16("D182");
item.CuringTimeSettingValue = obj.plc.ReadInt16("D910").ToString();
item.ActualValue = obj.plc.ReadInt16("T3").ToString();
item.UpdatedTime = DateTime.Now;
}
var objProduction = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2"));
if (objProduction == null) {
item.Production = 0;
}
else
{
item.Production = objProduction.plc.ReadInt16("D181");
}
}
if (item.ObjId == 2)
{
@ -434,8 +437,15 @@ namespace Admin.Core.Tasks
if (obj == null) { return; }
if (obj.plc.IsConnected)
{
string type = $"{obj.plc.ReadInt16("D3142")}{obj.plc.ReadInt16("D3141")}";
item.Fixtureboxtype = type;
//string type = $"{obj.plc.ReadInt16("D3142")}{obj.plc.ReadInt16("D3141")}";
//item.Fixtureboxtype = type;
var type1 = $"{obj.plc.ReadInt32("D3142")}";
if (type1.ToString() != "0")
{
item.Fixtureboxtype = type1;
}
if (obj.plc.ReadBool("Y0F5"))
{
item.Fixturestatus = "手动";
@ -448,19 +458,11 @@ namespace Admin.Core.Tasks
{
item.Fixturestatus = "停止";
}
item.Production = obj.plc.ReadInt16("D183");
item.CuringTimeSettingValue = obj.plc.ReadInt16("D912").ToString();
item.ActualValue = obj.plc.ReadInt16("T13").ToString();
item.UpdatedTime = DateTime.Now;
}
var objProduction = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2"));
if (objProduction == null)
{
item.Production = 0;
}
else if (objProduction != null&& objProduction.plc.IsConnected)
{
item.Production = objProduction.plc.ReadInt16("D183");
}
}
if (item.ObjId == 3)
{
@ -468,8 +470,13 @@ namespace Admin.Core.Tasks
if (obj == null) { return; }
if (obj.plc.IsConnected)
{
string type = $"{obj.plc.ReadInt16("D3142")}{obj.plc.ReadInt16("D3143")}";
item.Fixtureboxtype = type;
//string type = $"{obj.plc.ReadInt16("D3142")}{obj.plc.ReadInt16("D3143")}";
//item.Fixtureboxtype = type;
var type1 = $"{obj.plc.ReadInt32("D3144")}";
if (type1.ToString() != "0")
{
item.Fixtureboxtype = type1;
}
if (obj.plc.ReadBool("Y0FA"))
{
item.Fixturestatus = "手动";
@ -482,20 +489,11 @@ namespace Admin.Core.Tasks
{
item.Fixturestatus = "停止";
}
item.Production = obj.plc.ReadInt16("D184");
item.CuringTimeSettingValue = obj.plc.ReadInt16("D912").ToString();
item.ActualValue = obj.plc.ReadInt16("T23").ToString();
item.UpdatedTime = DateTime.Now;
}
var objProduction = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2"));
if (objProduction == null)
{
item.Production = 0;
}
else
{
item.Production = objProduction.plc.ReadInt16("D184");
}
}
if (item.ObjId == 4)
{
@ -503,9 +501,13 @@ namespace Admin.Core.Tasks
if (obj == null) { return; }
if (obj.plc.IsConnected)
{
string type = $"{obj.plc.ReadInt16("D3144")}{obj.plc.ReadInt16("D3145")}";
item.Fixtureboxtype = type;
// string type = $"{obj.plc.ReadInt16("D3144")}{obj.plc.ReadInt16("D3145")}";
var type1 = $"{obj.plc.ReadInt32("D3146")}";
if (type1.ToString() != "0")
{
item.Fixtureboxtype = type1;
}
item.Production = obj.plc.ReadInt16("D185");
item.CuringTimeSettingValue = obj.plc.ReadInt16("D913").ToString();
item.ActualValue = obj.plc.ReadInt16("T33").ToString();
item.UpdatedTime = DateTime.Now;
@ -524,7 +526,7 @@ namespace Admin.Core.Tasks
{
item.Fixturestatus = "停止";
}
item.Production = objStatus.plc.ReadInt16("D185");
}
}
if (item.ObjId == 5)
@ -533,8 +535,14 @@ namespace Admin.Core.Tasks
if (obj == null) { return; }
if (obj.plc.IsConnected)
{
string type = $"{obj.plc.ReadInt16("D3150")}{obj.plc.ReadInt16("D3151")}";
item.Fixtureboxtype = type;
//string type = $"{obj.plc.ReadInt16("D3150")}{obj.plc.ReadInt16("D3151")}";
//item.Fixtureboxtype = type;
var type1 = $"{obj.plc.ReadInt32("D3148")}";
if (type1.ToString() != "0")
{
item.Fixtureboxtype = type1;
}
item.Production = obj.plc.ReadInt16("D186");
item.CuringTimeSettingValue = obj.plc.ReadInt16("D913").ToString();
item.ActualValue = obj.plc.ReadInt16("T43").ToString();
item.UpdatedTime = DateTime.Now;
@ -555,7 +563,7 @@ namespace Admin.Core.Tasks
{
item.Fixturestatus = "停止";
}
item.Production = objStatus.plc.ReadInt16("D186");
}
}
if (item.ObjId == 6)
@ -564,10 +572,19 @@ namespace Admin.Core.Tasks
if (obj == null) { return; }
if (obj.plc.IsConnected)
{
string type = $"{obj.plc.ReadInt16("D3152")}{obj.plc.ReadInt16("D3143")}";
item.Fixtureboxtype = type;
//string type = $"{obj.plc.ReadInt16("D3152")}{obj.plc.ReadInt16("D3143")}";
//item.Fixtureboxtype = type;
var type1 = $"{obj.plc.ReadInt32("D3150")}";
if (type1.ToString() != "0")
{
item.Fixtureboxtype = type1;
}
else
{
item.Fixtureboxtype = "";
}
item.CuringTimeSettingValue = obj.plc.ReadInt16("D915").ToString();
item.Production = obj.plc.ReadInt16("D187");
item.UpdatedTime = DateTime.Now;
}
var objStatus = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("OldMelsecPlc2"));
@ -586,7 +603,7 @@ namespace Admin.Core.Tasks
item.Fixturestatus = "停止";
}
item.ActualValue = objStatus.plc.ReadInt16("T53").ToString();
item.Production = objStatus.plc.ReadInt16("D187");
}
}

@ -31,7 +31,7 @@ namespace Aucma.Core.HwPLc
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
byte[] ReadBytes(string address);
byte[] ReadBytes(string address, ushort len);
/// <summary>
/// 读取bool
/// </summary>

@ -124,12 +124,12 @@ namespace Aucma.Core.HwPLc
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
public byte[] ReadBytes(string address)
public byte[] ReadBytes(string address,ushort len)
{
byte[] bytes = null;
try
{
OperateResult<byte[]> read = melsecMcNet.Read(address, 26);
OperateResult<byte[]> read = melsecMcNet.Read(address, len);
if (read.IsSuccess)
{
byte[] code = new byte[read.Content.Length - 2];

@ -498,6 +498,11 @@ namespace Aucma.Core.HwPLc
}
return false;
}
public byte[] ReadBytes(string address, ushort len)
{
throw new NotImplementedException();
}
#endregion
}
}

@ -0,0 +1,116 @@
using Admin.Core.IService;
using Aucma.Core.OldBoxFoam.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace Aucma.Core.OldBoxFoam.ViewModels
{
/**
*
*
* */
public partial class FoamPlanPageViewModel : ObservableObject
{
protected readonly IBoxFoamPlanServices? _boxFoamPlanServices;
public FoamPlanPageViewModel()
{
_boxFoamPlanServices = App.ServiceProvider.GetService<IBoxFoamPlanServices>();
WeakReferenceMessenger.Default.Register<string>(this, Recive);
InitData();
}
public async void InitData()
{
var task =await _boxFoamPlanServices.QueryAsync();
if (task == null) return;
task.OrderBy(d=>d.ObjId);
foreach (var item in task)
{
Id.Add(item.ObjId);
MaterialCode.Add(item.MaterialCode);
MaterialName.Add(item.MaterialName);
PlanAmount.Add(item.PlanAmount);
}
}
#region MyRegion
private ObservableCollection<int> _id = new ObservableCollection<int>();
public ObservableCollection<int> Id
{
get => _id;
set => SetProperty(ref _id, value);
}
private ObservableCollection<string> _materialCode = new ObservableCollection<string>();
public ObservableCollection<string> MaterialCode
{
get => _materialCode;
set => SetProperty(ref _materialCode, value);
}
private ObservableCollection<string> _materialName = new ObservableCollection<string>();
public ObservableCollection<string> MaterialName
{
get => _materialName;
set => SetProperty(ref _materialName, value);
}
private ObservableCollection<int> _planAmount = new ObservableCollection<int>();
public ObservableCollection<int> PlanAmount
{
get => _planAmount;
set => SetProperty(ref _planAmount, value);
}
#endregion
[RelayCommand]
public void AddPlan(string objId)
{
SplitPlanView plan = new SplitPlanView(objId);
plan.Show();
}
[RelayCommand]
public async void ClearPlan(string objId)
{
int id=int.Parse(objId);
var obj=await _boxFoamPlanServices.FirstAsync(d=>d.ObjId== id);
obj.MaterialCode = "";
obj.MaterialName = "";
obj.PlanAmount = 0;
var result= await _boxFoamPlanServices.UpdateAsync(obj);
if (result)
{
ClearData();
MessageBox.Show("清除计划成功!", "系统提醒");
}
else
{
MessageBox.Show("清除计划失败!", "系统提醒");
}
}
private void Recive(object recipient, string message)
{
if (message == "RefreshTask")
{
ClearData();
}
}
public void ClearData()
{
Id.Clear();
MaterialCode.Clear();
MaterialName.Clear();
PlanAmount.Clear();
InitData();
}
}
}

@ -201,6 +201,11 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
OldWarehousePageView oldWarehousePage = new OldWarehousePageView();
UserContent = oldWarehousePage;
break;
case "FoamPlanPage":
FoamPlanPageView foamPlanPage = new FoamPlanPageView();
UserContent = foamPlanPage;
break;
default:
break;
}

@ -0,0 +1,145 @@
using Admin.Core.IService;
using Admin.Core.Model;
using Aucma.Core.OldBoxFoam.Models;
using Aucma.Core.OldBoxFoam.Models;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using log4net;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
using System.Windows;
namespace Aucma.Core.OldBoxFoam.ViewModels
{
public partial class QuantityIssuedViewModel : ObservableObject
{
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(QuantityIssuedViewModel));
private IBaseBomInfoServices _bomInfoServices;
private IBaseSpaceDetailServices _spaceDetailServices;
protected readonly IExecutePlanInfoServices? _executePlanInfoServices;
protected readonly IBoxFoamPlanServices? _boxFoamPlanServices;
#region 构造函数
public QuantityIssuedViewModel(ProductPlanInfoModel productPlanInfo, string objId)
{
_boxFoamPlanServices = App.ServiceProvider.GetService<IBoxFoamPlanServices>();
_planInfo = productPlanInfo;
_objId = objId;
}
#endregion
#region 属性
private ProductPlanInfoModel _planInfo = new ProductPlanInfoModel();
public ProductPlanInfoModel PlanInfo
{
get => _planInfo;
set => SetProperty(ref _planInfo, value);
}
private string _TransmitAmount = string.Empty;
public string TransmitAmount
{
get => _TransmitAmount;
set => SetProperty(ref _TransmitAmount, value);
}
private string _objId = string.Empty;
public string ObjId
{
get => _objId;
set => SetProperty(ref _objId, value);
}
#endregion
#region 清除
/// <summary>
/// 清除
/// </summary>
[RelayCommand]
private void ClearTransmitAmount()
{
string amount = _TransmitAmount.ToString();
if (amount.Length > 0)
{
TransmitAmount = amount.Substring(0, amount.Length - 1);
}
}
#endregion
#region KeypadButton
[RelayCommand]
private void KeypadButton(object obj)
{
var info = obj as string;
TransmitAmount += info;
}
#endregion
#region 关闭
/// <summary>
/// 关闭
/// </summary>
/// <param name="parameter"></param>
[RelayCommand]
private void CloseWindow(object parameter)
{
var window = parameter as Window;
if (window != null)
{
window.Close();
}
}
#endregion
#region 保存数据
/// <summary>
/// 保存数据
/// </summary>
[RelayCommand]
private void AddPlanInfo()
{
var productPlanInfo = _planInfo;
if (_planInfo != null)
{
var task = _boxFoamPlanServices.FirstAsync(d => d.ObjId ==int.Parse(_objId)).Result;
if (task != null)
{
task.MaterialCode = _planInfo.MaterialCode;
task.MaterialName = _planInfo.MaterialName;
task.PlanAmount = Convert.ToInt32(TransmitAmount);
var result = _boxFoamPlanServices.UpdateAsync(task).Result;
if (result)
{
MessageBox.Show("任务添加成功!", "系统提醒");
WeakReferenceMessenger.Default.Send<string>("RefreshTask");//刷新任务界面
}
else
{
MessageBox.Show("任务添加失败!", "系统提醒");
}
}
}
else
{
BoxFoamPlan plan = new BoxFoamPlan();
plan.MaterialCode = _planInfo.MaterialCode;
plan.MaterialName = _planInfo.MaterialName;
plan.PlanAmount = Convert.ToInt32(TransmitAmount);
var result = _boxFoamPlanServices.AddAsync(plan).Result;
if (result > 0)
{
MessageBox.Show("任务添加成功!", "系统提醒");
WeakReferenceMessenger.Default.Send<string>("RefreshTask");//刷新任务界面
}
else
{
MessageBox.Show("任务添加失败!", "系统提醒");
}
MessageBox.Show("任务添加失败,加载为空", "提示", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
}
}
#endregion
}
}

@ -0,0 +1,418 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Admin.Core.IService;
using log4net;
using Microsoft.Extensions.DependencyInjection;
using Admin.Core.Model;
using Castle.Core.Internal;
using CommunityToolkit.Mvvm.Messaging;
using Admin.Core.Common;
using Aucma.Core.OldBoxFoam.Common;
using Aucma.Core.OldBoxFoam.Models;
using Aucma.Core.OldBoxFoam.Views;
namespace Aucma.Core.OldBoxFoam.ViewModels
{
public partial class SplitPlanViewModel : ObservableObject
{
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(SplitPlanViewModel));
protected readonly IProductPlanInfoServices? _productPlanInfoServices;
//protected readonly ISmTaskExecutionServices? _smTaskExecutionServices;
protected readonly IExecutePlanInfoServices? _executePlanInfoServices;
private AppConfigHelper appConfig = new AppConfigHelper();
public SplitPlanViewModel(string objId)
{
_productPlanInfoServices = App.ServiceProvider.GetService<IProductPlanInfoServices>();
_executePlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>();
Task.WaitAll(LoadData());
//加载快捷方式
SaveSearchCriteria();
WeakReferenceMessenger.Default.Register<string>(this, SaveSearchCriteria);
_objId = objId;
}
#region 加载DataGrid数据
private async Task LoadData()
{
MaterialDataGrid.Clear();
int i = 1;
string station = Appsettings.app("StoreInfo", "StationCode");
var planlist = await _productPlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station));
var execList = await _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(station));
foreach (var item in planlist)
{
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++;
}
}
private async Task LoadData(string obj)
{
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)
{
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++;
}
}
#endregion
#region 初始化datagrid
private ObservableCollection<ProductPlanInfoModel> materialDataGrid = new ObservableCollection<ProductPlanInfoModel>();
public ObservableCollection<ProductPlanInfoModel> MaterialDataGrid
{
get => materialDataGrid;
set => SetProperty(ref materialDataGrid, value);
}
#endregion
#region 查询
/// <summary>
/// 查询
/// </summary>
[RelayCommand]
private async Task QueryPlan(string obj)
{
if (obj.IsNullOrEmpty())
{
System.Windows.Application.Current.Dispatcher.Invoke((Action)(async () =>
{
MaterialDataGrid.Clear();
await LoadData();
}));
return;
}
MaterialDataGrid.Clear();
await LoadData(obj);
}
#endregion
#region 创建任务
/// <summary>
/// 创建任务
/// </summary>
[RelayCommand]
private async Task CreateTask(string obj)
{
if (string.IsNullOrEmpty(obj))
{
MessageBox.Show("请选中需要拆分的计划!", "系统提醒");
return;
}
string plan_code = SelectedCells.PlanCode;
string order_code = SelectedCells.OrderCode;
string material_code = SelectedCells.MaterialCode;
string material_name = SelectedCells.MaterialName;
int plan_amount = SelectedCells.PlanAmount;
var list = await _executePlanInfoServices.QueryAsync(d=>d.ProductLineCode.Equals("1001"));
ExecutePlanInfo task=new ExecutePlanInfo();
task.ExecutePlanCode = Guid.NewGuid().ToString();
task.ProductPlanCode = plan_code;
task.OrderCode = order_code;
task.MaterialCode = material_code;
task.MaterialName = material_name;
task.ProductLineCode = "1001";//计划工位
if (list.Count == 0)
task.ExecuteOrder = 1;
if (list.Count != 0)
task.ExecuteOrder = list.Max(d => d.ExecuteOrder) + 1;
task.ExecuteMethod = 1;//不做要求,系统自动确定
task.ExecuteStatus = 1;
task.PlanAmount = SelectedCells.SpliteResidueAmount;
task.CompleteAmount = 0;
task.CreatedTime = DateTime.Now;
var result = await _executePlanInfoServices.AddAsync(task);
if (result>0)
{
MessageBox.Show("计划拆分成功!","系统提醒");
WeakReferenceMessenger.Default.Send<string>("Refresh");//刷新窗口
CloseWindow();
}
else
{
MessageBox.Show("计划拆分失败,请检查后重试!", "系统提醒");
}
}
#endregion
#region 获取当前行数据 赋值到textbox
private ProductPlanInfoModel selectedCells;
public ProductPlanInfoModel SelectedCells
{
get { return selectedCells; }
set
{
selectedCells = value;
SetProperty(ref selectedCells, value);
}
}
#endregion
#region 关闭当前窗口
/// <summary>
/// 关闭当前窗口
/// </summary>
public void CloseWindow()
{
WeakReferenceMessenger.Default.Send<object>("close");
}
#endregion
#region 参数定义
private string _objId = string.Empty;
public string ObjId
{
get => _objId;
set => SetProperty(ref _objId, value);
}
private string _search = string.Empty;
public string Search
{
get => _search;
set => SetProperty(ref _search, value);
}
/// <summary>
/// 下拉框
/// </summary>
public string _materialTypeCombox;
public string MaterialTypeCombox
{
get => _materialTypeCombox;
set => SetProperty(ref _materialTypeCombox, value);
}
#region 多选按钮
/// <summary>
/// 多选按钮
/// </summary>
public int _radioButtonStatus;
public int RadioButtonStatus
{
get => _radioButtonStatus;
set => SetProperty(ref _radioButtonStatus, value);
}
#endregion
private ObservableCollection<string> _configurations = new ObservableCollection<string>();
public ObservableCollection<string> Configurations
{
get => _configurations;
set => SetProperty(ref _configurations, value);
}
private ProductPlanInfoModel selectedDataItem;
public ProductPlanInfoModel SelectedDataItem
{
get => selectedDataItem;
set => SetProperty(ref selectedDataItem, value);
}
#endregion
#region 重置
/// <summary>
/// 重置
/// </summary>
[RelayCommand]
public void Reset()
{
LoadData();
Search = string.Empty;
MaterialTypeCombox = string.Empty;
this.LoadData();
}
#endregion
#region 搜索条件设置
/// <summary>
/// 搜索条件设置
/// </summary>
[RelayCommand]
public async Task SearchCriteriaSet()
{
SearchCriteriaView searchCriteriaWindow = new SearchCriteriaView();
bool? dialogResult = searchCriteriaWindow.ShowDialog();
if (dialogResult == false) // 用户点击了“取消”按钮或关闭窗口
{
await LoadData();
}
}
#endregion
#region 查询快捷查询方式
private void SaveSearchCriteria(object recipient, string message)
{
if (message== "RefreshSearchItems")
{
Configurations = new ObservableCollection<string>();
var searchItems = appConfig.searchItems;
var split = searchItems.Split('%');
foreach (var item in split)
{
if (!string.IsNullOrEmpty(item))
{
Configurations.Add(item);
}
}
}
}
private void SaveSearchCriteria()
{
Configurations = new ObservableCollection<string>();
var searchItems = appConfig.searchItems;
var split = searchItems.Split('%');
foreach (var item in split)
{
if (!string.IsNullOrEmpty(item))
{
Configurations.Add(item);
}
}
}
#endregion
#region 双击事件
public void MouseClick(object obj)
{
var info = SelectedDataItem as ProductPlanInfoModel;
if (info != null)
{
info.PlanType = _radioButtonStatus;
QuantityIssuedView quantityIssuedWindow = new QuantityIssuedView(info, ObjId);
quantityIssuedWindow.ShowDialog();
}
}
/// <summary>
/// 鼠标双击事件
/// </summary>
[RelayCommand]
public void DoubleMouseClick()
{
MessageBox.Show("双击事件");
}
#endregion
#region 快捷查询
/// <summary>
/// 快捷查询
/// </summary>
/// <param name="selectedOption"></param>
/// <returns></returns>
[RelayCommand]
public async Task RadioButton(string selectedOption)
{
string productLineCode = Appsettings.app("StoreInfo", "ProductLineCode");
List<ProductPlanInfo> planInfos = await _productPlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(productLineCode) && d.MaterialName.Contains(selectedOption));
if (planInfos != null)
{
if (planInfos.Count > 0)
{
MaterialDataGrid.Clear();
int i = 1;
var execList = await _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(productLineCode));
foreach (var item in planInfos)
{
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++;
}
}
}
}
#endregion
#region 按钮
/// <summary>
/// 按钮
/// </summary>
/// <returns></returns>
[RelayCommand]
public void UpdateRadioButtonStatus(string status)
{
if (status== "status1")
{
_radioButtonStatus = 1;
}
if (status == "status2")
{
_radioButtonStatus = 2;
}
if (status == "status3")
{
_radioButtonStatus = 3;
}
}
#endregion
}
}

@ -0,0 +1,291 @@
<UserControl x:Class="Aucma.Core.OldBoxFoam.Views.FoamPlanPageView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Aucma.Core.OldBoxFoam.Views"
mc:Ignorable="d" Background="#1152AC" FontFamily="Microsoft YaHei"
d:DesignHeight="1080" d:DesignWidth="1920">
<Border x:Name="HeightHelperPanel" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="5">
<Grid>
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontFamily" Value="Microsoft YaHei"/>
</Style>
<Style TargetType="Border">
<Setter Property="BorderBrush" Value="#0288d1"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.1*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
</Grid.ColumnDefinitions>
<Border Grid.Row="0" Grid.Column="0"></Border>
<Border Grid.Row="1" Grid.Column="0" >
<TextBlock Text="1" x:Name="PlanId1" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="2" Grid.Column="0">
<TextBlock Text="2" x:Name="PlanId2" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="3" Grid.Column="0" >
<TextBlock Text="3" x:Name="PlanId3" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="4" Grid.Column="0" >
<TextBlock Text="4" x:Name="PlanId4" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="5" Grid.Column="0" >
<TextBlock Text="5" x:Name="PlanId5" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="6" Grid.Column="0" >
<TextBlock Text="6" x:Name="PlanId6" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="7" Grid.Column="0" >
<TextBlock Text="7" x:Name="PlanId7" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="8" Grid.Column="0" >
<TextBlock Text="8" x:Name="PlanId8" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="9" Grid.Column="0" >
<TextBlock Text="9" x:Name="PlanId9" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="10" Grid.Column="0" >
<TextBlock Text="10" x:Name="PlanId10" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="11" Grid.Column="0" >
<TextBlock Text="11" x:Name="PlanId11" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="12" Grid.Column="0" >
<TextBlock Text="12" x:Name="PlanId12" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="0" Grid.Column="1" >
<TextBlock Text="物料编号" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="0" Grid.Column="2" >
<TextBlock Text="物料名称" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="0" Grid.Column="3" >
<TextBlock Text="发泡计划量" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="0" Grid.Column="4" >
<TextBlock Text="操作" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="1" Grid.Column="1" >
<TextBlock Text="{Binding MaterialCode[0], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="1" Grid.Column="2" >
<TextBlock Text="{Binding MaterialName[0], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="1" Grid.Column="3" >
<TextBlock Text="{Binding PlanAmount[0], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="1" Grid.Column="4" >
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="添加" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding AddPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId1}" />
<Button Content="清除" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding ClearPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId1}"/>
</WrapPanel>
</Border>
<Border Grid.Row="2" Grid.Column="1" >
<TextBlock Text="{Binding MaterialCode[1], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="2" Grid.Column="2" >
<TextBlock Text="{Binding MaterialName[1], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="2" Grid.Column="3" >
<TextBlock Text="{Binding PlanAmount[1], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="2" Grid.Column="4" >
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="添加" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding AddPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId2}" />
<Button Content="清除" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding ClearPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId2}"/>
</WrapPanel>
</Border>
<Border Grid.Row="3" Grid.Column="1" >
<TextBlock Text="{Binding MaterialCode[2], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="3" Grid.Column="2" >
<TextBlock Text="{Binding MaterialName[2], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="3" Grid.Column="3" >
<TextBlock Text="{Binding PlanAmount[2], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="3" Grid.Column="4" >
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="添加" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding AddPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId3}" />
<Button Content="清除" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding ClearPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId3}"/>
</WrapPanel>
</Border>
<Border Grid.Row="4" Grid.Column="1" >
<TextBlock Text="{Binding MaterialCode[3], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="4" Grid.Column="2" >
<TextBlock Text="{Binding MaterialName[3], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="4" Grid.Column="3" >
<TextBlock Text="{Binding PlanAmount[3], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="4" Grid.Column="4" >
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="添加" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding AddPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId3}" />
<Button Content="清除" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding ClearPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId3}"/>
</WrapPanel>
</Border>
<Border Grid.Row="5" Grid.Column="1" >
<TextBlock Text="{Binding MaterialCode[4], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="5" Grid.Column="2" >
<TextBlock Text="{Binding MaterialName[4], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="5" Grid.Column="3" >
<TextBlock Text="{Binding PlanAmount[4], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="5" Grid.Column="4" >
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="添加" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding AddPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId5}" />
<Button Content="清除" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding ClearPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId5}" />
</WrapPanel>
</Border>
<Border Grid.Row="6" Grid.Column="1" >
<TextBlock Text="{Binding MaterialCode[5], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="6" Grid.Column="2" >
<TextBlock Text="{Binding MaterialName[5], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="6" Grid.Column="3" >
<TextBlock Text="{Binding PlanAmount[5], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="6" Grid.Column="4" >
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="添加" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding AddPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId6}" />
<Button Content="清除" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding ClearPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId6}"/>
</WrapPanel>
</Border>
<Border Grid.Row="7" Grid.Column="1" >
<TextBlock Text="{Binding MaterialCode[6], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="7" Grid.Column="2" >
<TextBlock Text="{Binding MaterialName[6], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="7" Grid.Column="3" >
<TextBlock Text="{Binding PlanAmount[6], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="7" Grid.Column="4" >
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="添加" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding AddPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId7}" />
<Button Content="清除" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding ClearPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId7}" />
</WrapPanel>
</Border>
<Border Grid.Row="8" Grid.Column="1" >
<TextBlock Text="{Binding MaterialCode[8], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="8" Grid.Column="2" >
<TextBlock Text="{Binding MaterialName[8], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="8" Grid.Column="3" >
<TextBlock Text="{Binding PlanAmount[9], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="8" Grid.Column="4" >
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="添加" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding AddPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId8}" />
<Button Content="清除" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding ClearPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId8}" />
</WrapPanel>
</Border>
<Border Grid.Row="9" Grid.Column="1" >
<TextBlock Text="{Binding MaterialCode[8], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="9" Grid.Column="2" >
<TextBlock Text="{Binding MaterialName[8], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="9" Grid.Column="3" >
<TextBlock Text="{Binding PlanAmount[8], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="9" Grid.Column="4" >
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="添加" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding AddPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId9}" />
<Button Content="清除" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding ClearPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId9}" />
</WrapPanel>
</Border>
<Border Grid.Row="10" Grid.Column="1" >
<TextBlock Text="{Binding MaterialCode[9], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="10" Grid.Column="2" >
<TextBlock Text="{Binding MaterialName[9], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="10" Grid.Column="3" >
<TextBlock Text="{Binding PlanAmount[9], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="10" Grid.Column="4" >
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="添加" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding AddPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId10}" />
<Button Content="清除" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding ClearPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId10}" />
</WrapPanel>
</Border>
<Border Grid.Row="11" Grid.Column="1" >
<TextBlock Text="{Binding MaterialCode[10], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="11" Grid.Column="2" >
<TextBlock Text="{Binding MaterialName[10], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="11" Grid.Column="3" >
<TextBlock Text="{Binding PlanAmount[10], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="11" Grid.Column="4" >
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="添加" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding AddPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId11}" />
<Button Content="清除" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding ClearPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId11}" />
</WrapPanel>
</Border>
<Border Grid.Row="12" Grid.Column="1" >
<TextBlock Text="{Binding MaterialCode[11], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="12" Grid.Column="2" >
<TextBlock Text="{Binding MaterialName[11], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="12" Grid.Column="3" >
<TextBlock Text="{Binding PlanAmount[11], Mode=TwoWay}" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="12" Grid.Column="4" >
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="添加" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding AddPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId12}" />
<Button Content="清除" FontSize="20" Width="100" Height="40" Margin="3" Command="{Binding ClearPlanCommand}" CommandParameter="{Binding Text, ElementName=PlanId12}" />
</WrapPanel>
</Border>
</Grid>
</Border>
</UserControl>

@ -0,0 +1,30 @@
using Aucma.Core.OldBoxFoam.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Aucma.Core.OldBoxFoam.Views
{
/// <summary>
/// FoamPlanPageView.xaml 的交互逻辑
/// </summary>
public partial class FoamPlanPageView : UserControl
{
public FoamPlanPageView()
{
InitializeComponent();
this.DataContext = new FoamPlanPageViewModel();
}
}
}

@ -60,8 +60,9 @@
<Border BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom">
<Grid>
<StackPanel Grid.Row="1" Height="50" Orientation="Horizontal" Margin="5 0" HorizontalAlignment="Left">
<Button Content="发泡机监控" Height="40" x:Name="FoamMachinesPage" FontSize="18" Margin="2 0" Command="{Binding SwitchPagesCommand}" CommandParameter="{Binding Name,ElementName=FoamMachinesPage}" />
<Button Content="发泡机监控" Height="40" x:Name="FoamMachinesPage" FontSize="18" Margin="2 0" Command="{Binding SwitchPagesCommand}" CommandParameter="{Binding Name,ElementName=FoamMachinesPage}" />
<Button Content="老发泡线监控" Height="40" x:Name="OldBoxFoamPage" FontSize="18" Margin="2 0" Command="{Binding SwitchPagesCommand}" CommandParameter="{Binding Name,ElementName=OldBoxFoamPage}" />
<Button Content="发泡计划" Height="40" x:Name="FoamPlanPage" FontSize="18" Margin="2 0" Command="{Binding SwitchPagesCommand}" CommandParameter="{Binding Name,ElementName=FoamPlanPage}" />
<Button Content="键 盘" Height="40" x:Name="TabTip" FontSize="18" Margin="2 0" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=TabTip}" />
<Button Content="最小化" Height="40" x:Name="Minimized" FontSize="18" Margin="2 0" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Minimized}" Background="#FF9900" BorderBrush="#FF9900" />
<Button Content="退 出" Height="40" x:Name="Exit" Margin="2 0" FontSize="18" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Exit}" Background="#FF0033" BorderBrush="#FF0033"/>

@ -0,0 +1,106 @@
<Window x:Class="Aucma.Core.OldBoxFoam.Views.QuantityIssuedView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Aucma.Core.OldBoxFoam.Views"
mc:Ignorable="d" Background="#1152AC" FontFamily="Microsoft YaHei"
Title="下达数量" Height="500" Width="700" Name="window"
ResizeMode="NoResize" Topmost="True">
<Border Margin="5" BorderBrush="#0288d1" CornerRadius="10">
<Border.Effect>
<DropShadowEffect Color="Gray" ShadowDepth="0" BlurRadius="5" Opacity="0.3" Direction="0"></DropShadowEffect>
</Border.Effect>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderBrush="#0288d1" BorderThickness="3" CornerRadius="5" Background="Transparent" Margin="5,5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="计划编号" 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"/>
<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"/>
<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"/>
<TextBox FontSize="18" Text="{Binding PlanInfo.PlanAmount}" 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"/>
<TextBox FontSize="18" Text="{Binding PlanInfo.CompleteAmount}" Foreground="#FFFFFF" BorderBrush="White" Width="150" IsReadOnly="True" Margin="5,0,10,0"/>
</StackPanel>
</Grid>
</Border>
<Border Grid.Column="1" BorderBrush="#0288d1" BorderThickness="3" CornerRadius="5" Background="Transparent" Margin="5,5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="9*"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="下达数量" FontSize="18" Foreground="#FFFFFF" Margin="10,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox x:Name="TransmitAmount" VerticalContentAlignment="Center" FontSize="18" Text="{Binding TransmitAmount}" Foreground="#FFFFFF" BorderBrush="White" Width="150" Height="40" IsReadOnly="True" Margin="5,0,10,0"/>
</StackPanel>
<Border Grid.Row="1" BorderBrush="Black" BorderThickness="0" Margin="10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Grid.Row="0" Grid.Column="0" Content="1" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100"/>
<Button Grid.Row="0" Grid.Column="1" Content="2" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" />
<Button Grid.Row="0" Grid.Column="2" Content="3" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" />
<Button Grid.Row="1" Grid.Column="0" Content="4" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" />
<Button Grid.Row="1" Grid.Column="1" Content="5" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" />
<Button Grid.Row="1" Grid.Column="2" Content="6" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" />
<Button Grid.Row="2" Grid.Column="0" Content="7" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" />
<Button Grid.Row="2" Grid.Column="1" Content="8" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" />
<Button Grid.Row="2" Grid.Column="2" Content="9" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" />
<Button Grid.Row="3" Grid.Column="0" Content="0" FontSize="18" Margin="2,2" Command="{Binding KeypadButtonCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Content}" Height="70" Width="100" />
<Button Grid.Row="3" Grid.Column="2" Content="清除" FontSize="18" Margin="2,2" Background="#FF9900" Foreground="white" BorderBrush="#FF9900" Command="{Binding ClearTransmitAmountCommand}" Height="70" Width="100" />
</Grid>
</Border>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="下 达" Command="{Binding AddPlanInfoCommand}" Height="50" Width="140" />
<Button Content="取 消" Command="{Binding CloseWindowCommand}" CommandParameter="{Binding ElementName=window}" Background="#FF9900" Margin="25,0,0,0" Height="50" BorderBrush="#FF9900" Width="140" />
</StackPanel>
</Grid>
</Border>
</Grid>
</Border>
</Window>

@ -0,0 +1,24 @@
using Aucma.Core.OldBoxFoam.Models;
using Aucma.Core.OldBoxFoam.ViewModels;
using System.Windows;
namespace Aucma.Core.OldBoxFoam.Views
{
/// <summary>
/// QuantityIssuedView.xaml 的交互逻辑
/// </summary>
public partial class QuantityIssuedView : Window
{
public QuantityIssuedView()
{
InitializeComponent();
}
public QuantityIssuedView(ProductPlanInfoModel productPlanInfo,string objId)
{
InitializeComponent();
this.DataContext = new QuantityIssuedViewModel(productPlanInfo, objId);
}
}
}

@ -0,0 +1,202 @@
<Window x:Class="Aucma.Core.OldBoxFoam.Views.SplitPlanView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Background="#1152AC"
Title="计划维护" FontFamily="Microsoft YaHei" Height="700" Width="900"
d:DesignHeight="800" WindowStartupLocation="CenterScreen"
d:DesignWidth="1500" ResizeMode="NoResize" Topmost="True" >
<Window.Resources>
<Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style TargetType="DataGrid">
<!--网格线颜色-->
<Setter Property="CanUserResizeColumns" Value="false"/>
<Setter Property="Background" Value="#1152AC" />
<Setter Property="BorderBrush" Value="#4285DE" />
<Setter Property="Foreground" Value="White"/>
<Setter Property="HorizontalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#4285DE"/>
</Setter.Value>
</Setter>
<Setter Property="VerticalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#1152AC"/>
</Setter.Value>
</Setter>
</Style>
<!--列头标题栏样式-->
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="BorderBrush" Value="#dddddd" />
<Setter Property="Height" Value="40"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="Background" Value="#4285DE"/>
<Setter Property="Foreground" Value="White"/>
</Style>
<!--单元格样式-->
<Style TargetType="DataGridCell">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="White" />
<Setter Property="Height" Value="40"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}" >
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#4285DE"/>
<Setter Property="Foreground" Value="#dddddd"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type Slider}">
<Style.Resources>
<!-- 重写重复触发按钮的样式 -->
<Style x:Key="RepeatButtonStyle" TargetType="{x:Type RepeatButton}">
<Setter Property="Focusable" Value="false" />
<Setter Property="IsTabStop" Value="false" />
<Setter Property="Padding" Value="0" />
<Setter Property="Width" Value="30" />
</Style>
</Style.Resources>
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
<Setter Property="SmallChange" Value="1" />
<!-- 重写Slider的模板 -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Slider}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox Grid.RowSpan="2" Height="Auto" Margin="0" Padding="0" VerticalAlignment="Stretch"
VerticalContentAlignment="Center" Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Value}">
<!-- 给TextBox绑定上下命令 -->
<TextBox.InputBindings>
<KeyBinding Gesture="Up" Command="{x:Static Slider.IncreaseSmall}" />
<KeyBinding Gesture="Down" Command="{x:Static Slider.DecreaseSmall}" />
<KeyBinding Gesture="PageUp" Command="{x:Static Slider.IncreaseLarge}" />
<KeyBinding Gesture="PageDown" Command="{x:Static Slider.DecreaseLarge}" />
</TextBox.InputBindings>
</TextBox>
<RepeatButton Grid.Row="0" Grid.Column="1" Command="{x:Static Slider.IncreaseSmall}"
Style="{StaticResource RepeatButtonStyle}">
<Path Data="M4,0 L0,4 8,4 Z" Fill="Black" />
</RepeatButton>
<RepeatButton Grid.Row="1" Grid.Column="1" Command="{x:Static Slider.DecreaseSmall}"
Style="{StaticResource RepeatButtonStyle}">
<Path Data="M0,0 L4,4 8,0 Z" Fill="Black" />
</RepeatButton>
<!-- 由于Slider的内部实现要求存在这些必要组件,所以必须保留,但是设置为隐藏即可 -->
<Border x:Name="TrackBackground" Visibility="Collapsed">
<Rectangle x:Name="PART_SelectionRange" Visibility="Collapsed" />
</Border>
<Thumb x:Name="Thumb" Visibility="Collapsed" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Border Grid.Row="1" Grid.Column="1" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Margin="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.6*"/>
<RowDefinition Height="9*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Margin="1,1,5,5" >
<TextBlock Text="添加计划" FontSize="25" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Margin="1,0,5,5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.1*"/>
<RowDefinition Height="0.2*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<WrapPanel Grid.Row="0" Margin="5" VerticalAlignment="Center">
<Label Content="工单编号" VerticalAlignment="Center" Foreground="White" FontSize="18" />
<TextBox x:Name="queryParam" PreviewMouseDoubleClick="queryParam_PreviewMouseDoubleClick_1" Text="{Binding Search,Mode=TwoWay}" Style="{x:Null}" Width="300" HorizontalAlignment="Left" VerticalContentAlignment="Center" Margin="10 0 5 0"/>
<Button Content="查 询" Command="{Binding QueryPlanCommand}" CommandParameter="{Binding Text, ElementName=queryParam}" Margin="5 0" />
<Button Content="重 置" Command="{Binding ResetCommand}" Margin="5 0" />
<Button Content="配 置" Command="{Binding SearchCriteriaSetCommand}" Margin="5 0" />
</WrapPanel>
<Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" VerticalAlignment="Center" Margin="10 0 0 0">
<TextBlock Text="快捷查询" VerticalAlignment="Center" Foreground="#FFFFFF" FontSize="18" />
</StackPanel>
<WrapPanel Grid.Column="1" VerticalAlignment="Center" Margin="0 5">
<ItemsControl ItemsSource="{Binding Configurations}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton
Content="{Binding}"
Command="{Binding DataContext.RadioButtonCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
CommandParameter="{Binding}"
GroupName="MaterialTypeRadioButton"
Margin="25,0" FontSize="12" Foreground="#FFFFFF"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</WrapPanel>
</Grid>
</Border>
<UniformGrid Grid.Row="2" Margin="5" >
<DataGrid ItemsSource="{Binding MaterialDataGrid}" Background="Transparent"
ColumnHeaderHeight="35" x:Name="dgvMH" FontSize="20"
RowHeight="50" AutoGenerateColumns="False" RowHeaderWidth="0"
GridLinesVisibility="None" VerticalAlignment="Stretch"
BorderThickness="0" CanUserAddRows="False" SelectionMode="Single" IsReadOnly="True"
Foreground="White" SelectedItem="{Binding SelectedDataItem}" MouseLeftButtonDown="dgvMH_MouseLeftButtonDown_1">
<!--ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Visible"-->
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding No}" 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 MaterialName}" Header="产品型号" Width="2*" 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}"/>
</DataGrid.Columns>
</DataGrid>
</UniformGrid>
</Grid>
</Border>
</Grid>
</Border>
</Window>

@ -0,0 +1,49 @@
using Aucma.Core.OldBoxFoam.Common;
using Aucma.Core.OldBoxFoam.ViewModels;
using CommunityToolkit.Mvvm.Messaging;
using System.Windows;
using System.Windows.Input;
namespace Aucma.Core.OldBoxFoam.Views
{
/// <summary>
/// SplitPlanView.xaml 的交互逻辑
/// </summary>
public partial class SplitPlanView : Window
{
private SplitPlanViewModel planInfoEditViewModel = null;
public SplitPlanView(string objId)
{
InitializeComponent();
planInfoEditViewModel = new SplitPlanViewModel(objId);
this.DataContext = planInfoEditViewModel;
WeakReferenceMessenger.Default.Register<object>(this,Recive);
}
private void Recive(object recipient, object message)
{
this.Close();
}
private void dgvMH_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
planInfoEditViewModel.MouseClick(sender);
}
private void queryParam_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
CommHelper.OpenOsk();
}
private void dgvMH_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
{
planInfoEditViewModel.MouseClick(sender);
}
private void queryParam_PreviewMouseDoubleClick_1(object sender, MouseButtonEventArgs e)
{
CommHelper.OpenOsk();
}
}
}

@ -98,7 +98,7 @@
"ID": 1,
"Name": "OldBoxFoam",
"JobGroup": "DEFAULT",
"Cron": "*/10 * * * * ?",
"Cron": "*/1 * * * * ?",
"AssemblyName": "Admin.Core.Tasks",
"ClassName": "Job_OldBoxFoam_Quartz",
"Remark": "执行老发泡线任务调度系统",
@ -170,12 +170,16 @@
"PLCServer": [
{
"Id": 1,
"PlcType": "Melsec",
"Enabled": true,
"EquipName": "OldMelsecPlc1",
"IP": "10.10.93.151",
"Port": 5002
},
{
"Id": 2,
"PlcType": "Melsec",
"Enabled": true,
"EquipName": "OldMelsecPlc2",
"IP": "10.10.93.152",
"Port": 5002

@ -1,5 +1,6 @@
using Admin.Core.Common;
using Aucma.Core.HwPLc;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.Collections.Generic;
using System.Timers;
@ -45,7 +46,8 @@ namespace Aucma.Core.RunPlc
{
// string ip = Appsettings.app("Middleware", "Scanner1", "Ip");
var allPlcServices = Appsettings.app<PlcModel>("PLCServer").ToList();
foreach (var item in allPlcServices.Where(d=>d.PlcType.Equals("Melsec")&&d.Enabled==true))
var list = allPlcServices.Where(d => d.PlcType=="Melsec" && d.Enabled == true).ToList();
foreach (var item in list)
{
PlcModel model = new PlcModel();
model.Id = item.Id;
@ -61,18 +63,22 @@ namespace Aucma.Core.RunPlc
private static Task StartSiemensPlcServer()
{
var allPlcServices = Appsettings.app<PlcModel>("PLCServer").ToList();
foreach (var item in allPlcServices.Where(d => d.PlcType.Equals("Siemens") && d.Enabled == true))
{
PlcModel model = new PlcModel();
model.Id = item.Id;
model.EquipName = item.EquipName;
model.IP = item.IP;
model.Port = item.Port;
model.PlcType = item.PlcType;
model.plc = new SiemensPlc(item.IP, item.Port);
PlcHelper.siemensList.Add(model);
}
//var allPlcServices = Appsettings.app<PlcModel>("PLCServer").ToList();
//if (allPlcServices==null) return Task.CompletedTask;
////var list1 = allPlcServices.Where(d => d.PlcType.Equals("Siemens") && d.Enabled == true);
// if (list1 == null) return Task.CompletedTask;
//var list = list1.Where(d => d.PlcType.Equals("Siemens") && d.Enabled == true);
//foreach (var item in list)
//{
// PlcModel model = new PlcModel();
// model.Id = item.Id;
// model.EquipName = item.EquipName;
// model.IP = item.IP;
// model.Port = item.Port;
// model.PlcType = item.PlcType;
// model.plc = new SiemensPlc(item.IP, item.Port);
// PlcHelper.siemensList.Add(model);
//}
return Task.CompletedTask;
}
#endregion

Loading…
Cancel
Save