|
|
@@ -77,21 +77,25 @@ class InventoryAccountService
|
|
|
$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 ($code)$sql.=" and TOCustomerID = '".$code."' ";
|
|
|
if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
|
|
|
if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
|
|
|
$sql.=' group by TOCustomerID, TOLocation,FMSKU,FMLotNum union all ';
|
|
|
$sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量, 0 as 移入数量, FMLOCATION as 库位 ';
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='SO' ";
|
|
|
+ if ($code)$sql.=" and FMCUSTOMERID = '".$code."' ";
|
|
|
if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
|
|
|
if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
|
|
|
$sql.=' group by FMCustomerID, FMLocation,FMSKU,FMLotNum union all ';
|
|
|
$sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量,0 as 移入数量, FMLocation as 库位 ';
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
|
|
|
+ if ($code)$sql.=" and FMCUSTOMERID = '".$code."' ";
|
|
|
if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
|
|
|
if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
|
|
|
$sql.=' group by FMLocation,FMCUSTOMERID,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 ($code)$sql.=" and TOCustomerID = '".$code."' ";
|
|
|
if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
|
|
|
if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
|
|
|
$sql.=' group by TOLocation,TOCustomerID,FMSKU,FMLotNum)stockLog ';
|
|
|
@@ -211,7 +215,17 @@ class InventoryAccountService
|
|
|
if ($location||$barcode)$type='局部盘点';
|
|
|
if (!$location&&!$barcode)$type='动盘';
|
|
|
$wmsInventories=$this->conditionPortStock($date_start,$date_end,$ownerId,$location,$barcode);
|
|
|
+ //动盘 判断库存为0的ide料想是否放有其他商品
|
|
|
+ foreach ($wmsInventories as $key=>$wmsInventory){
|
|
|
+ if (!$wmsInventory->在库数量 && strpos($wmsInventory->库位,'IDE') !== false){
|
|
|
+ /** @var HandInStorageService $handInStorageService */
|
|
|
+ $handInStorageService=app('HandInStorageService');
|
|
|
+ $invs=$handInStorageService->getInventoryInfos($wmsInventory->库位);
|
|
|
+ if (count($invs)>0) unset($wmsInventories[$key]);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
if (!$date_start&&!$date_end){
|
|
|
$ownerName=Owner::where('id',$ownerId)->value('code');
|
|
|
//$ownerName=OracleBasCustomer::where('customer_type','OW')->where('active_flag','Y')->where('descr_c',$name)->value('customerid');
|