master
liuwf 1 year ago
parent cb4c8283db
commit db8a89c885

@ -2325,14 +2325,6 @@
Width="*"
ElementStyle="{StaticResource dgCell}"
/>
<!--<DataGridTextColumn
Header="箱体携带数量"
Binding="{Binding thisOutAmount}"
ElementStyle="{StaticResource dgCell}"
Width="3*"
/>-->
<DataGridTemplateColumn
Width="3*"
CanUserSort="False"
@ -2345,8 +2337,6 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
@ -2360,7 +2350,7 @@
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Height" Value="Auto" />
</Style>
</DataGrid.RowStyle>
<DataGrid.RowHeaderStyle>

@ -335,7 +335,8 @@ namespace Khd.Core.Wpf.Form
}
LocationsControl.ItemsSource = locations;
}catch (Exception ex)
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
@ -349,9 +350,9 @@ namespace Khd.Core.Wpf.Form
var location = button.DataContext as Location;
if (location != null)
{
StockWindow window = new StockWindow(_host,location.LocationId);
StockWindow window = new StockWindow(_host, location.LocationId);
window.Show();
// MessageBox.Show(location.LocationId.ToString());
// MessageBox.Show(location.LocationId.ToString());
}
}
}
@ -475,10 +476,10 @@ namespace Khd.Core.Wpf.Form
string nowStationCode = baseEquip.endStationCode;
Dispatcher.Invoke(() =>
{
this.OutOrder.Text = "当前:"+nowStationCode+"\n" +"待出库单:\n" + list.Distinct().Join("\n");
this.OutOrder.Text = "当前:" + nowStationCode + "\n" + "待出库单:\n" + list.Distinct().Join("\n");
});
if (!string.IsNullOrEmpty(baseEquip.endStationCode))
{
#region 待测试
@ -1435,10 +1436,10 @@ namespace Khd.Core.Wpf.Form
try
{
//剩余出库单
int count = OutTaskNumber.Items.Count;
int count = OutTaskNumber.Items.Count;
using var scope = _host.Services.CreateScope();
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
var wcsCmd = dbContext.WcsTask
.Where(t => t.taskStatus == 6 || t.taskStatus == 3)
.Where(t => t.nextPointId == 10)
@ -1451,20 +1452,32 @@ namespace Khd.Core.Wpf.Form
{
if (wcsCmd.taskType == 32)//领料
{
if(count>)
MessageBoxResult messageBoxResult = HandyControl.Controls.MessageBox.Show("是否需要背负式小车返回?", "提示信息", MessageBoxButton.YesNoCancel, MessageBoxImage.Information);
if (messageBoxResult == MessageBoxResult.Yes)
if (count > 0)
{
WcsTask wcsTask = CoreMapper.Map<WcsTask>(wcsCmd);
wcsTask.taskStatus = 0;
wcsTask.createTime = DateTime.Now;
wcsTask.useFlag = 1;
wcsTask.objid = Global.SnowId.NextId();
WcsTaskLog wcsTaskLog = CoreMapper.Map<WcsTaskLog>(wcsTask);
dbContext.Add(wcsTaskLog);
dbContext.Add(wcsTask);
MessageBoxResult messageBoxResult = HandyControl.Controls.MessageBox.Show("是否需要背负式小车返回?", "提示信息", MessageBoxButton.YesNoCancel, MessageBoxImage.Information);
if (messageBoxResult == MessageBoxResult.Yes)
{
WcsTask wcsTask = CoreMapper.Map<WcsTask>(wcsCmd);
wcsTask.taskStatus = 0;
wcsTask.createTime = DateTime.Now;
wcsTask.useFlag = 1;
wcsTask.objid = Global.SnowId.NextId();
WcsTaskLog wcsTaskLog = CoreMapper.Map<WcsTaskLog>(wcsTask);
dbContext.Add(wcsTaskLog);
dbContext.Add(wcsTask);
}
else
{
BaseEquip baseEquip = dbContext.BaseEquip.First(t => t.objid == 10);
baseEquip.endStationCode = string.Empty;
baseEquip.ud3 = null;
dbContext.Update(baseEquip);
dbContext.SaveChanges();
return;
}
}
else if (messageBoxResult == MessageBoxResult.Cancel)
else
{
BaseEquip baseEquip = dbContext.BaseEquip.First(t => t.objid == 10);
baseEquip.endStationCode = string.Empty;
@ -1473,6 +1486,7 @@ namespace Khd.Core.Wpf.Form
dbContext.SaveChanges();
return;
}
if (wcsCmd.taskStatus == 3)
{
wcsCmd.taskStatus = 4;
@ -1905,13 +1919,13 @@ namespace Khd.Core.Wpf.Form
applyBy = "WPF",
applyDate = System.DateTime.Now,
purchaseOrderId = mesBaseBarcodeInfo.PurchaseOrderId,
beginTime = System.DateTime.Now,
endTime = DateTime.Now,
locationCode = container.locationCode,
executeStatus = "2",
instockAmount = amount,
instockType = "1",
instockType = "1",
materialId = material.materialId,
operationType = "1",
palletInfoCode = container.containerCode,
@ -2383,7 +2397,7 @@ namespace Khd.Core.Wpf.Form
outMaterialSpecTxt.Text = materialInfo.MaterialSpec;
}
txtTotalAmount.Text = string.Format("{0:0.00}", wmsRawStock.totalAmount - wmsRawStock.frozenAmount);
txtOutScan.Focus();
txtOutScan.Focus();
//txtOutScan.Text = string.Format("{0:0}", (mesBaseMaterialInfo.batchFlag == "1" ? (wmsRawStock.totalAmount - wmsRawStock.frozenAmount) : 1)) ;
//if (mesBaseMaterialInfo.batchFlag == "1")
//{
@ -2426,6 +2440,9 @@ namespace Khd.Core.Wpf.Form
{
try
{
if (!string.IsNullOrEmpty(txtOutBox.Text) && !string.IsNullOrEmpty(txtOutBarCode.Text))
{
using var scope = _host.Services.CreateScope();
@ -2508,83 +2525,92 @@ namespace Khd.Core.Wpf.Form
}
else
{
if (mesBaseBarcodeInfo.PurchaseOrderId == null)
// 没有申请单
// 如果选中了出库单,并且无需要出库的申请单,则禁止出库
BaseEquip baseEquip = dbContext.BaseEquip.First(t => t.objid == 10);
if (!string.IsNullOrEmpty(baseEquip.endStationCode))
{
wmsRawStock.totalAmount -= outScan;
if (wmsRawStock.totalAmount == 0)
scanOutMsg.Text = "申请单里该条码无需出库!";
return;
}
if (mesBaseBarcodeInfo.PurchaseOrderId == null)
{
dbContext.WmsRawStock.Remove(wmsRawStock);
wmsRawStock.totalAmount -= outScan;
if (wmsRawStock.totalAmount == 0)
{
dbContext.WmsRawStock.Remove(wmsRawStock);
}
else
{
dbContext.WmsRawStock.Update(wmsRawStock);
}
#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.applyDate = DateTime.Now;
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
{
dbContext.WmsRawStock.Update(wmsRawStock);
scanOutMsg.Text = "该条码的销售订单不正确";
txtOutScan.Text = string.Empty;
txtOutBarCode.Text = string.Empty;
outMaterialSpecTxt.Text = string.Empty;
outMaterialNameTxt.Text = string.Empty;
txtOutBox.Text = string.Empty;
txtOutBox.Focus();
return;
}
#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.applyDate = DateTime.Now;
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
{
scanOutMsg.Text = "该条码的销售订单不正确";
txtOutScan.Text = string.Empty;
txtOutBarCode.Text = string.Empty;
outMaterialSpecTxt.Text = string.Empty;
outMaterialNameTxt.Text = string.Empty;
txtOutBox.Text = string.Empty;
txtOutBox.Focus();
return;
}
}
scanOutMsg.Text = "出库成功!";

Loading…
Cancel
Save