change-优化人工叫料界面分页查询速度

master
liuwf 1 year ago
parent 822dda30d0
commit e232619343

@ -1616,10 +1616,11 @@
<TabItem x:Name="CallPersonManager" Header="人工叫料" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="100" Margin="5"> <TabItem x:Name="CallPersonManager" Header="人工叫料" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="100" Margin="5">
<Grid Height="1100" Width="1700"> <Grid Height="1100" Width="1700">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="auto"/> <RowDefinition Height="0.5*"/>
<RowDefinition Height="auto"/> <RowDefinition Height="0.8*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="auto"/> <RowDefinition Height="5*"/>
<RowDefinition Height="0.4*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border Background="#213269" BorderBrush="Silver" BorderThickness="2" CornerRadius="10" Margin="0,5,0,0"> <Border Background="#213269" BorderBrush="Silver" BorderThickness="2" CornerRadius="10" Margin="0,5,0,0">
@ -1671,6 +1672,7 @@
RowHeaderWidth="0" RowHeaderWidth="0"
SelectionMode="Single" FontSize="16" SelectionMode="Single" FontSize="16"
Visibility="Visible" Visibility="Visible"
VerticalAlignment="Top"
x:Name="PersonCallMaterial"> x:Name="PersonCallMaterial">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTemplateColumn Width="130*" Header="选择"> <DataGridTemplateColumn Width="130*" Header="选择">
@ -1809,7 +1811,9 @@
</Style> </Style>
</DataGrid.ColumnHeaderStyle> </DataGrid.ColumnHeaderStyle>
</DataGrid> </DataGrid>
<hc:Pagination x:Name="Pagination2" Grid.Row="3" Height="50" MaxWidth="1500" MaxPageCount="1" Margin="0,0,0,15" PageUpdated="Pagination2_PageUpdated" IsJumpEnabled="True" HorizontalAlignment="Center" Width="339" /> <StackPanel Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
<hc:Pagination x:Name="Pagination2" Visibility="Visible" Height="50" MaxPageCount="1" Margin="0,0,0,15" PageUpdated="Pagination2_PageUpdated" HorizontalAlignment="Center" Width="339" />
</StackPanel>
</Grid> </Grid>
</TabItem> </TabItem>
<TabItem Visibility="Collapsed" x:Name="InventoryManager" Header="盘库任务" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="100" Margin="5"> <TabItem Visibility="Collapsed" x:Name="InventoryManager" Header="盘库任务" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="100" Margin="5">
@ -2190,6 +2194,7 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border BorderBrush="White" BorderThickness="2" Grid.ColumnSpan="1" Grid.Column="5" Grid.RowSpan="2" Margin="20 0 0 0"> <Border BorderBrush="White" BorderThickness="2" Grid.ColumnSpan="1" Grid.Column="5" Grid.RowSpan="2" Margin="20 0 0 0">
<StackPanel Orientation="Vertical" > <StackPanel Orientation="Vertical" >
@ -2197,7 +2202,7 @@
<TextBlock x:Name="thisOutEndStation" Background="Transparent" Grid.ColumnSpan="2" Grid.RowSpan="2" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,20,0,0"/> <TextBlock x:Name="thisOutEndStation" Background="Transparent" Grid.ColumnSpan="2" Grid.RowSpan="2" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,20,0,0"/>
</StackPanel> </StackPanel>
</Border> </Border>
<Border BorderBrush="White" BorderThickness="2" Grid.Column="0" Grid.ColumnSpan="6" Grid.Row="5" Grid.RowSpan="2" Margin="20"> <Border BorderBrush="White" BorderThickness="2" Grid.Column="0" Grid.ColumnSpan="6" Grid.Row="6" Grid.RowSpan="2" Margin="20">
<DataGrid Background="Transparent" <DataGrid Background="Transparent"
@ -2311,20 +2316,20 @@
<Button Content="执行CTU出库任务" Visibility="Hidden" Grid.Row="1" Grid.Column="3" Grid.ColumnSpan="2" Width="500" Height="100" FontSize="50" Background="#346DFF" Foreground="White" Click="ExecuteCtuTask_Click"/> <Button Content="执行CTU出库任务" Visibility="Hidden" Grid.Row="1" Grid.Column="3" Grid.ColumnSpan="2" Width="500" Height="100" FontSize="50" Background="#346DFF" Foreground="White" Click="ExecuteCtuTask_Click"/>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="0" Grid.ColumnSpan="6"> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="0" Grid.ColumnSpan="6">
<TextBlock Text="扫描料箱号:" Width="350" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="60"/> <TextBlock Text="扫描料箱号:" Width="280" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50"/>
<Grid> <Grid>
<hc:TextBox hc:InfoElement.ShowClearButton="True" x:Name="txtOutBox" FontSize="50" TextChanged="txtOutBox_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="130" Grid.Row="2" Grid.Column="3" Grid.ColumnSpan="3" /> <hc:TextBox hc:InfoElement.ShowClearButton="True" x:Name="txtOutBox" FontSize="50" TextChanged="txtOutBox_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Grid.Row="2" Grid.Column="3" Grid.ColumnSpan="3" />
<Button Click="boxOutClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="0,0,0,0" Grid.Column="5" Grid.Row="2"> <Button Click="boxOutClear_Click" HorizontalAlignment="Right" Height="80" Panel.ZIndex="1" Width="100" Margin="0,0,0,0" Grid.Column="5" Grid.Row="2">
<Image Source="..\Resources\cancel.png"/> <Image Source="..\Resources\cancel.png"/>
</Button> </Button>
</Grid> </Grid>
</StackPanel> </StackPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="6"> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="6">
<TextBlock Text="扫描条码号:" Width="350" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="60"/> <TextBlock Text="扫描条码号:" Width="280" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50"/>
<Grid> <Grid>
<hc:TextBox hc:InfoElement.ShowClearButton="True" x:Name="txtOutBarCode" FontSize="50" TextChanged="txtOutBarCode_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="130" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="3"/> <hc:TextBox hc:InfoElement.ShowClearButton="True" x:Name="txtOutBarCode" FontSize="50" TextChanged="txtOutBarCode_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="3"/>
<Button Click="barOutClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="0,0,0,0" Grid.Column="5" Grid.Row="3"> <Button Click="barOutClear_Click" HorizontalAlignment="Right" Height="80" Panel.ZIndex="1" Width="100" Margin="0,0,0,0" Grid.Column="5" Grid.Row="3">
<Image Source="..\Resources\cancel.png"/> <Image Source="..\Resources\cancel.png"/>
</Button> </Button>
</Grid> </Grid>
@ -2332,29 +2337,44 @@
</StackPanel> </StackPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="2" Grid.ColumnSpan="6"> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="2" Grid.ColumnSpan="6">
<TextBlock Width="350" Text="物料名称:" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="60"/> <TextBlock Width="280" Text="物料名称:" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50"/>
<Grid> <Grid>
<hc:TextBox hc:InfoElement.ShowClearButton="True" IsReadOnly="True" x:Name="outMaterialNameTxt" FontSize="50" LostFocus="txtOutBox_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="130" Grid.Row="2" Grid.Column="3" Grid.ColumnSpan="3"/> <hc:TextBox hc:InfoElement.ShowClearButton="True" IsReadOnly="True" x:Name="outMaterialNameTxt" FontSize="50" LostFocus="txtOutBox_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Grid.Row="2" Grid.Column="3" Grid.ColumnSpan="3"/>
</Grid> </Grid>
<Button Content="选择出库" Background="#346DFF" Grid.ColumnSpan="6" Grid.Row="1" Foreground="White" FontSize="50" Margin="20,0,0,0" Height="100" Width="250" Click="SelectOutBtn_Click"/> <Button Content="选择出库" Background="#346DFF" Grid.ColumnSpan="6" Grid.Row="1" Foreground="White" FontSize="50" Margin="20,0,0,0" Height="100" Width="250" Click="SelectOutBtn_Click"/>
<Button Content="继续出库" Background="#346DFF" Grid.ColumnSpan="6" Grid.Row="1" Foreground="White" FontSize="50" Margin="20,0,0,0" Height="100" Width="250" Click="ContineOutBtn_Click"/> <Button Content="继续出库" Background="#346DFF" Grid.ColumnSpan="6" Grid.Row="1" Foreground="White" FontSize="50" Margin="20,0,0,0" Height="100" Width="250" Click="ContineOutBtn_Click"/>
</StackPanel> </StackPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="3" Grid.ColumnSpan="6"> <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="3" Grid.ColumnSpan="6">
<TextBlock Text="物料规格:" Width="350" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="60"/> <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="outMaterialSpecTxt" FontSize="50" LostFocus="txtOutBarCode_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="130" 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="5" 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="5" Grid.ColumnSpan="2" Width="400" Height="100" 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">
<TextBlock Text="出库数量:" Width="350" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="60"/> <TextBlock Text="库存:" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50"/>
<Grid> <Grid>
<hc:TextBox x:Name="txtOutScan" Margin="0,0,0,0" IsReadOnly="True" FontSize="50" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="130" Grid.Row="4" Grid.Column="3" Grid.ColumnSpan="3" KeyDown="OutEnter" /> <hc:TextBox x:Name="txtTotalAmount" Margin="0,0,0,0" IsReadOnly="True" FontSize="50" Width="300" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Grid.Row="4" Grid.Column="3" Grid.ColumnSpan="3" KeyDown="OutEnter" />
</Grid>
<TextBlock Text="出库数量:" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50" Margin="63 0 0 0"/>
<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" />
</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="100" Margin="100,0,0,0" FontSize="35" Background="#346DFF" Foreground="White" Click="btnBearConfirmBox_Click"/>
</StackPanel> </StackPanel>
<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"/>
<Grid>
<TextBlock x:Name="scanOutMsg" hc:InfoElement.ShowClearButton="True" FontSize="50" Width="1300" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="4"/>
</Grid>
</StackPanel>
</Grid> </Grid>
<!--<Border Background="#213269" BorderBrush="Silver" BorderThickness="2" CornerRadius="10" Width="900" Height="500" Margin="0,5,0,0"> <!--<Border Background="#213269" BorderBrush="Silver" BorderThickness="2" CornerRadius="10" Width="900" Height="500" Margin="0,5,0,0">
<StackPanel Margin="0,10,10,10"> <StackPanel Margin="0,10,10,10">

@ -20,6 +20,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Data; using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing.Printing;
using System.IO.Ports; using System.IO.Ports;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -926,7 +927,7 @@ namespace Khd.Core.Wpf.Form
} }
if (!string.IsNullOrEmpty(this.locationStatus.SelectedItem?.ToString())) if (!string.IsNullOrEmpty(this.locationStatus.SelectedItem?.ToString()))
{ {
if(this.locationStatus.SelectedItem is ComboBoxItem item&&!string.IsNullOrEmpty(item.Tag?.ToString())) if (this.locationStatus.SelectedItem is ComboBoxItem item && !string.IsNullOrEmpty(item.Tag?.ToString()))
{ {
sql += " and t1.location_status = " + item.Tag + ""; sql += " and t1.location_status = " + item.Tag + "";
} }
@ -2164,8 +2165,12 @@ namespace Khd.Core.Wpf.Form
{ {
string containerCode = txtOutBox.Text; string containerCode = txtOutBox.Text;
if (containerCode.Length < 15) if (containerCode.Length>=1 && containerCode.Length < 15)
{
scanOutMsg.Text = "";
return; return;
}
if (!string.IsNullOrEmpty(containerCode)) if (!string.IsNullOrEmpty(containerCode))
{ {
using var scope = _host.Services.CreateScope(); using var scope = _host.Services.CreateScope();
@ -2173,7 +2178,7 @@ namespace Khd.Core.Wpf.Form
var container = dbContext.WmsBaseLocation.FirstOrDefault(t => t.containerCode == containerCode && t.warehouseId == 512); var container = dbContext.WmsBaseLocation.FirstOrDefault(t => t.containerCode == containerCode && t.warehouseId == 512);
if (container == null) if (container == null)
{ {
MsgText.Text = $"未查询到该容器{txtOutBox.Text}!"; scanOutMsg.Text = $"未查询到该容器{txtOutBox.Text}!";
txtOutBox.Text = string.Empty; txtOutBox.Text = string.Empty;
txtOutBox.Focus(); txtOutBox.Focus();
} }
@ -2197,8 +2202,10 @@ namespace Khd.Core.Wpf.Form
{ {
try try
{ {
txtTotalAmount.Text = "";
outMaterialNameTxt.Text = ""; outMaterialNameTxt.Text = "";
outMaterialSpecTxt.Text = ""; outMaterialSpecTxt.Text = "";
txtOutScan.Text = "";
string barCode = txtOutBarCode.Text; string barCode = txtOutBarCode.Text;
string containerCode = txtOutBox.Text; string containerCode = txtOutBox.Text;
if (barCode.Length < 19) return; if (barCode.Length < 19) return;
@ -2211,7 +2218,7 @@ namespace Khd.Core.Wpf.Form
var wmsRawStock = dbContext.WmsRawStock.FirstOrDefault(t => t.instockBatch == barCode && t.palletInfoCode == containerCode); var wmsRawStock = dbContext.WmsRawStock.FirstOrDefault(t => t.instockBatch == barCode && t.palletInfoCode == containerCode);
if (wmsRawStock == null) if (wmsRawStock == null)
{ {
MsgText.Text = "未在该容器中查询到该条码!"; scanOutMsg.Text = "未在该容器中查询到该条码!";
txtOutBarCode.Text = string.Empty; txtOutBarCode.Text = string.Empty;
txtOutScan.Text = string.Empty; txtOutScan.Text = string.Empty;
txtOutBarCode.Focus(); txtOutBarCode.Focus();
@ -2221,7 +2228,7 @@ namespace Khd.Core.Wpf.Form
var mesBaseMaterialInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == wmsRawStock.instockBatch); var mesBaseMaterialInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == wmsRawStock.instockBatch);
if (mesBaseMaterialInfo == null) if (mesBaseMaterialInfo == null)
{ {
MsgText.Text = "未查询到该条码绑定的物料信息!"; scanOutMsg.Text = "未查询到该条码绑定的物料信息!";
txtOutBarCode.Text = string.Empty; txtOutBarCode.Text = string.Empty;
txtOutScan.Text = string.Empty; txtOutScan.Text = string.Empty;
txtOutBarCode.Focus(); txtOutBarCode.Focus();
@ -2236,15 +2243,17 @@ namespace Khd.Core.Wpf.Form
outMaterialNameTxt.Text = materialInfo.MaterialName; outMaterialNameTxt.Text = materialInfo.MaterialName;
outMaterialSpecTxt.Text = materialInfo.MaterialSpec; outMaterialSpecTxt.Text = materialInfo.MaterialSpec;
} }
txtOutScan.Text = (mesBaseMaterialInfo.batchFlag == "1" ? (wmsRawStock.totalAmount - wmsRawStock.frozenAmount) : 1).ToString(); txtTotalAmount.Text = string.Format("{0:0}", wmsRawStock.totalAmount - wmsRawStock.frozenAmount);
if (mesBaseMaterialInfo.batchFlag == "1") txtOutScan.Focus();
{ //txtOutScan.Text = string.Format("{0:0}", (mesBaseMaterialInfo.batchFlag == "1" ? (wmsRawStock.totalAmount - wmsRawStock.frozenAmount) : 1)) ;
txtOutScan.IsReadOnly = false; //if (mesBaseMaterialInfo.batchFlag == "1")
} //{
else // txtOutScan.IsReadOnly = false;
{ //}
txtOutScan.IsReadOnly = true; //else
} //{
// txtOutScan.IsReadOnly = true;
//}
} }
} }
} }
@ -2253,7 +2262,7 @@ namespace Khd.Core.Wpf.Form
{ {
if (!string.IsNullOrEmpty(barCode)) if (!string.IsNullOrEmpty(barCode))
{ {
MsgText.Text = "请先扫描容器号!"; scanOutMsg.Text = "请先扫描容器号!";
txtOutBarCode.Text = string.Empty; txtOutBarCode.Text = string.Empty;
txtOutScan.Text = string.Empty; txtOutScan.Text = string.Empty;
} }
@ -2286,19 +2295,19 @@ namespace Khd.Core.Wpf.Form
.FirstOrDefault(t => t.instockBatch == txtOutBarCode.Text && t.palletInfoCode == txtOutBox.Text); .FirstOrDefault(t => t.instockBatch == txtOutBarCode.Text && t.palletInfoCode == txtOutBox.Text);
if (wmsRawStock == null) if (wmsRawStock == null)
{ {
HandyControl.Controls.MessageBox.Error("库存已经被清空!"); scanOutMsg.Text = "库存已经被清空!";
return; return;
} }
decimal outScan = Convert.ToDecimal(this.txtOutScan.Text); decimal outScan = Convert.ToDecimal(this.txtOutScan.Text);
if (outScan != 1 && outScan > wmsRawStock.totalAmount - wmsRawStock.frozenAmount) if (outScan != 1 && outScan > wmsRawStock.totalAmount - wmsRawStock.frozenAmount)
{ {
HandyControl.Controls.MessageBox.Error("出库数量不能大于库存数量!"); scanOutMsg.Text = "出库数量不能大于库存数量!";
return; return;
} }
var wcsTask = dbContext.WcsTask.Where(t => t.containerNo == txtOutBox.Text).FirstOrDefault(); var wcsTask = dbContext.WcsTask.Where(t => t.containerNo == txtOutBox.Text).FirstOrDefault();
if (wcsTask == null) if (wcsTask == null)
{ {
HandyControl.Controls.MessageBox.Error("出库失败非CTU出库任务无法出库!"); scanOutMsg.Text = "出库失败非CTU出库任务无法出库!";
return; return;
} }
else else
@ -2317,7 +2326,7 @@ namespace Khd.Core.Wpf.Form
} }
else if (wmsRawOutstock.realOutstockAmount > wmsRawOutstock.outstockAmount) else if (wmsRawOutstock.realOutstockAmount > wmsRawOutstock.outstockAmount)
{ {
HandyControl.Controls.MessageBox.Error("出库数量不能大于申请单数量,当前出库数量为:" + (wmsRawOutstock.realOutstockAmount - outScan) + ",申请单数量为:" + wmsRawOutstock.outstockAmount + "!"); scanOutMsg.Text = "出库数量不能大于申请单数量,当前出库数量为:" + (wmsRawOutstock.realOutstockAmount - outScan) + ",申请单数量为:" + wmsRawOutstock.outstockAmount + "!";
return; return;
} }
wmsRawStock.totalAmount -= outScan; wmsRawStock.totalAmount -= outScan;
@ -2376,7 +2385,7 @@ namespace Khd.Core.Wpf.Form
} }
else else
{ {
HandyControl.Controls.MessageBox.Error("该条码的销售订单不正确"); scanOutMsg.Text = "该条码的销售订单不正确";
txtOutScan.Text = string.Empty; txtOutScan.Text = string.Empty;
txtOutBarCode.Text = string.Empty; txtOutBarCode.Text = string.Empty;
outMaterialSpecTxt.Text = string.Empty; outMaterialSpecTxt.Text = string.Empty;
@ -2387,7 +2396,7 @@ namespace Khd.Core.Wpf.Form
} }
} }
HandyControl.Controls.MessageBox.Success("出库成功!"); scanOutMsg.Text = "出库成功!";
txtOutScan.Text = string.Empty; txtOutScan.Text = string.Empty;
txtOutBarCode.Text = string.Empty; txtOutBarCode.Text = string.Empty;
outMaterialSpecTxt.Text = string.Empty; outMaterialSpecTxt.Text = string.Empty;
@ -2397,13 +2406,13 @@ namespace Khd.Core.Wpf.Form
} }
else else
{ {
HandyControl.Controls.MessageBox.Error("未查询到该条码信息!"); scanOutMsg.Text = "未查询到该条码信息!";
} }
} }
} }
else else
{ {
HandyControl.Controls.MessageBox.Info("请先扫描容器号和条码!"); scanOutMsg.Text = "请先扫描容器号和条码!";
} }
} }
catch (Exception ex) catch (Exception ex)
@ -2416,18 +2425,22 @@ namespace Khd.Core.Wpf.Form
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void SelectButton_Click(object sender, RoutedEventArgs e) private async void SelectButton_Click(object sender, RoutedEventArgs e)
{ {
CallSelectedItem.Clear(); CallSelectedItem.Clear();
GetPersonCallMaterialData(); await GetPersonCallMaterialData();
} }
/// <summary> /// <summary>
/// 获取人员呼叫的物料数据 /// 获取人员呼叫的物料数据
/// </summary> /// </summary>
private void GetPersonCallMaterialData() private async Task GetPersonCallMaterialData()
{ {
try try
{ {
int pageNumber = this.Pagination2.PageIndex;
// 计算跳过的记录数
int skip = (pageNumber - 1) * pageCount;
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>();
List<long?> materialIds = new List<long?>(); List<long?> materialIds = new List<long?>();
@ -2437,11 +2450,14 @@ namespace Khd.Core.Wpf.Form
materialInfos = dbContext.MesBaseMaterialInfo.Where(t => t.MaterialName.Contains(MaterialName.Text) || t.MaterialCode.Contains(MaterialName.Text) || t.MaterialSpec.Contains(MaterialName.Text)).ToList(); materialInfos = dbContext.MesBaseMaterialInfo.Where(t => t.MaterialName.Contains(MaterialName.Text) || t.MaterialCode.Contains(MaterialName.Text) || t.MaterialSpec.Contains(MaterialName.Text)).ToList();
materialIds = materialInfos.Select(t => t.MaterialId).ToList(); materialIds = materialInfos.Select(t => t.MaterialId).ToList();
} }
List<WmsRawStock> wmsRawStocks =null;
var wmsRawStocks = dbContext.WmsRawStock wmsRawStocks =dbContext.WmsRawStock
.Where(t => t.warehouseId == 512) .Where(t => t.warehouseId == 512)
.WhereIf(materialIds.Count > 0, t => materialIds.Contains(t.materialId)) .WhereIf(materialIds.Count>0,t => materialIds.Contains(t.materialId))
.ToList(); .ToList();
var groupWmsRawStock = wmsRawStocks.GroupBy(t => new { t.materialId, t.palletInfoCode }).Select(t => var groupWmsRawStock = wmsRawStocks.GroupBy(t => new { t.materialId, t.palletInfoCode }).Select(t =>
new new
{ {
@ -2450,6 +2466,10 @@ namespace Khd.Core.Wpf.Form
totalAmount = t.Sum(x => x.totalAmount), totalAmount = t.Sum(x => x.totalAmount),
frozenAmount = t.Sum(x => x.frozenAmount), frozenAmount = t.Sum(x => x.frozenAmount),
}); });
int totalRecords = groupWmsRawStock.Count();
Pagination2.MaxPageCount = (totalRecords / pageCount) + (totalRecords % pageCount == 0 ? 0 : 1);
groupWmsRawStock = groupWmsRawStock.Skip(skip).Take(pageCount);
//.GroupBy(t => t.palletInfoCode) //.GroupBy(t => t.palletInfoCode)
//.Select(t => new //.Select(t => new
//{ //{
@ -2458,14 +2478,15 @@ namespace Khd.Core.Wpf.Form
// frozenAmount = string.Join("\n", t.Select(x => x.frozenAmount)), // frozenAmount = string.Join("\n", t.Select(x => x.frozenAmount)),
// materialId = string.Join("\n", t.Select(x => x.materialId)), // materialId = string.Join("\n", t.Select(x => x.materialId)),
//}).ToList(); //}).ToList();
var palletInfoCodes = wmsRawStocks.Select(t => t.palletInfoCode).Distinct().ToList(); var palletInfoCodes = groupWmsRawStock.Select(t => t.palletInfoCode).Distinct().ToList();
var wmsBaseLocations = dbContext.WmsBaseLocation var wmsBaseLocations =await dbContext.WmsBaseLocation
.Where(t => t.ContainerStatus == "1") .Where(t => t.ContainerStatus == "1")
.Where(t => t.warehouseId == 512) .Where(t => t.warehouseId == 512)
.Where(t => palletInfoCodes.Contains(t.containerCode)).ToList(); .Where(t => palletInfoCodes.Contains(t.containerCode)).ToListAsync();
if (string.IsNullOrEmpty(MaterialName.Text)) if (string.IsNullOrEmpty(MaterialName.Text))
{ {
materialInfos = dbContext.MesBaseMaterialInfo.ToList(); var tempMaterialIds = groupWmsRawStock.Select(x=>x.materialId).Distinct().ToList();
materialInfos =await dbContext.MesBaseMaterialInfo.Where(x=> tempMaterialIds.Contains(x.MaterialId)).ToListAsync();
} }
var bill = from a in wmsBaseLocations var bill = from a in wmsBaseLocations
from b in groupWmsRawStock from b in groupWmsRawStock
@ -2486,6 +2507,9 @@ namespace Khd.Core.Wpf.Form
frozenAmount = b.frozenAmount, frozenAmount = b.frozenAmount,
IsSelected = CallSelectedItem.Contains(a.locationId) IsSelected = CallSelectedItem.Contains(a.locationId)
}; };
var bills = bill.GroupBy(t => new { t.baseLocationId, t.palletInfoCode, t.locationCode, t.IsSelected }) var bills = bill.GroupBy(t => new { t.baseLocationId, t.palletInfoCode, t.locationCode, t.IsSelected })
.Select(t => new .Select(t => new
{ {
@ -2503,9 +2527,11 @@ namespace Khd.Core.Wpf.Form
materialSpecSrc = string.Join("\n", t.Select(x => x.materialSpec)) materialSpecSrc = string.Join("\n", t.Select(x => x.materialSpec))
}).ToList(); }).ToList();
bills = bills.OrderBy(t => t.palletInfoCode).ThenBy(t => t.materialId).ToList(); bills = bills.OrderBy(t => t.palletInfoCode).ThenBy(t => t.materialId).ToList();
PersonCallMaterial.ItemsSource = bills.Skip((this.Pagination2.PageIndex - 1) * this.pageCount).Take(this.pageCount); // PersonCallMaterial.ItemsSource = bills.Skip((this.Pagination2.PageIndex - 1) * this.pageCount).Take(this.pageCount);
PersonCallMaterial.ItemsSource = bills;
int sum = bills.Count(); int sum = bills.Count();
Pagination2.MaxPageCount = (sum / pageCount) + (sum % pageCount == 0 ? 0 : 1); // Pagination2.MaxPageCount = (sum / pageCount) + (sum % pageCount == 0 ? 0 : 1);
if (bills.Count == 0) if (bills.Count == 0)
{ {
HandyControl.Controls.MessageBox.Show("未查询到数据"); HandyControl.Controls.MessageBox.Show("未查询到数据");
@ -2521,9 +2547,9 @@ namespace Khd.Core.Wpf.Form
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void Pagination2_PageUpdated(object sender, HandyControl.Data.FunctionEventArgs<int> e) private async void Pagination2_PageUpdated(object sender, HandyControl.Data.FunctionEventArgs<int> e)
{ {
GetPersonCallMaterialData(); await GetPersonCallMaterialData();
} }
/// <summary> /// <summary>
/// 页码改变时 /// 页码改变时
@ -2740,6 +2766,29 @@ namespace Khd.Core.Wpf.Form
// HandyControl.Controls.HandyControl.Controls.MessageBox.Show("当前CTU入库任务已满6个,请等待任务完成后再叫空箱!"); // HandyControl.Controls.HandyControl.Controls.MessageBox.Show("当前CTU入库任务已满6个,请等待任务完成后再叫空箱!");
// return; // return;
//} //}
#region 出库创建taskmanual如果有之前的出库任务 弹框提示有未完成的出库任务,是否继续出库,如果继续,删除之前的出库任务
var removeList = dbContext.WcsTask.Where(x => x.taskType == 30 && x.taskStatus == 6).ToList();
if (removeList.Count > 0)
{
StringBuilder stringContainers = new StringBuilder();
stringContainers.AppendLine("以下料箱有未完成的出库任务:");
removeList.ForEach(x => stringContainers.AppendLine($"料箱号{x.containerNo}\n"));
stringContainers.AppendLine("是否删除任务继续出库?");
MessageBoxResult isContinueCreateResult = HandyControl.Controls.MessageBox.Show(stringContainers.ToString(), "提示", MessageBoxButton.YesNo);
if (isContinueCreateResult == MessageBoxResult.Yes)
{
dbContext.WcsTask.RemoveRange(removeList);
}
else
{
return;
}
}
#endregion
var wmsBaseLocation = dbContext.WmsBaseLocation var wmsBaseLocation = dbContext.WmsBaseLocation
.Where(t => t.locationStatus == "1") .Where(t => t.locationStatus == "1")
.Where(t => t.warehouseId == 512 && t.ContainerStatus == "1") .Where(t => t.warehouseId == 512 && t.ContainerStatus == "1")
@ -2837,6 +2886,28 @@ namespace Khd.Core.Wpf.Form
MessageBoxResult MessageBoxResult = HandyControl.Controls.MessageBox.Show(stringBuilder.ToString(), "提示", MessageBoxButton.YesNo); MessageBoxResult MessageBoxResult = HandyControl.Controls.MessageBox.Show(stringBuilder.ToString(), "提示", MessageBoxButton.YesNo);
if (MessageBoxResult == MessageBoxResult.Yes) if (MessageBoxResult == MessageBoxResult.Yes)
{ {
#region 出库创建taskmanual如果有之前的出库任务 弹框提示有未完成的出库任务,是否继续出库,如果继续,删除之前的出库任务
var removeList = dbContext.WcsTask.Where(x => x.taskType == 30 && x.taskStatus == 6).ToList();
if (removeList.Count > 0)
{
StringBuilder stringContainers = new StringBuilder();
stringContainers.AppendLine("以下料箱有未完成的出库任务:");
removeList.ForEach(x => stringContainers.AppendLine($"料箱号{x.containerNo}\n"));
stringContainers.AppendLine("是否删除任务继续出库?");
MessageBoxResult isContinueCreateResult = HandyControl.Controls.MessageBox.Show(stringContainers.ToString(), "提示", MessageBoxButton.YesNo);
if (isContinueCreateResult == MessageBoxResult.Yes)
{
dbContext.WcsTask.RemoveRange(removeList);
}
else
{
return;
}
}
#endregion
List<WcsTaskManual> addList = new List<WcsTaskManual>(); List<WcsTaskManual> addList = new List<WcsTaskManual>();
foreach (var item in wmsBaseLocation) foreach (var item in wmsBaseLocation)
{ {
@ -4062,7 +4133,7 @@ namespace Khd.Core.Wpf.Form
#region 移库方法 #region 移库方法
private void rawSourceBox_TextChanged(object sender, RoutedEventArgs e) private void rawSourceBox_TextChanged(object sender, RoutedEventArgs e)
{ {
if (this.rawSourceBox.Text.Length >=1 && this.rawSourceBox.Text.Length < 15) if (this.rawSourceBox.Text.Length >= 1 && this.rawSourceBox.Text.Length < 15)
{ {
this.RemoveMsg.Text = ""; this.RemoveMsg.Text = "";
return; return;
@ -4111,7 +4182,7 @@ namespace Khd.Core.Wpf.Form
.FirstOrDefault(); .FirstOrDefault();
if (wmsRawStock == null) if (wmsRawStock == null)
{ {
RemoveMsg.Text = $"未在{this.rawSourceBox.Text}托盘中找到{barCode}条码!" ; RemoveMsg.Text = $"未在{this.rawSourceBox.Text}托盘中找到{barCode}条码!";
rawSourceBarCode.Text = string.Empty; rawSourceBarCode.Text = string.Empty;
rawSourceMaterialName.Text = ""; rawSourceMaterialName.Text = "";
rawSourceMaterialSpec.Text = ""; rawSourceMaterialSpec.Text = "";
@ -4252,14 +4323,14 @@ namespace Khd.Core.Wpf.Form
//1.先校验物料类型是否一致 //1.先校验物料类型是否一致
var rawBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == this.rawSourceBarCode.Text); var rawBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == this.rawSourceBarCode.Text);
var removeBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == this.removeSourceBarCode.Text); var removeBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == this.removeSourceBarCode.Text);
if(rawBarcodeInfo.materialId != removeBarcodeInfo.materialId) if (rawBarcodeInfo.materialId != removeBarcodeInfo.materialId)
{ {
this.RemoveMsg.Text = "两个条码物料类型不同,请更换目标条码!"; this.RemoveMsg.Text = "两个条码物料类型不同,请更换目标条码!";
return; return;
} }
//判断目标库位是否有该物料 //判断目标库位是否有该物料
WmsRawStock? targetStock = dbContext.WmsRawStock.Where(t => t.palletInfoCode == this.removeSourceBox.Text && t.materialId == rawBarcodeInfo.materialId).FirstOrDefault(); WmsRawStock? targetStock = dbContext.WmsRawStock.Where(t => t.palletInfoCode == this.removeSourceBox.Text && t.materialId == rawBarcodeInfo.materialId).FirstOrDefault();
if(targetStock == null || (targetStock != null && removeBarcodeInfo.batchFlag == "0")) if (targetStock == null || (targetStock != null && removeBarcodeInfo.batchFlag == "0"))
{ {
// 更新 WmsRawStock 中的记录 // 更新 WmsRawStock 中的记录
dbContext.WmsRawStock dbContext.WmsRawStock

Loading…
Cancel
Save