|
@@ -192,42 +192,102 @@ class TestController extends Controller
|
|
|
// 先进后出“([{”入栈,")]}"出栈,轮询到出栈元素去映射栈顶,符合出栈,不符合直接返回
|
|
// 先进后出“([{”入栈,")]}"出栈,轮询到出栈元素去映射栈顶,符合出栈,不符合直接返回
|
|
|
//依次轮询 如果映射正确那么最后栈为空栈 否则返回false
|
|
//依次轮询 如果映射正确那么最后栈为空栈 否则返回false
|
|
|
}
|
|
}
|
|
|
- function test5(){
|
|
|
|
|
- /*$sql='select customer.CUSTOMERID from BAS_Customer customer';
|
|
|
|
|
- dd(DB::connection('oracle')->select($sql));*/
|
|
|
|
|
- $sql=' select ';
|
|
|
|
|
- $sql.=' customer.Descr_C 货主, 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
|
|
|
|
|
|
|
+ function test5(Request $request){
|
|
|
|
|
+ $page=$request->input('page')??1;
|
|
|
|
|
+ $date_start=$request->input('date_start');
|
|
|
|
|
+ $date_end=$request->input('date_end');
|
|
|
|
|
+ $sql='select * from (select result.*,rownum rn from (';
|
|
|
|
|
+ $sql.=' select customer.Descr_C 货主, 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
|
|
|
$sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, ';
|
|
$sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, ';
|
|
|
$sql.=' lot.LotAtt04 批号 ';
|
|
$sql.=' lot.LotAtt04 批号 ';
|
|
|
$sql.=' , sum(移出数量)移出数量, sum(移入数量)移入数量 ';
|
|
$sql.=' , sum(移出数量)移出数量, sum(移入数量)移入数量 ';
|
|
|
- $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量 from ';
|
|
|
|
|
|
|
+ $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
|
|
|
$sql.=' (select FMLotNum,FMSKU,TOCustomerID,0 as 移出数量, sum(TOQty_Each) as 移入数量, TOLocation as 库位 ';
|
|
$sql.=' (select FMLotNum,FMSKU,TOCustomerID,0 as 移出数量, sum(TOQty_Each) as 移入数量, TOLocation as 库位 ';
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='PA' ";
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='PA' ";
|
|
|
|
|
+ if ($date_start) $sql.=" and addtime > '".$date_start." 00:00:00' ";
|
|
|
|
|
+ if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' ";
|
|
|
|
|
+ if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' ";
|
|
|
$sql.=' group by TOCustomerID, TOLocation, TOCustomerID,FMSKU,FMLotNum union all ';
|
|
$sql.=' group by TOCustomerID, TOLocation, TOCustomerID,FMSKU,FMLotNum union all ';
|
|
|
$sql.=' select FMLotNum,FMSKU,TOCustomerID,sum(FMQty_Each) as 移出数量, 0 as 移入数量, FMLOCATION as 库位 ';
|
|
$sql.=' select FMLotNum,FMSKU,TOCustomerID,sum(FMQty_Each) as 移出数量, 0 as 移入数量, FMLOCATION as 库位 ';
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='SO' ";
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='SO' ";
|
|
|
|
|
+ if ($date_start) $sql.=" and addtime > '".$date_start." 00:00:00' ";
|
|
|
|
|
+ if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' ";
|
|
|
|
|
+ if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' ";
|
|
|
$sql.=' group by FMCustomerID, FMLocation, TOCustomerID,FMSKU,FMLotNum union all ';
|
|
$sql.=' group by FMCustomerID, FMLocation, TOCustomerID,FMSKU,FMLotNum union all ';
|
|
|
$sql.=' select FMLotNum,FMSKU,TOCustomerID,sum(FMQty_Each) as 移出数量,0 as 移入数量, FMLocation as 库位 ';
|
|
$sql.=' select FMLotNum,FMSKU,TOCustomerID,sum(FMQty_Each) as 移出数量,0 as 移入数量, FMLocation as 库位 ';
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
|
|
|
|
|
+ if ($date_start) $sql.=" and addtime > '".$date_start." 00:00:00' ";
|
|
|
|
|
+ if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' ";
|
|
|
|
|
+ if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' ";
|
|
|
$sql.=' group by FMLocation,TOCustomerID,FMSKU,FMLotNum union all ';
|
|
$sql.=' group by FMLocation,TOCustomerID,FMSKU,FMLotNum union all ';
|
|
|
$sql.=' select FMLotNum,FMSKU,TOCustomerID,0 as 移出数量,sum(TOQty_Each)as 移入数量, TOLocation as 库位 ';
|
|
$sql.=' select FMLotNum,FMSKU,TOCustomerID,0 as 移出数量,sum(TOQty_Each)as 移入数量, TOLocation as 库位 ';
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
|
|
|
|
|
+ if ($date_start) $sql.=" and addtime > '".$date_start." 00:00:00' ";
|
|
|
|
|
+ if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' ";
|
|
|
|
|
+ if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' ";
|
|
|
$sql.=' group by TOLocation,TOCustomerID,FMSKU,FMLotNum)stockLog ';
|
|
$sql.=' group by TOLocation,TOCustomerID,FMSKU,FMLotNum)stockLog ';
|
|
|
$sql.=' left join BAS_Customer customer on customer.CustomerID=stockLog.TOCUSTOMERID ';
|
|
$sql.=' left join BAS_Customer customer on customer.CustomerID=stockLog.TOCUSTOMERID ';
|
|
|
$sql.=' left join BAS_SKU sku on sku.SKU=stockLog.FMSKU ';
|
|
$sql.=' left join BAS_SKU sku on sku.SKU=stockLog.FMSKU ';
|
|
|
$sql.=' left join INV_LOT_ATT lot on lot.LOTNUM=stockLog.FMLOTNUM ';
|
|
$sql.=' left join INV_LOT_ATT lot on lot.LOTNUM=stockLog.FMLOTNUM ';
|
|
|
- $sql.=' left join INV_LOT_LOC_ID storeStatus on storeStatus.LOTNUM=stockLog.FMLOTNUM ';
|
|
|
|
|
- $sql.=' left join INV_LOT_LOC_ID storeStatus on storeStatus.LOTNUM=stockLog.FMLOTNUM ';
|
|
|
|
|
- $sql.=' and storeStatus.LocationID=stockLog.库位 where rownum<=50 ';
|
|
|
|
|
|
|
+ $sql.=' left join INV_LOT_LOC_ID storeStatus on storeStatus.LOTNUM=stockLog.FMLOTNUM ';;
|
|
|
|
|
+ $sql.=' and storeStatus.LocationID=stockLog.库位 where ROWNUM<=50 ';
|
|
|
$sql.=' group by 库位,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 ';
|
|
$sql.=' group by 库位,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 ';
|
|
|
$sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
|
|
$sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
|
|
|
- $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated';
|
|
|
|
|
- $oracleActTransactingLogs=DB::connection('oracle')->select($sql);
|
|
|
|
|
- dd($oracleActTransactingLogs);
|
|
|
|
|
- /*dd(OracleActTransactionLog::with(['oracleBasCustomer','oracleInvLotAtt','oracleBasSku'])
|
|
|
|
|
- ->leftJoin('INV_LOT_LOC_ID',function (JoinClause $join){
|
|
|
|
|
- $join->on('INV_LOT_LOC_ID.LOCATIONID','=','ACT_TRANSACTION_LOG.TOLOCATIONID')
|
|
|
|
|
- ->on('INV_LOT_LOC_ID.LOTNUM','=','ACT_TRANSACTION_LOG.FMLOTNUM');
|
|
|
|
|
- })->paginate(5));*/
|
|
|
|
|
|
|
+ $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated ';
|
|
|
|
|
+ $sql.=' )result) where rn>0';
|
|
|
|
|
+ $oracleActTransactingLogs1=DB::connection('oracle')->select($sql);
|
|
|
|
|
+ unset($sql);
|
|
|
|
|
+ $sql='select * from (select result.*,rownum rn from (';
|
|
|
|
|
+ $sql.=' select customer.Descr_C 货主, 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
|
|
|
|
|
+ $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, ';
|
|
|
|
|
+ $sql.=' lot.LotAtt04 批号 ';
|
|
|
|
|
+ $sql.=' , sum(移出数量)移出数量, sum(移入数量)移入数量 ';
|
|
|
|
|
+ $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
|
|
|
|
|
+ $sql.=' (select FMLotNum,FMSKU,TOCustomerID,0 as 移出数量, sum(TOQty_Each) as 移入数量, TOLocation as 库位 ';
|
|
|
|
|
+ $sql.=" from ACT_Transaction_Log where TransactionType='PA' ";
|
|
|
|
|
+ if ($date_start) $sql.=" and addtime > '".$date_start." 00:00:00' ";
|
|
|
|
|
+ if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' ";
|
|
|
|
|
+ if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' ";
|
|
|
|
|
+ $sql.=' group by TOCustomerID, TOLocation, TOCustomerID,FMSKU,FMLotNum union all ';
|
|
|
|
|
+ $sql.=' select FMLotNum,FMSKU,TOCustomerID,sum(FMQty_Each) as 移出数量, 0 as 移入数量, FMLOCATION as 库位 ';
|
|
|
|
|
+ $sql.=" from ACT_Transaction_Log where TransactionType='SO' ";
|
|
|
|
|
+ if ($date_start) $sql.=" and addtime > '".$date_start." 00:00:00' ";
|
|
|
|
|
+ if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' ";
|
|
|
|
|
+ if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' ";
|
|
|
|
|
+ $sql.=' group by FMCustomerID, FMLocation, TOCustomerID,FMSKU,FMLotNum union all ';
|
|
|
|
|
+ $sql.=' select FMLotNum,FMSKU,TOCustomerID,sum(FMQty_Each) as 移出数量,0 as 移入数量, FMLocation as 库位 ';
|
|
|
|
|
+ $sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
|
|
|
|
|
+ if ($date_start) $sql.=" and addtime > '".$date_start." 00:00:00' ";
|
|
|
|
|
+ if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' ";
|
|
|
|
|
+ if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' ";
|
|
|
|
|
+ $sql.=' group by FMLocation,TOCustomerID,FMSKU,FMLotNum union all ';
|
|
|
|
|
+ $sql.=' select FMLotNum,FMSKU,TOCustomerID,0 as 移出数量,sum(TOQty_Each)as 移入数量, TOLocation as 库位 ';
|
|
|
|
|
+ $sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
|
|
|
|
|
+ if ($date_start) $sql.=" and addtime > '".$date_start." 00:00:00' ";
|
|
|
|
|
+ if ($date_end) $sql.=" and addtime < '".$date_end." 23:59:59' ";
|
|
|
|
|
+ if (!$date_start && !$date_end)$sql .= " and addtime >'".date('Y-m-d H:i:s',strtotime("-1 day"))."' ";
|
|
|
|
|
+ $sql.=' group by TOLocation,TOCustomerID,FMSKU,FMLotNum)stockLog ';
|
|
|
|
|
+ $sql.=' left join BAS_Customer customer on customer.CustomerID=stockLog.TOCUSTOMERID ';
|
|
|
|
|
+ $sql.=' left join BAS_SKU sku on sku.SKU=stockLog.FMSKU ';
|
|
|
|
|
+ $sql.=' left join INV_LOT_ATT lot on lot.LOTNUM=stockLog.FMLOTNUM ';
|
|
|
|
|
+ $sql.=' left join INV_LOT_LOC_ID storeStatus on storeStatus.LOTNUM=stockLog.FMLOTNUM ';;
|
|
|
|
|
+ $sql.=' and storeStatus.LocationID=stockLog.库位 where ROWNUM<=500 ';
|
|
|
|
|
+ $sql.=' group by 库位,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 ';
|
|
|
|
|
+ $sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
|
|
|
|
|
+ $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated ';
|
|
|
|
|
+ $sql.=' )result) where rn>50';
|
|
|
|
|
+ $oracleActTransactingLogs2=DB::connection('oracle')->select($sql);
|
|
|
|
|
+ $oracleActTransactingLogs1=json_encode($oracleActTransactingLogs1);
|
|
|
|
|
+ $oracleActTransactingLogs2=json_encode($oracleActTransactingLogs2);
|
|
|
|
|
+ $oracleActTransactingLogs1=json_decode($oracleActTransactingLogs1,true);
|
|
|
|
|
+ $oracleActTransactingLogs2=json_decode($oracleActTransactingLogs2,true);
|
|
|
|
|
+ foreach ($oracleActTransactingLogs1 as $oracleActTransactingLog1){
|
|
|
|
|
+ foreach ($oracleActTransactingLogs2 as $oracleActTransactingLog2){
|
|
|
|
|
+ if ($oracleActTransactingLog1['产品编码']==$oracleActTransactingLog2['产品编码']){
|
|
|
|
|
+ /*if ($oracleActTransactingLog1['产品编码']=='6206100971005')*/var_dump(['oracleActTransactingLog1'=>$oracleActTransactingLog1,'oracleActTransactingLog2'=>$oracleActTransactingLog2]);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|