1 year ago
parent 71631e6349
commit ba059ae638

@ -509,7 +509,6 @@ namespace Khd.Core.Wcs.Wcs
{ {
using var scope = _host.Services.CreateScope(); using var scope = _host.Services.CreateScope();
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>(); using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
while (true) while (true)
{ {
using var transaction = dbContext.Database.BeginTransaction(); using var transaction = dbContext.Database.BeginTransaction();
@ -559,10 +558,12 @@ namespace Khd.Core.Wcs.Wcs
{ {
agvEquip = 9; agvEquip = 9;
taskType.Add(StaticTaskType.ThirdTransitToLift); taskType.Add(StaticTaskType.ThirdTransitToLift);
taskType.Add(StaticTaskType.ThirdStockReturnTask);
} }
else if (wcsTask.floorNo == 5) else if (wcsTask.floorNo == 5)
{ {
agvEquip = 28; agvEquip = 28;
taskType.Add(StaticTaskType.FiveStockReturnTask);
taskType.Add(StaticTaskType.FiveProductOut); taskType.Add(StaticTaskType.FiveProductOut);
} }
else if (wcsTask.floorNo == 2) else if (wcsTask.floorNo == 2)

@ -1009,7 +1009,7 @@
<Label Content="Label"/> <Label Content="Label"/>
</StackPanel> </StackPanel>
</TabItem> </TabItem>
<TabItem x:Name="LocationManager" Header="库存信息" Background="#213269" Style="{StaticResource DefaultItem}" Foreground="White" FontSize="25" Width="160" Height="80" VerticalAlignment="Top" HorizontalAlignment="Center" > <TabItem x:Name="LocationManager" Header="库存信息" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="80" Margin="5" >
<StackPanel <StackPanel
x:Name="orderControl" x:Name="orderControl"
Canvas.Left="174" Canvas.Left="174"
@ -1255,9 +1255,7 @@
</StackPanel> </StackPanel>
</TabItem> </TabItem>
<TabItem x:Name="LocationManager11" Header="辅料库位" Background="#213269" <TabItem x:Name="LocationManager11" Header="辅料库位" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="80" Margin="5">
Style="{StaticResource DefaultItem}" Foreground="White"
FontSize="25" Width="160" Height="80" VerticalAlignment="Top" HorizontalAlignment="Center">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -1314,9 +1312,7 @@
</Grid> </Grid>
</Grid> </Grid>
</TabItem> </TabItem>
<TabItem Header="库位状态" Background="#213269" <TabItem Header="库位状态" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="80" Margin="5">
Style="{StaticResource DefaultItem}" Foreground="White"
FontSize="25" Width="160" Height="80" VerticalAlignment="Top" HorizontalAlignment="Center">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
@ -2376,7 +2372,7 @@ FontSize="25" Width="160" Height="80" VerticalAlignment="Top" HorizontalAlignmen
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="3*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border BorderBrush="White" BorderThickness="2" Grid.ColumnSpan="1" Width="150" Grid.Column="4" Grid.RowSpan="2" Margin="20 0 0 0"> <Border BorderBrush="White" BorderThickness="2" Grid.ColumnSpan="1" Width="150" Grid.Column="4" Grid.RowSpan="2" Margin="20 0 0 0">
@ -2399,7 +2395,7 @@ FontSize="25" Width="160" Height="80" VerticalAlignment="Top" HorizontalAlignmen
<StackPanel Orientation="Vertical" > <StackPanel Orientation="Vertical" >
<Button x:Name="SelectOutButton" Content="选择出库" Background="#346DFF" Foreground="White" FontSize="50" Margin="20,0,0,0" Height="100" Width="250" Click="SelectOutBtn_Click"/> <Button x:Name="SelectOutButton" Content="选择出库" Background="#346DFF" Foreground="White" FontSize="50" Margin="20,0,0,0" Height="100" Width="250" Click="SelectOutBtn_Click"/>
<Button Content="继续出库" Background="#346DFF" Foreground="White" FontSize="50" Margin="20,50,0,0" Height="119" Width="250" Click="ContineOutBtn_Click"/> <Button Content="继续出库" Background="#346DFF" Foreground="White" FontSize="50" Margin="20,50,0,0" Height="100" Width="250" Click="ContineOutBtn_Click"/>
</StackPanel> </StackPanel>
</Border> </Border>
@ -2555,7 +2551,7 @@ FontSize="25" Width="160" Height="80" VerticalAlignment="Top" HorizontalAlignmen
<Grid> <Grid>
<hc:TextBox hc:InfoElement.ShowClearButton="True" IsReadOnly="True" x:Name="outMaterialSpecTxt" FontSize="50" LostFocus="txtOutBarCode_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="3"/> <hc:TextBox hc:InfoElement.ShowClearButton="True" IsReadOnly="True" x:Name="outMaterialSpecTxt" FontSize="50" LostFocus="txtOutBarCode_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="3"/>
</Grid> </Grid>
<Button Content="确认出库" Grid.Column="4" Grid.Row="3" Grid.ColumnSpan="2" Width="400" Height="100" Margin="100,0,0,0" FontSize="35" Background="#346DFF" Foreground="White" Click="OutRawBaseLocaltion_Click"/> <Button Content="确认出库" Grid.Column="4" Grid.Row="3" Grid.ColumnSpan="2" Width="400" Height="75" Margin="100,0,0,0" FontSize="35" Background="#346DFF" Foreground="White" Click="OutRawBaseLocaltion_Click"/>
</StackPanel> </StackPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="4" Grid.ColumnSpan="6"> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="4" Grid.ColumnSpan="6">
@ -2568,7 +2564,7 @@ FontSize="25" Width="160" Height="80" VerticalAlignment="Top" HorizontalAlignmen
<Grid> <Grid>
<hc:TextBox x:Name="txtOutScan" Margin="0,0,0,0" FontSize="50" Width="300" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Grid.Row="4" Grid.Column="3" Grid.ColumnSpan="3" KeyDown="OutEnter" /> <hc:TextBox x:Name="txtOutScan" Margin="0,0,0,0" FontSize="50" Width="300" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Grid.Row="4" Grid.Column="3" Grid.ColumnSpan="3" KeyDown="OutEnter" />
</Grid> </Grid>
<Button Content="背负式小车捡料完成" Grid.Column="4" Grid.Row="6" Grid.ColumnSpan="2" Width="400" Height="100" Margin="100,0,0,0" FontSize="35" Background="#346DFF" Foreground="White" Click="btnBearConfirmBox_Click"/> <Button Content="背负式小车捡料完成" Grid.Column="4" Grid.Row="6" Grid.ColumnSpan="2" Width="400" Height="75" Margin="100,0,0,0" FontSize="35" Background="#346DFF" Foreground="White" Click="btnBearConfirmBox_Click"/>
</StackPanel> </StackPanel>
@ -2576,9 +2572,9 @@ FontSize="25" Width="160" Height="80" VerticalAlignment="Top" HorizontalAlignmen
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="5" Grid.ColumnSpan="6"> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="5" Grid.ColumnSpan="6">
<TextBlock Text="备注信息:" Width="280" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50"/> <TextBlock Text="备注信息:" Width="280" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50"/>
<Grid> <Grid>
<hc:TextBox hc:InfoElement.ShowClearButton="True" IsReadOnly="True" x:Name="remarks" FontSize="50" LostFocus="txtOutBarCode_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="3"/> <hc:TextBox hc:InfoElement.ShowClearButton="True" x:Name="remarks" FontSize="50" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="3"/>
</Grid> </Grid>
<Button Content="创建背负小车任务" Grid.Column="4" Grid.Row="6" Grid.ColumnSpan="2" Width="400" Height="100" Margin="100,0,0,0" FontSize="35" Background="#346DFF" Foreground="White" Click="createBearConfirmBox_Click"/> <Button Content="创建背负小车任务" Grid.Column="4" Grid.Row="6" Grid.ColumnSpan="2" Width="400" Height="75" Margin="100,0,0,0" FontSize="35" Background="#346DFF" Foreground="White" Click="createBearConfirmBox_Click"/>
</StackPanel> </StackPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="6" Grid.ColumnSpan="6"> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="6" Grid.ColumnSpan="6">

@ -584,6 +584,7 @@ namespace Khd.Core.Wpf.Form
List<long?> orderIds = wmsRawOutstocks.Select(t => t.rawOutstockId).ToList(); List<long?> orderIds = wmsRawOutstocks.Select(t => t.rawOutstockId).ToList();
var endStations = wmsRawOutstocks.Select(t => new var endStations = wmsRawOutstocks.Select(t => new
{ {
t.rawOutstockId,
orderId = t.saleOrderId, orderId = t.saleOrderId,
t.materialId, t.materialId,
t.endStationCode t.endStationCode
@ -616,19 +617,20 @@ namespace Khd.Core.Wpf.Form
// 根据 materialId 分组,并计算 outstockAmount 和 realOutstockAmount 的总和 // 根据 materialId 分组,并计算 outstockAmount 和 realOutstockAmount 的总和
var targetRawOutstocks = RawOutstocks var targetRawOutstocks = RawOutstocks
.GroupBy(t => new { t.materialId, t.saleOrderId }) .GroupBy(t => new { t.rawOutstockId, t.materialId, t.saleOrderId, t.outstockAmount, t.realOutstockAmount })
.Select(g => new .Select(g => new
{ {
rawOutStocketId = g.Key.rawOutstockId,
materialId = g.Key.materialId, materialId = g.Key.materialId,
saleOrderId = g.Key.saleOrderId, saleOrderId = g.Key.saleOrderId,
//totalOutstockAmount = g.Sum(t => t.outstockAmount), //totalOutstockAmount = g.Sum(t => t.outstockAmount),
totalOutstockAmount = g.Sum(t => t.outstockAmount), totalOutstockAmount = g.Key.outstockAmount,
//totalRealOutstockAmount = g.Sum(t => t.realOutstockAmount) //totalRealOutstockAmount = g.Sum(t => t.realOutstockAmount)
totalRealOutstockAmount = g.Sum(t => t.realOutstockAmount) totalRealOutstockAmount = g.Key.realOutstockAmount
}).ToList(); }).ToList();
//本次所有任务出来的托盘号 //本次所有任务出来的托盘号
List<WcsTask> wcsTasks = dbContext.WcsTask.Where(t => t.taskType == 30).Where(t => orderIds.Contains(t.orderId)).ToList(); List<WcsTask> wcsTasks = dbContext.WcsTask.Where(t => t.taskType == 30&& targetRawOutstocks.Select(d=>d.materialId).Contains(t.materialId)).ToList();
List<string> containerNos = wcsTasks.Select(t => t.containerNo).ToList(); List<string> containerNos = wcsTasks.Select(t => t.containerNo).ToList();
//本次所有托盘携带的物料 //本次所有托盘携带的物料
List<WmsRawStock> wmsRawStocks = dbContext.WmsRawStock.Where(t => containerNos.Contains(t.palletInfoCode)).ToList(); List<WmsRawStock> wmsRawStocks = dbContext.WmsRawStock.Where(t => containerNos.Contains(t.palletInfoCode)).ToList();
@ -661,9 +663,18 @@ namespace Khd.Core.Wpf.Form
.Where(pallet => pallet.MaterialId == order.materialId) .Where(pallet => pallet.MaterialId == order.materialId)
.Select(pallet => $"托盘{pallet.PalletInfoCode}数量{string.Format("{0:0.00}", pallet.canUseAmount)}") .Select(pallet => $"托盘{pallet.PalletInfoCode}数量{string.Format("{0:0.00}", pallet.canUseAmount)}")
), ),
EndStationCodes = string.Join(",", endStations.Where(t => t.materialId == order.materialId && t.orderId == order.saleOrderId).Select(t => t.endStationCode).ToList()) EndStationCodes = endStations.Where(t => t.rawOutstockId == order.rawOutStocketId).FirstOrDefault()?.endStationCode
//EndStationCodes = string.Join(",", endStations.Where(t => t.materialId == order.materialId && t.orderId == order.saleOrderId).Select(t => t.endStationCode).ToList())
}).ToList(); }).ToList();
var list1 = new List<string>();
try
{
list1 = JsonConvert.DeserializeObject<List<string>>(nowStationCode);
}
catch
{
}
List<long?> materialIds = RawOutstocks.Select(t => t.materialId).ToList(); List<long?> materialIds = RawOutstocks.Select(t => t.materialId).ToList();
List<MesBaseMaterialInfo> mesBaseMaterialInfos = dbContext.MesBaseMaterialInfo.Where(t => materialIds.Contains(t.MaterialId)).ToList(); List<MesBaseMaterialInfo> mesBaseMaterialInfos = dbContext.MesBaseMaterialInfo.Where(t => materialIds.Contains(t.MaterialId)).ToList();
@ -728,8 +739,15 @@ namespace Khd.Core.Wpf.Form
// }; // };
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{
try
{
this.OutTaskNumber.ItemsSource = orderNumber.OrderBy(t => t.EndStationCodes.Contains(list1[0]) ? 1 : 99);
}
catch
{ {
this.OutTaskNumber.ItemsSource = orderNumber; this.OutTaskNumber.ItemsSource = orderNumber;
}
this.OutTaskNumber.Items.Refresh(); this.OutTaskNumber.Items.Refresh();
}); });
} }
@ -762,7 +780,7 @@ namespace Khd.Core.Wpf.Form
{ {
using var scope = _host.Services.CreateScope(); using var scope = _host.Services.CreateScope();
var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>(); var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
var alarmInfo = dbContext.DmsBaseAlarmRule.Where(t => t.DeviceId ==- 1).ToList(); var alarmInfo = dbContext.DmsBaseAlarmRule.Where(t => t.DeviceId == -1).ToList();
while (true) while (true)
{ {
try try
@ -2777,13 +2795,8 @@ namespace Khd.Core.Wpf.Form
} }
if (wmsRawOutstocks.Count > 0) if (wmsRawOutstocks.Count > 0)
{ {
int index = 0;
var sort = list.Select(t => new wmsRawOutstocks = wmsRawOutstocks.OrderBy(t => list[0]==t.endStationCode?0:99).ToList();
{
stationCode = t,
index = index++
});
wmsRawOutstocks = wmsRawOutstocks.OrderBy(t => sort.FirstOrDefault(s => s.stationCode == t.endStationCode) != null ? sort.FirstOrDefault(s => s.stationCode == t.endStationCode).index : 99).ToList();
decimal? sum = wmsRawOutstocks.Sum(t => (t.outstockAmount - t.realOutstockAmount)); decimal? sum = wmsRawOutstocks.Sum(t => (t.outstockAmount - t.realOutstockAmount));
if (outScan > sum) if (outScan > sum)
{ {
@ -2792,11 +2805,16 @@ namespace Khd.Core.Wpf.Form
} }
foreach (var item in wmsRawOutstocks) foreach (var item in wmsRawOutstocks)
{ {
if (outScan <= 0)
{
break;
}
decimal outAmount = 0; decimal outAmount = 0;
if (item.outstockAmount - item.realOutstockAmount > outScan) if (item.outstockAmount - item.realOutstockAmount > outScan)
{ {
item.realOutstockAmount += outScan; item.realOutstockAmount += outScan;
outAmount += outScan; outAmount += outScan;
outScan = 0;
} }
else else
{ {
@ -2940,6 +2958,7 @@ namespace Khd.Core.Wpf.Form
outMaterialSpecTxt.Text = string.Empty; outMaterialSpecTxt.Text = string.Empty;
outMaterialNameTxt.Text = string.Empty; outMaterialNameTxt.Text = string.Empty;
txtOutBox.Text = string.Empty; txtOutBox.Text = string.Empty;
remarks.Text = string.Empty;
txtOutBox.Focus(); txtOutBox.Focus();
} }
} }
@ -3150,6 +3169,7 @@ namespace Khd.Core.Wpf.Form
} }
catch (Exception ex) catch (Exception ex)
{ {
scanOutMsg.Text = "出库失败"+ex;
} }
} }
/// <summary> /// <summary>

@ -2,6 +2,7 @@
using Masuit.Tools; using Masuit.Tools;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
@ -43,7 +44,7 @@ namespace Khd.Core.Wpf.TaskForm
} }
else else
{ {
if (_isOut == 3||_isOut == 4) if (_isOut == 3 || _isOut == 4)
{ {
StationCode = this.endStationCode.SelectedItem.ToString(); StationCode = this.endStationCode.SelectedItem.ToString();
} }
@ -58,7 +59,7 @@ namespace Khd.Core.Wpf.TaskForm
} }
else else
{ {
baseEquip.endStationCode = this.endStationCode.SelectedItem.ToString(); baseEquip.endStationCode = new List<string> { this.endStationCode.SelectedItem.ToString() }.ToJsonString();
} }
baseEquip.ud3 = _ud3; baseEquip.ud3 = _ud3;
baseEquip.IsOut = _isOut; baseEquip.IsOut = _isOut;
@ -95,7 +96,7 @@ namespace Khd.Core.Wpf.TaskForm
List<string> endStationCodes = SystemData.BaseEquip.Where(t => t.equipType == 10).Select(t => t.agvPositionCode).ToList(); List<string> endStationCodes = SystemData.BaseEquip.Where(t => t.equipType == 10).Select(t => t.agvPositionCode).ToList();
if (_isOut == 4) if (_isOut == 4)
{ {
_endStationCodes= endStationCodes; _endStationCodes = endStationCodes;
this.endStationCode.ItemsSource = _endStationCodes; this.endStationCode.ItemsSource = _endStationCodes;
return; return;
} }

Loading…
Cancel
Save