Пример #1
0
 /**
  * WaveInfoManageView::makeSingleWave()
  * 生成单料号及单发货单配货单
  * @author Gary 
  * @return void
  */
 public function makeSingleWave($time)
 {
     $update = array('createUserId' => $_SESSION['userId'], 'createTime' => time(), 'waveStatus' => 1);
     $where = array('waveType in' => array(1, 2), 'createTime <=' => $time, 'createUserId' => 0, 'is_delete' => 0);
     $waveinfo = WhWaveInfoModel::get_wave_info('id', $where);
     //获取所有符合条件的配货单号
     WhBaseModel::begin();
     //更新配货单状态
     $info = WhWaveInfoModel::update_wave_info($update, $where);
     if (!$info) {
         WhBaseModel::rollback();
         return $info;
     }
     $waveIds = get_filed_array('id', $waveinfo);
     $waveIds = empty($waveIds) ? array(0) : $waveIds;
     $shipOrderIds = WhWaveShippingRelationModel::select(array('waveId in' => $waveIds), 'shipOrderId');
     //print_r($waveIds);exit;
     $shipOrderIds = get_filed_array('shipOrderId', $shipOrderIds);
     $shipOrderIds = empty($shipOrderIds) ? array(0) : $shipOrderIds;
     $info = WhShippingOrderModel::update(array('orderStatus' => PKS_PROCESS_GET_GOODS), array('id in' => $shipOrderIds));
     if (!$info) {
         WhBaseModel::rollback();
         return $info;
     }
     $info = WhBaseModel::affected_rows();
     WhBaseModel::commit();
     return $info;
 }