change - 采用入库完成信号版本

collection-v1.0
liuwf 2 years ago
parent 02f2ca4c96
commit 828a13fdb4

@ -115,12 +115,12 @@ namespace Aucma.Scada.Business
//Task.Run(() =>
//{
// Thread.Sleep(6000);
// for (int i = 1; i < 12; i++)
// for (int i = 1; i < 2; i++)
// {
// InStore(appConfig.shellStoreCode, "B23600000781110900" + i.ToString().PadLeft(2, '0'));
// Thread.Sleep(1000 * 30);
// InStore(appConfig.linerStoreCode, "L23600000788110900" + i.ToString().PadLeft(2, '0'));
// Thread.Sleep(1000 * 30);
// InStore("B2401018302500586001" + i.ToString().PadLeft(2, '0') , "169.254.100.169");
// // Thread.Sleep(1000 * 30);
// // InStore(appConfig.linerStoreCode, "L23600000788110900" + i.ToString().PadLeft(2, '0'));
// // Thread.Sleep(1000 * 30);
// }
//});
@ -131,10 +131,19 @@ namespace Aucma.Scada.Business
/// </summary>
/// <param name="storeCode"></param>
/// <param name="materialType"></param>
private void InStore(string storeCode, string materialCode)
private void InStore(string materialCode,string scannerIp)
{
try
{
string storeCode = string.Empty;
if (appConfig.shellHikRobotIp.Equals(scannerIp))
{
storeCode = appConfig.shellStoreCode;
}
else
{
storeCode = appConfig.linerStoreCode;
}
PrintLogInfoMessage($"扫码成功,物料码:{materialCode}");
string materialType = SubStringMaterialCode(materialCode);
#region Delete By wenjy 2023-10-30 11:41:00 取消通过数据库获取货道数量、在途量改为通过PLC获取货道信息
@ -151,17 +160,17 @@ namespace Aucma.Scada.Business
{
#region 2023-12-15 更新过点数据,插入记录到MATERIAL_COMPLETION表
PrintBarCode print =_printBarCodeServices.query(materialCode);
string planCode = _productPlanInfoServices.GetPlanCode(print.OrderCode, appConfig.stationCode);
MaterialCompletion completion = new MaterialCompletion();
completion.OrderCode = print.OrderCode;
completion.MaterialBarcode = materialCode;
completion.MaterialCode = print.MaterialCode;
completion.MaterialName = print.MaterialName;
completion.StationName = appConfig.stationCode;
completion.CompleteDate = DateTime.Now;
completion.planCode = planCode;
_iMaterialCompletionServices.Add(completion);
//PrintBarCode print =_printBarCodeServices.query(materialCode);
//string planCode = _productPlanInfoServices.GetPlanCode(print.OrderCode, appConfig.stationCode);
//MaterialCompletion completion = new MaterialCompletion();
//completion.OrderCode = print.OrderCode;
//completion.MaterialBarcode = materialCode;
//completion.MaterialCode = print.MaterialCode;
//completion.MaterialName = print.MaterialName;
//completion.StationName = appConfig.stationCode;
//completion.CompleteDate = DateTime.Now;
//completion.planCode = planCode;
//_iMaterialCompletionServices.Add(completion);
#endregion
//spaceInfo.onRouteAmount += 1; //通过PLC获取货道信息在库、在途数量时不需要修改在途数量
@ -173,7 +182,7 @@ namespace Aucma.Scada.Business
//报警停线
PrintLogInfoMessage($"物料码:{materialCode};未匹配到可用货道");
}
}
}
catch (Exception ex)
{
PrintLogErrorMessage("入库业务异常", ex);
@ -260,10 +269,12 @@ namespace Aucma.Scada.Business
RealTaskInfo taskInfo = _taskInfoService.GetTaskInfoByStoreCode(appConfig.shellStoreCode, appConfig.instoreTaskType);
if (taskInfo != null)
{
PrintLogInfoMessage($"下发箱壳入库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}");
int result = taskHandle.SendShellTask_InStore(taskInfo);
if (result==1)
{
PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode}下发成功等待PLC执行反馈");
shellSemaphore.Wait(); //一直堵塞直到信号量释放
@ -305,7 +316,7 @@ namespace Aucma.Scada.Business
RealTaskInfo taskInfo = _taskInfoService.GetTaskInfoByStoreCode(appConfig.linerStoreCode, appConfig.instoreTaskType);
if (taskInfo != null)
{
PrintLogInfoMessage($"下发内胆入库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}");
int result = taskHandle.SendLinerTask_InStore(taskInfo);
if (result==1)
{

@ -104,61 +104,76 @@ namespace Aucma.Scada.Business
Task.Run(() =>
{
while (true)
try
{
if (_plcDictionary.Count > 0)
while (true)
{
IPlc _plc = _plcDictionary[appConfig.shellStoreCode];
if (_plc != null && _plc.IsConnected)
if (_plcDictionary.Count > 0)
{
List<RealTaskInfo> taskList = _taskInfoService.GetTaskInfosForInstore(appConfig.shellStoreCode, appConfig.instoreTaskType, 2);
if (taskList != null && taskList.Count > 0)
IPlc _plc = _plcDictionary[appConfig.shellStoreCode];
if (_plc != null)
{
foreach (RealTaskInfo taskInfo in taskList)
List<RealTaskInfo> taskList = _taskInfoService.GetTaskInfosForInstore(appConfig.shellStoreCode, appConfig.instoreTaskType, 2);
if (taskList != null && taskList.Count > 0)
{
SpaceAddress spaceAddress = spaceConfig.GetSpaceAddress(appConfig.shellStoreCode, taskInfo.spaceCode);
JudgeIsFinish(taskInfo, _plc, spaceAddress, appConfig.shellStoreCode);
foreach (RealTaskInfo taskInfo in taskList)
{
SpaceAddress spaceAddress = spaceConfig.GetSpaceAddress(appConfig.shellStoreCode, taskInfo.spaceCode);
JudgeIsFinish(taskInfo, _plc, spaceAddress, appConfig.shellStoreCode);
}
}
}
else
{
logHelper.Info($"PLC信息为空或连接失败通过{appConfig.shellStoreCode}未获取到该仓库对应的PLC信息");
}
}
else
{
logHelper.Info($"PLC信息为空或连接失败通过{appConfig.shellStoreCode}未获取到该仓库对应的PLC信息");
}
}
Thread.Sleep(1000);
};
Thread.Sleep(1000);
};
}
catch (Exception ex)
{
logHelper.Error(ex.Message.ToString());
}
});
//内胆线程
Task.Run(() =>
{
while (true)
try
{
if (_plcDictionary.Count > 0)
while (true)
{
IPlc _plc = _plcDictionary[appConfig.linerStoreCode];
if (_plc != null && _plc.IsConnected)
if (_plcDictionary.Count > 0)
{
// 修改这个方法
List<RealTaskInfo> taskList = _taskInfoService.GetTaskInfosForInstore(appConfig.linerStoreCode, appConfig.instoreTaskType, 2);
if (taskList != null && taskList.Count > 0)
IPlc _plc = _plcDictionary[appConfig.linerStoreCode];
if (_plc != null)
{
foreach (RealTaskInfo taskInfo in taskList)
// 修改这个方法
List<RealTaskInfo> taskList = _taskInfoService.GetTaskInfosForInstore(appConfig.linerStoreCode, appConfig.instoreTaskType, 2);
if (taskList != null && taskList.Count > 0)
{
SpaceAddress spaceAddress = spaceConfig.GetSpaceAddress(appConfig.linerStoreCode, taskInfo.spaceCode);
JudgeIsFinish(taskInfo, _plc, spaceAddress, appConfig.linerStoreCode);
foreach (RealTaskInfo taskInfo in taskList)
{
SpaceAddress spaceAddress = spaceConfig.GetSpaceAddress(appConfig.linerStoreCode, taskInfo.spaceCode);
JudgeIsFinish(taskInfo, _plc, spaceAddress, appConfig.linerStoreCode);
}
}
}
else
{
logHelper.Info($"PLC信息为空或连接失败通过{appConfig.linerStoreCode}未获取到该仓库对应的PLC信息");
}
}
else
{
logHelper.Info($"PLC信息为空或连接失败通过{appConfig.linerStoreCode}未获取到该仓库对应的PLC信息");
}
}
Thread.Sleep(1000);
};
Thread.Sleep(1000);
};
}
catch (Exception ex)
{
logHelper.Error(ex.Message.ToString());
}
});
}
@ -191,8 +206,7 @@ namespace Aucma.Scada.Business
if (_plc != null)
{
if (_plc.IsConnected)
{
if (_plc.readInt32ByAddress(plcConfig.in_shell_answer) == 1)
{
logHelper.Info("箱壳入库应答字为1货道号:" + plcConfig.in_shell_spaceCode + ";写" + short.Parse(taskInfo.spaceCode.Substring(5, 1)));
@ -211,11 +225,7 @@ namespace Aucma.Scada.Business
result = 2;
logHelper.PlcLog("应答字为2下发新任务plc未就绪");
}
}
else
{
logHelper.Info($"仓库{taskInfo.storeCode}PLC未连接");
}
}
else
{

@ -429,13 +429,16 @@ namespace Aucma.Scada.Business
{
//var info = shellTaskInfos.Where(x => x.taskStatus != 3).ToList();
var info = GetTaskInfoByTaskStatus(appConfig.shellStoreCode);
for (int i = 0; i < info.Count; i++)
if(info != null)
{
var item = info[i];
ReadShellFinish_OutStore(item);
Console.WriteLine($"箱壳任务:{item.taskCode};物料:{item.materialCode};出库完成");
item.taskStatus = 3;
shellTaskInfos.Add(item);
for (int i = 0; i < info.Count; i++)
{
var item = info[i];
ReadShellFinish_OutStore(item);
Console.WriteLine($"箱壳任务:{item.taskCode};物料:{item.materialCode};出库完成");
item.taskStatus = 3;
shellTaskInfos.Add(item);
}
}
Thread.Sleep(1000);
@ -454,13 +457,16 @@ namespace Aucma.Scada.Business
{
//var info = linerTaskInfos.Where(x => x.taskStatus != 3).ToList();
var info = GetTaskInfoByTaskStatus(appConfig.linerStoreCode);
for (int i = 0; i < info.Count; i++)
if(info != null)
{
var item = info[i];
ReadLinerFinish_OutStore(item);
Console.WriteLine($"内胆任务:{item.taskCode};物料:{item.materialCode};出库完成");
item.taskStatus = 3;
linerTaskInfos.Add(item);
for (int i = 0; i < info.Count; i++)
{
var item = info[i];
ReadLinerFinish_OutStore(item);
Console.WriteLine($"内胆任务:{item.taskCode};物料:{item.materialCode};出库完成");
item.taskStatus = 3;
linerTaskInfos.Add(item);
}
}
Thread.Sleep(1000);

@ -17,7 +17,7 @@ namespace Aucma.Core.Scanner
private static AppConfig appConfig = AppConfig.Instance;
public static bool m_bGrabbing = true;
#region 委托事件
public delegate void RefreshMaterialCodeStr(string storeCode, string materialCodeStr);
public delegate void RefreshMaterialCodeStr(string materialCodeStr, string ip);
public static event RefreshMaterialCodeStr RefreshMaterialCodeStrEvent;
/// <summary>
/// 日志信息刷新
@ -66,7 +66,12 @@ namespace Aucma.Core.Scanner
try
{
RefreshLogMessageEvent?.Invoke("获取扫码器设备列表,进入DeviceListAcq()方法");
// 内胆扫码器ip
string LinerScannerIp = appConfig.linerHikRobotIp;
// 箱壳扫码器ip
string ShellScannerIp = appConfig.linerHikRobotIp;
System.GC.Collect();
m_stDeviceList.nDeviceNum = 0;
// 获取设备列表
@ -96,7 +101,9 @@ namespace Aucma.Core.Scanner
// 获取ip
string ip = ((stGigEDeviceInfo.nCurrentIp & 0xff000000) >> 24) + "." + ((stGigEDeviceInfo.nCurrentIp & 0x00ff0000) >> 16) + "." + ((stGigEDeviceInfo.nCurrentIp & 0x0000ff00) >> 8) + "." + (stGigEDeviceInfo.nCurrentIp & 0x000000ff);
// Console.WriteLine($"打印扫码设备信息,下标:{i}IP{ip}");
// 只连接配置的扫码器
if (!ip.Equals(LinerScannerIp) && !ip.Equals(ShellScannerIp)) continue;
Console.Write("扫码器设备[" + i + "],ip:" + ip);
// 创建第i个设备
stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(m_stDeviceList.pDeviceInfo[i], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO));
@ -181,14 +188,9 @@ namespace Aucma.Core.Scanner
RefreshLogMessageEvent?.Invoke("相机ip:" + hashmap.Value + " Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode + "]");
if (!string.IsNullOrEmpty(strCode))
{
// 获取到条码处理业务
if (appConfig.shellHikRobotIp == hashmap.Value)
{
RefreshMaterialCodeStrEvent?.Invoke(appConfig.shellStoreCode, strCode);
}else if(appConfig.linerHikRobotIp == hashmap.Value)
{
RefreshMaterialCodeStrEvent?.Invoke(appConfig.linerStoreCode, strCode);
}
RefreshMaterialCodeStrEvent?.Invoke(strCode,hashmap.Value);
}
}
}

@ -47,6 +47,7 @@
<Compile Include="domain\BaseBomInfo.cs" />
<Compile Include="domain\BaseSpaceDetail.cs" />
<Compile Include="domain\BaseSpaceInfo.cs" />
<Compile Include="domain\BaseMaterialInfo.cs" />
<Compile Include="domain\CodeBindingRecord.cs" />
<Compile Include="domain\ExecutePlanInfo.cs" />
<Compile Include="domain\MaterialCompletion.cs" />

@ -0,0 +1,43 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace Aucma.Scada.Model.domain
{
[SugarTable("BASE_MATERIALINFO")]
public class BaseMaterialInfo
{
/// <summary>
/// 主键标识
///</summary>
[SugarColumn(ColumnName = "OBJ_ID", IsPrimaryKey = true, IsIdentity = true)]
public int ObjId { get; set; }
/// <summary>
/// 物料编号
/// </summary>
[SugarColumn(ColumnName = "MATERIAL_CODE")]
public string MaterialCode { get; set; }
/// <summary>
/// 物料名称
/// </summary>
[SugarColumn(ColumnName = "MATERIAL_NAME")]
public string MaterialName { get; set; }
/// <summary>
/// 物料小类
/// </summary>
[SugarColumn(ColumnName = "MATERIAL_SUBCLASS")]
public string MaterialSubclass { get; set; }
/// <summary>
/// 物料sap类型FERT成品
/// </summary>
[SugarColumn(ColumnName = "MATERIAL_TYPE")]
public string MaterialType { get; set; }
}
}

@ -51,7 +51,7 @@ namespace Aucma.Scada.Model.domain
public int spaceType { get; set; }
/// <summary>
/// 物料类型
/// 物料类型A
/// </summary>
[SugarColumn(ColumnName = "MATERIAL_TYPE")]
public string materialType { get; set; }
@ -97,5 +97,32 @@ namespace Aucma.Scada.Model.domain
/// </summary>
[SugarColumn(ColumnName = "UNUSUAL_FLAG")]
public int unusualFlag { get; set; }
/// <summary>
/// 物料类型B
/// </summary>
[SugarColumn(ColumnName = "TYPE_CODE_B")]
public string typeCodeB { get; set; }
/// <summary>
/// 物料类型C
/// </summary>
[SugarColumn(ColumnName = "TYPE_CODE_C")]
public string typeCodeC { get; set; }
/// <summary>
/// 物料类型(名称)A
/// </summary>
[SugarColumn(ColumnName = "TYPE_NAME_A")]
public string typeNameA { get; set; }
/// <summary>
/// 物料类型(名称)B
/// </summary>
[SugarColumn(ColumnName = "TYPE_NAME_B")]
public string typeNameB { get; set; }
/// <summary>
/// 物料类型(名称)C
/// </summary>
[SugarColumn(ColumnName = "TYPE_NAME_C")]
public string typeNameC { get; set; }
}
}

@ -126,6 +126,9 @@
<Compile Include="Page\InventoryInfo\MaterialStatisticsWindow.xaml.cs">
<DependentUpon>MaterialStatisticsWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Page\InventoryInfo\SelectType.xaml.cs">
<DependentUpon>SelectType.xaml</DependentUpon>
</Compile>
<Compile Include="Page\InventoryInfo\ShellInventory.xaml.cs">
<DependentUpon>ShellInventory.xaml</DependentUpon>
</Compile>
@ -152,6 +155,7 @@
<Compile Include="viewModel\InventoryInfo\InventoryInfoViewModel.cs" />
<Compile Include="viewModel\InventoryInfo\LinerInventoryViewModel.cs" />
<Compile Include="viewModel\InventoryInfo\MaterialStatisticsViewModel.cs" />
<Compile Include="viewModel\InventoryInfo\SelectTypeViewModel.cs" />
<Compile Include="viewModel\InventoryInfo\SpaceDetailViewModel.cs" />
<Compile Include="viewModel\LogInfoViewModel.cs" />
<Compile Include="viewModel\MainViewModel.cs" />
@ -207,6 +211,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Page\InventoryInfo\SelectType.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Page\InventoryInfo\ShellInventory.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

@ -38,14 +38,19 @@
<StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right">
<Grid>
<Grid.ColumnDefinitions>
<!--<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.ColumnDefinitions>-->
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding ShiftStr}" FontSize="25" Foreground="White" FontWeight="Bold" Margin="0,0,30,0"/>
<TextBlock Grid.Row="1" Text="{Binding CurrentDateTime}" FontSize="20" 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>
</StackPanel>
</Grid>

@ -144,7 +144,7 @@
Foreground="#FFFFFF" SelectedItem="{Binding SelectedDataItem}" MouseLeftButtonDown="dataGrid_MouseLeftButtonDown">
<!--resourceStyle 399行修改选中字体颜色-->
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding planCode}" Header="计划编号" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding planCode}" Header="计划编号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding orderCode}" Header="工单编号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding materialName}" Header="产品型号" Width="3*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding planAmount}" Header="计划数量" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>

@ -129,7 +129,7 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderBrush="White" BorderThickness="1">
<TextBlock Text="{Binding spaceCode}" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock x:Name="spaceCodeText" Text="{Binding spaceCode}" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="1" BorderBrush="White" BorderThickness="1">
<TextBlock Text="在库" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
@ -161,7 +161,9 @@
<TextBlock Text="型号" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="1" BorderBrush="White" BorderThickness="1">
<TextBlock Text="{Binding materialType}" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Button Command="{Binding DataContext.SubmitCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding Text, ElementName=spaceCodeText}" Background="Transparent">
<TextBlock Text="{Binding materialType}" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
</Border>
</Grid>
</Border>

@ -0,0 +1,134 @@
<Window x:Class="Aucma.Scada.UI.Page.InventoryInfo.SelectType"
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.Scada.UI.Page.InventoryInfo"
mc:Ignorable="d" FontFamily="Microsoft YaHei"
Name="window" Background="#1254AB" d:DesignHeight="800" d:DesignWidth="1200">
<Window.Resources>
<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" />
</Style>
</Window.Resources>
<Border Margin="5" Background="#1254AB" CornerRadius="1">
<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>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" Grid.Column="0">
<TextBox Width="200" Height="25" Margin="10 0 0 0" Text="{Binding SearchText}" Foreground="White" VerticalAlignment="Center" FontSize="18"/>
<Button Content="查 询" Command="{Binding QueryCommand}" Background="#007DFA" BorderBrush="#007DFA" VerticalAlignment="Center" Foreground="White" Height="30" Width="100" Margin="0 0 50 0"/>
<Button Content="清除型号" Command="{Binding deleteCommand}" Background="#FF9900" Foreground="white" BorderBrush="#FF9900" VerticalAlignment="Center" Height="30" Width="100" />
</StackPanel>
<!--计划列表-->
<Border Grid.Row="1" Grid.Column="0" BorderBrush="#1254AB" Background="Transparent" BorderThickness="0" CornerRadius="5" Margin="1,1,5,5" >
<DataGrid ItemsSource="{Binding MaterialDataGrid}" Background="Transparent"
FontSize="18" ColumnHeaderHeight="35"
RowHeight="31" AutoGenerateColumns="False" RowHeaderWidth="0"
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False"
Foreground="#FFFFFF" SelectedItem="{Binding SelectedDataItem}" SelectionChanged="DataGrid_SelectionChanged">
<!--resourceStyle 399行修改选中字体颜色-->
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding MaterialCode}" Header="产品编码" Width="1*" />
<DataGridTextColumn Binding="{Binding MaterialName}" Header="产品名称" Width="2.5*" />
</DataGrid.Columns>
</DataGrid>
</Border>
<Border Grid.Row="1" Grid.Column="1" BorderBrush="#1254AB" BorderThickness="3" CornerRadius="5" Background="Transparent" Margin="5,5">
<Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0">
<TextBlock Text="产品编码:" FontSize="20" Foreground="#FFFFFF" Margin="10,0,0,0"/>
<TextBox x:Name="MaterialCode" FontSize="20" Text="{Binding PlanInfo.MaterialCode}" Foreground="#FFFFFF" Width="260" IsReadOnly="True" Margin="5,0,10,0"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0">
<TextBlock Text="产品型号:" FontSize="20" Foreground="#FFFFFF" Margin="10,0,0,0"/>
<TextBox x:Name="MaterialName" FontSize="20" Text="{Binding PlanInfo.MaterialName}" Foreground="#FFFFFF" Width="450" IsReadOnly="True" Margin="5,0,10,0"/>
</StackPanel>
<StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center" Margin="60,0,0,0" >
<!--单选框样式-->
<StackPanel.Resources>
<Style TargetType="RadioButton">
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<BulletDecorator Background="Transparent">
<BulletDecorator.Bullet>
<Grid Width="20" Height="20">
<Ellipse x:Name="BulletRadio" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1"/>
</Grid>
</BulletDecorator.Bullet>
<ContentPresenter Margin="4,0,0,0" VerticalAlignment="Center" RecognizesAccessKey="True"/>
</BulletDecorator>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="BulletRadio" Property="Fill" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="Green"/>
</Trigger>
</Style.Triggers>
</Style>
</StackPanel.Resources>
<TextBlock Text="选择型号: " FontSize="20" Foreground="#FFFFFF" />
<RadioButton Content="型号1" GroupName="Direction" IsChecked="{Binding IsSelectedOptionA, Mode=TwoWay}" />
<!--<RadioButton Content="型号2" GroupName="Direction" IsChecked="{Binding IsSelectedOptionB, Mode=TwoWay}" Margin="10 0 0 0"/>
<RadioButton Content="型号3" GroupName="Direction" IsChecked="{Binding IsSelectedOptionC, Mode=TwoWay}" Margin="10 0 0 0"/>-->
</StackPanel>
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="保 存" FontSize="20" Command="{Binding SaveCommand}" Background="#FF36B5C1" BorderBrush="#FF36B5C1" Foreground="white" Margin="0,0,10,0" Height="50" Width="100" />
</StackPanel>
</Grid>
</Border>
</Grid>
</Border>
</Window>

@ -0,0 +1,42 @@
using Aucma.Scada.UI.viewModel.InventoryInfo;
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.Shapes;
namespace Aucma.Scada.UI.Page.InventoryInfo
{
/// <summary>
/// SelectType.xaml 的交互逻辑
/// </summary>
public partial class SelectType : Window
{
private SelectTypeViewModel viewModel = null;
public SelectType(int ncount, string spaceCode)
{
InitializeComponent();
viewModel = new SelectTypeViewModel(ncount, spaceCode);
this.DataContext = viewModel;
viewModel.closeEvent += closeWindow;
}
private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
viewModel.MouseClick(sender);
}
private void closeWindow()
{
this.Close();
}
}
}

@ -130,7 +130,7 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderBrush="White" BorderThickness="1">
<TextBlock Text="{Binding spaceCode}" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock x:Name="spaceCodeText" Text="{Binding spaceCode}" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="1" BorderBrush="White" BorderThickness="1">
<TextBlock Text="在库" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
@ -162,7 +162,9 @@
<TextBlock Text="型号" FontSize="18" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Column="1" BorderBrush="White" BorderThickness="1">
<TextBlock Text="{Binding materialType}" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Button Command="{Binding DataContext.SubmitCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding Text, ElementName=spaceCodeText}" Background="Transparent">
<TextBlock Text="{Binding materialType}" FontSize="16" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
</Border>
</Grid>
</Border>

@ -1,7 +1,7 @@
[system]
#数据库连接
mesConnStr=Data Source=175.27.215.92/helowin;User ID=aucma_mes;Password=aucma
scadaConnStr=Data Source=175.27.215.92/helowin;User ID=aucma_scada;Password=aucma
mesConnStr=Data Source=10.100.72.20/ORCLCDB;User ID=c##aucma_mes;Password=aucma
scadaConnStr=Data Source=10.100.72.20/ORCLCDB;User ID=c##aucma_scada;Password=aucma
#工位编号
stationCode=1002
@ -9,9 +9,9 @@ stationCode=1002
stationName=箱壳内胆组装
#箱壳库编号
shellStoreCode=XKJCK-001
shellStoreCode=XKK-001
#内胆库编号
linerStoreCode=NDJCK-001
linerStoreCode=NDK-001
#箱壳物料类型编号
shellMaterialType =400

@ -8,7 +8,7 @@
[shell_inStore_address]
⻌踱億耋瘍=D7000
⻌踱茼湘趼=D7010
备用字=D7020
#囀筐⻌踱華硊
[liner_inStore_address]
⻌踱億耋瘍=D7000

@ -1,63 +1,63 @@
#箱壳库货道信息 是否已满=D7221 货道状态=D7231 仓库状态=D7300 #设备状态字,0未启动状态,1已自动运行,2维修调试状态,禁止启动
[XKJCK-001_XK_001]
[XKK-001_XK_001]
在库数量=D7201
在途数量=D7211
入库完成=D7021
出库完成=D7240
[XKJCK-001_XK_002]
[XKK-001_XK_002]
在库数量=D7202
在途数量=D7212
入库完成=D7022
出库完成=D7240
[XKJCK-001_XK_003]
[XKK-001_XK_003]
在库数量=D7203
在途数量=D7213
入库完成=D7023
出库完成=D7240
[XKJCK-001_XK_004]
[XKK-001_XK_004]
在库数量=D7204
在途数量=D7214
入库完成=D7024
出库完成=D7240
[XKJCK-001_XK_005]
[XKK-001_XK_005]
在库数量=D7205
在途数量=D7215
入库完成=D7025
出库完成=D7240
[XKJCK-001_XK_006]
[XKK-001_XK_006]
在库数量=D7206
在途数量=D7216
入库完成=D7026
出库完成=D7240
#内胆库货道信息
[NDJCK-001_ND_001]
[NDK-001_ND_001]
在库数量=D7201
在途数量=D7211
入库完成=D7021
出库完成=D7240
[NDJCK-001_ND_002]
[NDK-001_ND_002]
在库数量=D7202
在途数量=D7212
入库完成=D7022
出库完成=D7240
[NDJCK-001_ND_003]
[NDK-001_ND_003]
在库数量=D7203
在途数量=D7213
入库完成=D7023
出库完成=D7240
[NDJCK-001_ND_004]
[NDK-001_ND_004]
在库数量=D7204
在途数量=D7214
入库完成=D7024
出库完成=D7240
[NDJCK-001_ND_005]
[NDK-001_ND_005]
在库数量=D7205
在途数量=D7215
入库完成=D7025
出库完成=D7240
[NDJCK-001_ND_006]
[NDK-001_ND_006]
在库数量=D7206
在途数量=D7216
入库完成=D7026

@ -61,7 +61,7 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
var productPlanInfo = _PlanInfo;
if(productPlanInfo != null)
{
{ // 8302501428
var materialType = productPlanInfo.materialCode;
bool shellResult = assemblyPlanBusiness.JudgmentStock(productPlanInfo, Convert.ToInt32(_TransmitAmount), appConfig.shellMaterialType,appConfig.shellStoreCode);

@ -31,6 +31,10 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
{
#region 事件绑定
// 设置型号
SubmitCommand = new RelayCommand<string>(obj => SubmitCommandExecute(obj));
UpdateInStoreFlagCommand = new RelayCommand<object>(obj => UpdateInStoreFlag(obj));
UpdateOutStoreFlagCommand = new RelayCommand<object>(obj => UpdateOutStoreFlag(obj));
@ -44,7 +48,7 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
OutOnlyOneCommand = new RelayCommand<object>(obj => OutOnlyOne(obj));
#endregion
outStoreBusiness.RefreshStoreStockEvent += Query;
SelectTypeViewModel.RefreshLinerPageEvent += Query;
inStoreBusiness.RefreshInStoreTaskEvent += RefreshSpaceInfo;
Query();
@ -52,6 +56,18 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
}
#region 参数定义
public RelayCommand<string> SubmitCommand { get; set; }
private void SubmitCommandExecute(string spaceCode)
{
SelectType type = new SelectType(1, spaceCode);
type.ShowDialog();
}
public ObservableCollection<BaseSpaceInfo> _shapes;
public ObservableCollection<BaseSpaceInfo> Shapes

@ -0,0 +1,320 @@
using Aucma.Scada.Model.domain;
using Aucma.Scada.UI.Page.InventoryInfo;
using GalaSoft.MvvmLight;
using HighWayIot.Config;
using HighWayIot.Log4net;
using HighWayIot.Repository.service.Impl;
using HighWayIot.Repository.service;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using GalaSoft.MvvmLight.Command;
namespace Aucma.Scada.UI.viewModel.InventoryInfo
{
public class SelectTypeViewModel : ViewModelBase
{
/// <summary>
/// 委托,关闭窗口
/// </summary>
/// <param name="message"></param>
public delegate void close();
public event close closeEvent;
/// <summary>
/// 刷新箱壳库页面
/// </summary>
/// <param name="message"></param>
public delegate void RefreshShellPage();
public static event RefreshShellPage RefreshShellPageEvent;
/// <summary>
/// 刷新内胆库页面
/// </summary>
/// <param name="message"></param>
public delegate void RefreshLinerPage();
public static event RefreshLinerPage RefreshLinerPageEvent;
public RelayCommand QueryCommand { get; set; }
public RelayCommand deleteCommand { get; set; }
public RelayCommand SaveCommand { get; set; }
private AppConfig appConfig = AppConfig.Instance;
private LogHelper logHelper = LogHelper.Instance;
private ShellInventory shellInventory = new ShellInventory();
private LinerInventory linerInventory = new LinerInventory();
private IBaseMaterialInfoService baseMaterialInfoService = new BaseMaterialInfoServiceImpl();
private IBaseSpaceInfoService baseSpaceInfoService = new BaseSpaceInfoServiceImpl();
public RelayCommand<object> MouseClickCommand { get; set; }
private string spaceCodes = string.Empty;
public SelectTypeViewModel()
{
}
public SelectTypeViewModel(int ncount, string spaceCode)
{
QueryCommand = new RelayCommand(searchData);
SaveCommand = new RelayCommand(updateDirection);
deleteCommand = new RelayCommand(deleteModel);
spaceCodes = spaceCode;
MouseClickCommand = new RelayCommand<object>(MouseClick);
materialDataGrid = new ObservableCollection<BaseMaterialInfo>();
Console.WriteLine(spaceCode);
Load();
if (ncount == 1)
{
IsSelectedOptionA = true;
}
else if (ncount == 2)
{
IsSelectedOptionB = true;
}
else if (ncount == 3)
{
IsSelectedOptionC = true;
}
}
public void Load()
{
var infos = baseMaterialInfoService.getAllInfos();
MaterialDataGrid.Clear();
Application.Current.Dispatcher.Invoke(() =>
{
foreach (BaseMaterialInfo info in infos)
{
MaterialDataGrid.Add(info);
}
});
}
private ObservableCollection<BaseMaterialInfo> materialDataGrid;
public ObservableCollection<BaseMaterialInfo> MaterialDataGrid
{
get { return materialDataGrid; }
set { materialDataGrid = value; RaisePropertyChanged(() => MaterialDataGrid); }
}
private BaseMaterialInfo selectedDataItem;
public BaseMaterialInfo SelectedDataItem
{
get { return selectedDataItem; }
set
{
selectedDataItem = value;
RaisePropertyChanged(nameof(SelectedDataItem));
}
}
public void MouseClick(object obj)
{
var info = SelectedDataItem as BaseMaterialInfo;
if (info != null)
{
PlanInfo = info;
// SelectTypeWindow window = new SelectTypeWindow(spaceCodes, SelectedDataItem);
// window.ShowDialog();
}
}
private BaseMaterialInfo planInfo = new BaseMaterialInfo();
public BaseMaterialInfo PlanInfo
{
get { return planInfo; }
set
{
planInfo = value;
RaisePropertyChanged(nameof(PlanInfo));
}
}
private string searchText;
public string SearchText
{
get { return searchText; }
set
{
searchText = value;
RaisePropertyChanged(nameof(SearchText));
}
}
#region 单选框
private bool _isSelectedOptionA;
public bool IsSelectedOptionA
{
get { return _isSelectedOptionA; }
set
{
if (_isSelectedOptionA != value)
{
_isSelectedOptionA = value;
RaisePropertyChanged(nameof(IsSelectedOptionA));
// 如果选择了A选项将BC选项设为false
if (_isSelectedOptionA)
{
IsSelectedOptionB = false;
IsSelectedOptionC = false;
}
}
}
}
private bool _isSelectedOptionB;
public bool IsSelectedOptionB
{
get { return _isSelectedOptionB; }
set
{
if (_isSelectedOptionB != value)
{
_isSelectedOptionB = value;
RaisePropertyChanged(nameof(IsSelectedOptionB));
// 如果选择了B选项将A选项设为false
if (_isSelectedOptionB)
{
IsSelectedOptionA = false;
IsSelectedOptionC = false;
}
}
}
}
private bool _isSelectedOptionC;
public bool IsSelectedOptionC
{
get { return _isSelectedOptionC; }
set
{
if (_isSelectedOptionC != value)
{
_isSelectedOptionC = value;
RaisePropertyChanged(nameof(IsSelectedOptionC));
if (_isSelectedOptionC)
{
IsSelectedOptionA = false;
IsSelectedOptionB = false;
}
}
}
}
#endregion
private async void deleteModel()
{
if (!IsSelectedOptionA && !IsSelectedOptionB && !IsSelectedOptionC)
{
MessageBox.Show("请至少选择一个型号!");
return;
}
// 查询货道信息
string storeCode = spaceCodes.Substring(0,2).Equals("XK")? appConfig.shellStoreCode: appConfig.linerStoreCode;
BaseSpaceInfo space = baseSpaceInfoService.GetSpaceInfoBySpaceCode(storeCode, spaceCodes);
if (IsSelectedOptionA)
{
space.materialType = null;
space.typeNameA = null;
}
else if (IsSelectedOptionB)
{
space.typeCodeB = null;
space.typeNameB = null;
}
else if (IsSelectedOptionC)
{
space.typeCodeC = null;
space.typeNameC = null;
}
bool result = baseSpaceInfoService.UpdateSpaceInfo(space);
if (result)
{
MessageBox.Show("清除型号成功!");
}
//关闭窗口
closeEvent?.Invoke();
//刷新界面
RefreshShellPageEvent?.Invoke();
RefreshLinerPageEvent?.Invoke();
}
/// <summary>
/// 设置型号
/// </summary>
private async void updateDirection()
{
if (!IsSelectedOptionA && !IsSelectedOptionB && !IsSelectedOptionC)
{
MessageBox.Show("请至少选择一个型号!");
return;
}
// 查询货道信息
string storeCode = spaceCodes.Substring(0, 2).Equals("XK") ? appConfig.shellStoreCode : appConfig.linerStoreCode;
BaseSpaceInfo space = baseSpaceInfoService.GetSpaceInfoBySpaceCode(storeCode, spaceCodes);
if (IsSelectedOptionA)
{
space.materialType = PlanInfo.MaterialCode;
space.typeNameA = PlanInfo.MaterialName;
}
else if (IsSelectedOptionB)
{
space.typeCodeB = PlanInfo.MaterialCode;
space.typeNameB = PlanInfo.MaterialName;
}
else if (IsSelectedOptionC)
{
space.typeCodeC = PlanInfo.MaterialCode;
space.typeNameC = PlanInfo.MaterialName;
}
bool result = baseSpaceInfoService.UpdateSpaceInfo(space);
if (result)
{
MessageBox.Show("型号设置成功");
}
//关闭窗口
closeEvent?.Invoke();
//刷新界面
RefreshShellPageEvent?.Invoke();
RefreshLinerPageEvent?.Invoke();
}
///<summary>
///条件查询型号
/// </summary>
private async void searchData()
{
if (!string.IsNullOrEmpty(searchText))
{
var infos = baseMaterialInfoService.getAllInfos().Where(x => x.MaterialName.Contains(searchText) || x.MaterialCode.Contains(searchText));
MaterialDataGrid.Clear();
Application.Current.Dispatcher.Invoke(() =>
{
foreach (BaseMaterialInfo info in infos)
{
MaterialDataGrid.Add(info);
}
});
}
}
}
}

@ -31,6 +31,10 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
{
#region 事件绑定
// 设置型号
SubmitCommand = new RelayCommand<string>(obj => SubmitCommandExecute(obj));
UpdateInStoreFlagCommand = new RelayCommand<object>(obj => UpdateInStoreFlag(obj));
UpdateOutStoreFlagCommand = new RelayCommand<object>(obj => UpdateOutStoreFlag(obj));
@ -46,13 +50,28 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
outStoreBusiness.RefreshStoreStockEvent += Query;
SelectTypeViewModel.RefreshShellPageEvent += Query;
inStoreBusiness.RefreshInStoreTaskEvent += RefreshSpaceInfo;
Query();
}
#region 参数定义
public RelayCommand<string> SubmitCommand { get; set; }
private void SubmitCommandExecute(string spaceCode)
{
SelectType type = new SelectType(1, spaceCode);
type.ShowDialog();
}
public ObservableCollection<BaseSpaceInfo> _shapes;
public ObservableCollection<BaseSpaceInfo> Shapes

@ -15,6 +15,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Windows.Threading;
namespace Aucma.Scada.UI.viewModel
{
@ -33,7 +34,12 @@ namespace Aucma.Scada.UI.viewModel
public MainViewModel()
{
// 创建一个DispatcherTimer对象
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Start();
ControlOnClickCommand = new RelayCommand<object>(obj => ControlOnClick(obj));
OpenSystemKeyboardCommand = new RelayCommand(OpenSystemKeyboard);
@ -228,9 +234,17 @@ namespace Aucma.Scada.UI.viewModel
/// <param name="e"></param>
public void RefreshStatus(object sender, System.Timers.ElapsedEventArgs e)
{
RefreshMesDb();
RefreshPlc();
RefreshScanner();
try
{
RefreshMesDb();
RefreshPlc();
RefreshScanner();
}
catch (Exception ex)
{
logHelper.Error(ex.Message.ToString());
}
}
/// <summary>
@ -574,6 +588,38 @@ namespace Aucma.Scada.UI.viewModel
}
#endregion
public string _currentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
public string CurrentDateTime
{
get => _currentDateTime;
set { _currentDateTime = value; RaisePropertyChanged(nameof(CurrentDateTime)); }
}
public string _shiftStr = string.Empty;
public string ShiftStr
{
get => _shiftStr;
set { _shiftStr = value; RaisePropertyChanged(nameof(ShiftStr)); }
}
private void Timer_Tick(object sender, EventArgs e)
{
DateTime now = DateTime.Now;
// 判断当前是否是白班时间段
if (now.Hour >= 8 && now.Hour < 20)
{
ShiftStr = $"白班 08点-20点";
}
else
{
ShiftStr = $"夜班 20点-08点";
}
CurrentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
}
}

@ -32,7 +32,7 @@ namespace HighWayIot.Config
SpaceAddress spaceAddress = new SpaceAddress();
spaceAddress.onStore = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "在库数量");
spaceAddress.onRoute = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "在途数量");
spaceAddress.outStoreFinish = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "入库完成");
spaceAddress.inStoreFinish = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "入库完成");
spaceAddress.outStoreFinish = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "出库完成");
return spaceAddress;
// spaceAddress.isFull = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "是否已满");

@ -52,7 +52,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="service\IBaseMaterialInfoService.cs" />
<Compile Include="service\ICodeBindingRecordServices.cs" />
<Compile Include="service\Impl\BaseMaterialInfoServiceImpl.cs" />
<Compile Include="service\Impl\CodeBindingRecordServiceImpl.cs" />
<Compile Include="service\Impl\MaterialCompletionServiceImpl.cs" />
<Compile Include="service\Impl\PrintBarCodeServicesImpl.cs" />

@ -0,0 +1,19 @@
using Aucma.Scada.Model.domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.service
{ /// <summary>
/// 条码绑定
/// </summary>
public interface IBaseMaterialInfoService
{
/// <summary>
/// 箱壳内胆条码绑定
/// </summary>
List<BaseMaterialInfo> getAllInfos();
}
}

@ -0,0 +1,32 @@
using Aucma.Scada.Model.domain;
using HighWayIot.Log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.Repository.service.Impl
{
public class BaseMaterialInfoServiceImpl : IBaseMaterialInfoService
{
Repository<BaseMaterialInfo> _baseMaterialInfo => new Repository<BaseMaterialInfo>("mes");
private LogHelper logHelper = LogHelper.Instance;
public List<BaseMaterialInfo> getAllInfos()
{
try
{
var info = _baseMaterialInfo.GetList(x => x.MaterialSubclass == "200");
return info;
}
catch (Exception ex)
{
logHelper.Error("获取集合异常", ex);
return null;
}
}
}
}

@ -178,28 +178,28 @@ namespace HighWayIot.Repository.service.Impl
List<BaseSpaceInfo> spaceInfos = null;
try
{
//spaceInfos = _mesRepository.GetList(x => x.storeCode == storeCode).ToList();
spaceInfos = _mesRepository.GetList(x => x.storeCode == storeCode).ToList();
spaceInfos = _mesRepository.Context.Queryable<BaseSpaceInfo>()
.LeftJoin<BaseBomInfo>((s, b) => s.materialType == b.materialCode)
.Where((s, b) => s.storeCode == storeCode)
.Select((s, b) => new BaseSpaceInfo()
{
objId = s.objId,
spaceCode = s.spaceCode,
spaceName = s.spaceName,
spaceCapacity = s.spaceCapacity,
spaceStock = s.spaceStock,
spaceStatus = s.spaceStatus,
spaceType = s.spaceType,
isFlag = s.isFlag,
materialType = b.materialName,
onRouteAmount = s.onRouteAmount,
inStoreFlag = s.inStoreFlag,
outRouteAmount = s.outRouteAmount,
outStoreFlag = s.outStoreFlag,
unusualFlag = s.unusualFlag,
}).ToList();
//spaceInfos = _mesRepository.Context.Queryable<BaseSpaceInfo>()
// .LeftJoin<BaseBomInfo>((s, b) => s.materialType == b.materialCode)
// .Where((s, b) => s.storeCode == storeCode)
// .Select((s, b) => new BaseSpaceInfo()
// {
// objId = s.objId,
// spaceCode = s.spaceCode,
// spaceName = s.spaceName,
// spaceCapacity = s.spaceCapacity,
// spaceStock = s.spaceStock,
// spaceStatus = s.spaceStatus,
// spaceType = s.spaceType,
// isFlag = s.isFlag,
// materialType = b.materialName,
// onRouteAmount = s.onRouteAmount,
// inStoreFlag = s.inStoreFlag,
// outRouteAmount = s.outRouteAmount,
// outStoreFlag = s.outStoreFlag,
// unusualFlag = s.unusualFlag,
// }).ToList();
}
catch (Exception ex)
{
@ -227,6 +227,8 @@ namespace HighWayIot.Repository.service.Impl
return result;
}
/// <summary>
///
/// </summary>
@ -251,13 +253,14 @@ namespace HighWayIot.Repository.service.Impl
shellStock = g.Where(x => x.STORE_CODE == shellStoreCode).Select(x => x.SPACE_STOCK).FirstOrDefault(),
linerStock = g.Where(x => x.STORE_CODE == linerStoreCode).Select(x => x.SPACE_STOCK).FirstOrDefault()
}).ToList();
}
}
catch (Exception ex)
{
logHelper.Error("获取物料库存异常", ex);
}
return result;
}

Loading…
Cancel
Save