|
@@ -38,8 +38,10 @@ class InventoryService
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='PA' ";
|
|
$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_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 ($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 .= " and TOLocation like '".$TOLocation."' ";
|
|
|
|
|
+// if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
|
|
|
|
|
+ if ($TOLocation)$sql=$this->searchWay($sql,$TOLocation,"TOLocation");
|
|
|
|
|
+ if ($SKU)$sql=$this->searchWay($sql,$SKU,"FMSKU");
|
|
|
if ($customerid){
|
|
if ($customerid){
|
|
|
$sql .= ' and TOCustomerID in (';
|
|
$sql .= ' and TOCustomerID in (';
|
|
|
$arr = explode(',',$customerid);
|
|
$arr = explode(',',$customerid);
|
|
@@ -62,8 +64,10 @@ class InventoryService
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='SO' ";
|
|
$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_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 ($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 .= " and FMLOCATION like '".$TOLocation."' ";
|
|
|
|
|
+// if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
|
|
|
|
|
+ if ($TOLocation)$sql=$this->searchWay($sql,$TOLocation,"FMLOCATION");
|
|
|
|
|
+ if ($SKU)$sql=$this->searchWay($sql,$SKU,"FMSKU");
|
|
|
if ($customerid){
|
|
if ($customerid){
|
|
|
$sql .= ' and FMCUSTOMERID in (';
|
|
$sql .= ' and FMCUSTOMERID in (';
|
|
|
$arr = explode(',',$customerid);
|
|
$arr = explode(',',$customerid);
|
|
@@ -86,8 +90,11 @@ class InventoryService
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
|
|
$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_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 ($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 .= " and FMLocation like '".$TOLocation."' ";
|
|
|
|
|
+// if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
|
|
|
|
|
+ if ($TOLocation)$sql=$this->searchWay($sql,$TOLocation,"FMLocation");
|
|
|
|
|
+ if ($SKU)$sql=$this->searchWay($sql,$SKU,"FMSKU");
|
|
|
|
|
+
|
|
|
if ($customerid){
|
|
if ($customerid){
|
|
|
$sql .= ' and FMCUSTOMERID in (';
|
|
$sql .= ' and FMCUSTOMERID in (';
|
|
|
$arr = explode(',',$customerid);
|
|
$arr = explode(',',$customerid);
|
|
@@ -110,8 +117,11 @@ class InventoryService
|
|
|
$sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
|
|
$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_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 ($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 .= " and TOLocation like '".$TOLocation."' ";
|
|
|
|
|
+// if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
|
|
|
|
|
+ if ($TOLocation)$sql=$this->searchWay($sql,$TOLocation,"TOLocation");
|
|
|
|
|
+ if ($SKU)$sql=$this->searchWay($sql,$SKU,"FMSKU");
|
|
|
|
|
+
|
|
|
if ($customerid){
|
|
if ($customerid){
|
|
|
$sql .= ' and TOCustomerID in (';
|
|
$sql .= ' and TOCustomerID in (';
|
|
|
$arr = explode(',',$customerid);
|
|
$arr = explode(',',$customerid);
|
|
@@ -139,15 +149,35 @@ class InventoryService
|
|
|
$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,stockLog.客户 ';
|
|
$sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,stockLog.客户 ';
|
|
|
$sql.=' )result where 1=1 ';
|
|
$sql.=' )result where 1=1 ';
|
|
|
- if ($LotAtt05)$sql .=" and 属性仓 like '".$LotAtt05."' ";
|
|
|
|
|
|
|
+// if ($LotAtt05)$sql .=" and 属性仓 like '".$LotAtt05."' ";
|
|
|
|
|
+ if ($LotAtt05)$sql=$this->searchWay($sql,$LotAtt05,"属性仓");
|
|
|
if ($LotAtt02_start)$sql.=" and 失效日期 >='".$LotAtt02_start." 00:00:00' ";
|
|
if ($LotAtt02_start)$sql.=" and 失效日期 >='".$LotAtt02_start." 00:00:00' ";
|
|
|
if ($LotAtt02_end)$sql.=" and 失效日期 <='".$LotAtt02_end." 23:59:59' ";
|
|
if ($LotAtt02_end)$sql.=" and 失效日期 <='".$LotAtt02_end." 23:59:59' ";
|
|
|
- if ($ALTERNATE_SKU1)$sql.=" and 产品条码 like '".$ALTERNATE_SKU1."' ";
|
|
|
|
|
|
|
+// if ($ALTERNATE_SKU1)$sql.=" and 产品条码 like '".$ALTERNATE_SKU1."' ";
|
|
|
|
|
+ if ($ALTERNATE_SKU1)$sql=$this->searchWay($sql,$ALTERNATE_SKU1,"产品条码");
|
|
|
if ($page&&$paginate)$sql.=" and ROWNUM<='".$page*$paginate."'";
|
|
if ($page&&$paginate)$sql.=" and ROWNUM<='".$page*$paginate."'";
|
|
|
$sql.=' ) ';
|
|
$sql.=' ) ';
|
|
|
if ($page&&$paginate)$sql.=" where rn>'".($page-1)*$paginate."'";
|
|
if ($page&&$paginate)$sql.=" where rn>'".($page-1)*$paginate."'";
|
|
|
return $sql;
|
|
return $sql;
|
|
|
}
|
|
}
|
|
|
|
|
+ private function searchWay($sql,$condition,$column)
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($condition){
|
|
|
|
|
+ if (strpos($condition, ',') || strpos($condition, ',') || strpos($condition, ' ')) {
|
|
|
|
|
+ $arr = array_filter(preg_split('/[,, ]+/is', $condition));
|
|
|
|
|
+ $sql .= ' and '.$column.' in (';
|
|
|
|
|
+ foreach ($arr as $index => $arr){
|
|
|
|
|
+ if ($index != 0)$sql .= ',';
|
|
|
|
|
+ $sql .= "'".$arr."'";
|
|
|
|
|
+ }
|
|
|
|
|
+ $sql .= ') ';
|
|
|
|
|
+ unset($condition);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $sql .= " and $column like '".$condition."' ";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return $sql;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
public function paginate(array $params)
|
|
public function paginate(array $params)
|
|
|
{
|
|
{
|