@ -2264,11 +2264,15 @@ namespace Khd.Core.Wpf.Form
decimal amount = decimal . Parse ( txtInScan . Text ) ;
decimal orderAmount = decimal . Parse ( orderNumText . Text ) ;
decimal stockAmount = decimal . Parse ( stockNumText . Text ) ;
if ( amount + stockAmount > orderAmount ) //输入数量与库存数之和不能大于收料通知单数量
if ( ! orderNumText . Text . Equals ( "无收料通知单" ) )
{
HandyControl . Controls . MessageBox . Error ( "入库数量不能超过收料通知单数量" ) ;
return ;
if ( amount + stockAmount > orderAmount ) //输入数量与此收料通知单已入库存数之和不能大于收料通知单数量
{
HandyControl . Controls . MessageBox . Error ( "入库数量不能超过收料通知单数量" ) ;
return ;
}
}
// 计算入库后当前总数量,仅用来提示使用
decimal? totalMessage = 0 ;
if ( amount < = 0 )
@ -2327,15 +2331,15 @@ namespace Khd.Core.Wpf.Form
wmsRawStock . totalAmount + = amount ;
dbContext . WmsRawStock . Update ( wmsRawStock ) ;
var mesBaseBarcodeInfo = dbContext . MesBaseBarcodeInfo . FirstOrDefault ( t = > t . barcodeInfo = = txtInBarCode . Text ) ;
//var mesBaseBarcodeInfo = dbContext.MesBaseBarcodeInfo.FirstOrDefault(t => t.barcodeInfo == txtInBarCode.Text) ;
WmsRawInstock wmsRawInstock = new WmsRawInstock ( )
{
taskCode = Global . SnowId . NextId ( ) . ToString ( ) ,
materialBarCode = m esBaseBarcodeInfo . barcodeInfo ,
materialBatchCode = m esBaseBarcodeInfo . batchCode ,
materialBarCode = m aterial . barcodeInfo ,
materialBatchCode = m aterial . batchCode ,
applyBy = "WPF" ,
applyDate = System . DateTime . Now ,
purchaseOrderId = m esBaseBarcodeInfo . PurchaseOrderId ,
purchaseOrderId = m aterial . PurchaseOrderId ,
beginTime = System . DateTime . Now ,
endTime = DateTime . Now ,
locationCode = container . locationCode ,
@ -2345,10 +2349,10 @@ namespace Khd.Core.Wpf.Form
materialId = material . materialId ,
operationType = "1" ,
palletInfoCode = container . containerCode ,
poNo = m esBaseBarcodeInfo . poNo ,
poNo = m aterial . poNo ,
warehouseId = 512 ,
tips = this . txtInStoreRemark . Text ,
receiveBillId = material . receiveBillId
receiveBillId = ( long ) material . receiveBillId
} ;
dbContext . Add ( wmsRawInstock ) ;
@ -2403,7 +2407,8 @@ namespace Khd.Core.Wpf.Form
palletInfoCode = container . containerCode ,
poNo = mesBaseBarcodeInfo . poNo ,
warehouseId = 512 ,
tips = this . txtInStoreRemark . Text
tips = this . txtInStoreRemark . Text ,
receiveBillId = ( long ) material . receiveBillId
} ;
dbContext . Add ( wmsRawInstock ) ;
dbContext . SaveChanges ( ) ;
@ -2697,17 +2702,21 @@ namespace Khd.Core.Wpf.Form
if ( purchaseReceiveBill ! = null )
{
// 假设 TextBlock 的名称为 orderAmountTextBlock
orderNumText . Text = purchaseReceiveBill . Act_land_amount . ToString ( ) ;
orderNumText . Text = ( ( int ) purchaseReceiveBill . Act_land_amount ) . ToString ( ) ;
}
else
{
orderNumText . Text = "无收料通知单" ;
}
//查找 现有 库存
var raw Stock = dbContext . WmsRawS tock. FirstOrDefault ( x = > x . materialId = = material . materia lId) ;
if ( raw S tock ! = null )
//查找 入库记录中对应收料通知单已入 库存
var raw Instock = dbContext . WmsRawIns tock. FirstOrDefault ( x = > x . receiveBillId = = material . receiveBil lId) ;
if ( raw Ins tock ! = null )
{
stockNumText . Text = rawStock . totalAmount . ToString ( ) ;
stockNumText . Text = ( ( int ) rawInstock . instockAmount ) . ToString ( ) ;
}
else
{
stockNumText . Text = "0" ;
}
//显示单位信息
@ -2903,34 +2912,43 @@ namespace Khd.Core.Wpf.Form
}
else
{
var mesBaseMaterialInfo = dbContext . MesBaseBarcodeInfo . FirstOrDefault ( t = > t . barcodeInfo = = wmsRawStock . instockBatch ) ;
if ( mesBaseMaterialInfo = = null )
try
{
scanOutMsg . Text = "未查询到该条码绑定的物料信息!" ;
txtOutBarCode . Text = string . Empty ;
txtOutScan . Text = string . Empty ;
txtOutBarCode . Focus ( ) ;
}
else
{
var materialInfo = dbContext . MesBaseMaterialInfo . FirstOrDefault ( t = > t . MaterialId = = wmsRawStock . materialId ) ;
if ( materialInfo ! = null )
Console . WriteLine ( wmsRawStock . instockBatch ) ;
var mesBaseMaterialInfo = dbContext . MesBaseBarcodeInfo . FirstOrDefault ( t = > t . barcodeInfo = = wmsRawStock . instockBatch ) ;
if ( mesBaseMaterialInfo = = null )
{
outMaterialNameTxt . Text = materialInfo . MaterialName ;
outMaterialSpecTxt . Text = materialInfo . MaterialSpec ;
scanOutMsg . Text = "未查询到该条码绑定的物料信息!" ;
txtOutBarCode . Text = string . Empty ;
txtOutScan . Text = string . Empty ;
txtOutBarCode . Focus ( ) ;
}
else
{
var materialInfo = dbContext . MesBaseMaterialInfo . FirstOrDefault ( t = > t . MaterialId = = wmsRawStock . materialId ) ;
if ( materialInfo ! = null )
{
outMaterialNameTxt . Text = materialInfo . MaterialName ;
outMaterialSpecTxt . Text = materialInfo . MaterialSpec ;
}
txtTotalAmount . Text = string . Format ( "{0:0.00}" , 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;
//}
}
txtTotalAmount . Text = string . Format ( "{0:0.00}" , 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;
//}
}
catch ( Exception ex )
{
LogManager . Error ( ex ) ;
}
}
}
}
@ -2944,8 +2962,10 @@ namespace Khd.Core.Wpf.Form
}
}
}
catch
catch ( Exception ex )
{
scanOutMsg . Text = "出库条码更新刷新信息异常:" + ex ;
LogManager . Error ( ex ) ;
}
}