|
|
|
|
@ -20,6 +20,7 @@ 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;
|
|
|
|
|
@ -926,7 +927,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 + "";
|
|
|
|
|
}
|
|
|
|
|
@ -2164,8 +2165,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 +2178,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 +2202,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 +2218,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 +2228,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 +2243,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 +2262,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(barCode))
|
|
|
|
|
{
|
|
|
|
|
MsgText.Text = "请先扫描容器号!";
|
|
|
|
|
scanOutMsg.Text = "请先扫描容器号!";
|
|
|
|
|
txtOutBarCode.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);
|
|
|
|
|
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 +2326,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;
|
|
|
|
|
@ -2376,7 +2385,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
HandyControl.Controls.MessageBox.Error("该条码的销售订单不正确");
|
|
|
|
|
scanOutMsg.Text = "该条码的销售订单不正确";
|
|
|
|
|
txtOutScan.Text = string.Empty;
|
|
|
|
|
txtOutBarCode.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;
|
|
|
|
|
txtOutBarCode.Text = string.Empty;
|
|
|
|
|
outMaterialSpecTxt.Text = string.Empty;
|
|
|
|
|
@ -2397,13 +2406,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 +2425,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 +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();
|
|
|
|
|
materialIds = materialInfos.Select(t => t.MaterialId).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var wmsRawStocks = dbContext.WmsRawStock
|
|
|
|
|
.Where(t => t.warehouseId == 512)
|
|
|
|
|
.WhereIf(materialIds.Count > 0, t => materialIds.Contains(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 groupWmsRawStock = wmsRawStocks.GroupBy(t => new { t.materialId, t.palletInfoCode }).Select(t =>
|
|
|
|
|
new
|
|
|
|
|
{
|
|
|
|
|
@ -2450,6 +2466,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 +2478,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 +2507,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 +2527,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 +2547,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 +2766,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 +2886,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 +4133,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 +4145,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 +4182,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 +4229,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
{
|
|
|
|
|
removeSourceBarCode.Focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -4206,7 +4277,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
{
|
|
|
|
|
removeSourceMaterialName.Text = mesBaseMaterialInfo.MaterialName;
|
|
|
|
|
removeSourceMaterialSpec.Text = mesBaseMaterialInfo.MaterialSpec;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -4252,14 +4323,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 +4348,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
dbContext.WmsRawStock.Update(targetStock);
|
|
|
|
|
}
|
|
|
|
|
#region 插入移库记录
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
|
|