Commit f526207f authored by wxl's avatar wxl

商品列表入库出库列表

parent 598722cf
...@@ -24,9 +24,12 @@ use Stock\Entity\ExWarehouseOrder; ...@@ -24,9 +24,12 @@ use Stock\Entity\ExWarehouseOrder;
use Stock\Entity\ExWarehouseOrderGoods; use Stock\Entity\ExWarehouseOrderGoods;
use Stock\Entity\OtherWarehouseOrder; use Stock\Entity\OtherWarehouseOrder;
use Stock\Entity\OtherWarehouseOrderGoods; use Stock\Entity\OtherWarehouseOrderGoods;
use Store\Entity\AllExWarehouseOrderGoods;
use Store\Entity\AllWarehouseOrderGoods;
use Store\Entity\Goods; use Store\Entity\Goods;
use Store\Entity\GoodsCategory; use Store\Entity\GoodsCategory;
use Store\Entity\GoodsCustom; use Store\Entity\GoodsCustom;
use Store\Entity\Warehouse;
use Store\Entity\WarehouseGoods; use Store\Entity\WarehouseGoods;
use Store\Form\GoodsForm; use Store\Form\GoodsForm;
use Store\Form\ImportGoodsForm; use Store\Form\ImportGoodsForm;
...@@ -85,8 +88,8 @@ class GoodsController extends AbstractActionController ...@@ -85,8 +88,8 @@ class GoodsController extends AbstractActionController
$goodsList = $this->adminCommon()->erpPaginator($query, $page); $goodsList = $this->adminCommon()->erpPaginator($query, $page);
if(!empty($goodsList)) { if(!empty($goodsList)) {
foreach ($goodsList as $key => $value) { foreach ($goodsList as $key => $value) {
$value->OtherWarehouseOrderGoodsAmount = $this->entityManager->getRepository(OtherWarehouseOrderGoods::class)->OtherWarehouseOrderGoodsAmount(['goods_id' => $value->getGoodsId()]); $value->OtherWarehouseOrderGoodsAmount = $this->entityManager->getRepository(AllWarehouseOrderGoods::class)->warehouseOrderGoodsAmount(['goods_id' => $value->getGoodsId()]);
$value->ExWarehouseOrderGoodsAmount = $this->entityManager->getRepository(ExWarehouseOrderGoods::class)->ExWarehouseOrderGoodsAmount(['goods_id' => $value->getGoodsId()]); $value->ExWarehouseOrderGoodsAmount = $this->entityManager->getRepository(AllExWarehouseOrderGoods::class)->exWarehouseOrderGoodsAmount(['goods_id' => $value->getGoodsId()]);
} }
} }
return ['goodsList' => $goodsList, 'searchForm' => $searchForm]; return ['goodsList' => $goodsList, 'searchForm' => $searchForm];
...@@ -499,22 +502,20 @@ class GoodsController extends AbstractActionController ...@@ -499,22 +502,20 @@ class GoodsController extends AbstractActionController
$this->flashMessenger()->addWarningMessage($this->translator->translate('该商品不存在!')); $this->flashMessenger()->addWarningMessage($this->translator->translate('该商品不存在!'));
return $this->redirect()->toRoute('goods'); return $this->redirect()->toRoute('goods');
} }
$orderGoods = $this->entityManager->getRepository(OtherWarehouseOrderGoods::class)->findBy(['goodsId' => $goodsId]); $orderGoods = $this->entityManager->getRepository(AllWarehouseOrderGoods::class)->findBy(['goodsId' => $goodsId]);
if($orderGoods == null) { if($orderGoods == null) {
$this->flashMessenger()->addWarningMessage($this->translator->translate('该入库单不存在!')); $this->flashMessenger()->addWarningMessage($this->translator->translate('该入库单不存在!'));
return $this->redirect()->toRoute('goods'); return $this->redirect()->toRoute('goods');
} }
if(!empty($orderGoods)) { if(!empty($orderGoods)) {
foreach ($orderGoods as $key => $value) { foreach ($orderGoods as $key => $value) {
$otherWarehouseOrderInfo= $this->entityManager->getRepository(OtherWarehouseOrder::class)->findOneBy(['otherWarehouseOrderId' => $value->getOtherWarehouseOrderId()]); $warehouse=$this->entityManager->getRepository(Warehouse::class)->findOneBy(['warehouseId' => $value->getwarehouseId()]);
$value->otherAddTime = $otherWarehouseOrderInfo->getOtherAddTime(); $value->warehouseName = $warehouse->getWarehouseName();
$value->WarehouseOrderSn = $otherWarehouseOrderInfo->getWarehouseOrderSn();
$value->WarehouseName = $otherWarehouseOrderInfo->getOneWarehouse()->getWarehouseName();
$value->WarehouseOrderInfo = $otherWarehouseOrderInfo->getWarehouseOrderInfo();
$otherWarehouseOrderInfo->OtherWarehouseOrderGoodsAmount = $this->entityManager->getRepository(OtherWarehouseOrderGoods::class)->OtherWarehouseOrderGoodsAmount(['goods_id' => $value->getGoodsId()]);
} }
$warehouseOrderGoods['Num'] =$this->entityManager->getRepository(AllWarehouseOrderGoods::class)->warehouseOrderGoodsAmount(['goods_id' => $goodsId]);
$warehouseOrderGoods['Amount'] = $this->entityManager->getRepository(AllWarehouseOrderGoods::class)->warehouseOrderGoodsAmountPrice(['goods_id' => $goodsId]);
} }
return ['goodsInfo' => $goodsInfo, 'otherWarehouseOrder' => $otherWarehouseOrderInfo, 'orderGoods'=>$orderGoods]; return ['goodsInfo' => $goodsInfo,'warehouseOrderGoods'=>$warehouseOrderGoods, 'orderGoods'=>$orderGoods];
} }
/** /**
...@@ -530,22 +531,20 @@ class GoodsController extends AbstractActionController ...@@ -530,22 +531,20 @@ class GoodsController extends AbstractActionController
$this->flashMessenger()->addWarningMessage($this->translator->translate('该商品不存在!')); $this->flashMessenger()->addWarningMessage($this->translator->translate('该商品不存在!'));
return $this->redirect()->toRoute('goods'); return $this->redirect()->toRoute('goods');
} }
$orderGoods = $this->entityManager->getRepository(ExWarehouseOrderGoods::class)->findBy(['goodsId' => $goodsId]); $orderGoods = $this->entityManager->getRepository(AllExWarehouseOrderGoods::class)->findBy(['goodsId' => $goodsId]);
if($orderGoods == null) { if($orderGoods == null) {
$this->flashMessenger()->addWarningMessage($this->translator->translate('该出库单不存在!')); $this->flashMessenger()->addWarningMessage($this->translator->translate('该出库单不存在!'));
return $this->redirect()->toRoute('goods'); return $this->redirect()->toRoute('goods');
} }
if(!empty($orderGoods)) { if(!empty($orderGoods)) {
foreach ($orderGoods as $key => $value) { foreach ($orderGoods as $key => $value) {
$exWarehouseOrderInfo= $this->entityManager->getRepository(ExWarehouseOrder::class)->findOneBy(['exWarehouseOrderId' => $value->getExWarehouseOrderId()]); $warehouse=$this->entityManager->getRepository(Warehouse::class)->findOneBy(['warehouseId' => $value->getwarehouseId()]);
$value->exAddTime = $exWarehouseOrderInfo->getExAddTime(); $value->warehouseName = $warehouse->getWarehouseName();
$value->ExWarehouseOrderSn = $exWarehouseOrderInfo->getExWarehouseOrderSn();
$value->WarehouseName = $exWarehouseOrderInfo->getOneWarehouse()->getWarehouseName();
$value->ExWarehouseOrderInfo = $exWarehouseOrderInfo->getExWarehouseOrderInfo();
$exWarehouseOrderInfo->ExWarehouseOrderGoodsAmount = $this->entityManager->getRepository(ExWarehouseOrderGoods::class)->ExWarehouseOrderGoodsAmount(['goods_id' => $value->getGoodsId()]);
} }
$exWarehouseOrderGoods['Num'] =$this->entityManager->getRepository(AllExWarehouseOrderGoods::class)->exWarehouseOrderGoodsAmount(['goods_id' => $goodsId]);
$exWarehouseOrderGoods['Amount'] = $this->entityManager->getRepository(AllExWarehouseOrderGoods::class)->exWarehouseOrderGoodsAmountPrice(['goods_id' => $goodsId]);
} }
return ['goodsInfo' => $goodsInfo, 'exWarehouseOrder' => $exWarehouseOrderInfo, 'orderGoods' => $orderGoods]; return ['goodsInfo' => $goodsInfo, 'exWarehouseOrderGoods' => $exWarehouseOrderGoods, 'orderGoods' => $orderGoods];
} }
/** /**
...@@ -575,8 +574,8 @@ class GoodsController extends AbstractActionController ...@@ -575,8 +574,8 @@ class GoodsController extends AbstractActionController
$arr['goodsSpec']=$val->getGoodsSpec(); $arr['goodsSpec']=$val->getGoodsSpec();
$arr['goodsCategoryName']=$val->getGoodsCategory()?$val->getGoodsCategory()->getGoodsCategoryName():''; $arr['goodsCategoryName']=$val->getGoodsCategory()?$val->getGoodsCategory()->getGoodsCategoryName():'';
$arr['brandName']=$val->getBrand()?$val->getBrand()->getBrandName():''; $arr['brandName']=$val->getBrand()?$val->getBrand()->getBrandName():'';
$arr['OtherWarehouseOrderGoodsAmount'] = $this->entityManager->getRepository(OtherWarehouseOrderGoods::class)->OtherWarehouseOrderGoodsAmount(['goods_id' => $val->getGoodsId()]); $arr['OtherWarehouseOrderGoodsAmount'] = $this->entityManager->getRepository(AllWarehouseOrderGoods::class)->warehouseOrderGoodsAmount(['goods_id' => $val->getGoodsId()]);
$arr['ExWarehouseOrderGoodsAmount'] = $this->entityManager->getRepository(ExWarehouseOrderGoods::class)->ExWarehouseOrderGoodsAmount(['goods_id' => $val->getGoodsId()]); $arr['ExWarehouseOrderGoodsAmount'] = $this->entityManager->getRepository(AllExWarehouseOrderGoods::class)->exWarehouseOrderGoodsAmount(['goods_id' => $val->getGoodsId()]);
array_push($list,$arr); array_push($list,$arr);
} }
$columns=['goodsId','goodsName','goodsStock','goodsPrice','goodsRecommendPrice','goodsSpec','goodsCategoryName','brandName','OtherWarehouseOrderGoodsAmount','ExWarehouseOrderGoodsAmount']; $columns=['goodsId','goodsName','goodsStock','goodsPrice','goodsRecommendPrice','goodsSpec','goodsCategoryName','brandName','OtherWarehouseOrderGoodsAmount','ExWarehouseOrderGoodsAmount'];
......
...@@ -25,7 +25,7 @@ class AllExWarehouseOrderGoodsRepository extends EntityRepository ...@@ -25,7 +25,7 @@ class AllExWarehouseOrderGoodsRepository extends EntityRepository
* @param array $search * @param array $search
* @return \Doctrine\ORM\Query * @return \Doctrine\ORM\Query
*/ */
public function AllExWarehouseOrderGoodsAmount($search = []) public function exWarehouseOrderGoodsAmount($search = [])
{ {
$query = $this->getEntityManager()->createQueryBuilder() $query = $this->getEntityManager()->createQueryBuilder()
->select('SUM(e.warehouseGoodsExNum)') ->select('SUM(e.warehouseGoodsExNum)')
...@@ -35,6 +35,21 @@ class AllExWarehouseOrderGoodsRepository extends EntityRepository ...@@ -35,6 +35,21 @@ class AllExWarehouseOrderGoodsRepository extends EntityRepository
return $ExWarehouseAmount ? $ExWarehouseAmount : 0; return $ExWarehouseAmount ? $ExWarehouseAmount : 0;
} }
/**
* 获取入库总金额
* @param array $search
* @return \Doctrine\ORM\Query
*/
public function exWarehouseOrderGoodsAmountPrice($search = [])
{
$query = $this->getEntityManager()->createQueryBuilder()
->select('SUM(e.warehouseGoodsAmount)')
->from(AllExWarehouseOrderGoods::class, 'e');
$this->querySearchData($search, $query);
$OtherWarehouseAmount= $query->getQuery()->getSingleScalarResult();
return $OtherWarehouseAmount ? $OtherWarehouseAmount : 0;
}
/** /**
* 检索商品id * 检索商品id
* @param $goodsName * @param $goodsName
......
...@@ -59,6 +59,36 @@ class AllWarehouseOrderGoodsRepository extends EntityRepository ...@@ -59,6 +59,36 @@ class AllWarehouseOrderGoodsRepository extends EntityRepository
return true; return true;
} }
/**
* 获取入库总数
* @param array $search
* @return \Doctrine\ORM\Query
*/
public function warehouseOrderGoodsAmount($search = [])
{
$query = $this->getEntityManager()->createQueryBuilder()
->select('SUM(o.warehouseGoodsBuyNum)')
->from(AllWarehouseOrderGoods::class, 'o');
$this->querySearchData($search, $query);
$OtherWarehouseAmount= $query->getQuery()->getSingleScalarResult();
return $OtherWarehouseAmount ? $OtherWarehouseAmount : 0;
}
/**
* 获取入库总金额
* @param array $search
* @return \Doctrine\ORM\Query
*/
public function warehouseOrderGoodsAmountPrice($search = [])
{
$query = $this->getEntityManager()->createQueryBuilder()
->select('SUM(o.warehouseGoodsAmount)')
->from(AllWarehouseOrderGoods::class, 'o');
$this->querySearchData($search, $query);
$OtherWarehouseAmount= $query->getQuery()->getSingleScalarResult();
return $OtherWarehouseAmount ? $OtherWarehouseAmount : 0;
}
private function querySearchData($search, QueryBuilder $queryBuilder) private function querySearchData($search, QueryBuilder $queryBuilder)
{ {
if(isset($search['all_warehouse_order_goods_id']) && !empty($search['all_warehouse_order_goods_id'])) $queryBuilder->andWhere($queryBuilder->expr()->eq('o.allWarehouseOrderGoodsId', $search['all_warehouse_order_goods_id'])); if(isset($search['all_warehouse_order_goods_id']) && !empty($search['all_warehouse_order_goods_id'])) $queryBuilder->andWhere($queryBuilder->expr()->eq('o.allWarehouseOrderGoodsId', $search['all_warehouse_order_goods_id']));
......
...@@ -50,18 +50,18 @@ ...@@ -50,18 +50,18 @@
<td><?php echo $this->erpCurrencyFormat($goodsValue->getWarehouseGoodsPrice()); ?></td> <td><?php echo $this->erpCurrencyFormat($goodsValue->getWarehouseGoodsPrice()); ?></td>
<td><?php echo $goodsValue->getWarehouseGoodsExNum(); ?></td> <td><?php echo $goodsValue->getWarehouseGoodsExNum(); ?></td>
<td><?php echo $this->erpCurrencyFormat($goodsValue->getWarehouseGoodsAmount()); ?></td> <td><?php echo $this->erpCurrencyFormat($goodsValue->getWarehouseGoodsAmount()); ?></td>
<td><?php echo $goodsValue->ExWarehouseOrderSn; ?></td> <td><?php echo $this->escapeHtml($goodsValue->getExWarehouseOrderSn()); ?> </td>
<td><?php echo $goodsValue->WarehouseName; ?></td> <td><?php echo $goodsValue->warehouseName; ?></td>
<td><?php echo date("Y-m-d H:i:s", $goodsValue->exAddTime); ?></td> <td><?php echo date("Y-m-d H:i:s", $goodsValue->getAddTime()); ?></td>
<td><?php echo $goodsValue->ExWarehouseOrderInfo; ?></td> <td></td>
</tr> </tr>
<?php } ?> <?php } ?>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="6"></td> <td colspan="6"></td>
<td colspan="2" class="text-right"><b><?php echo $this->translate('总出库数'); ?></b><span id="order-amount"><?php echo (isset($this->exWarehouseOrder) ? $this->exWarehouseOrder->ExWarehouseOrderGoodsAmount : 0); ?></span></td> <td colspan="2" class="text-right"><b><?php echo $this->translate('总出库数'); ?></b><span id="order-amount"><?php echo (isset($this->exWarehouseOrderGoods) ? $this->exWarehouseOrderGoods['Num'] : 0); ?></span></td>
<td colspan="2" class="text-right"><b><?php echo $this->translate('金额合计'); ?></b><span id="order-amount"><?php echo (isset($this->exWarehouseOrder) ? $this->erpCurrencyFormat($this->exWarehouseOrder->getExWarehouseOrderAmount()) : 0); ?></span></td> <td colspan="2" class="text-right"><b><?php echo $this->translate('金额合计'); ?></b><span id="order-amount"><?php echo (isset($this->exWarehouseOrderGoods) ? $this->erpCurrencyFormat($this->exWarehouseOrderGoods['Amount']) : 0); ?></span></td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
......
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
<th width="10%"><?php echo $this->translate('商品分类'); ?></th> <th width="10%"><?php echo $this->translate('商品分类'); ?></th>
<th width="8%"><?php echo $this->translate('商品品牌'); ?></th> <th width="8%"><?php echo $this->translate('商品品牌'); ?></th>
<th width="6%"><?php echo $this->translate('库存'); ?></th> <th width="6%"><?php echo $this->translate('库存'); ?></th>
<th width="6%"><?php echo $this->translate('总出库存'); ?></th>
<th width="6%"><?php echo $this->translate('总入库存'); ?></th> <th width="6%"><?php echo $this->translate('总入库存'); ?></th>
<th width="6%"><?php echo $this->translate('总出库存'); ?></th>
<th width="12%"><?php echo $this->translate('操作'); ?></th> <th width="12%"><?php echo $this->translate('操作'); ?></th>
</tr> </tr>
<?php <?php
...@@ -138,8 +138,8 @@ ...@@ -138,8 +138,8 @@
<?php echo $this->translate('无'); ?> <?php echo $this->translate('无'); ?>
<?php } ?> <?php } ?>
</td> </td>
<td><?php echo empty($goods->ExWarehouseOrderGoodsAmount) ? $this->translate('无') : $this->escapeHtml($goods->ExWarehouseOrderGoodsAmount); ?></td>
<td><?php echo empty($goods->OtherWarehouseOrderGoodsAmount) ? $this->translate('无') : $this->escapeHtml($goods->OtherWarehouseOrderGoodsAmount); ?></td> <td><?php echo empty($goods->OtherWarehouseOrderGoodsAmount) ? $this->translate('无') : $this->escapeHtml($goods->OtherWarehouseOrderGoodsAmount); ?></td>
<td><?php echo empty($goods->ExWarehouseOrderGoodsAmount) ? $this->translate('无') : $this->escapeHtml($goods->ExWarehouseOrderGoodsAmount); ?></td>
<td> <td>
<a href="<?php echo $this->url('goods', <a href="<?php echo $this->url('goods',
['action'=>'edit', 'id'=>$goods->getGoodsId()]); ?>" ['action'=>'edit', 'id'=>$goods->getGoodsId()]); ?>"
......
...@@ -49,18 +49,18 @@ ...@@ -49,18 +49,18 @@
<td><?php echo $this->erpCurrencyFormat($goodsValue->getWarehouseGoodsPrice()); ?></td> <td><?php echo $this->erpCurrencyFormat($goodsValue->getWarehouseGoodsPrice()); ?></td>
<td><?php echo $goodsValue->getWarehouseGoodsBuyNum(); ?></td> <td><?php echo $goodsValue->getWarehouseGoodsBuyNum(); ?></td>
<td><?php echo $this->erpCurrencyFormat($goodsValue->getWarehouseGoodsAmount()); ?></td> <td><?php echo $this->erpCurrencyFormat($goodsValue->getWarehouseGoodsAmount()); ?></td>
<td><?php echo $goodsValue->WarehouseOrderSn; ?></td> <td><?php echo $this->escapeHtml($goodsValue->getWarehouseOrderSn()); ?> </td>
<td><?php echo $goodsValue->WarehouseName; ?></td> <td><?php echo $goodsValue->warehouseName; ?></td>
<td><?php echo date("Y-m-d H:i:s", $goodsValue->otherAddTime); ?></td> <td><?php echo date("Y-m-d H:i:s", $goodsValue->getAddTime()); ?></td>
<td><?php echo $goodsValue->WarehouseOrderInfo; ?></td> <td></td>
</tr> </tr>
<?php } ?> <?php } ?>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="6"></td> <td colspan="6"></td>
<td colspan="2" class="text-right"><b><?php echo $this->translate('总入库数'); ?></b><span id="order-amount"><?php echo (isset($this->otherWarehouseOrder) ? $this->otherWarehouseOrder->OtherWarehouseOrderGoodsAmount : 0); ?></span></td> <td colspan="2" class="text-right"><b><?php echo $this->translate('总入库数'); ?></b><span id="order-amount"><?php echo (isset($this->warehouseOrderGoods) ? $this->warehouseOrderGoods['Num'] : 0); ?></span></td>
<td colspan="2" class="text-right"><b><?php echo $this->translate('金额合计'); ?></b><span id="order-amount"><?php echo (isset($this->otherWarehouseOrder) ? $this->erpCurrencyFormat($this->otherWarehouseOrder->getWarehouseOrderAmount()) : 0); ?></span></td> <td colspan="2" class="text-right"><b><?php echo $this->translate('金额合计'); ?></b><span id="order-amount"><?php echo (isset($this->warehouseOrderGoods) ? $this->erpCurrencyFormat($this->warehouseOrderGoods['Amount']) : 0); ?></span></td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment