master
1 year ago
commit 6830422286

@ -100,5 +100,17 @@ namespace Khd.Core.Api.Controllers
LogManager.Info($"AGVStopOrStart 接口收到消息: {agvStopOrStart.ToJsonString()}");
return _application.CallAgvStopOrStart(agvStopOrStart);
}
/// <summary>
/// 取消CTU预调度接口WPF界面使用
/// </summary>
/// <returns></returns>
[HttpPost("CancelPreScheduling")]
public ReponseMessage CancelPreScheduling()
{
LogManager.Info($"CancelPreScheduling 接口收到消息");
return _application.CancelPreScheduling();
}
}
}

@ -33,5 +33,8 @@ namespace Khd.Core.Application.Interface
ReponseMessage CallMaterial(CallMaterial callMaterial);
ReponseMessage AGVTaskComplete();
ReponseMessage CallAgvStopOrStart(CallAgvStopOrStart agvStopOrStart);
ReponseMessage CancelPreScheduling();
}
}

@ -479,5 +479,33 @@ namespace Khd.Core.Application
return new ReponseMessage() { code = "1", message = "调用失败" };
}
}
/// <summary>
/// 取消预调度
/// </summary>
/// <returns></returns>
public ReponseMessage CancelPreScheduling()
{
try
{
_dbContext.ChangeTracker.Entries().ToList().ForEach(e => e.Reload());
var baseEquip = _dbContext.BaseEquip.FirstOrDefault(x => x.objid == 11);
var executeTask = new
{
reqCode = new JcSnowId().NextId().ToString(),
positionCode = "CTU_IN",
nextTask = -1
};
string executeMessage = JsonConvert.SerializeObject(executeTask);
string executeResult = HttpHelper.SendPostMessage(baseEquip.serverIp, baseEquip.serverPort.Value, "rcms/services/rest/hikRpcService/genPreScheduleTask", executeMessage);
ReponseMessage reponseMessage = JsonConvert.DeserializeObject<ReponseMessage>(executeResult);
return reponseMessage;
}catch (Exception ex)
{
return new ReponseMessage() { code = "1", message = "调用失败" };
}
}
}
}

@ -21,6 +21,7 @@ namespace Khd.Core.Domain.Models
public long? saleOrderId { get; set; }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("raw_outstock_id")]
public long? rawOutstockId { get; set; }

@ -20,6 +20,7 @@ namespace Khd.Core.Wcs.Wcs
/// </summary>
public class FiveFloorCTU
{
List<BasePlcpoint> ScanPoint { get; set; }//点位信息
private readonly IHost _host;
private readonly LoggerUtils _logger = new LoggerUtils();
private readonly BasePlcpoint LineRFID;
@ -150,10 +151,13 @@ namespace Khd.Core.Wcs.Wcs
{
if (task.taskType == StaticTaskType.FiveAccessoryOut || task.taskType == StaticTaskType.FiveAccessoryRemove)
{
//dbContext.WcsTask.Where(t => t.objid == task.objid).Delete();
#region 如果已经开始入库,还有出库任务,删除出库任务
List<WcsTask> outTasks = dbContext.WcsTask.Where(t => t.taskType == StaticTaskType.FiveAccessoryOut && t.taskStatus == 6).ToList();
dbContext.RemoveRange(outTasks);
dbContext.WcsTask.Where(t => t.objid == task.objid).Delete();
#region 暂不使用-因为删除之后ctu无法知道还有几个箱子///如果已经开始入库,还有出库任务,删除出库任务
//List<WcsTask> outTasks = dbContext.WcsTask.Where(t => t.taskType == StaticTaskType.FiveAccessoryOut && t.taskStatus == 6).ToList();
//if(outTasks!=null && outTasks.Count > 0)
//{
// dbContext.RemoveRange(outTasks);
//}
#endregion
//根据rfid找到库位
//生成入库任务

@ -1058,7 +1058,7 @@
MinWidth="10"
Header=" 序号"
IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock
@ -1131,7 +1131,7 @@
FontSize="20"
Header="楼层"
IsReadOnly="True" />
<!--<DataGridTextColumn
Width="180*"
Binding="{Binding totalAmount}"
@ -1616,11 +1616,12 @@
<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.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.8*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="0.4*"/>
</Grid.RowDefinitions>
<Border Background="#213269" BorderBrush="Silver" BorderThickness="2" CornerRadius="10" Margin="0,5,0,0">
<StackPanel Orientation="Horizontal">
@ -1671,6 +1672,7 @@
RowHeaderWidth="0"
SelectionMode="Single" FontSize="16"
Visibility="Visible"
VerticalAlignment="Top"
x:Name="PersonCallMaterial">
<DataGrid.Columns>
<DataGridTemplateColumn Width="130*" Header="选择">
@ -1809,7 +1811,9 @@
</Style>
</DataGrid.ColumnHeaderStyle>
</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>
</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">
@ -1994,31 +1998,32 @@
<RowDefinition Height="167*"/>
</Grid.RowDefinitions>
<TextBlock Text="扫描入库" FontSize="50" Grid.ColumnSpan="6" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="扫描料箱号:" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="扫描条码号:" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="物料名称:" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="物料规格:" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="入库数量:" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<hc:TextBox x:Name="txtInBox" hc:InfoElement.ShowClearButton="True" FontSize="50" LostFocus="txtInBox_TextChanged" TextChanged="txtInBox_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="1" Grid.Column="3" Grid.ColumnSpan="3"/>
<TextBlock Text="扫描料箱号:" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="扫描条码号:" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="物料名称:" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="物料规格:" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="入库数量:" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<hc:TextBox x:Name="txtInBox" hc:InfoElement.ShowClearButton="True" FontSize="50" LostFocus="txtInBox_TextChanged" TextChanged="txtInBox_TextChanged" Width="900" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="4"/>
<Button Click="barClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="0,0,130,0" Grid.Column="5" Grid.Row="2">
<Image Source="..\Resources\cancel.png"/>
</Button>
<Button Click="boxClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="0,0,130,0" Grid.Column="5" Grid.Row="1">
<Image Source="..\Resources\cancel.png"/>
</Button>
<hc:TextBox x:Name="txtInBarCode" hc:InfoElement.ShowClearButton="True" FontSize="50" LostFocus="txtInBarCode_TextChanged" TextChanged="txtInBarCode_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="2" Grid.Column="3" Grid.ColumnSpan="3"/>
<hc:TextBox x:Name="materialName" IsReadOnly="True" hc:InfoElement.ShowClearButton="True" FontSize="50" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="3"/>
<hc:TextBox x:Name="materialSpec" IsReadOnly="True" hc:InfoElement.ShowClearButton="True" FontSize="50" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="4" Grid.Column="3" Grid.ColumnSpan="3"/>
<hc:TextBox x:Name="txtInScan" FontSize="50" IsReadOnly="True" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="5" Grid.Column="3" Grid.ColumnSpan="3" KeyDown="ScanInKeyDown" />
<hc:TextBox x:Name="txtInBarCode" hc:InfoElement.ShowClearButton="True" FontSize="50" LostFocus="txtInBarCode_TextChanged" TextChanged="txtInBarCode_TextChanged" Width="900" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="4"/>
<hc:TextBox x:Name="materialName" IsReadOnly="True" hc:InfoElement.ShowClearButton="True" FontSize="50" Width="900" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="3"/>
<hc:TextBox x:Name="materialSpec" IsReadOnly="True" hc:InfoElement.ShowClearButton="True" FontSize="50" Width="900" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="3"/>
<hc:TextBox x:Name="txtInScan" FontSize="50" IsReadOnly="True" Width="900" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="3" KeyDown="ScanInKeyDown" />
<Button Content="确认入库" Grid.Row="6" Grid.ColumnSpan="6" Width="300" Height="100" FontSize="50" Background="#346DFF" Foreground="White" Click="InRawBaseLocaltion_Click"/>
<Button Content="一键收料" Grid.Row="7" Grid.ColumnSpan="6" Width="300" Height="100" FontSize="50" Background="#346DFF" Foreground="White" Click="callPlc_Click" HorizontalAlignment="Right"/>
<Button Content="取消预调度" x:Name="CancelPreScheduling" Grid.Row="6" Grid.ColumnSpan="2" Width="328" Height="100" FontSize="50" Background="#346DFF" Foreground="White" HorizontalAlignment="Left" Grid.Column="4" Margin="222,0,0,0" Click="CancelPreScheduling_Click"/>
<Button Content="一键收料" Grid.Row="7" Grid.ColumnSpan="2" Width="328" Height="100" FontSize="50" Background="#346DFF" Foreground="White" Click="callPlc_Click" HorizontalAlignment="Left" Grid.Column="4" Margin="222,0,0,0"/>
<TextBlock Grid.Row="7" Text="提示信息:" HorizontalAlignment="Center" Grid.Column="1" Grid.ColumnSpan="1" Width="250" Height="100" FontSize="50" Foreground="White" />
<TextBlock x:Name="MsgText" Grid.Row="7" FontSize="50" Grid.ColumnSpan="5" Width="800" Height="100" Foreground="White" HorizontalAlignment="Right" />
<Button Content="执行CTU入库任务" Visibility="Hidden" Click="btnCtuInConfirmBox_Click" Grid.Row="5" Grid.ColumnSpan="6" Width="500" Height="100" FontSize="50" Background="#346DFF" Foreground="White"/>
</Grid>
</StackPanel>
</StackPanel>
</StackPanel>
</TabItem>
<TabItem x:Name="ScanReturnManager" Header="扫描退库" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="100" Margin="5">
@ -2190,6 +2195,7 @@
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border BorderBrush="White" BorderThickness="2" Grid.ColumnSpan="1" Grid.Column="5" Grid.RowSpan="2" Margin="20 0 0 0">
<StackPanel Orientation="Vertical" >
@ -2197,9 +2203,9 @@
<TextBlock x:Name="thisOutEndStation" Background="Transparent" Grid.ColumnSpan="2" Grid.RowSpan="2" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,20,0,0"/>
</StackPanel>
</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"
CanUserAddRows="False"
AutoGenerateColumns="False"
@ -2229,7 +2235,7 @@
ElementStyle="{StaticResource dgCell}"
Width="2*"
/>-->
<DataGridTextColumn
Header="申请数量"
Binding="{Binding outstockAmount}"
@ -2249,7 +2255,7 @@
Width="*"
ElementStyle="{StaticResource dgCell}"
/>
<!--<DataGridTextColumn
Header="箱体携带数量"
Binding="{Binding thisOutAmount}"
@ -2309,52 +2315,67 @@
<TextBlock Text="待执行CTU任务数:" Visibility="Hidden" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="50"/>
<TextBlock x:Name="outTaskCount" Visibility="Hidden" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<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">
<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>
<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" />
<Button Click="boxOutClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="0,0,0,0" Grid.Column="5" Grid.Row="2">
<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="80" Panel.ZIndex="1" Width="100" Margin="0,0,0,0" Grid.Column="5" Grid.Row="2">
<Image Source="..\Resources\cancel.png"/>
</Button>
</Grid>
</StackPanel>
<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>
<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"/>
<Button Click="barOutClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="0,0,0,0" Grid.Column="5" Grid.Row="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="80" Panel.ZIndex="1" Width="100" Margin="0,0,0,0" Grid.Column="5" Grid.Row="3">
<Image Source="..\Resources\cancel.png"/>
</Button>
</Grid>
</StackPanel>
<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>
<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>
<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"/>
</StackPanel>
<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>
<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>
<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 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>
<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>
<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 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>
<!--<Border Background="#213269" BorderBrush="Silver" BorderThickness="2" CornerRadius="10" Width="900" Height="500" Margin="0,5,0,0">
<StackPanel Margin="0,10,10,10">
@ -2472,7 +2493,7 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="辅料移库" FontSize="50" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="0" Grid.ColumnSpan="4"/>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="原料箱号:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<hc:TextBox x:Name="rawSourceBox" TextChanged="rawSourceBox_TextChanged" FontSize="40" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
@ -2487,7 +2508,7 @@
<Image Source="..\Resources\cancel.png"/>
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="移库料箱:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:TextBox x:Name="removeSourceBox" FontSize="40" TextChanged="removeSourceBox_TextChanged" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
@ -2495,7 +2516,7 @@
<Image Source="..\Resources\cancel.png"/>
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="移库条码:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
@ -2519,17 +2540,17 @@
<hc:TextBox x:Name="removeSourceMaterialName" FontSize="40" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="物料规格:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:TextBox x:Name="removeSourceMaterialSpec" FontSize="40" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="移库数量:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:TextBox x:Name="removeScan" FontSize="40" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
</StackPanel>
<Button Content="确认移库" Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="4" Width="500" Height="150" FontSize="75" Background="#346DFF" Foreground="White" Click="btnRemoveConfirmBox_Click"/>

@ -1,6 +1,7 @@
using HandyControl.Tools.Extension;
using Jc.SnowId;
using Khd.Core.Domain.Auth;
using Khd.Core.Domain.Dto.webapi;
using Khd.Core.Domain.Models;
using Khd.Core.EntityFramework;
using Khd.Core.Library.Mapper;
@ -15,11 +16,13 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Diagnostics;
using System.Drawing.Printing;
using System.IO.Ports;
using System.Linq;
using System.Text;
@ -116,6 +119,8 @@ namespace Khd.Core.Wpf.Form
/// <param name="e"></param>
private void FormBoard_Loaded(object sender, RoutedEventArgs e)
{
try
{
itemsControlItems = new ObservableCollection<SelectItemModel>();
@ -128,14 +133,14 @@ namespace Khd.Core.Wpf.Form
{
Plc.S7.Plc plc;
plc = new Plc.S7.Plc(plcConfig.CpuType, plcConfig.IP, plcConfig.Port, plcConfig.Rack, plcConfig.Slot);
//try
//{
// plc.Open();
//}
//catch (Exception ex)
//{
// LogManager.Error(ex);
//}
try
{
plc.Open();
}
catch (Exception ex)
{
LogManager.Error(ex);
}
SystemData.PlcDic.TryAdd(plcConfig.Code, plc);
}
};
@ -926,7 +931,7 @@ namespace Khd.Core.Wpf.Form
}
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 + "";
}
@ -1804,6 +1809,25 @@ namespace Khd.Core.Wpf.Form
WmsRawStock wmsRawStock = wmsRawStocks.First();
wmsRawStock.totalAmount += amount;
dbContext.WmsRawStock.Update(wmsRawStock);
var mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == txtInBarCode.Text);
WmsRawInstock wmsRawInstock = new WmsRawInstock()
{
beginTime = System.DateTime.Now,
endTime = DateTime.Now,
locationCode = container.locationCode,
executeStatus = "2",
instockAmount = amount,
instockType = "1",
materialBatchCode = txtInBarCode.Text,
materialId = material.materialId,
operationType = "2",
palletInfoCode = container.containerCode,
poNo = mesBaseBarcodeInfo.poNo,
warehouseId = 512
};
dbContext.WmsRawInstock.Add(wmsRawInstock);
dbContext.SaveChanges();
totalMessage = wmsRawStock.totalAmount;
}
@ -1833,6 +1857,24 @@ namespace Khd.Core.Wpf.Form
safeFlag = material.safeFlag
};
dbContext.WmsRawStock.Add(newRawStock);
var mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == txtInBarCode.Text);
WmsRawInstock wmsRawInstock = new WmsRawInstock()
{
beginTime = System.DateTime.Now,
endTime = DateTime.Now,
locationCode = container.locationCode,
executeStatus = "2",
instockAmount = amount,
instockType = "1",
materialBatchCode = txtInBarCode.Text,
materialId = material.materialId,
operationType = "2",
palletInfoCode = container.containerCode,
poNo = mesBaseBarcodeInfo.poNo,
warehouseId = 512
};
dbContext.WmsRawInstock.Add(wmsRawInstock);
dbContext.SaveChanges();
totalMessage = newRawStock.totalAmount;
}
@ -2164,8 +2206,12 @@ namespace Khd.Core.Wpf.Form
{
string containerCode = txtOutBox.Text;
if (containerCode.Length < 15)
if (containerCode.Length >= 1 && containerCode.Length < 15)
{
scanOutMsg.Text = "";
return;
}
if (!string.IsNullOrEmpty(containerCode))
{
using var scope = _host.Services.CreateScope();
@ -2173,7 +2219,7 @@ namespace Khd.Core.Wpf.Form
var container = dbContext.WmsBaseLocation.FirstOrDefault(t => t.containerCode == containerCode && t.warehouseId == 512);
if (container == null)
{
MsgText.Text = $"未查询到该容器{txtOutBox.Text}!";
scanOutMsg.Text = $"未查询到该容器{txtOutBox.Text}!";
txtOutBox.Text = string.Empty;
txtOutBox.Focus();
}
@ -2197,8 +2243,10 @@ namespace Khd.Core.Wpf.Form
{
try
{
txtTotalAmount.Text = "";
outMaterialNameTxt.Text = "";
outMaterialSpecTxt.Text = "";
txtOutScan.Text = "";
string barCode = txtOutBarCode.Text;
string containerCode = txtOutBox.Text;
if (barCode.Length < 19) return;
@ -2211,7 +2259,7 @@ namespace Khd.Core.Wpf.Form
var wmsRawStock = dbContext.WmsRawStock.FirstOrDefault(t => t.instockBatch == barCode && t.palletInfoCode == containerCode);
if (wmsRawStock == null)
{
MsgText.Text = "未在该容器中查询到该条码!";
scanOutMsg.Text = "未在该容器中查询到该条码!";
txtOutBarCode.Text = string.Empty;
txtOutScan.Text = string.Empty;
txtOutBarCode.Focus();
@ -2221,7 +2269,7 @@ namespace Khd.Core.Wpf.Form
var mesBaseMaterialInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == wmsRawStock.instockBatch);
if (mesBaseMaterialInfo == null)
{
MsgText.Text = "未查询到该条码绑定的物料信息!";
scanOutMsg.Text = "未查询到该条码绑定的物料信息!";
txtOutBarCode.Text = string.Empty;
txtOutScan.Text = string.Empty;
txtOutBarCode.Focus();
@ -2236,15 +2284,17 @@ namespace Khd.Core.Wpf.Form
outMaterialNameTxt.Text = materialInfo.MaterialName;
outMaterialSpecTxt.Text = materialInfo.MaterialSpec;
}
txtOutScan.Text = (mesBaseMaterialInfo.batchFlag == "1" ? (wmsRawStock.totalAmount - wmsRawStock.frozenAmount) : 1).ToString();
if (mesBaseMaterialInfo.batchFlag == "1")
{
txtOutScan.IsReadOnly = false;
}
else
{
txtOutScan.IsReadOnly = true;
}
txtTotalAmount.Text = string.Format("{0:0}", wmsRawStock.totalAmount - wmsRawStock.frozenAmount);
txtOutScan.Focus();
//txtOutScan.Text = string.Format("{0:0}", (mesBaseMaterialInfo.batchFlag == "1" ? (wmsRawStock.totalAmount - wmsRawStock.frozenAmount) : 1)) ;
//if (mesBaseMaterialInfo.batchFlag == "1")
//{
// txtOutScan.IsReadOnly = false;
//}
//else
//{
// txtOutScan.IsReadOnly = true;
//}
}
}
}
@ -2253,7 +2303,7 @@ namespace Khd.Core.Wpf.Form
{
if (!string.IsNullOrEmpty(barCode))
{
MsgText.Text = "请先扫描容器号!";
scanOutMsg.Text = "请先扫描容器号!";
txtOutBarCode.Text = string.Empty;
txtOutScan.Text = string.Empty;
}
@ -2286,19 +2336,19 @@ namespace Khd.Core.Wpf.Form
.FirstOrDefault(t => t.instockBatch == txtOutBarCode.Text && t.palletInfoCode == txtOutBox.Text);
if (wmsRawStock == null)
{
HandyControl.Controls.MessageBox.Error("库存已经被清空!");
scanOutMsg.Text = "库存已经被清空!";
return;
}
decimal outScan = Convert.ToDecimal(this.txtOutScan.Text);
if (outScan != 1 && outScan > wmsRawStock.totalAmount - wmsRawStock.frozenAmount)
{
HandyControl.Controls.MessageBox.Error("出库数量不能大于库存数量!");
scanOutMsg.Text = "出库数量不能大于库存数量!";
return;
}
var wcsTask = dbContext.WcsTask.Where(t => t.containerNo == txtOutBox.Text).FirstOrDefault();
if (wcsTask == null)
{
HandyControl.Controls.MessageBox.Error("出库失败非CTU出库任务无法出库!");
scanOutMsg.Text = "出库失败非CTU出库任务无法出库!";
return;
}
else
@ -2317,7 +2367,7 @@ namespace Khd.Core.Wpf.Form
}
else if (wmsRawOutstock.realOutstockAmount > wmsRawOutstock.outstockAmount)
{
HandyControl.Controls.MessageBox.Error("出库数量不能大于申请单数量,当前出库数量为:" + (wmsRawOutstock.realOutstockAmount - outScan) + ",申请单数量为:" + wmsRawOutstock.outstockAmount + "!");
scanOutMsg.Text = "出库数量不能大于申请单数量,当前出库数量为:" + (wmsRawOutstock.realOutstockAmount - outScan) + ",申请单数量为:" + wmsRawOutstock.outstockAmount + "!";
return;
}
wmsRawStock.totalAmount -= outScan;
@ -2366,17 +2416,68 @@ namespace Khd.Core.Wpf.Form
if (wmsRawStock.totalAmount == 0)
{
dbContext.WmsRawStock.Remove(wmsRawStock);
dbContext.SaveChanges();
}
else
{
dbContext.WmsRawStock.Update(wmsRawStock);
dbContext.SaveChanges();
}
#region 插入rawOutstock
string timeStamp = DateTime.Now.ToString("yyyyMMddHHmmss");
WmsRawOutstock newWmsRawOutstock = new WmsRawOutstock();
newWmsRawOutstock.taskCode = timeStamp + "CTU" + Random.Shared.Next(10, 99);
newWmsRawOutstock.warehouseId = 512;
newWmsRawOutstock.locationCode = wcsTask.currPointNo;
newWmsRawOutstock.stationId = 512;
newWmsRawOutstock.materialId = mesBaseBarcodeInfo.materialId;
newWmsRawOutstock.materialBatch = mesBaseBarcodeInfo.barcodeInfo;
newWmsRawOutstock.palletInfoCode = wcsTask.containerNo;
newWmsRawOutstock.outstockAmount = outScan;
newWmsRawOutstock.realOutstockAmount = outScan;
newWmsRawOutstock.operationType = "1";
newWmsRawOutstock.taskType = "1";
newWmsRawOutstock.auditStatus = "1";
newWmsRawOutstock.applyBy = "CtuGun";
newWmsRawOutstock.executeStatus = "2";
newWmsRawOutstock.saleOrderId = mesBaseBarcodeInfo.saleOrderId;
newWmsRawOutstock.updateDate = DateTime.Now;
newWmsRawOutstock.beginTime = DateTime.Now;
newWmsRawOutstock.endTime = DateTime.Now;
dbContext.WmsRawOutstock.Add(newWmsRawOutstock);
dbContext.SaveChanges();
#endregion
//if (mesBaseBarcodeInfo != null)
//{
// WmsRawOutstockDetail wmsProductOutstockDetail = new WmsRawOutstockDetail()
// {
// rawOutstockDetailId = Global.SnowId.NextId(),
// rawOutstockId = 0,
// materialId = mesBaseBarcodeInfo.materialId,
// createDate = DateTime.Now,
// createBy = "WCS",
// taskCode = wcsTask.objid.ToString(),
// executeStatus = "2",
// locationCode = wcsTask.currPointNo,
// outstockAmount = outScan,
// planAmount = outScan,
// warehouseId = 512,
// materialBarcode = mesBaseBarcodeInfo.barcodeInfo,
// instockBatch = mesBaseBarcodeInfo.batchCode,
// stackAmount = outScan,
// outstockPerson = "WCS",
// outstockTime = DateTime.Now,
// outstockWay = "2",
// materialProductionDate = mesBaseBarcodeInfo.productionDate
// };
// dbContext.WmsRawOutstockDetail.Add(wmsProductOutstockDetail);
//}
// dbContext.SaveChanges();
}
else
{
HandyControl.Controls.MessageBox.Error("该条码的销售订单不正确");
scanOutMsg.Text = "该条码的销售订单不正确";
txtOutScan.Text = string.Empty;
txtOutBarCode.Text = string.Empty;
outMaterialSpecTxt.Text = string.Empty;
@ -2387,7 +2488,7 @@ namespace Khd.Core.Wpf.Form
}
}
HandyControl.Controls.MessageBox.Success("出库成功!");
scanOutMsg.Text = "出库成功!";
txtOutScan.Text = string.Empty;
txtOutBarCode.Text = string.Empty;
outMaterialSpecTxt.Text = string.Empty;
@ -2397,13 +2498,13 @@ namespace Khd.Core.Wpf.Form
}
else
{
HandyControl.Controls.MessageBox.Error("未查询到该条码信息!");
scanOutMsg.Text = "未查询到该条码信息!";
}
}
}
else
{
HandyControl.Controls.MessageBox.Info("请先扫描容器号和条码!");
scanOutMsg.Text = "请先扫描容器号和条码!";
}
}
catch (Exception ex)
@ -2416,18 +2517,22 @@ namespace Khd.Core.Wpf.Form
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SelectButton_Click(object sender, RoutedEventArgs e)
private async void SelectButton_Click(object sender, RoutedEventArgs e)
{
CallSelectedItem.Clear();
GetPersonCallMaterialData();
await GetPersonCallMaterialData();
}
/// <summary>
/// 获取人员呼叫的物料数据
/// </summary>
private void GetPersonCallMaterialData()
private async Task GetPersonCallMaterialData()
{
try
{
int pageNumber = this.Pagination2.PageIndex;
// 计算跳过的记录数
int skip = (pageNumber - 1) * pageCount;
using var scope = _host.Services.CreateScope();
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
List<long?> materialIds = new List<long?>();
@ -2437,11 +2542,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();
materialIds = materialInfos.Select(t => t.MaterialId).ToList();
}
List<WmsRawStock> wmsRawStocks = null;
wmsRawStocks = dbContext.WmsRawStock
.Where(t => t.warehouseId == 512)
.WhereIf(materialIds.Count > 0, t => materialIds.Contains(t.materialId))
.ToList();
var wmsRawStocks = dbContext.WmsRawStock
.Where(t => t.warehouseId == 512)
.WhereIf(materialIds.Count > 0, t => materialIds.Contains(t.materialId))
.ToList();
var groupWmsRawStock = wmsRawStocks.GroupBy(t => new { t.materialId, t.palletInfoCode }).Select(t =>
new
{
@ -2450,6 +2558,10 @@ namespace Khd.Core.Wpf.Form
totalAmount = t.Sum(x => x.totalAmount),
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)
//.Select(t => new
//{
@ -2458,14 +2570,15 @@ namespace Khd.Core.Wpf.Form
// frozenAmount = string.Join("\n", t.Select(x => x.frozenAmount)),
// materialId = string.Join("\n", t.Select(x => x.materialId)),
//}).ToList();
var palletInfoCodes = wmsRawStocks.Select(t => t.palletInfoCode).Distinct().ToList();
var wmsBaseLocations = dbContext.WmsBaseLocation
var palletInfoCodes = groupWmsRawStock.Select(t => t.palletInfoCode).Distinct().ToList();
var wmsBaseLocations = await dbContext.WmsBaseLocation
.Where(t => t.ContainerStatus == "1")
.Where(t => t.warehouseId == 512)
.Where(t => palletInfoCodes.Contains(t.containerCode)).ToList();
.Where(t => palletInfoCodes.Contains(t.containerCode)).ToListAsync();
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
from b in groupWmsRawStock
@ -2486,6 +2599,9 @@ namespace Khd.Core.Wpf.Form
frozenAmount = b.frozenAmount,
IsSelected = CallSelectedItem.Contains(a.locationId)
};
var bills = bill.GroupBy(t => new { t.baseLocationId, t.palletInfoCode, t.locationCode, t.IsSelected })
.Select(t => new
{
@ -2503,9 +2619,11 @@ namespace Khd.Core.Wpf.Form
materialSpecSrc = string.Join("\n", t.Select(x => x.materialSpec))
}).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();
Pagination2.MaxPageCount = (sum / pageCount) + (sum % pageCount == 0 ? 0 : 1);
// Pagination2.MaxPageCount = (sum / pageCount) + (sum % pageCount == 0 ? 0 : 1);
if (bills.Count == 0)
{
HandyControl.Controls.MessageBox.Show("未查询到数据");
@ -2521,9 +2639,9 @@ namespace Khd.Core.Wpf.Form
/// </summary>
/// <param name="sender"></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>
/// 页码改变时
@ -2740,6 +2858,29 @@ namespace Khd.Core.Wpf.Form
// HandyControl.Controls.HandyControl.Controls.MessageBox.Show("当前CTU入库任务已满6个,请等待任务完成后再叫空箱!");
// 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
.Where(t => t.locationStatus == "1")
.Where(t => t.warehouseId == 512 && t.ContainerStatus == "1")
@ -2837,6 +2978,28 @@ namespace Khd.Core.Wpf.Form
MessageBoxResult MessageBoxResult = HandyControl.Controls.MessageBox.Show(stringBuilder.ToString(), "提示", MessageBoxButton.YesNo);
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>();
foreach (var item in wmsBaseLocation)
{
@ -4062,7 +4225,7 @@ namespace Khd.Core.Wpf.Form
#region 移库方法
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 = "";
return;
@ -4074,7 +4237,7 @@ namespace Khd.Core.Wpf.Form
//WcsTask? wcsTask = dbContext.WcsTask.Where(t => t.containerNo == this.rawSourceBox.Text).FirstOrDefault();
//if (wcsTask == null)
//{
// this.RemoveMsg.Text = $"未找到该托盘{this.rawSourceBox.Text}的移库任务!";
// this.rawSourceBox.Text = "";
// return;
@ -4111,13 +4274,13 @@ namespace Khd.Core.Wpf.Form
.FirstOrDefault();
if (wmsRawStock == null)
{
RemoveMsg.Text = $"未在{this.rawSourceBox.Text}托盘中找到{barCode}条码!" ;
RemoveMsg.Text = $"未在{this.rawSourceBox.Text}托盘中找到{barCode}条码!";
rawSourceBarCode.Text = string.Empty;
rawSourceMaterialName.Text = "";
rawSourceMaterialSpec.Text = "";
return;
}
var material = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == barCode);
if (material == null)
{
@ -4158,7 +4321,7 @@ namespace Khd.Core.Wpf.Form
{
removeSourceBarCode.Focus();
}
}
@ -4206,7 +4369,7 @@ namespace Khd.Core.Wpf.Form
{
removeSourceMaterialName.Text = mesBaseMaterialInfo.MaterialName;
removeSourceMaterialSpec.Text = mesBaseMaterialInfo.MaterialSpec;
}
}
}
@ -4252,14 +4415,14 @@ namespace Khd.Core.Wpf.Form
//1.先校验物料类型是否一致
var rawBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == this.rawSourceBarCode.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 = "两个条码物料类型不同,请更换目标条码!";
return;
}
//判断目标库位是否有该物料
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 中的记录
dbContext.WmsRawStock
@ -4277,7 +4440,7 @@ namespace Khd.Core.Wpf.Form
dbContext.WmsRawStock.Update(targetStock);
}
#region 插入移库记录
#endregion
dbContext.SaveChanges();
@ -4407,6 +4570,28 @@ namespace Khd.Core.Wpf.Form
}
}
/// <summary>
/// 取消预调度
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CancelPreScheduling_Click(object sender, RoutedEventArgs e)
{
// 调用取消预调度接口
string executeResult = HttpHelper.SendPostMessage("172.16.12.100", 5001, "wcs/RecieveRcs/CancelPreScheduling", null, "application/Json");
// string executeResult = HttpHelper.SendPostMessage("127.0.0.1", 5001, "wcs/RecieveRcs/CancelPreScheduling", null, "application/Json");
var executeReponse = JsonConvert.DeserializeObject<ReponseMessage>(executeResult);
if (executeReponse != null && executeReponse.code == "0")
{
MessageBox.Show("取消预调度成功!");
}
else
{
MessageBox.Show($"取消预调度失败!");
}
}
}
}

Loading…
Cancel
Save