|
|
@@ -61,7 +61,7 @@ class InventoryAccountService
|
|
|
->whereIn('id',explode(',',$queryParam['data']))->get();
|
|
|
}
|
|
|
//动盘查询
|
|
|
- public function conditionPortStock($date_start,$date_end,$ownerId){
|
|
|
+ public function conditionPortStock($date_start,$date_end,$ownerId,$location){
|
|
|
if (!$ownerId) return null;
|
|
|
$descr_c=Owner::where('id',$ownerId)->value('name');
|
|
|
$sql='select * from (select result.*,rownum rn from (';
|
|
|
@@ -95,6 +95,7 @@ class InventoryAccountService
|
|
|
$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.库位 ';
|
|
|
+ if ($location)$sql.=" where storeStatus.LocationID like '".$location."%' ";
|
|
|
$sql.=' group by 库位,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1,sku.ALTERNATE_SKU2,sku.ALTERNATE_SKU3 ';
|
|
|
$sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt01,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
|
|
|
$sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,stockLog.客户 ';
|
|
|
@@ -112,7 +113,7 @@ class InventoryAccountService
|
|
|
return DB::connection('oracle')->select($sql);
|
|
|
}
|
|
|
//全盘查询
|
|
|
- private function conditionTotalStock($ownerId){
|
|
|
+ private function conditionTotalStock($ownerId,$location){
|
|
|
$descr_c=Owner::where('id',$ownerId)->value('name');
|
|
|
$sql='select * from (select result.* from (';
|
|
|
$sql.=' select customer.Descr_C as 货主,storeStatus.CUSTOMERID 客户,storeStatus.LocationID 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码1, sku.ALTERNATE_SKU2 产品条码2, sku.ALTERNATE_SKU3 产品条码3, ';
|
|
|
@@ -123,6 +124,7 @@ class InventoryAccountService
|
|
|
$sql.=' left join BAS_Customer customer on customer.CustomerID=storeStatus.CUSTOMERID ';
|
|
|
$sql.=' left join BAS_SKU sku on sku.SKU=storeStatus.SKU and sku.CUSTOMERID=storeStatus.CUSTOMERID ';
|
|
|
$sql.=' left join INV_LOT_ATT lot on lot.LOTNUM = storeStatus.LOTNUM AND lot.CUSTOMERID = storeStatus.CUSTOMERID ';
|
|
|
+ if ($location)$sql.=" where storeStatus.LocationID like '".$location."%' ";
|
|
|
$sql.=' group by storeStatus.LocationID,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1,sku.ALTERNATE_SKU2,sku.ALTERNATE_SKU3 ';
|
|
|
$sql.=' ,sku.Descr_C,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
|
|
|
$sql.=' ,storeStatus.CUSTOMERID,lot.LotAtt01 ';
|
|
|
@@ -133,19 +135,19 @@ class InventoryAccountService
|
|
|
|
|
|
}
|
|
|
//创建盘点任务
|
|
|
- public function createMission($date_start,$date_end,$ownerId){
|
|
|
+ public function createMission($date_start,$date_end,$ownerId,$location){
|
|
|
if (!$ownerId) return null;
|
|
|
if ($date_start&&$date_end){
|
|
|
$date_end_time=$date_end.' 23:59:59';
|
|
|
$type='动盘';
|
|
|
- $wmsInventories=$this->conditionPortStock($date_start,$date_end,$ownerId);
|
|
|
+ $wmsInventories=$this->conditionPortStock($date_start,$date_end,$ownerId,$location);
|
|
|
}elseif (!$date_start&&!$date_end){
|
|
|
$name=Owner::where('id',$ownerId)->value('name');
|
|
|
$ownerName=OracleBasCustomer::where('customer_type','OW')->where('active_flag','Y')->where('descr_c',$name)->value('customerid');
|
|
|
$date_start=OracleInvLotLocId::where('customerid',$ownerName)->orderBy('addtime','ASC')->value('addtime');
|
|
|
$date_end_time=OracleInvLotLocId::where('customerid',$ownerName)->orderBy('addtime','DESC')->value('addtime');
|
|
|
$type='全盘';
|
|
|
- $wmsInventories=$this->conditionTotalStock($ownerId);
|
|
|
+ $wmsInventories=$this->conditionTotalStock($ownerId,$location);
|
|
|
}else{
|
|
|
return null;
|
|
|
}
|
|
|
@@ -166,6 +168,7 @@ class InventoryAccountService
|
|
|
'date_start'=>$date_start,
|
|
|
'date_end'=>$date_end,
|
|
|
'ownerId'=>$ownerId,
|
|
|
+ 'location'=>$location,
|
|
|
'inventoryId'=>$inventory['id'],
|
|
|
];
|
|
|
Controller::logS(__METHOD__,"创建盘点任务__".__FUNCTION__,json_encode($request),Auth::user()['id']);
|