|
|
@@ -30,6 +30,7 @@ class InventoryService
|
|
|
$SKU=$params['SKU'] ?? null;
|
|
|
$ALTERNATE_SKU1=$params['ALTERNATE_SKU1'] ?? null;
|
|
|
$LotAtt02_end=$params['LotAtt02_end'] ?? null;
|
|
|
+ $commodityName=$params['commodity_name'] ?? null;
|
|
|
$sql='select * from (select result.*,rownum rn from (';
|
|
|
$sql.=' select customer.Descr_C as 货主,stockLog.客户 客户, 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
|
|
|
$sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, ';
|
|
|
@@ -40,8 +41,6 @@ class InventoryService
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='PA' ";
|
|
|
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') ";
|
|
|
-// if ($TOLocation)$sql .= " and TOLocation like '".$TOLocation."' ";
|
|
|
-// if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
|
|
|
if ($TOLocation)$sql=$this->sqlSearchWay($sql,$TOLocation,"TOLocation");
|
|
|
if ($SKU)$sql=$this->sqlSearchWay($sql,$SKU,"FMSKU");
|
|
|
if ($customerid){
|
|
|
@@ -66,8 +65,6 @@ class InventoryService
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='SO' ";
|
|
|
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') ";
|
|
|
-// if ($TOLocation)$sql .= " and FMLOCATION like '".$TOLocation."' ";
|
|
|
-// if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
|
|
|
if ($TOLocation)$sql=$this->sqlSearchWay($sql,$TOLocation,"FMLOCATION");
|
|
|
if ($SKU)$sql=$this->sqlSearchWay($sql,$SKU,"FMSKU");
|
|
|
if ($customerid){
|
|
|
@@ -92,8 +89,6 @@ class InventoryService
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
|
|
|
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') ";
|
|
|
-// if ($TOLocation)$sql .= " and FMLocation like '".$TOLocation."' ";
|
|
|
-// if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
|
|
|
if ($TOLocation)$sql=$this->sqlSearchWay($sql,$TOLocation,"FMLocation");
|
|
|
if ($SKU)$sql=$this->sqlSearchWay($sql,$SKU,"FMSKU");
|
|
|
|
|
|
@@ -119,8 +114,6 @@ class InventoryService
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
|
|
|
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') ";
|
|
|
-// if ($TOLocation)$sql .= " and TOLocation like '".$TOLocation."' ";
|
|
|
-// if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
|
|
|
if ($TOLocation)$sql=$this->sqlSearchWay($sql,$TOLocation,"TOLocation");
|
|
|
if ($SKU)$sql=$this->sqlSearchWay($sql,$SKU,"FMSKU");
|
|
|
|
|
|
@@ -146,16 +139,18 @@ class InventoryService
|
|
|
$sql.=' left join BAS_SKU sku on sku.SKU=stockLog.FMSKU and sku.CUSTOMERID=stockLog.客户 ';
|
|
|
$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.库位 ';
|
|
|
+ $sql.=' and storeStatus.LocationID=stockLog.库位 WHERE 1=1 ';
|
|
|
+ if ($commodityName){
|
|
|
+ $commodityName = str_replace("'",'"',$commodityName);
|
|
|
+ $sql .= " AND sku.Descr_C like '".$commodityName."%' ";
|
|
|
+ }
|
|
|
$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,stockLog.客户 ';
|
|
|
$sql.=' )result where 1=1 ';
|
|
|
-// if ($LotAtt05)$sql .=" and 属性仓 like '".$LotAtt05."' ";
|
|
|
if ($LotAtt05)$sql=$this->sqlSearchWay($sql,$LotAtt05,"属性仓");
|
|
|
if ($LotAtt02_start)$sql.=" and 失效日期 >='".$LotAtt02_start." 00:00:00' ";
|
|
|
if ($LotAtt02_end)$sql.=" and 失效日期 <='".$LotAtt02_end." 23:59:59' ";
|
|
|
-// if ($ALTERNATE_SKU1)$sql.=" and 产品条码 like '".$ALTERNATE_SKU1."' ";
|
|
|
if ($ALTERNATE_SKU1)$sql=$this->sqlSearchWay($sql,$ALTERNATE_SKU1,"产品条码");
|
|
|
if ($page&&$paginate)$sql.=" and ROWNUM<='".$page*$paginate."'";
|
|
|
$sql.=' ) ';
|