@ -1343,6 +1343,7 @@ namespace ICSSoft.DataProject
//出库条码
else if ( isOut )
{
if ( ScanType = = "LOTNO" )
{
sql = @ "IF NOT EXISTS(SELECT a.ID FROM ICSWareHouseLotInfo a WHERE a.LotNo='{2}' AND a.WorkPoint='{3}' AND a.Quantity>0)
@ -1415,6 +1416,7 @@ namespace ICSSoft.DataProject
LEFT JOIN ICSInventoryBatchEnable invBat ON a . InvCode = invBat . InvCode AND a . WarehouseCode = invBat . WHCode AND a . WorkPoint = invBat . WorkPoint
";
}
}
//入库条码
@ -1513,88 +1515,115 @@ namespace ICSSoft.DataProject
#region 出库检验是否符合源头单据
string msg = string . Empty ;
bool isLimit = false ;
if ( isOut & & TransType ! = TransTypeEnum . TransferLibrary . GetDescription ( ) ) // && TransType != TransTypeEnum.LOTSplit.GetDescription()
if ( isOut & & TransType ! = TransTypeEnum . TransferLibrary . GetDescription ( ) ) // && TransType != TransTypeEnum.LOTSplit.GetDescription()
{
if ( string . IsNullOrEmpty ( JsonData . TransCode ) )
{
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo001" ) ) ; //"单据号不能为空!"
}
WMSSourceDocumentModel model = new WMSSourceDocumentModel ( ) ;
model . TransCode = JsonData . TransCode ;
model . TransType = JsonData . TransType ;
model . WorkPoint = JsonData . WorkPoint ;
DataTable TransData = TransInformationGet ( model ) ;
DataView dataView = TransData . DefaultView ;
foreach ( DataRow drLot in table . Rows )
{
string Lot = drLot [ "LotNo" ] . ToString ( ) ;
//盘点不需要对比以下属性
if ( TransType = = TransTypeEnum . Check . GetDescription ( ) )
continue ;
//string Lot ="";
//if (TransType == TransTypeEnum.TransferLibrary.GetDescription())
//{
// foreach (DataRow drLot in table.Rows)
// {
// Lot = drLot["LotNo"].ToString();
// string sql = @"SELECT WarehouseCode FROM ICSWareHouseLotInfo a WHERE LotNo='{0}' AND WorkPoint='{1}'";
// sql = string.Format(sql, Lot, WorkPoint);
// DataTable dt = DBHelper.SQlReturnData(sql, cmd);
// if (dt == null || dt.Rows.Count <= 0)
// {
// throw new Exception(string.Format(language.GetNameByCode("WMSAPIInfo171"), LotNo));
// }
// string whcode = dt.Rows[0]["WarehouseCode"].ToString();
// IF("+whcode+@" != '{8}')
//BEGIN
// RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo394"), "{8}",whcode) + @"', 16, 1);
// RETURN
// END
// }
string rowFilter = "InvCode='" + drLot [ "InvCode" ] + "'" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo041" ) , Lot , drLot [ "InvCode" ] ) ) ;
rowFilter + = " AND (LEN(ISNULL(WHCode,''))<=0 OR (LEN(ISNULL(WHCode,''))>0 AND WHCode='" + drLot [ "WHCode" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo042" ) , Lot , drLot [ "WHCode" ] ) ) ;
rowFilter + = " AND (LEN(ISNULL(ProjectCode,''))<=0 OR (LEN(ISNULL(ProjectCode,''))>0 AND ProjectCode='" + drLot [ "ProjectCode" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo043" ) , Lot , drLot [ "ProjectCode" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(BatchCode,''))<=0 OR (LEN(ISNULL(BatchCode,''))>0 AND BatchCode='" + drLot [ "BatchCode" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo044" ) , Lot , drLot [ "BatchCode" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(Version,''))<=0 OR (LEN(ISNULL(Version,''))>0 AND Version='" + drLot [ "Version" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo045" ) , Lot , drLot [ "Version" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(Brand,''))<=0 OR (LEN(ISNULL(Brand,''))>0 AND Brand='" + drLot [ "Brand" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo046" ) , Lot , drLot [ "Brand" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree1,''))<=0 OR (LEN(ISNULL(cFree1,''))>0 AND cFree1='" + drLot [ "cFree1" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo047" ) , Lot , drLot [ "cFree1" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree2,''))<=0 OR (LEN(ISNULL(cFree2,''))>0 AND cFree2='" + drLot [ "cFree2" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo048" ) , Lot , drLot [ "cFree2" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree3,''))<=0 OR (LEN(ISNULL(cFree3,''))>0 AND cFree3='" + drLot [ "cFree3" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo049" ) , Lot , drLot [ "cFree3" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree4,''))<=0 OR (LEN(ISNULL(cFree4,''))>0 AND cFree4='" + drLot [ "cFree4" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo050" ) , Lot , drLot [ "cFree4" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree5,''))<=0 OR (LEN(ISNULL(cFree5,''))>0 AND cFree5='" + drLot [ "cFree5" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo051" ) , Lot , drLot [ "cFree5" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree6,''))<=0 OR (LEN(ISNULL(cFree6,''))>0 AND cFree6='" + drLot [ "cFree6" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo052" ) , Lot , drLot [ "cFree6" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree7,''))<=0 OR (LEN(ISNULL(cFree7,''))>0 AND cFree7='" + drLot [ "cFree7" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo053" ) , Lot , drLot [ "cFree7" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree8,''))<=0 OR (LEN(ISNULL(cFree8,''))>0 AND cFree8='" + drLot [ "cFree8" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo054" ) , Lot , drLot [ "cFree8" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree9,''))<=0 OR (LEN(ISNULL(cFree9,''))>0 AND cFree9='" + drLot [ "cFree9" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo055" ) , Lot , drLot [ "cFree9" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree10,''))<=0 OR (LEN(ISNULL(cFree10,''))>0 AND cFree10='" + drLot [ "cFree10" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo056" ) , Lot , drLot [ "cFree10" ] ) ) ;
//保质期管理
var resultEffective = Effective ( Lot , JsonData . WorkPoint , cmd , language ) ;
//0 - 已经是最早的批次
//1 - 不管控
//2 - 提醒
//3 - 限制
if ( resultEffective = = "2" )
{
msg + = string . Format ( language . GetNameByCode ( "WMSAPIInfo181" ) , Lot ) + Environment . NewLine ;
}
else if ( resultEffective = = "3" )
{
msg + = string . Format ( language . GetNameByCode ( "WMSAPIInfo182" ) , Lot ) + Environment . NewLine ;
isLimit = true ;
}
//先进先出判断
var result = CanOut ( Lot , JsonData . WorkPoint , JsonData . ScanLotCode , cmd , language ) ;
//0 - 已经是最早的批次
//1 - 不管控
//2 - 提醒
//3 - 限制
if ( result = = "2" )
//}
//else
//{
if ( string . IsNullOrEmpty ( JsonData . TransCode ) )
{
msg + = string . Format ( language . GetNameByCode ( "WMSAPIInfo178 " ) , Lot ) + Environment . NewLine ;
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo001" ) ) ; //"单据号不能为空!"
}
else if ( result = = "3" )
WMSSourceDocumentModel model = new WMSSourceDocumentModel ( ) ;
model . TransCode = JsonData . TransCode ;
model . TransType = JsonData . TransType ;
model . WorkPoint = JsonData . WorkPoint ;
DataTable TransData = TransInformationGet ( model ) ;
DataView dataView = TransData . DefaultView ;
foreach ( DataRow drLot in table . Rows )
{
msg + = string . Format ( language . GetNameByCode ( "WMSAPIInfo179" ) , Lot ) + Environment . NewLine ;
isLimit = true ;
string Lot = drLot [ "LotNo" ] . ToString ( ) ;
//盘点不需要对比以下属性
if ( TransType = = TransTypeEnum . Check . GetDescription ( ) )
continue ;
string rowFilter = "InvCode='" + drLot [ "InvCode" ] + "'" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo041" ) , Lot , drLot [ "InvCode" ] ) ) ;
rowFilter + = " AND (LEN(ISNULL(WHCode,''))<=0 OR (LEN(ISNULL(WHCode,''))>0 AND WHCode='" + drLot [ "WHCode" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo042" ) , Lot , drLot [ "WHCode" ] ) ) ;
rowFilter + = " AND (LEN(ISNULL(ProjectCode,''))<=0 OR (LEN(ISNULL(ProjectCode,''))>0 AND ProjectCode='" + drLot [ "ProjectCode" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo043" ) , Lot , drLot [ "ProjectCode" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(BatchCode,''))<=0 OR (LEN(ISNULL(BatchCode,''))>0 AND BatchCode='" + drLot [ "BatchCode" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo044" ) , Lot , drLot [ "BatchCode" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(Version,''))<=0 OR (LEN(ISNULL(Version,''))>0 AND Version='" + drLot [ "Version" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo045" ) , Lot , drLot [ "Version" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(Brand,''))<=0 OR (LEN(ISNULL(Brand,''))>0 AND Brand='" + drLot [ "Brand" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo046" ) , Lot , drLot [ "Brand" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree1,''))<=0 OR (LEN(ISNULL(cFree1,''))>0 AND cFree1='" + drLot [ "cFree1" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo047" ) , Lot , drLot [ "cFree1" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree2,''))<=0 OR (LEN(ISNULL(cFree2,''))>0 AND cFree2='" + drLot [ "cFree2" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo048" ) , Lot , drLot [ "cFree2" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree3,''))<=0 OR (LEN(ISNULL(cFree3,''))>0 AND cFree3='" + drLot [ "cFree3" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo049" ) , Lot , drLot [ "cFree3" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree4,''))<=0 OR (LEN(ISNULL(cFree4,''))>0 AND cFree4='" + drLot [ "cFree4" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo050" ) , Lot , drLot [ "cFree4" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree5,''))<=0 OR (LEN(ISNULL(cFree5,''))>0 AND cFree5='" + drLot [ "cFree5" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo051" ) , Lot , drLot [ "cFree5" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree6,''))<=0 OR (LEN(ISNULL(cFree6,''))>0 AND cFree6='" + drLot [ "cFree6" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo052" ) , Lot , drLot [ "cFree6" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree7,''))<=0 OR (LEN(ISNULL(cFree7,''))>0 AND cFree7='" + drLot [ "cFree7" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo053" ) , Lot , drLot [ "cFree7" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree8,''))<=0 OR (LEN(ISNULL(cFree8,''))>0 AND cFree8='" + drLot [ "cFree8" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo054" ) , Lot , drLot [ "cFree8" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree9,''))<=0 OR (LEN(ISNULL(cFree9,''))>0 AND cFree9='" + drLot [ "cFree9" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo055" ) , Lot , drLot [ "cFree9" ] ) ) ;
rowFilter + = "AND (LEN(ISNULL(cFree10,''))<=0 OR (LEN(ISNULL(cFree10,''))>0 AND cFree10='" + drLot [ "cFree10" ] + "'))" ;
CheckTrans ( dataView , rowFilter , string . Format ( language . GetNameByCode ( "WMSAPIInfo056" ) , Lot , drLot [ "cFree10" ] ) ) ;
//保质期管理
var resultEffective = Effective ( Lot , JsonData . WorkPoint , cmd , language ) ;
//0 - 已经是最早的批次
//1 - 不管控
//2 - 提醒
//3 - 限制
if ( resultEffective = = "2" )
{
msg + = string . Format ( language . GetNameByCode ( "WMSAPIInfo181" ) , Lot ) + Environment . NewLine ;
}
else if ( resultEffective = = "3" )
{
msg + = string . Format ( language . GetNameByCode ( "WMSAPIInfo182" ) , Lot ) + Environment . NewLine ;
isLimit = true ;
}
//先进先出判断
var result = CanOut ( Lot , JsonData . WorkPoint , JsonData . ScanLotCode , cmd , language ) ;
//0 - 已经是最早的批次
//1 - 不管控
//2 - 提醒
//3 - 限制
if ( result = = "2" )
{
msg + = string . Format ( language . GetNameByCode ( "WMSAPIInfo178" ) , Lot ) + Environment . NewLine ;
}
else if ( result = = "3" )
{
msg + = string . Format ( language . GetNameByCode ( "WMSAPIInfo179" ) , Lot ) + Environment . NewLine ;
isLimit = true ;
}
}
}
//}
}
#endregion
//return table;
@ -4975,7 +5004,7 @@ namespace ICSSoft.DataProject
#region 更新库存
if ( item . UpdateWHLI )
{
ICSWareHouseLotInfoService . WareHouseLotInfoUpdate ( Identification , item . CheckCode , "" , itemInfo . LotNo , itemInfo . ActualQuantity , item . User , item . WorkPoint , "9" , cmd , language ) ;
ICSWareHouseLotInfoService . WareHouseLotInfoUpdate ( Identification , item . CheckCode , "" , itemInfo . LotNo , itemInfo . ActualQuantity , item . User , item . WorkPoint , "9" , item . CheckKind , cmd , language ) ;
}
#endregion
lots + = "'" + itemInfo . LotNo + item . WorkPoint + "'," ;