Beispiel #1
0
 protected function batchAddEachProcess($rData)
 {
     $em = $this->em;
     $oOrders = new Orders();
     $oOpe = new Ope();
     $oGoodsPassport = new GoodsPassport();
     $oGoodsPassport->setBrand($this->brand)->setModel($rData['model'])->setColor($this->color)->setPattern($this->pattern)->setColorSn(array_key_exists('colorSn', $rData) ? $rData['colorSn'] : '')->setLevel($this->oGoodsLevel)->setGoodsStatus($this->oGoodsStatus)->setName($rData['sGoodsName'])->setCost($rData['nGoodsCost'])->setPrice($rData['nGoodsPrice'])->setOrgSn(array_key_exists('sGoodsOrgSn', $rData) ? $rData['sGoodsOrgSn'] : '')->setMemo(array_key_exists('sGoodsMemo', $rData) ? $rData['sGoodsMemo'] : '');
     $em->persist($oGoodsPassport);
     $em->flush();
     $sym = $this->get('base_method')->getSymbol();
     $theRate = $sym == 'NT' ? self::SN_RATE : 10;
     $nGoodsId = $oGoodsPassport->getId();
     $sGoodsSn = $oGoodsPassport->genSn($rData['sStoreSn']);
     $oGoodsPassport->setSn($sGoodsSn)->setParent($em->find('WoojinGoodsBundle:GoodsPassport', $nGoodsId));
     $em->persist($oGoodsPassport);
     $em->flush();
     $oOrders->setGoodsPassport($oGoodsPassport)->setPayType($this->oPayType)->setOrdersKind($this->oOrdersKind)->setOrdersStatus($this->oOrdersStatus)->setRequired($rData['nGoodsCost'])->setPaid($rData['nGoodsCost']);
     $em->persist($oOrders);
     $em->flush();
     $nOrdersId = $oOrders->getId();
     //Ope實體新增
     $oOpe->setOrders($oOrders)->setUser($this->oUser)->setAct('批次成立進貨訂單')->setDatetime(new \DateTime($rData['time']));
     $em->persist($oOpe);
     $em->flush();
 }