|
|
|
|
@ -1460,11 +1460,18 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(txtInBox.Text) && !string.IsNullOrEmpty(txtInBarCode.Text))
|
|
|
|
|
{
|
|
|
|
|
using var scope = _host.Services.CreateScope();
|
|
|
|
|
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
|
|
|
|
|
if (txtInScan.Text == "")
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先输入数量"); return;
|
|
|
|
|
}
|
|
|
|
|
decimal amount = decimal.Parse(txtInScan.Text);
|
|
|
|
|
// 计算入库后当前总数量,仅用来提示使用
|
|
|
|
|
decimal? totalMessage = 0;
|
|
|
|
|
if (amount <= 0)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("入库数量需大于0");
|
|
|
|
|
@ -1513,6 +1520,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
wmsRawStock.totalAmount += amount;
|
|
|
|
|
dbContext.WmsRawStock.Update(wmsRawStock);
|
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
|
totalMessage = wmsRawStock.totalAmount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -1542,15 +1550,16 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
};
|
|
|
|
|
dbContext.WmsRawStock.Add(newRawStock);
|
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
|
totalMessage = newRawStock.totalAmount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
txtInBox.Focus();
|
|
|
|
|
MsgText.Text = "入库成功!";
|
|
|
|
|
MsgText.Text = $"入库成功!当前库存:{totalMessage}";
|
|
|
|
|
txtInBox.Text = string.Empty;
|
|
|
|
|
txtInBarCode.Text = string.Empty;
|
|
|
|
|
txtInScan.Text = string.Empty;
|
|
|
|
|
txtInBarCode.Focus();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@ -1730,7 +1739,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
txtInScan.Text = (material.batchFlag == "1") ? "0.00" : "1.00";
|
|
|
|
|
txtInScan.Text = (material.batchFlag == "1") ? "" : "1.00";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mesBaseMaterialInfo.BatchFlag == "0")
|
|
|
|
|
@ -2446,9 +2455,10 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
BasePlcpoint basePlcpoint = SystemData.BasePlcpoints.First(t => t.plcpointNo == "canReceive");
|
|
|
|
|
SystemData.PlcDic[1].WriteToPoint(basePlcpoint.plcpointAddress, "1", basePlcpoint.plcpointLength.ToString());
|
|
|
|
|
MessageBox.Show("一键收料发送成功");
|
|
|
|
|
MsgText.Text = "一键收料发送成功";
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
@ -2460,7 +2470,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
{
|
|
|
|
|
if (item.Value.IP == ex.Message)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("PLC断开连接,正在重连!");
|
|
|
|
|
MsgText.Text = "PLC断开连接,正在重连!";
|
|
|
|
|
SystemData.PlcDic[item.Key] = new Plc.S7.Plc(item.Value.CPU, item.Value.IP, item.Value.Port, item.Value.Slot, item.Value.Rack);
|
|
|
|
|
SystemData.PlcDic[item.Key].Open();
|
|
|
|
|
break;
|
|
|
|
|
@ -2470,7 +2480,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("PLC连接失败!");
|
|
|
|
|
MsgText.Text = "PLC连接失败!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|