Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
a60cc936
"...main/resources/git@ustchcs.com:gujinli1118/JSH_ERP.git" did not exist on "ccec596c936e8737738dde3f8d1fa8532a41d882"
Commit
a60cc936
authored
Jun 21, 2021
by
季圣华
Browse files
解决商品选择框中多单位商品库存bug
parent
6eb7d965
Changes
1
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java
View file @
a60cc936
...
...
@@ -5,14 +5,12 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.DepotEx
;
import
com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx
;
import
com.jsh.erp.datasource.entities.Material
;
import
com.jsh.erp.datasource.entities.MaterialVo4Unit
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.depotItem.DepotItemService
;
import
com.jsh.erp.service.material.MaterialService
;
import
com.jsh.erp.service.redis.RedisService
;
import
com.jsh.erp.service.unit.UnitService
;
import
com.jsh.erp.utils.*
;
import
jxl.Sheet
;
import
jxl.Workbook
;
...
...
@@ -44,6 +42,9 @@ public class MaterialController {
@Resource
private
DepotItemService
depotItemService
;
@Resource
private
UnitService
unitService
;
@Resource
private
RedisService
redisService
;
...
...
@@ -188,17 +189,24 @@ public class MaterialController {
ratio
=
ratio
.
substring
(
ratio
.
indexOf
(
"("
));
}
}
//名称/型号/扩展信息/包装
String
MaterialName
=
""
;
String
mBarCode
=
""
;
if
(
material
.
getmBarCode
()!=
null
)
{
mBarCode
=
material
.
getmBarCode
();
MaterialName
=
MaterialName
+
mBarCode
+
"_"
;
item
.
put
(
"mBarCode"
,
material
.
getmBarCode
());
item
.
put
(
"name"
,
material
.
getName
());
item
.
put
(
"categoryName"
,
material
.
getCategoryName
());
item
.
put
(
"standard"
,
material
.
getStandard
());
item
.
put
(
"model"
,
material
.
getModel
());
item
.
put
(
"unit"
,
material
.
getCommodityUnit
()
+
ratio
);
if
(
depotId
!=
null
)
{
BigDecimal
stock
=
depotItemService
.
getStockByParam
(
depotId
,
material
.
getId
(),
null
,
null
,
tenantId
);
if
(
material
.
getUnitId
()!=
null
){
Unit
unit
=
unitService
.
getUnit
(
material
.
getUnitId
());
if
(
material
.
getCommodityUnit
().
equals
(
unit
.
getOtherUnit
()))
{
if
(
unit
.
getRatio
()!=
0
)
{
stock
=
stock
.
divide
(
BigDecimal
.
valueOf
(
unit
.
getRatio
()));
}
}
}
item
.
put
(
"stock"
,
stock
);
}
item
.
put
(
"mBarCode"
,
mBarCode
);
MaterialName
=
MaterialName
+
" "
+
material
.
getName
()
+
((
material
.
getStandard
()
==
null
||
material
.
getStandard
().
equals
(
""
))
?
""
:
"("
+
material
.
getStandard
()
+
")"
)
+
((
material
.
getModel
()
==
null
||
material
.
getModel
().
equals
(
""
))
?
""
:
"("
+
material
.
getModel
()
+
")"
);
String
expand
=
""
;
//扩展信息
for
(
int
i
=
0
;
i
<
mpArr
.
length
;
i
++)
{
if
(
mpArr
[
i
].
equals
(
"制造商"
))
{
...
...
@@ -214,18 +222,7 @@ public class MaterialController {
expand
=
expand
+
((
material
.
getOtherField3
()
==
null
||
material
.
getOtherField3
().
equals
(
""
))
?
""
:
"("
+
material
.
getOtherField3
()
+
")"
);
}
}
MaterialName
=
MaterialName
+
expand
+
((
material
.
getCommodityUnit
()
==
null
||
material
.
getCommodityUnit
().
equals
(
""
))
?
""
:
"("
+
material
.
getCommodityUnit
()
+
")"
)
+
ratio
;
item
.
put
(
"materialName"
,
MaterialName
);
item
.
put
(
"categoryName"
,
material
.
getCategoryName
());
item
.
put
(
"name"
,
material
.
getName
());
item
.
put
(
"expand"
,
expand
);
item
.
put
(
"model"
,
material
.
getModel
());
item
.
put
(
"standard"
,
material
.
getStandard
());
item
.
put
(
"unit"
,
material
.
getCommodityUnit
()
+
ratio
);
if
(
depotId
!=
null
)
{
BigDecimal
stock
=
depotItemService
.
getStockByParam
(
depotId
,
material
.
getId
(),
null
,
null
,
tenantId
);
item
.
put
(
"stock"
,
stock
);
}
dataArray
.
add
(
item
);
}
}
...
...
Write
Preview
Supports
Markdown
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