@ -88,7 +88,7 @@ namespace ICSSoft.DataProject
string sql = @ "SELECT y.DepCode+a.FromWarehouseCode+y.OOCode+a.MUSER AS Costre,y.DepCode,a.FromWarehouseCode AS WarehouseCode,y.OOCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY y.DepCode,a.FromWarehouseCode,y.OOCode,x.PickID,a.InvCode) AS Sequence,
a . InvCode , SUM ( a . Quantity ) AS Quantity , SUM ( a . Quantity ) * ( lot . Amount / lot . Quantity ) AS Amount , x . PickID , con . Enable AS UpdateTodoQuantity
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , conv . Enable AS CompleteVerification
INTO # TempERP
FROM ICSWareHouseLotInfoLog a
INNER JOIN ICSInventoryLot lot ON a . LotNo = lot . LotNo AND a . WorkPoint = lot . WorkPoint
@ -98,12 +98,13 @@ namespace ICSSoft.DataProject
INNER JOIN ICSOutsourcingOrder y ON a . TransCode = y . OOCode AND a . WorkPoint = y . WorkPoint
INNER JOIN ICSOOPick x ON x . OODetailID = y . OODetailID AND a . TransSequence = y . Sequence + '~' + x . Sequence AND x . WorkPoint = y . WorkPoint
INNER JOIN ICSConfiguration con ON con . Code = ' Stock002 ' AND a . WorkPoint = con . WorkPoint
INNER JOIN ICSConfiguration conv ON conv . Code = ' CompleteVerification ' AND a . WorkPoint = conv . WorkPoint
WHERE a . Identification = ' { 0 } ' AND ERPUpload = '0' AND ( a . BusinessCode = '5' OR a . BusinessCode = ' 1 0 5 ' )
GROUP BY y . DepCode , a . FromWarehouseCode , y . OOCode , a . MUSER , a . InvCode , lot . Amount , lot . Quantity , x . PickID , x . OODetailID , con . Enable
GROUP BY y . DepCode , a . FromWarehouseCode , y . OOCode , a . MUSER , a . InvCode , lot . Amount , lot . Quantity , x . PickID , x . OODetailID , con . Enable , conv . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , ISNULL ( ext . Version , ' ' ) , ISNULL ( ext . Brand , ' ' ) ,
ISNULL ( ext . cFree1 , ' ' ) , ISNULL ( ext . cFree2 , ' ' ) , ISNULL ( ext . cFree3 , ' ' ) , ISNULL ( ext . cFree4 , ' ' ) , ISNULL ( ext . cFree5 , ' ' ) , ISNULL ( ext . cFree6 , ' ' ) , ISNULL ( ext . cFree7 , ' ' ) , ISNULL ( ext . cFree8 , ' ' ) , ISNULL ( ext . cFree9 , ' ' ) , ISNULL ( ext . cFree10 , ' ' )
SELECT DISTINCT Costre , WorkPoint , DepCode , WarehouseCode AS WHCode , ' 委 外 订 单 ' AS SourceType , OOCode AS SourceCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity FROM # TempERP
SELECT DISTINCT Costre , WorkPoint , DepCode , WarehouseCode AS WHCode , ' 委 外 订 单 ' AS SourceType , OOCode AS SourceCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity , CompleteVerification FROM # TempERP
SELECT Costre , Sequence , InvCode , Quantity , Amount , PickID AS SourceDetailID , ProjectCode , BatchCode , Version , Brand , cFree1 , cFree2 , cFree3 , cFree4 , cFree5 , cFree6 , cFree7 , cFree8 , cFree9 , cFree10 FROM # TempERP
DROP TABLE # TempERP ";
@ -213,9 +214,9 @@ namespace ICSSoft.DataProject
{
#region ERP
string sql = @ "SELECT a.FromWarehouseCode+b.ApplyCode+a.MUSER AS Costre,a.FromWarehouseCode AS WarehouseCode,b.ApplyCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY a.FromWarehouseCode,b.ApplyCode,b.ApplyDetailID,a.InvCode) AS Sequence,
a . InvCode , SUM ( a . Quantity ) AS Quantity , SUM ( a . Quantity ) * ( lot . Amount / lot . Quantity ) AS Amount , b . ApplyDetailID , Enable AS UpdateTodoQuantity
a . InvCode , SUM ( a . Quantity ) AS Quantity , SUM ( a . Quantity ) * ( lot . Amount / lot . Quantity ) AS Amount , b . ApplyDetailID , con . Enable AS UpdateTodoQuantity
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , conv . Enable AS CompleteVerification
INTO # TempERP
FROM ICSWareHouseLotInfoLog a
INNER JOIN ICSInventoryLot lot ON a . LotNo = lot . LotNo AND a . WorkPoint = lot . WorkPoint
@ -224,12 +225,13 @@ namespace ICSSoft.DataProject
LEFT JOIN ICSInventoryBatchEnable invBat ON a . InvCode = invBat . InvCode AND a . FromWarehouseCode = invBat . WHCode AND a . WorkPoint = invBat . WorkPoint
INNER JOIN ICSOApply b ON a . TransCode = b . ApplyCode AND a . TransSequence = b . Sequence AND a . WorkPoint = b . WorkPoint
INNER JOIN ICSConfiguration con ON con . Code = ' Stock002 ' AND a . WorkPoint = con . WorkPoint
INNER JOIN ICSConfiguration conv ON conv . Code = ' CompleteVerification ' AND a . WorkPoint = conv . WorkPoint
WHERE a . Identification = ' { 0 } ' AND ERPUpload = '0' AND ( a . BusinessCode = '6' OR a . BusinessCode = ' 1 0 5 ' )
GROUP BY a . FromWarehouseCode , b . ApplyCode , a . MUSER , a . InvCode , lot . Amount , lot . Quantity , b . ApplyDetailID , Enable
GROUP BY a . FromWarehouseCode , b . ApplyCode , a . MUSER , a . InvCode , lot . Amount , lot . Quantity , b . ApplyDetailID , con . Enable , conv . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , ISNULL ( ext . Version , ' ' ) , ISNULL ( ext . Brand , ' ' ) ,
ISNULL ( ext . cFree1 , ' ' ) , ISNULL ( ext . cFree2 , ' ' ) , ISNULL ( ext . cFree3 , ' ' ) , ISNULL ( ext . cFree4 , ' ' ) , ISNULL ( ext . cFree5 , ' ' ) , ISNULL ( ext . cFree6 , ' ' ) , ISNULL ( ext . cFree7 , ' ' ) , ISNULL ( ext . cFree8 , ' ' ) , ISNULL ( ext . cFree9 , ' ' ) , ISNULL ( ext . cFree10 , ' ' )
SELECT DISTINCT Costre , WorkPoint , ' ' AS DepCode , WarehouseCode AS WHCode , ' 委 外 领 料 申 请 单 ' AS SourceType , ApplyCode AS SourceCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity FROM # TempERP
SELECT DISTINCT Costre , WorkPoint , ' ' AS DepCode , WarehouseCode AS WHCode , ' 委 外 领 料 申 请 单 ' AS SourceType , ApplyCode AS SourceCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity , CompleteVerification FROM # TempERP
SELECT Costre , Sequence , InvCode , Quantity , Amount , ApplyDetailID AS SourceDetailID , ProjectCode , BatchCode , Version , Brand , cFree1 , cFree2 , cFree3 , cFree4 , cFree5 , cFree6 , cFree7 , cFree8 , cFree9 , cFree10 FROM # TempERP
DROP TABLE # TempERP ";
@ -517,9 +519,9 @@ namespace ICSSoft.DataProject
if ( TransType = = TransTypeEnum . ICSOutsourcingIssueDoNegative . GetDescription ( ) )
{
sql = @ "SELECT y.DepCode+a.ToWarehouseCode+y.OOCode+a.MUSER AS Costre,y.DepCode,a.ToWarehouseCode AS WarehouseCode,y.OOCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY y.DepCode,a.ToWarehouseCode,y.OOCode,x.PickID,a.InvCode) AS Sequence,
a . InvCode , SUM ( a . Quantity ) AS Quantity , SUM ( a . Quantity ) * ( lot . Amount / lot . Quantity ) AS Amount , x . PickID AS SourceDetailID , Enable AS UpdateTodoQuantity
a . InvCode , SUM ( a . Quantity ) AS Quantity , SUM ( a . Quantity ) * ( lot . Amount / lot . Quantity ) AS Amount , x . PickID AS SourceDetailID , con . Enable AS UpdateTodoQuantity
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , con . Enable AS Enable
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , conv . Enable AS CompleteVerification
INTO # TempERP
FROM ICSWareHouseLotInfoLog a
INNER JOIN ICSInventoryLot lot ON a . LotNo = lot . LotNo AND a . WorkPoint = lot . WorkPoint
@ -531,15 +533,16 @@ namespace ICSSoft.DataProject
INNER JOIN ICSOOPick x ON c . SourceDetailID = x . PickID AND c . WorkPoint = x . WorkPoint
INNER JOIN ICSOutsourcingOrder y ON x . OODetailID = y . OODetailID AND x . WorkPoint = y . WorkPoint
INNER JOIN ICSConfiguration con ON con . Code = ' Stock001 ' AND a . WorkPoint = con . WorkPoint
INNER JOIN ICSConfiguration conv ON conv . Code = ' CompleteVerification ' AND a . WorkPoint = conv . WorkPoint
WHERE a . Identification = ' { 0 } ' AND a . ERPUpload = '0' AND ISNULL ( a . LogID , ' ' ) = ' '
GROUP BY y . DepCode , a . ToWarehouseCode , y . OOCode , a . MUSER , a . InvCode , lot . Amount , lot . Quantity , x . PickID , Enable
GROUP BY y . DepCode , a . ToWarehouseCode , y . OOCode , a . MUSER , a . InvCode , lot . Amount , lot . Quantity , x . PickID , con . Enable , conv . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , ISNULL ( ext . Version , ' ' ) , ISNULL ( ext . Brand , ' ' ) ,
ISNULL ( ext . cFree1 , ' ' ) , ISNULL ( ext . cFree2 , ' ' ) , ISNULL ( ext . cFree3 , ' ' ) , ISNULL ( ext . cFree4 , ' ' ) , ISNULL ( ext . cFree5 , ' ' ) , ISNULL ( ext . cFree6 , ' ' ) , ISNULL ( ext . cFree7 , ' ' ) , ISNULL ( ext . cFree8 , ' ' ) , ISNULL ( ext . cFree9 , ' ' ) , ISNULL ( ext . cFree10 , ' ' )
UNION ALL
SELECT y . DepCode + a . ToWarehouseCode + y . OOCode + a . MUSER AS Costre , y . DepCode , a . ToWarehouseCode AS WarehouseCode , y . OOCode , a . MUSER , ROW_NUMBER ( ) OVER ( ORDER BY y . DepCode , a . ToWarehouseCode , y . OOCode , x . PickID , a . InvCode ) AS Sequence ,
a . InvCode , SUM ( a . Quantity ) AS Quantity , 0 AS Amount , x . PickID AS SourceDetailID , Enable AS UpdateTodoQuantity
a . InvCode , SUM ( a . Quantity ) AS Quantity , 0 AS Amount , x . PickID AS SourceDetailID , con . Enable AS UpdateTodoQuantity
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , conv . Enable AS CompleteVerification
FROM ICSWareHouseLotInfoLog a
INNER JOIN ICSInventoryLot lot ON a . LotNo = lot . LotNo AND a . WorkPoint = lot . WorkPoint
INNER JOIN ICSExtension ext ON lot . ExtensionID = ext . ID AND lot . WorkPoint = ext . WorkPoint
@ -549,12 +552,13 @@ namespace ICSSoft.DataProject
INNER JOIN ICSOutsourcingOrder y ON b . TransCode = y . OOCode AND b . WorkPoint = y . WorkPoint
INNER JOIN ICSOOPick x ON x . OODetailID = y . OODetailID AND x . WorkPoint = y . WorkPoint AND b . TransSequence = y . Sequence + '~' + x . Sequence
INNER JOIN ICSConfiguration con ON con . Code = ' Stock001 ' AND a . WorkPoint = con . WorkPoint
INNER JOIN ICSConfiguration conv ON conv . Code = ' CompleteVerification ' AND a . WorkPoint = conv . WorkPoint
WHERE a . Identification = ' { 0 } ' AND a . ERPUpload = '0' AND ISNULL ( a . LogID , ' ' ) < > ' '
GROUP BY y . DepCode , a . ToWarehouseCode , y . OOCode , a . MUSER , a . InvCode , x . PickID , Enable
GROUP BY y . DepCode , a . ToWarehouseCode , y . OOCode , a . MUSER , a . InvCode , x . PickID , con . Enable , conv . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , ISNULL ( ext . Version , ' ' ) , ISNULL ( ext . Brand , ' ' ) ,
ISNULL ( ext . cFree1 , ' ' ) , ISNULL ( ext . cFree2 , ' ' ) , ISNULL ( ext . cFree3 , ' ' ) , ISNULL ( ext . cFree4 , ' ' ) , ISNULL ( ext . cFree5 , ' ' ) , ISNULL ( ext . cFree6 , ' ' ) , ISNULL ( ext . cFree7 , ' ' ) , ISNULL ( ext . cFree8 , ' ' ) , ISNULL ( ext . cFree9 , ' ' ) , ISNULL ( ext . cFree10 , ' ' )
SELECT DISTINCT Costre , WorkPoint , DepCode , WarehouseCode AS WHCode , ' 委 外 订 单 ' AS SourceType , OOCode AS SourceCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity , Enable AS CompleteVerification FROM # TempERP
SELECT DISTINCT Costre , WorkPoint , DepCode , WarehouseCode AS WHCode , ' 委 外 订 单 ' AS SourceType , OOCode AS SourceCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity , CompleteVerification FROM # TempERP
SELECT Costre , Sequence , InvCode , Quantity , Amount , SourceDetailID , ProjectCode , BatchCode , Version , Brand , cFree1 , cFree2 , cFree3 , cFree4 , cFree5 , cFree6 , cFree7 , cFree8 , cFree9 , cFree10 FROM # TempERP
DROP TABLE # TempERP ";
@ -562,9 +566,9 @@ namespace ICSSoft.DataProject
else if ( TransType = = TransTypeEnum . ICSOutsourcingIssueDoNegativeApply . GetDescription ( ) )
{
sql = @ "SELECT a.ToWarehouseCode+z.ApplyCode+a.MUSER AS Costre,'' AS DepCode,a.ToWarehouseCode AS WarehouseCode,z.ApplyCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY a.ToWarehouseCode,z.ApplyCode,z.ApplyDetailID,a.InvCode) AS Sequence,
a . InvCode , SUM ( a . Quantity ) AS Quantity , 0 AS Amount , z . ApplyDetailID AS SourceDetailID , Enable AS UpdateTodoQuantity
a . InvCode , SUM ( a . Quantity ) AS Quantity , 0 AS Amount , z . ApplyDetailID AS SourceDetailID , con . Enable AS UpdateTodoQuantity
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , con . Enable AS Enable
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , conv . Enable AS CompleteVerification
INTO # TempERP
FROM ICSWareHouseLotInfoLog a
INNER JOIN ICSInventoryLot lot ON a . LotNo = lot . LotNo AND a . WorkPoint = lot . WorkPoint
@ -575,15 +579,16 @@ namespace ICSSoft.DataProject
INNER JOIN ICSOApplyNegDetail c ON b . TransCode = c . OApplyNegCode AND b . TransSequence = c . Sequence AND b . WorkPoint = c . WorkPoint
INNER JOIN ICSOApply z ON c . SourceDetailID = z . ApplyDetailID AND c . WorkPoint = z . WorkPoint
INNER JOIN ICSConfiguration con ON con . Code = ' Stock001 ' AND a . WorkPoint = con . WorkPoint
INNER JOIN ICSConfiguration conv ON conv . Code = ' CompleteVerification ' AND a . WorkPoint = conv . WorkPoint
WHERE a . Identification = ' { 0 } ' AND a . ERPUpload = '0' AND ISNULL ( a . LogID , ' ' ) = ' '
GROUP BY a . ToWarehouseCode , z . ApplyCode , a . MUSER , a . InvCode , z . ApplyDetailID , Enable
GROUP BY a . ToWarehouseCode , z . ApplyCode , a . MUSER , a . InvCode , z . ApplyDetailID , con . Enable , conv . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , ISNULL ( ext . Version , ' ' ) , ISNULL ( ext . Brand , ' ' ) ,
ISNULL ( ext . cFree1 , ' ' ) , ISNULL ( ext . cFree2 , ' ' ) , ISNULL ( ext . cFree3 , ' ' ) , ISNULL ( ext . cFree4 , ' ' ) , ISNULL ( ext . cFree5 , ' ' ) , ISNULL ( ext . cFree6 , ' ' ) , ISNULL ( ext . cFree7 , ' ' ) , ISNULL ( ext . cFree8 , ' ' ) , ISNULL ( ext . cFree9 , ' ' ) , ISNULL ( ext . cFree10 , ' ' )
UNION ALL
SELECT a . ToWarehouseCode + z . ApplyCode + a . MUSER AS Costre , ' ' AS DepCode , a . ToWarehouseCode AS WarehouseCode , z . ApplyCode , a . MUSER , ROW_NUMBER ( ) OVER ( ORDER BY a . ToWarehouseCode , z . ApplyCode , z . ApplyDetailID , a . InvCode ) AS Sequence ,
a . InvCode , SUM ( a . Quantity ) AS Quantity , 0 AS Amount , z . ApplyDetailID AS SourceDetailID , Enable AS UpdateTodoQuantity
a . InvCode , SUM ( a . Quantity ) AS Quantity , 0 AS Amount , z . ApplyDetailID AS SourceDetailID , con . Enable AS UpdateTodoQuantity
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , conv . Enable AS CompleteVerification
FROM ICSWareHouseLotInfoLog a
INNER JOIN ICSInventoryLot lot ON a . LotNo = lot . LotNo AND a . WorkPoint = lot . WorkPoint
INNER JOIN ICSExtension ext ON lot . ExtensionID = ext . ID AND lot . WorkPoint = ext . WorkPoint
@ -592,12 +597,13 @@ namespace ICSSoft.DataProject
INNER JOIN ICSWareHouseLotInfoLog b ON a . LogID = b . ID AND a . WorkPoint = b . WorkPoint
INNER JOIN ICSOApply z ON b . TransCode = z . ApplyCode AND b . TransSequence = z . Sequence AND b . WorkPoint = z . WorkPoint
INNER JOIN ICSConfiguration con ON con . Code = ' Stock001 ' AND a . WorkPoint = con . WorkPoint
INNER JOIN ICSConfiguration conv ON conv . Code = ' CompleteVerification ' AND a . WorkPoint = conv . WorkPoint
WHERE a . Identification = ' { 0 } ' AND a . ERPUpload = '0' AND ISNULL ( a . LogID , ' ' ) < > ' '
GROUP BY a . ToWarehouseCode , z . ApplyCode , a . MUSER , a . InvCode , z . ApplyDetailID , Enable
GROUP BY a . ToWarehouseCode , z . ApplyCode , a . MUSER , a . InvCode , z . ApplyDetailID , con . Enable , conv . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , ISNULL ( ext . Version , ' ' ) , ISNULL ( ext . Brand , ' ' ) ,
ISNULL ( ext . cFree1 , ' ' ) , ISNULL ( ext . cFree2 , ' ' ) , ISNULL ( ext . cFree3 , ' ' ) , ISNULL ( ext . cFree4 , ' ' ) , ISNULL ( ext . cFree5 , ' ' ) , ISNULL ( ext . cFree6 , ' ' ) , ISNULL ( ext . cFree7 , ' ' ) , ISNULL ( ext . cFree8 , ' ' ) , ISNULL ( ext . cFree9 , ' ' ) , ISNULL ( ext . cFree10 , ' ' )
SELECT DISTINCT Costre , WorkPoint , DepCode , WarehouseCode AS WHCode , ' 委 外 领 料 申 请 单 ' AS SourceType , ApplyCode AS SourceCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity , Enable AS CompleteVerification FROM # TempERP
SELECT DISTINCT Costre , WorkPoint , DepCode , WarehouseCode AS WHCode , ' 委 外 领 料 申 请 单 ' AS SourceType , ApplyCode AS SourceCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity , CompleteVerification FROM # TempERP
SELECT Costre , Sequence , InvCode , Quantity , Amount , SourceDetailID , ProjectCode , BatchCode , Version , Brand , cFree1 , cFree2 , cFree3 , cFree4 , cFree5 , cFree6 , cFree7 , cFree8 , cFree9 , cFree10 FROM # TempERP
DROP TABLE # TempERP ";
@ -606,9 +612,9 @@ namespace ICSSoft.DataProject
else if ( TransType = = TransTypeEnum . ICSOutsourcingIssueDoNegativeIssue . GetDescription ( ) )
{
sql = @ "SELECT ISNULL(y.DepCode, '')+a.ToWarehouseCode+a.MUSER AS Costre,ISNULL(y.DepCode, '') AS DepCode,a.ToWarehouseCode AS WarehouseCode,CASE WHEN m.ApplyDetailID IS NOT NULL THEN '委外领料申请单' WHEN m.PickID IS NOT NULL THEN '委外订单' ELSE '' END AS SourceType,ISNULL(z.ApplyCode, y.OOCode) AS OOCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY ISNULL(y.DepCode, ''),a.ToWarehouseCode,ISNULL(z.ApplyCode, y.OOCode),a.InvCode) AS Sequence,
a . InvCode , SUM ( a . Quantity ) AS Quantity , 0 AS Amount , ISNULL ( m . ApplyDetailID , m . PickID ) AS SourceDetailID , Enable AS UpdateTodoQuantity
a . InvCode , SUM ( a . Quantity ) AS Quantity , 0 AS Amount , ISNULL ( m . ApplyDetailID , m . PickID ) AS SourceDetailID , con . Enable AS UpdateTodoQuantity
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , con . Enable AS Enable
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , conv . Enable AS CompleteVerification
INTO # TempERP
FROM ICSWareHouseLotInfoLog a
INNER JOIN ICSInventoryLot lot ON a . LotNo = lot . LotNo AND a . WorkPoint = lot . WorkPoint
@ -622,15 +628,16 @@ namespace ICSSoft.DataProject
LEFT JOIN ICSOutsourcingOrder y ON x . OODetailID = y . OODetailID AND x . WorkPoint = y . WorkPoint
LEFT JOIN ICSOApply z ON m . ApplyDetailID = z . ApplyDetailID AND m . WorkPoint = z . WorkPoint
INNER JOIN ICSConfiguration con ON con . Code = ' Stock001 ' AND a . WorkPoint = con . WorkPoint
INNER JOIN ICSConfiguration conv ON conv . Code = ' CompleteVerification ' AND a . WorkPoint = con . WorkPoint
WHERE a . Identification = ' { 0 } ' AND a . ERPUpload = '0' AND ISNULL ( a . LogID , ' ' ) = ' '
GROUP BY ISNULL ( y . DepCode , ' ' ) , a . ToWarehouseCode , ISNULL ( z . ApplyCode , y . OOCode ) , a . MUSER , a . InvCode , m . PickID , m . ApplyDetailID , Enable
GROUP BY ISNULL ( y . DepCode , ' ' ) , a . ToWarehouseCode , ISNULL ( z . ApplyCode , y . OOCode ) , a . MUSER , a . InvCode , m . PickID , m . ApplyDetailID , con . Enable , conv . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , ISNULL ( ext . Version , ' ' ) , ISNULL ( ext . Brand , ' ' ) ,
ISNULL ( ext . cFree1 , ' ' ) , ISNULL ( ext . cFree2 , ' ' ) , ISNULL ( ext . cFree3 , ' ' ) , ISNULL ( ext . cFree4 , ' ' ) , ISNULL ( ext . cFree5 , ' ' ) , ISNULL ( ext . cFree6 , ' ' ) , ISNULL ( ext . cFree7 , ' ' ) , ISNULL ( ext . cFree8 , ' ' ) , ISNULL ( ext . cFree9 , ' ' ) , ISNULL ( ext . cFree10 , ' ' )
UNION ALL
SELECT ISNULL ( y . DepCode , ' ' ) + a . ToWarehouseCode + a . MUSER AS Costre , ISNULL ( y . DepCode , ' ' ) AS DepCode , a . ToWarehouseCode AS WarehouseCode , CASE WHEN m . ApplyDetailID IS NOT NULL THEN ' 委 外 领 料 申 请 单 ' WHEN m . PickID IS NOT NULL THEN ' 委 外 订 单 ' ELSE ' ' END AS SourceType , ISNULL ( z . ApplyCode , y . OOCode ) AS OOCode , a . MUSER , ROW_NUMBER ( ) OVER ( ORDER BY ISNULL ( y . DepCode , ' ' ) , a . ToWarehouseCode , ISNULL ( z . ApplyCode , y . OOCode ) , a . InvCode ) AS Sequence ,
a . InvCode , SUM ( a . Quantity ) AS Quantity , 0 AS Amount , ISNULL ( m . ApplyDetailID , m . PickID ) AS SourceDetailID , Enable AS UpdateTodoQuantity
a . InvCode , SUM ( a . Quantity ) AS Quantity , 0 AS Amount , ISNULL ( m . ApplyDetailID , m . PickID ) AS SourceDetailID , con . Enable AS UpdateTodoQuantity
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , conv . Enable AS CompleteVerification
FROM ICSWareHouseLotInfoLog a
INNER JOIN ICSInventoryLot lot ON a . LotNo = lot . LotNo AND a . WorkPoint = lot . WorkPoint
INNER JOIN ICSExtension ext ON lot . ExtensionID = ext . ID AND lot . WorkPoint = ext . WorkPoint
@ -642,8 +649,9 @@ namespace ICSSoft.DataProject
LEFT JOIN ICSOutsourcingOrder y ON x . OODetailID = y . OODetailID AND x . WorkPoint = y . WorkPoint
LEFT JOIN ICSOApply z ON m . ApplyDetailID = z . ApplyDetailID AND m . WorkPoint = z . WorkPoint
INNER JOIN ICSConfiguration con ON con . Code = ' Stock001 ' AND a . WorkPoint = con . WorkPoint
INNER JOIN ICSConfiguration conv ON conv . Code = ' CompleteVerification ' AND a . WorkPoint = con . WorkPoint
WHERE a . Identification = ' { 0 } ' AND a . ERPUpload = '0' AND ISNULL ( a . LogID , ' ' ) < > ' '
GROUP BY ISNULL ( y . DepCode , ' ' ) , a . ToWarehouseCode , ISNULL ( z . ApplyCode , y . OOCode ) , a . MUSER , a . InvCode , m . PickID , m . ApplyDetailID , Enable
GROUP BY ISNULL ( y . DepCode , ' ' ) , a . ToWarehouseCode , ISNULL ( z . ApplyCode , y . OOCode ) , a . MUSER , a . InvCode , m . PickID , m . ApplyDetailID , con . Enable , conv . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , ISNULL ( ext . Version , ' ' ) , ISNULL ( ext . Brand , ' ' ) ,
ISNULL ( ext . cFree1 , ' ' ) , ISNULL ( ext . cFree2 , ' ' ) , ISNULL ( ext . cFree3 , ' ' ) , ISNULL ( ext . cFree4 , ' ' ) , ISNULL ( ext . cFree5 , ' ' ) , ISNULL ( ext . cFree6 , ' ' ) , ISNULL ( ext . cFree7 , ' ' ) , ISNULL ( ext . cFree8 , ' ' ) , ISNULL ( ext . cFree9 , ' ' ) , ISNULL ( ext . cFree10 , ' ' )
@ -653,7 +661,7 @@ namespace ICSSoft.DataProject
RAISERROR ( ' " + language.GetNameByCode(" WMSAPIInfo116 ") + @" ' , 1 6 , 1 ) ;
END
SELECT DISTINCT Costre , WorkPoint , DepCode , WarehouseCode AS WHCode , SourceType , OOCode AS SourceCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity , Enable AS CompleteVerification FROM # TempERP
SELECT DISTINCT Costre , WorkPoint , DepCode , WarehouseCode AS WHCode , SourceType , OOCode AS SourceCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity , CompleteVerification FROM # TempERP
SELECT Costre , Sequence , InvCode , Quantity , Amount , SourceDetailID , ProjectCode , BatchCode , Version , Brand , cFree1 , cFree2 , cFree3 , cFree4 , cFree5 , cFree6 , cFree7 , cFree8 , cFree9 , cFree10 FROM # TempERP
DROP TABLE # TempERP ";
@ -860,7 +868,7 @@ namespace ICSSoft.DataProject
string sql = @ "SELECT c.VenCode+a.ToWarehouseCode+c.OOCode+a.MUSER+f.ODNCode AS Costre,c.VenCode,a.ToWarehouseCode AS WarehouseCode,c.OOCode,f.ODNCode,a.MUSER,f.Sequence AS ODNSequence,ROW_NUMBER() OVER (ORDER BY c.VenCode,a.ToWarehouseCode,c.OOCode,c.OODetailID,a.InvCode) AS Sequence,
a . InvCode , SUM ( a . Quantity ) AS Quantity , SUM ( a . Quantity ) * ( lot . Amount / lot . Quantity ) AS Amount , isnull ( ( c . UnitPrice ) , 0 ) as UnitPrice , c . Currency , c . OODetailID , con . Enable AS UpdateTodoQuantity , conn . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , con . Enable AS Enable
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , conv . Enable AS CompleteVerification
INTO # TempERP
FROM ICSWareHouseLotInfoLog a
INNER JOIN ICSInventoryLot lot ON a . LotNo = lot . LotNo AND a . WorkPoint = lot . WorkPoint
@ -873,12 +881,13 @@ namespace ICSSoft.DataProject
INNER JOIN ICSOutsourcingOrder c ON b . TransCode = c . OOCode AND b . TransSequence = c . Sequence AND f . OODetailID = c . OODetailID AND b . WorkPoint = c . WorkPoint
INNER JOIN ICSConfiguration con ON con . Code = ' Stock001 ' AND a . WorkPoint = con . WorkPoint
INNER JOIN ICSConfiguration conn ON con . WorkPoint = conn . WorkPoint AND conn . Code = ' Escrow001 '
INNER JOIN ICSConfiguration conv ON conv . Code = ' CompleteVerification ' AND a . WorkPoint = conv . WorkPoint
WHERE a . Identification = ' { 0 } ' AND ERPUpload = '0'
GROUP BY c . VenCode , a . ToWarehouseCode , c . OOCode , a . MUSER , lot . Amount , lot . Quantity , f . ODNCode , f . Sequence , a . InvCode , c . OODetailID , isnull ( ( c . UnitPrice ) , 0 ) , c . Currency , con . Enable , conn . Enable
GROUP BY c . VenCode , a . ToWarehouseCode , c . OOCode , a . MUSER , lot . Amount , lot . Quantity , f . ODNCode , f . Sequence , a . InvCode , c . OODetailID , isnull ( ( c . UnitPrice ) , 0 ) , c . Currency , con . Enable , conn . Enable , conv . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , ISNULL ( ext . Version , ' ' ) , ISNULL ( ext . Brand , ' ' ) ,
ISNULL ( ext . cFree1 , ' ' ) , ISNULL ( ext . cFree2 , ' ' ) , ISNULL ( ext . cFree3 , ' ' ) , ISNULL ( ext . cFree4 , ' ' ) , ISNULL ( ext . cFree5 , ' ' ) , ISNULL ( ext . cFree6 , ' ' ) , ISNULL ( ext . cFree7 , ' ' ) , ISNULL ( ext . cFree8 , ' ' ) , ISNULL ( ext . cFree9 , ' ' ) , ISNULL ( ext . cFree10 , ' ' )
SELECT DISTINCT Costre , WorkPoint , VenCode , WarehouseCode AS WHCode , OOCode , ODNCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , Enable , UpdateTodoQuantity FROM # TempERP
SELECT DISTINCT Costre , WorkPoint , VenCode , WarehouseCode AS WHCode , OOCode , ODNCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , Enable , UpdateTodoQuantity , CompleteVerification FROM # TempERP
SELECT Costre , Sequence , ODNSequence , InvCode , Quantity , Amount , OODetailID , Currency , UnitPrice , ProjectCode , BatchCode , Version , Brand , cFree1 , cFree2 , cFree3 , cFree4 , cFree5 , cFree6 , cFree7 , cFree8 , cFree9 , cFree10
FROM # TempERP
@ -994,7 +1003,7 @@ namespace ICSSoft.DataProject
string sql = @ "SELECT c.VenCode+a.ToWarehouseCode+c.ODNCode+a.MUSER AS Costre,c.VenCode,a.ToWarehouseCode AS WarehouseCode,c.ODNCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY c.VenCode,a.ToWarehouseCode,c.ODNDetailID,a.InvCode) AS Sequence,
a . InvCode , SUM ( a . Quantity ) AS Quantity , SUM ( a . Quantity ) * ( lot . Amount / lot . Quantity ) AS Amount , isnull ( ( c . UnitPrice ) , 0 ) as UnitPrice , c . Currency , c . ODNDetailID , con . Enable AS UpdateTodoQuantity , conn . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , con . Enable AS Enable
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , conv . Enable AS CompleteVerification
INTO # TempERP
FROM ICSWareHouseLotInfoLog a
INNER JOIN ICSInventoryLot lot ON a . LotNo = lot . LotNo AND a . WorkPoint = lot . WorkPoint
@ -1005,12 +1014,13 @@ namespace ICSSoft.DataProject
INNER JOIN ICSODeliveryNotice c ON b . TransCode = c . ODNCode AND b . TransSequence = c . Sequence AND b . WorkPoint = c . WorkPoint
INNER JOIN ICSConfiguration con ON con . Code = ' Stock001 ' AND a . WorkPoint = con . WorkPoint
INNER JOIN ICSConfiguration conn ON con . WorkPoint = conn . WorkPoint AND conn . Code = ' Escrow001 '
INNER JOIN ICSConfiguration conv ON con . Code = ' CompleteVerification ' AND a . WorkPoint = conv . WorkPoint
WHERE a . Identification = ' { 0 } ' AND ERPUpload = '0'
GROUP BY c . VenCode , a . ToWarehouseCode , c . ODNCode , a . MUSER , lot . Amount , lot . Quantity , a . InvCode , c . ODNDetailID , isnull ( ( c . UnitPrice ) , 0 ) , c . Currency , con . Enable , conn . Enable
GROUP BY c . VenCode , a . ToWarehouseCode , c . ODNCode , a . MUSER , lot . Amount , lot . Quantity , a . InvCode , c . ODNDetailID , isnull ( ( c . UnitPrice ) , 0 ) , c . Currency , con . Enable , conn . Enable , conv . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , ISNULL ( ext . Version , ' ' ) , ISNULL ( ext . Brand , ' ' ) ,
ISNULL ( ext . cFree1 , ' ' ) , ISNULL ( ext . cFree2 , ' ' ) , ISNULL ( ext . cFree3 , ' ' ) , ISNULL ( ext . cFree4 , ' ' ) , ISNULL ( ext . cFree5 , ' ' ) , ISNULL ( ext . cFree6 , ' ' ) , ISNULL ( ext . cFree7 , ' ' ) , ISNULL ( ext . cFree8 , ' ' ) , ISNULL ( ext . cFree9 , ' ' ) , ISNULL ( ext . cFree10 , ' ' )
SELECT DISTINCT Costre , WorkPoint , VenCode , WarehouseCode AS WHCode , ODNCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , Enable , UpdateTodoQuantity FROM # TempERP
SELECT DISTINCT Costre , WorkPoint , VenCode , WarehouseCode AS WHCode , ODNCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , Enable , UpdateTodoQuantity , CompleteVerification FROM # TempERP
SELECT Costre , Sequence , InvCode , Quantity , Amount , ODNDetailID , Currency , UnitPrice , ProjectCode , BatchCode , Version , Brand , cFree1 , cFree2 , cFree3 , cFree4 , cFree5 , cFree6 , cFree7 , cFree8 , cFree9 , cFree10
FROM # TempERP
@ -1123,9 +1133,9 @@ namespace ICSSoft.DataProject
{
#region ERP
string sql = @ "SELECT c.VenCode+a.ToWarehouseCode+c.ODNCode+a.MUSER AS Costre,c.VenCode,a.ToWarehouseCode AS WarehouseCode,d.ODNCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY c.VenCode,a.ToWarehouseCode,c.ODNCode,c.ODNDetailID,a.InvCode) AS Sequence,
a . InvCode , SUM ( a . Quantity ) AS Quantity , SUM ( a . Quantity ) * ( lot . Amount / lot . Quantity ) AS Amount , isnull ( ( c . UnitPrice ) , 0 ) as UnitPrice , c . Currency , d . ODNDetailID , Enable AS UpdateTodoQuantity
a . InvCode , SUM ( a . Quantity ) AS Quantity , SUM ( a . Quantity ) * ( lot . Amount / lot . Quantity ) AS Amount , isnull ( ( c . UnitPrice ) , 0 ) as UnitPrice , c . Currency , d . ODNDetailID , con . Enable AS UpdateTodoQuantity
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , con . Enable AS Enable
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , conv . Enable AS CompleteVerification
INTO # TempERP
FROM ICSWareHouseLotInfoLog a
INNER JOIN ICSInventoryLotDetail b ON a . LotNo = b . LotNo AND a . WorkPoint = b . WorkPoint
@ -1136,13 +1146,14 @@ namespace ICSSoft.DataProject
INNER JOIN ICSODeliveryNotice c ON b . TransCode = c . ODNCode AND b . TransSequence = c . Sequence AND b . WorkPoint = c . WorkPoint
INNER JOIN ICSODeliveryNotice d ON c . OODetailID = d . ODNDetailID AND d . WorkPoint = c . WorkPoint
INNER JOIN ICSConfiguration con ON con . Code = ' Stock001 ' AND a . WorkPoint = con . WorkPoint
INNER JOIN ICSConfiguration conv ON conv . Code = ' CompleteVerification ' AND a . WorkPoint = conv . WorkPoint
WHERE a . Identification = ' { 0 } ' AND ERPUpload = '0'
GROUP BY c . VenCode , a . ToWarehouseCode , c . ODNCode , d . ODNCode , a . MUSER , lot . Amount , lot . Quantity , a . InvCode , d . ODNDetailID , c . ODNDetailID , isnull ( ( c . UnitPrice ) , 0 ) , c . Currency , Enable
GROUP BY c . VenCode , a . ToWarehouseCode , c . ODNCode , d . ODNCode , a . MUSER , lot . Amount , lot . Quantity , a . InvCode , d . ODNDetailID , c . ODNDetailID , isnull ( ( c . UnitPrice ) , 0 ) , c . Currency , con . Enable , conv . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , ISNULL ( ext . Version , ' ' ) , ISNULL ( ext . Brand , ' ' ) ,
ISNULL ( ext . cFree1 , ' ' ) , ISNULL ( ext . cFree2 , ' ' ) , ISNULL ( ext . cFree3 , ' ' ) , ISNULL ( ext . cFree4 , ' ' ) , ISNULL ( ext . cFree5 , ' ' ) , ISNULL ( ext . cFree6 , ' ' ) , ISNULL ( ext . cFree7 , ' ' ) , ISNULL ( ext . cFree8 , ' ' ) , ISNULL ( ext . cFree9 , ' ' ) , ISNULL ( ext . cFree10 , ' ' )
SELECT DISTINCT Costre , VenCode , WarehouseCode AS WHCode , ODNCode AS DNCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity , WorkPoint , Enable AS CompleteVerification FROM # TempERP
SELECT DISTINCT Costre , VenCode , WarehouseCode AS WHCode , ODNCode AS DNCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity , WorkPoint , CompleteVerification FROM # TempERP
SELECT Costre , Sequence , InvCode , Quantity , Amount , ODNDetailID AS DNDetailID , Currency , UnitPrice , ProjectCode , BatchCode , Version , Brand , cFree1 , cFree2 , cFree3 , cFree4 , cFree5 , cFree6 , cFree7 , cFree8 , cFree9 , cFree10
FROM # TempERP
@ -1252,9 +1263,9 @@ namespace ICSSoft.DataProject
{
#region ERP
string sql = @ "SELECT y.VenCode+a.FromWarehouseCode+y.ODNCode+a.MUSER AS Costre,y.VenCode,a.FromWarehouseCode AS WarehouseCode,y.ODNCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY y.VenCode,a.FromWarehouseCode,y.ODNCode,y.ODNDetailID,a.InvCode) AS Sequence,
a . InvCode , SUM ( a . Quantity ) AS Quantity , SUM ( a . Quantity ) * ( lot . Amount / lot . Quantity ) AS Amount , y . ODNDetailID , y . Currency , ISNULL ( y . UnitPrice , 0 ) AS UnitPrice , Enable AS UpdateTodoQuantity
a . InvCode , SUM ( a . Quantity ) AS Quantity , SUM ( a . Quantity ) * ( lot . Amount / lot . Quantity ) AS Amount , y . ODNDetailID , y . Currency , ISNULL ( y . UnitPrice , 0 ) AS UnitPrice , con . Enable AS UpdateTodoQuantity
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10 , conv . Enable AS CompleteVerification
INTO # TempERP
FROM ICSWareHouseLotInfoLog a
INNER JOIN ICSInventoryLot lot ON a . LotNo = lot . LotNo AND a . WorkPoint = lot . WorkPoint
@ -1263,12 +1274,13 @@ namespace ICSSoft.DataProject
LEFT JOIN ICSInventoryBatchEnable invBat ON a . InvCode = invBat . InvCode AND a . FromWarehouseCode = invBat . WHCode AND a . WorkPoint = invBat . WorkPoint
INNER JOIN ICSODeliveryNotice y ON a . TransCode = y . ODNCode AND a . TransSequence = y . Sequence AND a . WorkPoint = y . WorkPoint
INNER JOIN ICSConfiguration con ON con . Code = ' Stock002 ' AND a . WorkPoint = con . WorkPoint
INNER JOIN ICSConfiguration conv ON conv . Code = ' CompleteVerification ' AND a . WorkPoint = conv . WorkPoint
WHERE a . Identification = ' { 0 } ' AND ERPUpload = '0' AND ( a . BusinessCode = ' 1 1 ' OR a . BusinessCode = ' 1 0 5 ' )
GROUP BY y . VenCode , a . FromWarehouseCode , y . ODNCode , a . MUSER , a . InvCode , lot . Amount , lot . Quantity , y . ODNDetailID , y . Currency , ISNULL ( y . UnitPrice , 0 ) , Enable
GROUP BY y . VenCode , a . FromWarehouseCode , y . ODNCode , a . MUSER , a . InvCode , lot . Amount , lot . Quantity , y . ODNDetailID , y . Currency , ISNULL ( y . UnitPrice , 0 ) , con . Enable , conv . Enable
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END , ISNULL ( ext . Version , ' ' ) , ISNULL ( ext . Brand , ' ' ) ,
ISNULL ( ext . cFree1 , ' ' ) , ISNULL ( ext . cFree2 , ' ' ) , ISNULL ( ext . cFree3 , ' ' ) , ISNULL ( ext . cFree4 , ' ' ) , ISNULL ( ext . cFree5 , ' ' ) , ISNULL ( ext . cFree6 , ' ' ) , ISNULL ( ext . cFree7 , ' ' ) , ISNULL ( ext . cFree8 , ' ' ) , ISNULL ( ext . cFree9 , ' ' ) , ISNULL ( ext . cFree10 , ' ' )
SELECT DISTINCT Costre , WorkPoint , VenCode , WarehouseCode AS WHCode , ODNCode AS ODNRTCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity FROM # TempERP
SELECT DISTINCT Costre , WorkPoint , VenCode , WarehouseCode AS WHCode , ODNCode AS ODNRTCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity , CompleteVerification FROM # TempERP
SELECT Costre , Sequence , InvCode , Quantity , Amount , ODNDetailID AS ODNRTDetailID , Currency , UnitPrice , ProjectCode , BatchCode , Version , Brand , cFree1 , cFree2 , cFree3 , cFree4 , cFree5 , cFree6 , cFree7 , cFree8 , cFree9 , cFree10
FROM # TempERP