|
|
|
|
@ -119,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>();
|
|
|
|
|
@ -1807,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;
|
|
|
|
|
}
|
|
|
|
|
@ -1836,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;
|
|
|
|
|
}
|
|
|
|
|
@ -2167,12 +2206,12 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
{
|
|
|
|
|
string containerCode = txtOutBox.Text;
|
|
|
|
|
|
|
|
|
|
if (containerCode.Length>=1 && containerCode.Length < 15)
|
|
|
|
|
if (containerCode.Length >= 1 && containerCode.Length < 15)
|
|
|
|
|
{
|
|
|
|
|
scanOutMsg.Text = "";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(containerCode))
|
|
|
|
|
{
|
|
|
|
|
using var scope = _host.Services.CreateScope();
|
|
|
|
|
@ -2377,13 +2416,64 @@ 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
|
|
|
|
|
{
|
|
|
|
|
@ -2430,7 +2520,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
private async void SelectButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
CallSelectedItem.Clear();
|
|
|
|
|
await GetPersonCallMaterialData();
|
|
|
|
|
await GetPersonCallMaterialData();
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取人员呼叫的物料数据
|
|
|
|
|
@ -2452,14 +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();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
@ -2481,14 +2571,14 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
// materialId = string.Join("\n", t.Select(x => x.materialId)),
|
|
|
|
|
//}).ToList();
|
|
|
|
|
var palletInfoCodes = groupWmsRawStock.Select(t => t.palletInfoCode).Distinct().ToList();
|
|
|
|
|
var wmsBaseLocations =await dbContext.WmsBaseLocation
|
|
|
|
|
var wmsBaseLocations = await dbContext.WmsBaseLocation
|
|
|
|
|
.Where(t => t.ContainerStatus == "1")
|
|
|
|
|
.Where(t => t.warehouseId == 512)
|
|
|
|
|
.Where(t => palletInfoCodes.Contains(t.containerCode)).ToListAsync();
|
|
|
|
|
if (string.IsNullOrEmpty(MaterialName.Text))
|
|
|
|
|
{
|
|
|
|
|
var tempMaterialIds = groupWmsRawStock.Select(x=>x.materialId).Distinct().ToList();
|
|
|
|
|
materialInfos =await dbContext.MesBaseMaterialInfo.Where(x=> tempMaterialIds.Contains(x.MaterialId)).ToListAsync();
|
|
|
|
|
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
|
|
|
|
|
@ -2529,11 +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("未查询到数据");
|
|
|
|
|
@ -4491,7 +4581,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
// 调用取消预调度接口
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
// 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")
|
|
|
|
|
{
|
|
|
|
|
|