|
@@ -529,14 +529,22 @@ class FyySqlServerService extends Service
|
|
|
}
|
|
|
|
|
|
//获取发货单数据 还没发的
|
|
|
- public function getDataFromDispatchList($order_number){
|
|
|
- $message = $this->db->table('DispatchList as a')
|
|
|
+ public function getDataFromDispatchList($data){
|
|
|
+ $model = $this->db->table('DispatchList as a')
|
|
|
->leftJoin('DispatchLists as b','b.DLID','a.DLID')
|
|
|
- ->where('a.cSOcode',$order_number)
|
|
|
->whereNotNull('a.cVerifier')
|
|
|
- ->whereColumn('b.iQuantity', '>', 'b.fOutQuantity')
|
|
|
- ->select('a.DLID as id','a.cDefine10 as customer_name','a.cSOCode','a.cDepCode as cdepcode','a.cCusCode as cuscode','b.iDLsID as idlsid','b.cWhCode as cwhcode','b.cInvCode as cinvcode','b.cInvName as product_title','b.cFree1 as cfree1','b.cFree2 as cfree2','b.cPosition as cposition','b.cBatch as cbatch','b.iQuantity as iquantity','b.iNum as inum','b.iInvExchRate as iinvexchrate','b.fOutQuantity as out_quantity','b.iUnitPrice as iunitcost','b.iMoney as imoney')
|
|
|
+ ->whereColumn('b.iQuantity', '>', 'b.fOutQuantity');
|
|
|
+
|
|
|
+ //检索条件
|
|
|
+ if(! empty($data['time'][0]) && ! empty($data['time'][1])) {
|
|
|
+ $model->where('a.dDate','>=',$data['time'][0]);
|
|
|
+ $model->where('a.dDate','<=',$data['time'][1]);
|
|
|
+ }
|
|
|
+ if(! empty($data['order_no'])) $model->where('a.cSOcode',$data['order_no']);
|
|
|
+
|
|
|
+ $message = $model->select('a.cDLCode as cdlcode','a.DLID as id','a.cDefine10 as customer_name','a.cSOCode','a.cDepCode as cdepcode','a.cCusCode as cuscode','b.iDLsID as idlsid','b.cWhCode as cwhcode','b.cInvCode as cinvcode','b.cInvName as product_title','b.cFree1 as cfree1','b.cFree2 as cfree2','b.cPosition as cposition','b.cBatch as cbatch','b.iQuantity as iquantity','b.iNum as inum','b.iInvExchRate as iinvexchrate','b.fOutQuantity as out_quantity','b.iUnitPrice as iunitcost','b.iMoney as imoney')
|
|
|
->get()->toArray();
|
|
|
+
|
|
|
if(! empty($message)){
|
|
|
foreach ($message as $key => $value){
|
|
|
// $message[$key]->iquantity = $value->iquantity - $value->out_quantity;
|