save($param); } /** * 获取列表 * @param $param * @return array */ public function getList($param){ $dao = new ReceiptOrderDao(); return $dao->getList($param); } /** * 设置状态 * @param $id * @param $status * @return array */ public function setStatus($id,$status) { Db::startTrans(); //1.设置收购单状态 $dao = new ReceiptOrderDao(); $statusRe = $dao->setStatus($id,$status); if (!$statusRe['flag']) { Db::rollback(); return$statusRe; } //2.设置所有订单主表的状态 $orderDao = new OrderMainDao(); $orderRe = $orderDao->setReceiptOrderStatus($id,$status); if (!$orderRe['flag']) { Db::rollback(); return $orderRe; } Db::commit(); return Util::returnArrSu(); } /** * 添加主订单到采购单 * @param $id * @param $order_id * @return array */ public function addOrderMain($id,$order_id){ $model = new ReceiptOrderDao(); $infoRe = $model->getInfoById($id); if (!$infoRe['flag']) { return $infoRe; } $orderIds = explode(",", $order_id); $orderMainDao = new OrderMainDao(); $addRe = $orderMainDao->addOrderMainInReceipt($infoRe['data'],$orderIds); if (!$addRe['flag']) { return $addRe; } return Util::returnArrSu(); } /** * 移除采购单 * @param $order_id * @return array */ public function removeOrderMain($order_id){ $orderIds = explode(",", $order_id); $orderMainDao = new OrderMainDao(); return $orderMainDao->removeOrderMainFormReceipt($orderIds); } /** * 获取主订单列表 * @param $param * @return array */ public function getOrderMainList($param){ $orderMainDao = new OrderMainDao(); $where = ["id"=>["neq",""]]; if (!empty($param['order_id'])) { $where["order"]=$param['order_id']; } switch ($param['inReceipt']) { case 0: break; case 1: $where["receipt_order_id"] = $param['receipt_order_id']; break; case 2: $where["receipt_order_id"] = ["neq",$param['receipt_order_id']]; break; case 3: $where["receipt_order_id"] = ""; } return $orderMainDao->getOrderListByWhere($where,$param); } }