@ -10560,6 +10560,96 @@ END";
}
}
}
}
}
}
#region 盘点审核
/// <summary>
/// 多语言查询
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
public static DataTable CheckApove ( List < ICSCheck > JsonData )
{
var language = LanguageHelper . GetName ( "WMSAPIInfo" ) ;
if ( JsonData . Count < = 0 )
{
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo007" ) ) ; //"传送数据为空!"
}
using ( SqlConnection conn = new System . Data . SqlClient . SqlConnection ( connString ) )
{
conn . Open ( ) ;
SqlTransaction sqlTran = conn . BeginTransaction ( ) ;
SqlCommand cmd = new SqlCommand ( ) ;
cmd . Transaction = sqlTran ;
cmd . Connection = conn ;
cmd . CommandTimeout = Convert . ToInt32 ( System . Configuration . ConfigurationManager . AppSettings [ "TimeOut" ] ) ;
try
{
string lots = string . Empty ;
string sql = string . Empty ;
int result = 0 ;
string Identification = Guid . NewGuid ( ) . ToString ( ) ;
foreach ( var item in JsonData )
{
//创建盘点单
foreach ( var itemInfo in item . detail )
{
ICSWareHouseLotInfoService . WareHouseLotInfoUpdate ( Identification , item . CheckCode , "" , itemInfo . LotNo , itemInfo . ActualQuantity , item . User , item . WorkPoint , TransTypeEnum . Check . GetDescription < DBValue > ( ) , item . CheckKind , cmd , language ) ;
lots + = "'" + itemInfo . LotNo + item . WorkPoint + "'," ;
}
if ( string . IsNullOrWhiteSpace ( lots ) )
{
throw new Exception ( language . GetNameByCode ( "WMSAPIInfo005" ) ) ; //"请传入条码信息!");
}
//sql = @"UPDATE a SET ActualQuantity=b.ActualQuantity
// FROM ICSCheck a
// INNER JOIN (SELECT x.CheckCode,x.WorkPoint,y.WarehouseCode,y.InvCode,SUM(ActualQuantity) AS ActualQuantity FROM ICSCheckDetail x INNER JOIN ICSWareHouseLotInfo y ON x.LotNo=y.LotNo AND x.WorkPoint=y.WorkPoint WHERE x.LotNo+x.WorkPoint IN ({2}) GROUP BY x.CheckCode,x.WorkPoint,y.WarehouseCode,y.InvCode) b ON a.CheckCode=b.CheckCode AND a.WorkPoint=b.WorkPoint AND a.WHCode=b.WarehouseCode AND a.InvCode=b.InvCode
// WHERE a.CheckCode='{0}' and a.WorkPoint='{1}'";
//sql = string.Format(sql, item.CheckCode, item.WorkPoint, lots.Substring(0, lots.Length - 1));
//if (!DBHelper.ExecuteNonQuery(sql, cmd))
//{
// throw new Exception(language.GetNameByCode("WMSAPIInfo034"));//"盘点扫描更新盘点单失败!");
//}
}
#region 查询返回数据
sql = @ "SELECT x.ID,x.CheckID,y.WarehouseCode AS WHCode,x.LotNo,
y . InvCode ,
inv . InvName ,
inv . InvStd ,
x . Quantity , x . PrimaryQuantity , x . PrimaryAmount , x . ReplayQuantity , x . ReplayAmount , x . CheckQuantity , x . CheckAmount ,
inv . InvUnit ,
x . MUSER AS [ User ] ,
x . MTIME AS [ MTime ]
FROM ICSCheckDetail x
INNER JOIN ICSWareHouseLotInfo y ON x . LotNo = y . LotNo AND x . WorkPoint = y . WorkPoint
INNER JOIN ICSInventory inv ON y . InvCode = inv . InvCode AND y . WorkPoint = inv . WorkPoint
WHERE x . LotNo + x . WorkPoint IN ( { 0 } ) ";
sql = string . Format ( sql , lots . Substring ( 0 , lots . Length - 1 ) ) ;
DataTable data = DBHelper . SQlReturnData ( sql , cmd ) ;
#endregion
cmd . Transaction . Commit ( ) ;
return data ;
}
catch ( Exception ex )
{
if ( cmd . Transaction ! = null )
cmd . Transaction . Rollback ( ) ;
log . Error ( ex . Message ) ;
throw new Exception ( ex . Message ) ;
}
finally
{
if ( conn . State = = ConnectionState . Open )
{
conn . Close ( ) ;
}
conn . Dispose ( ) ;
}
}
}
#endregion
/// <summary>
/// <summary>
/// 容器关联查询容器
/// 容器关联查询容器
/// </summary>
/// </summary>