Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dsyerp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sugar
dsyerp
Commits
8cbfe738
Commit
8cbfe738
authored
Apr 24, 2023
by
wxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
总入库存 总出库存
parent
a9535ec9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
8 deletions
+80
-8
module/Stock/src/Repository/ExWarehouseOrderGoodsRepository.php
.../Stock/src/Repository/ExWarehouseOrderGoodsRepository.php
+27
-0
module/Stock/src/Repository/OtherWarehouseOrderGoodsRepository.php
...ock/src/Repository/OtherWarehouseOrderGoodsRepository.php
+28
-0
module/Store/src/Controller/GoodsController.php
module/Store/src/Controller/GoodsController.php
+12
-3
module/Store/view/store/goods/exwarehousegoods.phtml
module/Store/view/store/goods/exwarehousegoods.phtml
+2
-1
module/Store/view/store/goods/index.phtml
module/Store/view/store/goods/index.phtml
+9
-3
module/Store/view/store/goods/otherwarehousegoods.phtml
module/Store/view/store/goods/otherwarehousegoods.phtml
+2
-1
No files found.
module/Stock/src/Repository/ExWarehouseOrderGoodsRepository.php
View file @
8cbfe738
...
...
@@ -15,8 +15,35 @@
namespace
Stock\Repository
;
use
Doctrine\ORM\EntityRepository
;
use
Doctrine\ORM\QueryBuilder
;
use
Stock\Entity\ExWarehouseOrderGoods
;
class
ExWarehouseOrderGoodsRepository
extends
EntityRepository
{
/**
* 获取出库总数
* @param array $search
* @return \Doctrine\ORM\Query
*/
public
function
ExWarehouseOrderGoodsAmount
(
$search
=
[])
{
$query
=
$this
->
getEntityManager
()
->
createQueryBuilder
()
->
select
(
'SUM(e.warehouseGoodsExNum)'
)
->
from
(
ExWarehouseOrderGoods
::
class
,
'e'
);
$this
->
querySearchData
(
$search
,
$query
);
$ExWarehouseAmount
=
$query
->
getQuery
()
->
getSingleScalarResult
();
return
$ExWarehouseAmount
?
$ExWarehouseAmount
:
0
;
}
private
function
querySearchData
(
$search
,
QueryBuilder
$queryBuilder
)
{
if
(
isset
(
$search
[
'ex_warehouse_order_goods_id'
])
&&
!
empty
(
$search
[
'ex_warehouse_order_goods_id'
]))
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
()
->
eq
(
'e.exWarehouseOrderGoodsId'
,
$search
[
'ex_warehouse_order_goods_id'
]));
if
(
isset
(
$search
[
'ex_warehouse_order_id'
])
&&
!
empty
(
$search
[
'ex_warehouse_order_id'
]))
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
()
->
eq
(
'e.exWarehouseOrderId'
,
$search
[
'ex_warehouse_order_id'
]));
if
(
isset
(
$search
[
'goods_id'
])
&&
!
empty
(
$search
[
'goods_id'
]))
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
()
->
eq
(
'e.goodsId'
,
$search
[
'goods_id'
]));
if
(
isset
(
$search
[
'goods_name'
])
&&
!
empty
(
$search
[
'goods_name'
]))
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
()
->
like
(
'e.goodsName'
,
"'%"
.
$search
[
'goods_name'
]
.
"%'"
));
if
(
isset
(
$search
[
'goods_number'
])
&&
!
empty
(
$search
[
'goods_number'
]))
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
()
->
like
(
'e.goodsNumber'
,
"'%"
.
$search
[
'goods_number'
]
.
"%'"
));
if
(
isset
(
$search
[
'goods_spec'
])
&&
!
empty
(
$search
[
'goods_spec'
]))
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
()
->
like
(
'e.goodsSpec'
,
"'%"
.
$search
[
'goods_spec'
]
.
"%'"
));
return
$queryBuilder
;
}
}
\ No newline at end of file
module/Stock/src/Repository/OtherWarehouseOrderGoodsRepository.php
View file @
8cbfe738
...
...
@@ -15,8 +15,36 @@
namespace
Stock\Repository
;
use
Doctrine\ORM\EntityRepository
;
use
Doctrine\ORM\QueryBuilder
;
use
Stock\Entity\OtherWarehouseOrderGoods
;
class
OtherWarehouseOrderGoodsRepository
extends
EntityRepository
{
/**
* 获取入库总数
* @param array $search
* @return \Doctrine\ORM\Query
*/
public
function
OtherWarehouseOrderGoodsAmount
(
$search
=
[])
{
$query
=
$this
->
getEntityManager
()
->
createQueryBuilder
()
->
select
(
'SUM(o.warehouseGoodsBuyNum)'
)
->
from
(
OtherWarehouseOrderGoods
::
class
,
'o'
);
$this
->
querySearchData
(
$search
,
$query
);
$OtherWarehouseAmount
=
$query
->
getQuery
()
->
getSingleScalarResult
();
return
$OtherWarehouseAmount
?
$OtherWarehouseAmount
:
0
;
}
private
function
querySearchData
(
$search
,
QueryBuilder
$queryBuilder
)
{
if
(
isset
(
$search
[
'warehouse_order_goods_id'
])
&&
!
empty
(
$search
[
'warehouse_order_goods_id'
]))
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
()
->
eq
(
'o.warehouseOrderGoodsId'
,
$search
[
'warehouse_order_goods_id'
]));
if
(
isset
(
$search
[
'other_warehouse_order_id'
])
&&
!
empty
(
$search
[
'other_warehouse_order_id'
]))
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
()
->
eq
(
'o.otherWarehouseOrderId'
,
$search
[
'other_warehouse_order_id'
]));
if
(
isset
(
$search
[
'goods_id'
])
&&
!
empty
(
$search
[
'goods_id'
]))
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
()
->
eq
(
'o.goodsId'
,
$search
[
'goods_id'
]));
if
(
isset
(
$search
[
'goods_name'
])
&&
!
empty
(
$search
[
'goods_name'
]))
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
()
->
like
(
'o.goodsName'
,
"'%"
.
$search
[
'goods_name'
]
.
"%'"
));
if
(
isset
(
$search
[
'goods_number'
])
&&
!
empty
(
$search
[
'goods_number'
]))
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
()
->
like
(
'o.goodsNumber'
,
"'%"
.
$search
[
'goods_number'
]
.
"%'"
));
if
(
isset
(
$search
[
'goods_spec'
])
&&
!
empty
(
$search
[
'goods_spec'
]))
$queryBuilder
->
andWhere
(
$queryBuilder
->
expr
()
->
like
(
'o.goodsSpec'
,
"'%"
.
$search
[
'goods_spec'
]
.
"%'"
));
return
$queryBuilder
;
}
}
\ No newline at end of file
module/Store/src/Controller/GoodsController.php
View file @
8cbfe738
...
...
@@ -83,7 +83,12 @@ class GoodsController extends AbstractActionController
$query
=
$this
->
entityManager
->
getRepository
(
Goods
::
class
)
->
findAllGoods
(
$search
);
$goodsList
=
$this
->
adminCommon
()
->
erpPaginator
(
$query
,
$page
);
if
(
!
empty
(
$goodsList
))
{
foreach
(
$goodsList
as
$key
=>
$value
)
{
$value
->
OtherWarehouseOrderGoodsAmount
=
$this
->
entityManager
->
getRepository
(
OtherWarehouseOrderGoods
::
class
)
->
OtherWarehouseOrderGoodsAmount
([
'goods_id'
=>
$value
->
getGoodsId
()]);
$value
->
ExWarehouseOrderGoodsAmount
=
$this
->
entityManager
->
getRepository
(
ExWarehouseOrderGoods
::
class
)
->
ExWarehouseOrderGoodsAmount
([
'goods_id'
=>
$value
->
getGoodsId
()]);
}
}
return
[
'goodsList'
=>
$goodsList
,
'searchForm'
=>
$searchForm
];
}
...
...
@@ -506,6 +511,7 @@ class GoodsController extends AbstractActionController
$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
()]);
}
}
return
[
'goodsInfo'
=>
$goodsInfo
,
'otherWarehouseOrder'
=>
$otherWarehouseOrderInfo
,
'orderGoods'
=>
$orderGoods
];
...
...
@@ -536,6 +542,7 @@ class GoodsController extends AbstractActionController
$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
()]);
}
}
return
[
'goodsInfo'
=>
$goodsInfo
,
'exWarehouseOrder'
=>
$exWarehouseOrderInfo
,
'orderGoods'
=>
$orderGoods
];
...
...
@@ -568,10 +575,12 @@ class GoodsController extends AbstractActionController
$arr
[
'goodsSpec'
]
=
$val
->
getGoodsSpec
();
$arr
[
'goodsCategoryName'
]
=
$val
->
getGoodsCategory
()
?
$val
->
getGoodsCategory
()
->
getGoodsCategoryName
()
:
''
;
$arr
[
'brandName'
]
=
$val
->
getBrand
()
?
$val
->
getBrand
()
->
getBrandName
()
:
''
;
$arr
[
'OtherWarehouseOrderGoodsAmount'
]
=
$this
->
entityManager
->
getRepository
(
OtherWarehouseOrderGoods
::
class
)
->
OtherWarehouseOrderGoodsAmount
([
'goods_id'
=>
$val
->
getGoodsId
()]);
$arr
[
'ExWarehouseOrderGoodsAmount'
]
=
$this
->
entityManager
->
getRepository
(
ExWarehouseOrderGoods
::
class
)
->
ExWarehouseOrderGoodsAmount
([
'goods_id'
=>
$val
->
getGoodsId
()]);
array_push
(
$list
,
$arr
);
}
$columns
=
[
'goodsId'
,
'goodsName'
,
'goodsStock'
,
'goodsPrice'
,
'goodsRecommendPrice'
,
'goodsSpec'
,
'goodsCategoryName'
,
'brandName'
];
$columns_CH
=
"ID,商品名称,库存,采购价格,建议售价,商品规格,商品分类,商品品牌"
;
$columns
=
[
'goodsId'
,
'goodsName'
,
'goodsStock'
,
'goodsPrice'
,
'goodsRecommendPrice'
,
'goodsSpec'
,
'goodsCategoryName'
,
'brandName'
,
'OtherWarehouseOrderGoodsAmount'
,
'ExWarehouseOrderGoodsAmount'
];
$columns_CH
=
"ID,商品名称,库存,采购价格,建议售价,商品规格,商品分类,商品品牌
,总入库存,总出库存
"
;
$this
->
goodsManager
->
export_excel
(
$list
,
$columns
,
'商品导出'
,
explode
(
","
,
$columns_CH
));
exit
;
return
;
...
...
module/Store/view/store/goods/exwarehousegoods.phtml
View file @
8cbfe738
...
...
@@ -59,7 +59,8 @@
<tfoot>
<tr>
<td
colspan=
"8"
></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
->
exWarehouseOrder
)
?
$this
->
erpCurrencyFormat
(
$this
->
exWarehouseOrder
->
getExWarehouseOrderAmount
())
:
0
);
?>
</span></td>
</tr>
</tfoot>
...
...
module/Store/view/store/goods/index.phtml
View file @
8cbfe738
...
...
@@ -25,7 +25,7 @@
<thead>
<tr
class=
"erp-bg-thead"
>
<th
width=
"6%"
>
ID
</th>
<th
width=
"
2
0%"
>
<?php
echo
$this
->
translate
(
'商品名称'
);
?>
</th>
<th
width=
"
1
0%"
>
<?php
echo
$this
->
translate
(
'商品名称'
);
?>
</th>
<th
width=
"10%"
>
<?php
echo
$this
->
translate
(
'商品编号'
);
?>
</th>
<th
width=
"12%"
>
<?php
echo
$this
->
translate
(
'商品规格'
);
?>
</th>
<th
width=
"10%"
>
<?php
echo
$this
->
translate
(
'采购价格'
);
?>
</th>
...
...
@@ -33,6 +33,8 @@
<th
width=
"10%"
>
<?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=
"12%"
>
<?php
echo
$this
->
translate
(
'操作'
);
?>
</th>
</tr>
<?php
...
...
@@ -101,6 +103,8 @@
<?php
echo
$this
->
formElementErrors
(
$sForm
->
get
(
'start_stock'
),
[
'class'
=>
'error-message'
]);
?>
<?php
echo
$this
->
formElementErrors
(
$sForm
->
get
(
'end_stock'
),
[
'class'
=>
'error-message'
]);
?>
</td>
<td></td>
<td></td>
<td>
<button
type=
"submit"
class=
"btn btn-info btn-sm"
><i
class=
"fa fa-search"
></i></button>
<?php
if
(
!
empty
(
array_filter
(
$sForm
->
getData
())))
{
?>
...
...
@@ -134,6 +138,8 @@
<?php
echo
$this
->
translate
(
'无'
);
?>
<?php
}
?>
</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>
<a
href=
"
<?php
echo
$this
->
url
(
'goods'
,
[
'action'
=>
'edit'
,
'id'
=>
$goods
->
getGoodsId
()]);
?>
"
...
...
@@ -146,12 +152,12 @@
<a
href=
"
<?php
echo
$this
->
url
(
'goods'
,
[
'action'
=>
'otherwarehousegoods'
,
'id'
=>
$goods
->
getGoodsId
()]);
?>
"
class=
"btn btn-xs btn-success"
>
<?php
echo
$this
->
translate
(
'入库'
);
?>
class=
"btn btn-xs btn-success"
>
<?php
echo
$this
->
translate
(
'入库
记录
'
);
?>
</a>
<a
href=
"
<?php
echo
$this
->
url
(
'goods'
,
[
'action'
=>
'exwarehousegoods'
,
'id'
=>
$goods
->
getGoodsId
()]);
?>
"
class=
"btn btn-xs btn-success"
>
<?php
echo
$this
->
translate
(
'出库'
);
?>
class=
"btn btn-xs btn-success"
>
<?php
echo
$this
->
translate
(
'出库
记录
'
);
?>
</a>
</td>
</tr>
...
...
module/Store/view/store/goods/otherwarehousegoods.phtml
View file @
8cbfe738
...
...
@@ -58,7 +58,8 @@
<tfoot>
<tr>
<td
colspan=
"8"
></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
->
otherWarehouseOrder
)
?
$this
->
erpCurrencyFormat
(
$this
->
otherWarehouseOrder
->
getWarehouseOrderAmount
())
:
0
);
?>
</span></td>
</tr>
</tfoot>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment