1 year ago
commit 80d8f04559

@ -36,7 +36,7 @@ namespace Khd.Core.Domain.Models
[Column("remark")] [Column("remark")]
public string Remark { get; set; } public string Remark { get; set; }
[Column("status")] [Column("alarm_status_word")]
public string Status { get; set; } public string Status { get; set; }
} }
} }

@ -148,7 +148,7 @@ namespace Khd.Core.Wcs.Wcs
} }
else else
{ {
if (task.taskType == StaticTaskType.FiveAccessoryOut) if (task.taskType == StaticTaskType.FiveAccessoryOut || task.taskType == StaticTaskType.FiveAccessoryRemove)
{ {
//dbContext.WcsTask.Where(t => t.objid == task.objid).Delete(); //dbContext.WcsTask.Where(t => t.objid == task.objid).Delete();
#region 如果已经开始入库,还有出库任务,删除出库任务 #region 如果已经开始入库,还有出库任务,删除出库任务

@ -2462,6 +2462,8 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
@ -2469,33 +2471,73 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Text="辅料移库" FontSize="100" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="0" Grid.ColumnSpan="4"/> <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"> <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="原料箱号:" FontSize="70" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Text="原料箱号:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<hc:TextBox x:Name="rawSourceBox" LostFocus="rawSourceBox_LostFocus" FontSize="50" Width="500" Height="150" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/> <hc:TextBox x:Name="rawSourceBox" TextChanged="rawSourceBox_TextChanged" FontSize="40" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
<Button Click="rawSourceBoxClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="-100,0,0,0" Grid.Column="5" Grid.Row="2"> <Button Click="rawSourceBoxClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="-100,0,0,0" Grid.Column="5" Grid.Row="2">
<Image Source="..\Resources\cancel.png"/> <Image Source="..\Resources\cancel.png"/>
</Button> </Button>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="原条码号:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:TextBox x:Name="rawSourceBarCode" FontSize="40" TextChanged="rawSourceBarCode_TextChanged" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
<Button Click="rawSourceBarCodeClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="-100,0,0,0" Grid.Column="5" Grid.Row="2">
<Image Source="..\Resources\cancel.png"/>
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5"> <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="移库料箱:" FontSize="70" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Text="移库料箱:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:TextBox x:Name="removeSourceBox" FontSize="50" LostFocus="removeSourceBox_LostFocus" Width="500" Height="150" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/> <hc:TextBox x:Name="removeSourceBox" FontSize="40" TextChanged="removeSourceBox_TextChanged" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
<Button Click="removeSourceBoxClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="-100,0,0,0" Grid.Column="5" Grid.Row="2"> <Button Click="removeSourceBoxClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="-100,0,0,0" Grid.Column="5" Grid.Row="2">
<Image Source="..\Resources\cancel.png"/> <Image Source="..\Resources\cancel.png"/>
</Button> </Button>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="2" Grid.ColumnSpan="3" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="条码号:" FontSize="70" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:TextBox x:Name="removeBarCode" FontSize="50" LostFocus="removeBarCode_LostFocus" Width="750" Height="150" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/> <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<Button Click="removeBarCodeClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="-100,0,0,0" Grid.Column="5" Grid.Row="2"> <TextBlock Text="移库条码:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:TextBox x:Name="removeSourceBarCode" FontSize="40" TextChanged="removeSourceBarCode_TextChanged" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
<Button Click="removeSourceBarCodeClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="-100,0,0,0" Grid.Column="5" Grid.Row="2">
<Image Source="..\Resources\cancel.png"/> <Image Source="..\Resources\cancel.png"/>
</Button> </Button>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="3" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="数量:" FontSize="70" VerticalAlignment="Center" HorizontalAlignment="Center"/> <StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock x:Name="removeScan" FontSize="50" Width="150" Margin="0,0,0,0" /> <TextBlock Text="物料名称:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:TextBox x:Name="rawSourceMaterialName" FontSize="40" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
</StackPanel> </StackPanel>
<Button Content="确认移库" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="4" Width="600" Height="150" FontSize="75" Background="#346DFF" Foreground="White" Click="btnRemoveConfirmBox_Click"/> <StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="物料规格:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:TextBox x:Name="rawSourceMaterialSpec" FontSize="40" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="物料名称:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<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"/>
<StackPanel Orientation="Horizontal" Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="4" HorizontalAlignment="Left" Margin="100 0 0 0 ">
<TextBlock Text="提示信息:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<TextBlock x:Name="RemoveMsg" HorizontalAlignment="Left" FontSize="40" Foreground="White" Width="1200" Height="60" Margin="10,0,0,0" />
</StackPanel>
</Grid> </Grid>
</TabItem> </TabItem>
<TabItem x:Name="FirstFloorManager" Header="一楼接驳位" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Background="#213269" Foreground="White" Width="160" Height="100" Margin="5"> <TabItem x:Name="FirstFloorManager" Header="一楼接驳位" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Background="#213269" Foreground="White" Width="160" Height="100" Margin="5">

@ -1869,6 +1869,16 @@ namespace Khd.Core.Wpf.Form
{ {
this.removeSourceBox.Text = string.Empty; this.removeSourceBox.Text = string.Empty;
} }
private void rawSourceBarCodeClear_Click(object sender, RoutedEventArgs e)
{
this.rawSourceBarCode.Text = string.Empty;
}
private void removeSourceBarCodeClear_Click(object sender, RoutedEventArgs e)
{
this.removeSourceBarCode.Text = string.Empty;
}
/// <summary> /// <summary>
/// 入库扫描 /// 入库扫描
/// </summary> /// </summary>
@ -2996,6 +3006,7 @@ namespace Khd.Core.Wpf.Form
select t1.location_id locationId, select t1.location_id locationId,
t1.container_code containerCode, t1.container_code containerCode,
t1.location_code locationCode t1.location_code locationCode
from wms_base_location t1 from wms_base_location t1
left join wms_raw_stock t2 left join wms_raw_stock t2
on t1.location_code=t2.location_code on t1.location_code=t2.location_code
@ -3003,6 +3014,8 @@ namespace Khd.Core.Wpf.Form
and t1.container_status=1 and t1.warehouse_id=512 and t1.container_status=1 and t1.warehouse_id=512
order by t1.loc_column,t1.loc_row order by t1.loc_column,t1.loc_row
"); ");
var wmsLocation = dbContext.WmsBaseLocation.FirstOrDefault(t => t.locationId == idList[0] && t.locationStatus == "1"); var wmsLocation = dbContext.WmsBaseLocation.FirstOrDefault(t => t.locationId == idList[0] && t.locationStatus == "1");
if (wmsLocation == null) if (wmsLocation == null)
{ {
@ -3017,7 +3030,8 @@ namespace Khd.Core.Wpf.Form
MessageBoxResult messageBoxResult = HandyControl.Controls.MessageBox.Show("选择了一个移库料箱,需要出空料箱,是否确认?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question); MessageBoxResult messageBoxResult = HandyControl.Controls.MessageBox.Show("选择了一个移库料箱,需要出空料箱,是否确认?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (messageBoxResult == MessageBoxResult.Yes) if (messageBoxResult == MessageBoxResult.Yes)
{ {
WmsBaseLocation emptyLocation = emptyLocations.First(); var emptyLocation = dbContext.WmsBaseLocation.FirstOrDefault(t => t.locationId == emptyLocations.First().locationId);
//WmsBaseLocation emptyLocation = emptyLocations.First();
emptyLocation.locationStatus = "4"; emptyLocation.locationStatus = "4";
emptyLocation.ContainerStatus = "2"; emptyLocation.ContainerStatus = "2";
wmsLocation.locationStatus = "4"; wmsLocation.locationStatus = "4";
@ -4046,92 +4060,162 @@ namespace Khd.Core.Wpf.Form
} }
#region 移库方法 #region 移库方法
private void removeSourceBox_LostFocus(object sender, RoutedEventArgs e) private void rawSourceBox_TextChanged(object sender, RoutedEventArgs e)
{ {
if (string.IsNullOrEmpty(this.removeSourceBox.Text)) if (this.rawSourceBox.Text.Length >=1 && this.rawSourceBox.Text.Length < 15)
{ {
this.RemoveMsg.Text = "";
return; return;
} }
try try
{ {
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>();
WcsTask? wcsTask = dbContext.WcsTask.Where(t => t.containerNo == this.removeSourceBox.Text).FirstOrDefault(); //WcsTask? wcsTask = dbContext.WcsTask.Where(t => t.containerNo == this.rawSourceBox.Text).FirstOrDefault();
if (wcsTask == null) //if (wcsTask == null)
//{
// this.RemoveMsg.Text = $"未找到该托盘{this.rawSourceBox.Text}的移库任务!";
// this.rawSourceBox.Text = "";
// return;
//}
//else
{ {
HandyControl.Controls.MessageBox.Show("未找到该托盘!"); rawSourceBarCode.Focus();
this.removeSourceBox.Text = "";
return;
} }
} }
catch catch (Exception ex)
{ {
this.RemoveMsg.Text = ex.Message;
} }
} }
private void rawSourceBox_LostFocus(object sender, RoutedEventArgs e) private void rawSourceBarCode_TextChanged(object sender, RoutedEventArgs e)
{ {
if (string.IsNullOrEmpty(this.rawSourceBox.Text)) if (this.rawSourceBarCode.Text.Length < 19)
{ {
rawSourceMaterialName.Text = "";
rawSourceMaterialSpec.Text = "";
removeScan.Text = "";
return; return;
} }
string barCode = rawSourceBarCode.Text;
try try
{ {
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>();
WcsTask? wcsTask = dbContext.WcsTask.Where(t => t.containerNo == this.rawSourceBox.Text).FirstOrDefault();
if (wcsTask == null)
{
HandyControl.Controls.MessageBox.Show("未找到该托盘!");
this.rawSourceBox.Text = "";
return;
}
}
catch
{
}
}
private void removeBarCodeClear_Click(object sender, RoutedEventArgs e)
{
removeBarCode.Text = "";
}
private void removeBarCode_LostFocus(object sender, RoutedEventArgs e)
{
try
{
if (string.IsNullOrEmpty(this.removeBarCode.Text))
{
return;
}
if (string.IsNullOrEmpty(this.rawSourceBox.Text))
{
HandyControl.Controls.MessageBox.Show("请先选择托盘!");
return;
}
using var scope = _host.Services.CreateScope();
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
WmsRawStock? wmsRawStock = dbContext.WmsRawStock.Where(t => t.palletInfoCode == this.rawSourceBox.Text) WmsRawStock? wmsRawStock = dbContext.WmsRawStock.Where(t => t.palletInfoCode == this.rawSourceBox.Text)
.Where(t => t.instockBatch == this.removeBarCode.Text) .Where(t => t.instockBatch == barCode)
.FirstOrDefault(); .FirstOrDefault();
if (wmsRawStock == null) if (wmsRawStock == null)
{ {
HandyControl.Controls.MessageBox.Show($"未在{this.rawSourceBox.Text}托盘中找到{this.removeBarCode.Text}条码!"); RemoveMsg.Text = $"未在{this.rawSourceBox.Text}托盘中找到{barCode}条码!" ;
this.removeBarCode.Text = ""; rawSourceBarCode.Text = string.Empty;
this.removeScan.Text = string.Empty; rawSourceMaterialName.Text = "";
rawSourceMaterialSpec.Text = "";
return; return;
} }
var material = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == barCode);
if (material == null)
{
RemoveMsg.Text = $"未查询{barCode}条码内容!";
rawSourceBarCode.Text = string.Empty;
}
else else
{ {
this.removeScan.Text = wmsRawStock.frozenAmount.ToString(); var mesBaseMaterialInfo = dbContext.MesBaseMaterialInfo.FirstOrDefault(t => t.MaterialId == material.materialId);
if (mesBaseMaterialInfo == null)
{
RemoveMsg.Text = $"未查询{barCode}绑定的物料信息!";
rawSourceBarCode.Text = string.Empty;
}
else
{
rawSourceMaterialName.Text = mesBaseMaterialInfo.MaterialName;
rawSourceMaterialSpec.Text = mesBaseMaterialInfo.MaterialSpec;
this.removeScan.Text = string.Format("{0:0}", wmsRawStock.totalAmount - wmsRawStock.frozenAmount);
removeSourceBox.Focus();
}
} }
} }
catch catch (Exception ex)
{
RemoveMsg.Text = $"查询{barCode}条码内容异常!";
rawSourceBarCode.Text = string.Empty;
rawSourceMaterialName.Text = "";
rawSourceMaterialSpec.Text = "";
}
}
private void removeSourceBox_TextChanged(object sender, RoutedEventArgs e)
{
if (this.rawSourceBox.Text.Length >= 15)
{
removeSourceBarCode.Focus();
}
}
private void removeSourceBarCode_TextChanged(object sender, RoutedEventArgs e)
{
if (this.removeSourceBarCode.Text.Length < 19)
{
removeSourceMaterialName.Text = "";
removeSourceMaterialSpec.Text = "";
return;
}
string barCode = removeSourceBarCode.Text;
try
{ {
using var scope = _host.Services.CreateScope();
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
//WmsRawStock? wmsRawStock = dbContext.WmsRawStock.Where(t => t.palletInfoCode == this.removeSourceBox.Text)
// .Where(t => t.instockBatch == barCode)
// .FirstOrDefault();
//if (wmsRawStock == null)
//{
// RemoveMsg.Text = $"未在目标托盘中找到条码,请打印粘贴后重新扫描!";
// removeSourceBarCode.Text = string.Empty;
// removeSourceMaterialName.Text = "";
// removeSourceMaterialSpec.Text = "";
// return;
//}
var material = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == barCode);
if (material == null)
{
RemoveMsg.Text = $"未查询{barCode}条码信息!";
removeSourceBarCode.Text = string.Empty;
}
else
{
var mesBaseMaterialInfo = dbContext.MesBaseMaterialInfo.FirstOrDefault(t => t.MaterialId == material.materialId);
if (mesBaseMaterialInfo == null)
{
RemoveMsg.Text = $"未查询{barCode}绑定的物料信息!";
removeSourceBarCode.Text = string.Empty;
}
else
{
removeSourceMaterialName.Text = mesBaseMaterialInfo.MaterialName;
removeSourceMaterialSpec.Text = mesBaseMaterialInfo.MaterialSpec;
}
}
}
catch (Exception ex)
{
RemoveMsg.Text = $"查询{barCode}条码内容异常!";
removeSourceBarCode.Text = string.Empty;
removeSourceMaterialName.Text = "";
removeSourceMaterialSpec.Text = "";
} }
} }
@ -4140,17 +4224,22 @@ namespace Khd.Core.Wpf.Form
if (string.IsNullOrEmpty(this.rawSourceBox.Text)) if (string.IsNullOrEmpty(this.rawSourceBox.Text))
{ {
HandyControl.Controls.MessageBox.Show("请先选择移库源托盘!"); this.RemoveMsg.Text = "请先选择原托盘!";
return;
}
if (string.IsNullOrEmpty(this.rawSourceBarCode.Text))
{
this.RemoveMsg.Text = "请先选择原条码!";
return; return;
} }
if (string.IsNullOrEmpty(this.removeSourceBox.Text)) if (string.IsNullOrEmpty(this.removeSourceBox.Text))
{ {
HandyControl.Controls.MessageBox.Show("请先选择移库条码!"); this.RemoveMsg.Text = "请先选择移库目标托盘!";
return; return;
} }
if (string.IsNullOrEmpty(this.removeBarCode.Text)) if (string.IsNullOrEmpty(this.removeSourceBarCode.Text))
{ {
HandyControl.Controls.MessageBox.Show("请先扫码移库数量!"); this.RemoveMsg.Text = "请先选择移库目标条码!";
return; return;
} }
using var scope = _host.Services.CreateScope(); using var scope = _host.Services.CreateScope();
@ -4159,15 +4248,48 @@ namespace Khd.Core.Wpf.Form
{ {
WmsBaseLocation removeLocation = dbContext.WmsBaseLocation.Where(t => t.containerCode == this.removeSourceBox.Text).First(); WmsBaseLocation removeLocation = dbContext.WmsBaseLocation.Where(t => t.containerCode == this.removeSourceBox.Text).First();
WmsBaseLocation rawLocation = dbContext.WmsBaseLocation.Where(t => t.containerCode == this.rawSourceBox.Text).First(); WmsBaseLocation rawLocation = dbContext.WmsBaseLocation.Where(t => t.containerCode == this.rawSourceBox.Text).First();
dbContext.WmsRawStock.Where(t => t.locationCode == rawLocation.locationCode)
.Where(t => t.instockBatch == this.removeBarCode.Text) //1.先校验物料类型是否一致
.Update(t => new WmsRawStock var rawBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == this.rawSourceBarCode.Text);
{ var removeBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == this.removeSourceBarCode.Text);
locationCode = removeLocation.locationCode, if(rawBarcodeInfo.materialId != removeBarcodeInfo.materialId)
}); {
HandyControl.Controls.MessageBox.Show("移库成功!"); this.RemoveMsg.Text = "两个条码物料类型不同,请更换目标条码!";
this.removeBarCode.Text = ""; return;
this.removeScan.Text = string.Empty; }
//判断目标库位是否有该物料
WmsRawStock? targetStock = dbContext.WmsRawStock.Where(t => t.palletInfoCode == this.removeSourceBox.Text && t.materialId == rawBarcodeInfo.materialId).FirstOrDefault();
if(targetStock == null || (targetStock != null && removeBarcodeInfo.batchFlag == "0"))
{
// 更新 WmsRawStock 中的记录
dbContext.WmsRawStock
.Where(t => t.locationCode == rawLocation.locationCode)
.Where(t => t.instockBatch == this.rawSourceBarCode.Text)
.Update(t => new WmsRawStock
{
locationCode = removeLocation.locationCode, // 更新 locationCode
palletInfoCode = removeLocation.containerCode // 更新 palletInfoCode
});
}
else
{
targetStock.totalAmount += Convert.ToInt32(this.removeScan.Text);
dbContext.WmsRawStock.Update(targetStock);
}
#region 插入移库记录
#endregion
dbContext.SaveChanges();
this.RemoveMsg.Text = "移库成功!";
removeSourceBarCode.Text = string.Empty;
removeSourceMaterialName.Text = "";
removeSourceMaterialSpec.Text = "";
rawSourceBarCode.Text = string.Empty;
rawSourceMaterialName.Text = "";
rawSourceMaterialSpec.Text = "";
this.removeScan.Text = "";
} }
catch catch
{ {

@ -3,8 +3,8 @@
//mysql //mysql
//"DefaultConnection": "server=106.12.13.113;port=3306;database=khd_jyhb;uid=root;pwd=root;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True" //"DefaultConnection": "server=106.12.13.113;port=3306;database=khd_jyhb;uid=root;pwd=root;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True"
//khd //khd
//"DefaultConnection": "server=172.16.12.100;port=3306;database=hwjy-cloud;uid=kehaida;pwd=khdrkjy2024...;charset='utf8';persistsecurityinfo=True;SslMode=None;Allow User Variables=True" "DefaultConnection": "server=172.16.12.100;port=3306;database=hwjy-cloud;uid=kehaida;pwd=khdrkjy2024...;charset='utf8';persistsecurityinfo=True;SslMode=None;Allow User Variables=True"
"DefaultConnection": "server=175.27.215.92;port=3306;database=hwjy-cloud;uid=kehaida;pwd=khd2024;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True" //"DefaultConnection": "server=175.27.215.92;port=3306;database=hwjy-cloud;uid=kehaida;pwd=khd2024;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True"
// "DefaultConnection": "server=localhost;port=3306;database=jyhb;uid=root;pwd=root;charset='utf8';persistsecurityinfo=True;SslMode=None;Allow User Variables=True" // "DefaultConnection": "server=localhost;port=3306;database=jyhb;uid=root;pwd=root;charset='utf8';persistsecurityinfo=True;SslMode=None;Allow User Variables=True"
}, },
"PlcConfigs": [ "PlcConfigs": [

Loading…
Cancel
Save