|
|
|
|
@ -282,12 +282,13 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
.Where(t => t.outstockAmount > t.realOutstockAmount)
|
|
|
|
|
.ToList();
|
|
|
|
|
List<string> list = wmsRawOutstocks.Select(t => t.endStationCode).ToList();
|
|
|
|
|
var baseEquip = dbContext.BaseEquip.First(t => t.objid == 10);
|
|
|
|
|
Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
this.OutOrder.Text = "待出库单:\n" + list.Distinct().Join("\n");
|
|
|
|
|
this.thisOutEndStation.Text = "当前出库"+baseEquip.endStationCode;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var baseEquip = dbContext.BaseEquip.First(t => t.objid == 10);
|
|
|
|
|
if (!string.IsNullOrEmpty(baseEquip.endStationCode))
|
|
|
|
|
{
|
|
|
|
|
List<WcsTask> wcsTasks = dbContext.WcsTask.Where(t => t.taskType == 30).ToList();
|
|
|
|
|
@ -315,9 +316,10 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
var orderNumber = from a in bill
|
|
|
|
|
from b in thisOutList
|
|
|
|
|
from c in mesBaseMaterialInfos
|
|
|
|
|
where a.materialId == b.materialId && a.saleOrderId == b.saleOrderId
|
|
|
|
|
where a.materialId == b.materialId && a.saleOrderId == b.saleOrderId && a.materialId==c.MaterialId
|
|
|
|
|
select new
|
|
|
|
|
{
|
|
|
|
|
materiaName=c.MaterialName,
|
|
|
|
|
materialBatch = a.materialBatch,
|
|
|
|
|
saleOrderId = b.saleOrderId,
|
|
|
|
|
outstockAmount = a.outstockAmount,
|
|
|
|
|
@ -1496,13 +1498,12 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
locationCode = container.locationCode,
|
|
|
|
|
stockType = "1",
|
|
|
|
|
palletInfoCode = container.containerCode,
|
|
|
|
|
totalAmount = material.batchFlag == "1" ? material.amount : 1,
|
|
|
|
|
totalAmount = int.Parse(txtInScan.Text),
|
|
|
|
|
activeFlag = "1",
|
|
|
|
|
occupyAmount = 0,
|
|
|
|
|
completeFlag = "1",
|
|
|
|
|
frozenAmount = 0,
|
|
|
|
|
instockDate = System.DateTime.Now,
|
|
|
|
|
rawStockId = Global.SnowId.NextId(),
|
|
|
|
|
saleOrderId = material.saleOrderId == null ? 0 : material.saleOrderId,
|
|
|
|
|
warehouseFloor = 5,
|
|
|
|
|
warehouseId = 512,
|
|
|
|
|
@ -1510,6 +1511,22 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
createDate = System.DateTime.Now,
|
|
|
|
|
safeFlag = material.safeFlag
|
|
|
|
|
};
|
|
|
|
|
WmsRawInstock wmsRawInstock = new WmsRawInstock()
|
|
|
|
|
{
|
|
|
|
|
beginTime = System.DateTime.Now,
|
|
|
|
|
endTime = DateTime.Now,
|
|
|
|
|
locationCode = container.locationCode,
|
|
|
|
|
executeStatus = "2",
|
|
|
|
|
instockAmount = int.Parse(txtInScan.Text),
|
|
|
|
|
instockType = "1",
|
|
|
|
|
materialBatchCode = txtInBarCode.Text,
|
|
|
|
|
materialId = material.materialId,
|
|
|
|
|
operationType = "3",
|
|
|
|
|
palletInfoCode = container.containerCode,
|
|
|
|
|
poNo = material.poNo,
|
|
|
|
|
warehouseId = 512
|
|
|
|
|
};
|
|
|
|
|
dbContext.Add(wmsRawInstock);
|
|
|
|
|
dbContext.WmsRawStock.Add(newRawStock);
|
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
|
MessageBox.Show("入库成功!");
|
|
|
|
|
@ -1542,14 +1559,11 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
{
|
|
|
|
|
using var scope = _host.Services.CreateScope();
|
|
|
|
|
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
|
|
|
|
|
WmsRawReturn? wmsRawReturn = dbContext.WmsRawReturn.Where(t => t.executeStatus == "1").FirstOrDefault();
|
|
|
|
|
if (wmsRawReturn == null)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("未查询到退库任务!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var material = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == txtInBarCode.Text);
|
|
|
|
|
var container = dbContext.WmsBaseLocation.FirstOrDefault(t => t.containerCode == txtInBox.Text && t.warehouseId == 512);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<WmsRawStock> wmsRawStocks = dbContext.WmsRawStock
|
|
|
|
|
.Where(t => txtInBarCode.Text == t.instockBatch)
|
|
|
|
|
.Where(t => t.warehouseFloor == 5 && t.warehouseId == 512).ToList();
|
|
|
|
|
@ -1573,6 +1587,15 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
txtInScan.Text = string.Empty;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
WmsRawReturn? wmsRawReturn = dbContext.WmsRawReturn
|
|
|
|
|
.Where(t => t.materialId == material.materialId)
|
|
|
|
|
.Where(t => t.planAmount > t.returnAmount)
|
|
|
|
|
.Where(t => t.executeStatus == "0" || t.executeStatus == "1").FirstOrDefault();
|
|
|
|
|
if (wmsRawReturn == null)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("未查询到退库任务!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var newRawStock = new WmsRawStock()
|
|
|
|
|
{
|
|
|
|
|
materialId = material.materialId,
|
|
|
|
|
@ -1679,7 +1702,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
txtInScan.Text = (material.batchFlag == "1" ? material.amount : 1).ToString();
|
|
|
|
|
txtInScan.Text = (material.batchFlag == "1" ? Convert.ToInt32(material.amount) : 1).ToString();
|
|
|
|
|
if (mesBaseMaterialInfo.BatchFlag == "0")
|
|
|
|
|
{
|
|
|
|
|
txtInScan.IsReadOnly = true;
|
|
|
|
|
@ -1766,7 +1789,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
txtOutScan.Text = (mesBaseMaterialInfo.batchFlag == "1" ? (wmsRawStock.totalAmount - wmsRawStock.frozenAmount) : 1).ToString();
|
|
|
|
|
txtOutScan.Text = (mesBaseMaterialInfo.batchFlag == "1" ? Convert.ToInt32((wmsRawStock.totalAmount - wmsRawStock.frozenAmount)) : 1).ToString();
|
|
|
|
|
if (mesBaseMaterialInfo.batchFlag == "1")
|
|
|
|
|
{
|
|
|
|
|
txtOutScan.IsReadOnly = false;
|
|
|
|
|
@ -1826,10 +1849,12 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
BaseEquip baseEquip = dbContext.BaseEquip.First(t => t.objid == 10);
|
|
|
|
|
var mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == txtOutBarCode.Text);
|
|
|
|
|
if (mesBaseBarcodeInfo != null)
|
|
|
|
|
{
|
|
|
|
|
WmsRawOutstock? wmsRawOutstock = dbContext.WmsRawOutstock
|
|
|
|
|
.Where(t => t.endStationCode == baseEquip.endStationCode)
|
|
|
|
|
.Where(t => t.materialId == mesBaseBarcodeInfo.materialId && t.realOutstockAmount < t.outstockAmount && t.saleOrderId == (mesBaseBarcodeInfo.saleOrderId == null ? 0 : mesBaseBarcodeInfo.saleOrderId)).FirstOrDefault();
|
|
|
|
|
if (wmsRawOutstock != null)
|
|
|
|
|
{
|
|
|
|
|
@ -1837,6 +1862,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
if (wmsRawOutstock.outstockAmount == wmsRawOutstock.realOutstockAmount)
|
|
|
|
|
{
|
|
|
|
|
wmsRawOutstock.executeStatus = "2";
|
|
|
|
|
wmsRawOutstock.endTime = DateTime.Now;
|
|
|
|
|
}
|
|
|
|
|
else if (wmsRawOutstock.realOutstockAmount > wmsRawOutstock.outstockAmount)
|
|
|
|
|
{
|
|
|
|
|
@ -2460,7 +2486,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
{
|
|
|
|
|
if (!ReadEmptyLocation())
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("有任务正在执行");
|
|
|
|
|
MessageBox.Show("有任务正在执行");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
using var scope = _host.Services.CreateScope();
|
|
|
|
|
@ -2495,7 +2521,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
LogManager.Error(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OneOut_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
@ -2854,22 +2880,39 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
using var scope = _host.Services.CreateScope();
|
|
|
|
|
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
|
|
|
|
|
BaseEquip baseEquip = dbContext.BaseEquip.First(t => t.objid == equip.objid);
|
|
|
|
|
bool hastask = dbContext.WcsTask.Where(t => t.endPointId == baseEquip.objid || t.currPointId == baseEquip.objid).Any();
|
|
|
|
|
bool hasTaskManual = dbContext.WcsTaskManual.Where(t => t.currPointId == baseEquip.objid || t.endPointId == baseEquip.objid).Any();
|
|
|
|
|
if (hastask || hasTaskManual)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("已存在当前库位的任务");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (baseEquip.emptyCount > 0)
|
|
|
|
|
{
|
|
|
|
|
FloorForm floorForm = new FloorForm(new List<int>() { 1, 3 });
|
|
|
|
|
floorForm.ShowDialog();
|
|
|
|
|
if (FloorForm.SelecetedFloorNo != 0)
|
|
|
|
|
{
|
|
|
|
|
//WcsTaskManual task = new()
|
|
|
|
|
//{
|
|
|
|
|
// objid = Global.SnowId.NextId(),
|
|
|
|
|
// taskType = 56,
|
|
|
|
|
// containerNo = "00000000",
|
|
|
|
|
// currPointId = baseEquip.objid,
|
|
|
|
|
// currPointNo = baseEquip.equipNo,
|
|
|
|
|
//};
|
|
|
|
|
WcsTaskManual task = new()
|
|
|
|
|
{
|
|
|
|
|
objid = Global.SnowId.NextId(),
|
|
|
|
|
taskType = 57,
|
|
|
|
|
containerNo = "00000000",
|
|
|
|
|
currPointId = baseEquip.objid,
|
|
|
|
|
currPointNo = baseEquip.equipNo,
|
|
|
|
|
nextPointId = 8,
|
|
|
|
|
qty = baseEquip.emptyCount,
|
|
|
|
|
endPointId = FloorForm.SelecetedFloorNo,
|
|
|
|
|
endPointNo = $"TSJ_0{FloorForm.SelecetedFloorNo}",
|
|
|
|
|
useFlag = 1,
|
|
|
|
|
taskStatus = 0,
|
|
|
|
|
fromFloorNo = 2,
|
|
|
|
|
floorNo = FloorForm.SelecetedFloorNo
|
|
|
|
|
};
|
|
|
|
|
dbContext.Add(task);
|
|
|
|
|
dbContext.SaveChanges();
|
|
|
|
|
MessageBox.Show("下发成功");
|
|
|
|
|
}
|
|
|
|
|
MessageBox.Show("下发成功");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@ -3069,5 +3112,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
SelectOutRawForm selectOutRawForm = new SelectOutRawForm(this._host);
|
|
|
|
|
selectOutRawForm.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|