change-集存库测试版本0309

collection-v1.0
liuwf 1 year ago
parent f72138f2b5
commit f7fed8b983

@ -116,6 +116,7 @@ namespace Aucma.Scada.Business
MvCodeHelper.RefreshLogMessageEvent += PrintLogInfoMessage; MvCodeHelper.RefreshLogMessageEvent += PrintLogInfoMessage;
StartPassDown(); StartPassDown();
// shell 8301501047 liner 8301501067 // shell 8301501047 liner 8301501067
//Task.Run(() => //Task.Run(() =>
//{ //{
@ -201,6 +202,7 @@ namespace Aucma.Scada.Business
else else
{ {
spaceInfo.materialType = materialType; spaceInfo.materialType = materialType;
spaceInfo.typeNameA = GetMaterialName(materialType);
} }
RefreshScanMateriaCodeEvent?.Invoke(materialCode, GetMaterialName(materialType), spaceInfo.spaceName, storeCode); //刷新界面扫码信息 RefreshScanMateriaCodeEvent?.Invoke(materialCode, GetMaterialName(materialType), spaceInfo.spaceName, storeCode); //刷新界面扫码信息
var result = CreateInStoreTask(spaceInfo, materialCode); //创建入库任务 var result = CreateInStoreTask(spaceInfo, materialCode); //创建入库任务
@ -358,7 +360,8 @@ namespace Aucma.Scada.Business
// } // }
//} //}
}catch(Exception ex) }
catch (Exception ex)
{ {
PrintLogErrorMessage("依次获取箱壳任务队列进行下发逻辑异常", ex); PrintLogErrorMessage("依次获取箱壳任务队列进行下发逻辑异常", ex);
} }
@ -417,7 +420,8 @@ namespace Aucma.Scada.Business
// } // }
//} //}
} }
}catch(Exception ex) }
catch (Exception ex)
{ {
PrintLogErrorMessage("依次获取内胆任务队列进行下发逻辑异常", ex); PrintLogErrorMessage("依次获取内胆任务队列进行下发逻辑异常", ex);
} }
@ -702,5 +706,34 @@ namespace Aucma.Scada.Business
logHelper.Error(message, ex); logHelper.Error(message, ex);
} }
#endregion #endregion
/// <summary>
/// 截取两个逗号之间的字符串
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
static string GetSubstringBetweenCommas(string input)
{
// 找到第一个逗号的位置
int firstCommaIndex = input.IndexOf(',');
if (firstCommaIndex != -1)
{
// 找到第二个逗号的位置
int secondCommaIndex = input.IndexOf(',', firstCommaIndex + 1);
if (secondCommaIndex != -1)
{
// 使用Substring截取第一个逗号和第二个逗号之间的字符
return input.Substring(firstCommaIndex + 1, secondCommaIndex - firstCommaIndex - 1);
}
else
{
return null ;
}
}
else
{
return null ;
}
}
} }
} }

@ -15,7 +15,7 @@ namespace Aucma.Scada.Business
/// <summary> /// <summary>
/// 入库任务处理 /// 入库任务处理
/// </summary> /// </summary>
internal sealed class InStoreTaskHandle public sealed class InStoreTaskHandle
{ {
#region 单例实现 #region 单例实现
private static readonly Lazy<InStoreTaskHandle> lazy = new Lazy<InStoreTaskHandle>(() => new InStoreTaskHandle()); private static readonly Lazy<InStoreTaskHandle> lazy = new Lazy<InStoreTaskHandle>(() => new InStoreTaskHandle());
@ -69,6 +69,21 @@ namespace Aucma.Scada.Business
#endregion #endregion
#region 委托事件 #region 委托事件
/// <summary>
/// 箱壳实时库存刷新
/// </summary>
/// <param name="message"></param>
public delegate void RefreshShellStock();
public event RefreshShellStock RefreshShellStockEvent;
/// <summary>
/// 内胆实时库存刷新
/// </summary>
/// <param name="message"></param>
public delegate void RefreshLinerStock();
public event RefreshLinerStock RefreshLinerStockEvent;
/// <summary> /// <summary>
/// 入库完成 /// 入库完成
/// </summary> /// </summary>
@ -110,40 +125,51 @@ namespace Aucma.Scada.Business
{ {
Task.Run(() => Task.Run(() =>
{ {
List<BaseSpaceInfo> spaceList = _spaceInfoService.GetSpaceInfosByStoreCode(appConfig.shellStoreCode, appConfig.linerStoreCode);
// List<SpaceAddress> spaceAddressList = spaceConfig.GetAllSpaceAddress(spaceList); // List<SpaceAddress> spaceAddressList = spaceConfig.GetAllSpaceAddress(spaceList);
if (spaceList!=null && spaceList.Count>0)
{
Thread.Sleep(2000); Thread.Sleep(2000);
while (true) while (true)
{
List<BaseSpaceInfo> spaceList = _spaceInfoService.GetSpaceInfosByStoreCode(appConfig.shellStoreCode, appConfig.linerStoreCode);
if (spaceList != null && spaceList.Count > 0)
{ {
foreach (BaseSpaceInfo spaceInfo in spaceList) foreach (BaseSpaceInfo spaceInfo in spaceList)
{ {
int Stock = spaceInfo.spaceStock;
int OnAmount = spaceInfo.onRouteAmount;
//BaseSpaceInfo tempSpace = new BaseSpaceInfo();
//tempSpace.storeCode = spaceInfo.storeCode;
//tempSpace.spaceCode = spaceInfo.spaceCode;
ReadSpaceInfoByPlc(spaceInfo);
//if (spaceInfo.spaceStock == 0 && spaceInfo.onRouteAmount == 0)
//{
// // 清空型号供新型号使用
// spaceInfo.materialType = null;
// spaceInfo.typeNameA = null;
// _spaceInfoService.UpdateSpaceInfo(spaceInfo);
// RefreshShellStockEvent?.Invoke();
// RefreshLinerStockEvent?.Invoke();
//}
BaseSpaceInfo tempSpace = new BaseSpaceInfo();
tempSpace.storeCode = spaceInfo.storeCode;
tempSpace.spaceCode = spaceInfo.spaceCode;
tempSpace = ReadSpaceInfoByPlc(tempSpace);
// 更新库存 // 更新库存
if(tempSpace.spaceStock!=spaceInfo.spaceStock || tempSpace.onRouteAmount != spaceInfo.onRouteAmount) if (Stock != spaceInfo.spaceStock || OnAmount != spaceInfo.onRouteAmount)
{ {
// Console.WriteLine("RealUpdateSpaceInfoByPlc1 " + JsonChange.Instance.ModeToJson(spaceInfo)); // Console.WriteLine("RealUpdateSpaceInfoByPlc1 " + JsonChange.Instance.ModeToJson(spaceInfo));
spaceInfo.spaceStock = tempSpace.spaceStock; // spaceInfo.spaceStock = tempSpace.spaceStock;
spaceInfo.onRouteAmount = tempSpace.onRouteAmount; // spaceInfo.onRouteAmount = tempSpace.onRouteAmount;
if(spaceInfo.spaceStock==0 && spaceInfo.onRouteAmount == 0)
{
// 清空型号供新型号使用
spaceInfo.materialType = null;
spaceInfo.typeNameA = null;
}
// Console.WriteLine("RealUpdateSpaceInfoByPlc2 "+JsonChange.Instance.ModeToJson(spaceInfo));
_spaceInfoService.UpdateSpaceInfo(spaceInfo); _spaceInfoService.UpdateSpaceInfo(spaceInfo);
RefreshShellStockEvent?.Invoke();
RefreshLinerStockEvent?.Invoke();
} }
} }
}
Thread.Sleep(3000); Thread.Sleep(3000);
} }
}
}); });
} }

@ -462,10 +462,9 @@ namespace Aucma.Scada.Business
{ {
while (true) while (true)
{ {
//var shellTasks = shellTaskInfos.Where(x => x.taskStatus == 3).ToList();
//var linerTasks = linerTaskInfos.Where(x => x.taskStatus == 3).ToList();
try
{
var shellTasks = GetTaskInfoByTaskStatus(appConfig.shellStoreCode, 3); var shellTasks = GetTaskInfoByTaskStatus(appConfig.shellStoreCode, 3);
var linerTasks = GetTaskInfoByTaskStatus(appConfig.linerStoreCode, 3); var linerTasks = GetTaskInfoByTaskStatus(appConfig.linerStoreCode, 3);
if (shellTasks == null || linerTasks == null) continue; if (shellTasks == null || linerTasks == null) continue;
@ -491,12 +490,16 @@ namespace Aucma.Scada.Business
_taskInfoService.DeleteTaskInfoById(shellTask.objId); _taskInfoService.DeleteTaskInfoById(shellTask.objId);
_taskInfoService.DeleteTaskInfoById(linerTask.objId); _taskInfoService.DeleteTaskInfoById(linerTask.objId);
// shellTaskInfos.Remove(shellTask);
// linerTaskInfos.Remove(linerTask);
} }
Thread.Sleep(2000); Thread.Sleep(2000);
} }
catch (Exception ex)
{
logHelper.Error(ex.Message.ToString());
}
}
}); });
} }

@ -155,7 +155,9 @@
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/>
<ColumnDefinition Width="6*"/> <ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderBrush="White" BorderThickness="1"> <Border Grid.Column="0" BorderBrush="White" BorderThickness="1">
<TextBlock Text="型号" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Text="型号" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
@ -165,6 +167,16 @@
<TextBlock Text="{Binding materialType}" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" /> <TextBlock Text="{Binding materialType}" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button> </Button>
</Border> </Border>
<Border Grid.Column="2" BorderBrush="White" BorderThickness="1">
<TextBlock Text="名称" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="3" BorderBrush="White" BorderThickness="1">
<Button Command="{Binding DataContext.SubmitCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding Text, ElementName=spaceCodeText}" Background="Transparent">
<TextBlock Text="{Binding typeNameA}" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
</Border>
</Grid> </Grid>
</Border> </Border>

@ -156,7 +156,9 @@
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/>
<ColumnDefinition Width="6*"/> <ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderBrush="White" BorderThickness="1"> <Border Grid.Column="0" BorderBrush="White" BorderThickness="1">
<TextBlock Text="型号" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Text="型号" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
@ -166,6 +168,15 @@
<TextBlock Text="{Binding materialType}" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" /> <TextBlock Text="{Binding materialType}" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button> </Button>
</Border> </Border>
<Border Grid.Column="2" BorderBrush="White" BorderThickness="1">
<TextBlock Text="名称" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="3" BorderBrush="White" BorderThickness="1">
<Button Command="{Binding DataContext.SubmitCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding Text, ElementName=spaceCodeText}" Background="Transparent">
<TextBlock Text="{Binding typeNameA}" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
</Border>
</Grid> </Grid>
</Border> </Border>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

@ -1,8 +1,8 @@
[plcSystem] [plcSystem]
دل؟اPLCIP=127.0.0.1 دل؟اPLCIP=10.10.92.22
دل؟اPLC<EFBFBD>ث؟غ=6000 دل؟اPLC<EFBFBD>ث؟غ=2015
ؤغ<EFBFBD><EFBFBD>PLCIP=127.0.0.1 ؤغ<EFBFBD><EFBFBD>PLCIP=10.10.92.6
ؤغ<EFBFBD><EFBFBD>PLC<EFBFBD>ث؟غ=6001 ؤغ<EFBFBD><EFBFBD>PLC<EFBFBD>ث؟غ=2015
#眊褲⻌踱華硊 #眊褲⻌踱華硊
[shell_inStore_address] [shell_inStore_address]

@ -1,8 +1,8 @@
[plcSystem] [plcSystem]
دل؟اPLCIP=10.10.92.22 دل؟اPLCIP=127.0.0.1
دل؟اPLC<EFBFBD>ث؟غ=2015 دل؟اPLC<EFBFBD>ث؟غ=6000
ؤغ<EFBFBD><EFBFBD>PLCIP=10.10.92.6 ؤغ<EFBFBD><EFBFBD>PLCIP=127.0.0.1
ؤغ<EFBFBD><EFBFBD>PLC<EFBFBD>ث؟غ=2015 ؤغ<EFBFBD><EFBFBD>PLC<EFBFBD>ث؟غ=6001
#眊褲⻌踱華硊 #眊褲⻌踱華硊
[shell_inStore_address] [shell_inStore_address]

@ -27,6 +27,9 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
private AppConfig appConfig = AppConfig.Instance; private AppConfig appConfig = AppConfig.Instance;
private InStoreTaskHandle taskHandle = InStoreTaskHandle.Instance;
public LinerInventoryViewModel() public LinerInventoryViewModel()
{ {
@ -50,7 +53,7 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
outStoreBusiness.RefreshStoreStockEvent += Query; outStoreBusiness.RefreshStoreStockEvent += Query;
SelectTypeViewModel.RefreshLinerPageEvent += Query; SelectTypeViewModel.RefreshLinerPageEvent += Query;
inStoreBusiness.RefreshInStoreTaskEvent += RefreshSpaceInfo; inStoreBusiness.RefreshInStoreTaskEvent += RefreshSpaceInfo;
taskHandle.RefreshLinerStockEvent += Query;
Query(); Query();
} }
@ -132,6 +135,7 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
foreach (var item in info) foreach (var item in info)
{ {
item.typeNameA = GetSubstringBetweenCommas(item.typeNameA);
spaceItems.Add(item); spaceItems.Add(item);
} }
Shapes = spaceItems; Shapes = spaceItems;
@ -139,6 +143,36 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
})); }));
} }
/// <summary>
/// 截取两个逗号之间的字符串
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
static string GetSubstringBetweenCommas(string input)
{
if (input == null) return null;
// 找到第一个逗号的位置
int firstCommaIndex = input.IndexOf(',');
if (firstCommaIndex != -1)
{
// 找到第二个逗号的位置
int secondCommaIndex = input.IndexOf(',', firstCommaIndex + 1);
if (secondCommaIndex != -1)
{
// 使用Substring截取第一个逗号和第二个逗号之间的字符
return input.Substring(firstCommaIndex + 1, secondCommaIndex - firstCommaIndex - 1);
}
else
{
return null;
}
}
else
{
return null;
}
}
private void RefreshSpaceInfo(object obj = null, bool isFinish = true) private void RefreshSpaceInfo(object obj = null, bool isFinish = true)
{ {
Query(); Query();

@ -27,6 +27,8 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
private AppConfig appConfig = AppConfig.Instance; private AppConfig appConfig = AppConfig.Instance;
private InStoreTaskHandle taskHandle = InStoreTaskHandle.Instance;
public ShellInventoryViewModel() public ShellInventoryViewModel()
{ {
@ -52,7 +54,7 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
SelectTypeViewModel.RefreshShellPageEvent += Query; SelectTypeViewModel.RefreshShellPageEvent += Query;
inStoreBusiness.RefreshInStoreTaskEvent += RefreshSpaceInfo; inStoreBusiness.RefreshInStoreTaskEvent += RefreshSpaceInfo;
taskHandle.RefreshShellStockEvent += Query;
Query(); Query();
@ -137,6 +139,7 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
foreach (var item in info) foreach (var item in info)
{ {
item.typeNameA = GetSubstringBetweenCommas(item.typeNameA);
spaceItems.Add(item); spaceItems.Add(item);
} }
Shapes = spaceItems; Shapes = spaceItems;
@ -145,6 +148,36 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
} }
/// <summary>
/// 截取两个逗号之间的字符串
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
static string GetSubstringBetweenCommas(string input)
{
if (input == null) return null;
// 找到第一个逗号的位置
int firstCommaIndex = input.IndexOf(',');
if (firstCommaIndex != -1)
{
// 找到第二个逗号的位置
int secondCommaIndex = input.IndexOf(',', firstCommaIndex + 1);
if (secondCommaIndex != -1)
{
// 使用Substring截取第一个逗号和第二个逗号之间的字符
return input.Substring(firstCommaIndex + 1, secondCommaIndex - firstCommaIndex - 1);
}
else
{
return null;
}
}
else
{
return null;
}
}
private void RefreshSpaceInfo(object obj = null, bool isFinish = true) private void RefreshSpaceInfo(object obj = null, bool isFinish = true)
{ {
Query(); Query();

@ -521,6 +521,8 @@ namespace Aucma.Scada.UI.viewModel
/// </summary> /// </summary>
/// <param name="type"></param> /// <param name="type"></param>
public void ShellScannerState(bool type) public void ShellScannerState(bool type)
{
try
{ {
Application.Current.Dispatcher.Invoke(() => Application.Current.Dispatcher.Invoke(() =>
{ {
@ -538,6 +540,11 @@ namespace Aucma.Scada.UI.viewModel
} }
}); });
} }
catch (Exception ex)
{
logHelper.Error(ex.Message.ToString());
}
}
#endregion #endregion
#region 扫码器2状态 #region 扫码器2状态
@ -583,6 +590,8 @@ namespace Aucma.Scada.UI.viewModel
/// </summary> /// </summary>
/// <param name="type"></param> /// <param name="type"></param>
public void LinerScannerState(bool type) public void LinerScannerState(bool type)
{
try
{ {
Application.Current.Dispatcher.Invoke(() => Application.Current.Dispatcher.Invoke(() =>
{ {
@ -600,6 +609,11 @@ namespace Aucma.Scada.UI.viewModel
} }
}); });
} }
catch (Exception ex)
{
logHelper.Error(ex.Message.ToString());
}
}
#endregion #endregion
public string _currentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); public string _currentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

Loading…
Cancel
Save