@ -99,7 +99,7 @@ namespace ICSSoft.DataProject
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
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 , x . PickID , x . OODetailID , con . Enable
GROUP BY y . DepCode , a . FromWarehouseCode , y . OOCode , a . MUSER , lot . Amount , lot . Quantity , a . InvCode , x . PickID , x . OODetailID , con . 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 , ' ' )
@ -857,8 +857,8 @@ namespace ICSSoft.DataProject
try
{
#region ERP
string sql = @ "SELECT c.VenCode+a.ToWarehouseCode+c.OOCode+a.MUSER 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 , Enable AS UpdateTodoQuantity
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
INTO # TempERP
@ -869,15 +869,16 @@ namespace ICSSoft.DataProject
LEFT JOIN ICSInventoryBatchEnable invBat ON a . InvCode = invBat . InvCode AND a . ToWarehouseCode = invBat . WHCode AND a . WorkPoint = invBat . WorkPoint
INNER JOIN ICSInventoryLotDetail b ON a . LotNo = b . LotNo AND a . WorkPoint = b . WorkPoint
INNER JOIN ICSOASNDetail g ON a . LotNo = g . LotNo AND a . WorkPoint = g . WorkPoint
INNER JOIN ICSODeliveryNotice f ON g . OD NCode = f . OD NCode AND g . WorkPoint = f . WorkPoint
INNER JOIN ICSOutsourcingOrder c ON b . TransCode = c . OOCode AND b . TransSequence = c . Sequence AND f . OODetailID = c . Out DetailID AND b . WorkPoint = c . WorkPoint
INNER JOIN ICSODeliveryNotice f ON g . OAS NCode = f . OAS NCode AND g . WorkPoint = f . WorkPoint
INNER JOIN ICSOutsourcingOrder c ON b . TransCode = c . OOCode AND b . TransSequence = c . Sequence AND f . OODetailID = c . OO DetailID 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 '
WHERE a . Identification = ' { 0 } ' AND ERPUpload = '0'
GROUP BY c . VenCode , a . ToWarehouseCode , c . OOCode , a . MUSER , lot . Amount , lot . Quantity , a . InvCode , c . OODetailID , isnull ( ( c . UnitPrice ) , 0 ) , c . Currency , 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
, 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 , UpdateTodoQuantity FROM # TempERP
SELECT DISTINCT Costre , WorkPoint , VenCode , WarehouseCode AS WHCode , OOCode , ODNCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , Enable , UpdateTodoQuantity 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
@ -989,8 +990,8 @@ namespace ICSSoft.DataProject
try
{
#region ERP
string sql = @ "SELECT c.VenCode+a.ToWarehouseCode+c.ODNCode+a.MUSER AS Costre,c.VenCode,b.TransCode,b.TransSequence, a.ToWarehouseCode AS WarehouseCode,c.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 , c . ODNDetailID , Enable AS UpdateTodoQuantity
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.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 , 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
INTO # TempERP
@ -1002,12 +1003,13 @@ namespace ICSSoft.DataProject
INNER JOIN ICSInventoryLotDetail b ON a . LotNo = b . LotNo AND a . WorkPoint = b . WorkPoint
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 '
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 , 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
, 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 , TransCode , TransSequence , WorkPoint , VenCode , WarehouseCode AS WHCode , ODNCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , UpdateTodoQuantity FROM # TempERP
SELECT DISTINCT Costre , WorkPoint , VenCode , WarehouseCode AS WHCode , ODNCode , MUSER AS [ User ] , SYSDATETIME ( ) AS MTime , Enabl e , UpdateTodoQuantity 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