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
5df71b26
Commit
5df71b26
authored
Dec 01, 2021
by
季圣华
Browse files
给多单位再增加两个副单位
parent
c0ee413c
Changes
11
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/docs/jsh_erp.sql
View file @
5df71b26
...
...
@@ -866,7 +866,11 @@ CREATE TABLE `jsh_unit` (
`name`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'名称,支持多单位'
,
`basic_unit`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'基础单位'
,
`other_unit`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'副单位'
,
`other_unit_two`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'副单位2'
,
`other_unit_three`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'副单位3'
,
`ratio`
int
(
11
)
DEFAULT
NULL
COMMENT
'比例'
,
`ratio_two`
int
(
11
)
DEFAULT
NULL
COMMENT
'比例2'
,
`ratio_three`
int
(
11
)
DEFAULT
NULL
COMMENT
'比例3'
,
`tenant_id`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'租户id'
,
`delete_flag`
varchar
(
1
)
DEFAULT
'0'
COMMENT
'删除标记,0未删除,1删除'
,
PRIMARY
KEY
(
`id`
)
...
...
@@ -875,10 +879,10 @@ CREATE TABLE `jsh_unit` (
-- ----------------------------
-- Records of jsh_unit
-- ----------------------------
INSERT
INTO
`jsh_unit`
VALUES
(
'15'
,
'个,箱(1:12)'
,
'个'
,
'箱'
,
'12'
,
'63'
,
'0'
);
INSERT
INTO
`jsh_unit`
VALUES
(
'19'
,
'个,盒(1:15)'
,
'个'
,
'盒'
,
'15'
,
'63'
,
'0'
);
INSERT
INTO
`jsh_unit`
VALUES
(
'20'
,
'盒,箱(1:8)'
,
'盒'
,
'箱'
,
'8'
,
'63'
,
'0'
);
INSERT
INTO
`jsh_unit`
VALUES
(
'21'
,
'瓶,箱(1:12)'
,
'瓶'
,
'箱'
,
'12'
,
'63'
,
'0'
);
INSERT
INTO
`jsh_unit`
VALUES
(
'15'
,
'个,箱(1:12)'
,
'个'
,
'箱'
,
null
,
null
,
'12'
,
null
,
null
,
'63'
,
'0'
);
INSERT
INTO
`jsh_unit`
VALUES
(
'19'
,
'个,盒(1:15)'
,
'个'
,
'盒'
,
null
,
null
,
'15'
,
null
,
null
,
'63'
,
'0'
);
INSERT
INTO
`jsh_unit`
VALUES
(
'20'
,
'盒,箱(1:8)'
,
'盒'
,
'箱'
,
null
,
null
,
'8'
,
null
,
null
,
'63'
,
'0'
);
INSERT
INTO
`jsh_unit`
VALUES
(
'21'
,
'瓶,箱(1:12)'
,
'瓶'
,
'箱'
,
null
,
null
,
'12'
,
null
,
null
,
'63'
,
'0'
);
-- ----------------------------
-- Table structure for jsh_user
...
...
jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt
View file @
5df71b26
...
...
@@ -1297,4 +1297,14 @@ alter table jsh_user_business add tenant_id bigint(20) DEFAULT null COMMENT '租
update jsh_user_business ub left join jsh_user u on ub.key_id=u.id set ub.tenant_id=u.tenant_id
where (ub.type='UserRole' or ub.type='UserDepot' or ub.type='UserCustomer') and u.tenant_id!=0;
update jsh_user_business ub left join jsh_role r on ub.key_id=r.id set ub.tenant_id=r.tenant_id
where (ub.type='RoleFunctions') and r.tenant_id is not null;
\ No newline at end of file
where (ub.type='RoleFunctions') and r.tenant_id is not null;
-- --------------------------------------------------------
-- 时间 2021年11月30日
-- by jishenghua
-- 给计量单位表增加副单位2、副单位3、比例2、比例3 四个字段
-- --------------------------------------------------------
alter table jsh_unit add other_unit_two varchar(50) DEFAULT NULL COMMENT '副单位2' after other_unit;
alter table jsh_unit add other_unit_three varchar(50) DEFAULT NULL COMMENT '副单位3' after other_unit_two;
alter table jsh_unit add ratio_two int(11) DEFAULT NULL COMMENT '比例2' after ratio;
alter table jsh_unit add ratio_three int(11) DEFAULT NULL COMMENT '比例3' after ratio_two;
\ No newline at end of file
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotItemController.java
View file @
5df71b26
...
...
@@ -138,17 +138,10 @@ public class DepotItemController {
stock
=
depotItemService
.
getSkuStockByParam
(
depotId
,
materialVo4Unit
.
getMeId
(),
null
,
null
);
}
else
{
stock
=
depotItemService
.
getStockByParam
(
depotId
,
materialVo4Unit
.
getId
(),
null
,
null
);
String
commodityUnit
=
materialVo4Unit
.
getCommodityUnit
();
Long
unitId
=
materialVo4Unit
.
getUnitId
();
if
(
unitId
!=
null
)
{
Integer
ratio
=
1
;
Unit
unit
=
unitService
.
getUnit
(
unitId
);
if
(
commodityUnit
.
equals
(
unit
.
getOtherUnit
())){
ratio
=
unit
.
getRatio
();
if
(
ratio
!=
0
)
{
stock
=
stock
.
divide
(
BigDecimal
.
valueOf
(
ratio
),
2
,
BigDecimal
.
ROUND_HALF_UP
);
//两位小数
}
}
if
(
materialVo4Unit
.
getUnitId
()!=
null
)
{
Unit
unit
=
unitService
.
getUnit
(
materialVo4Unit
.
getUnitId
());
String
commodityUnit
=
materialVo4Unit
.
getCommodityUnit
();
stock
=
unitService
.
parseStockByUnit
(
stock
,
unit
,
commodityUnit
);
}
}
}
...
...
@@ -197,20 +190,15 @@ public class DepotItemController {
item
.
put
(
"model"
,
diEx
.
getMModel
());
item
.
put
(
"color"
,
diEx
.
getMColor
());
item
.
put
(
"materialOther"
,
getOtherInfo
(
mpArr
,
diEx
));
Integer
ratio
=
diEx
.
getRatio
();
BigDecimal
stock
;
if
(
StringUtil
.
isNotEmpty
(
diEx
.
getSku
())){
stock
=
depotItemService
.
getSkuStockByParam
(
diEx
.
getDepotId
(),
diEx
.
getMaterialExtendId
(),
null
,
null
);
}
else
{
stock
=
depotItemService
.
getStockByParam
(
diEx
.
getDepotId
(),
diEx
.
getMaterialId
(),
null
,
null
);
if
(
ratio
!=
null
){
BigDecimal
ratioDecimal
=
new
BigDecimal
(
ratio
.
toString
());
if
(
ratioDecimal
.
compareTo
(
BigDecimal
.
ZERO
)!=
0
){
String
otherUnit
=
diEx
.
getOtherUnit
();
if
(
otherUnit
.
equals
(
diEx
.
getMaterialUnit
()))
{
stock
=
stock
.
divide
(
ratioDecimal
,
2
,
BigDecimal
.
ROUND_HALF_UP
);
//两位小数
}
}
Unit
unitInfo
=
materialService
.
findUnit
(
diEx
.
getMaterialId
());
//查询计量单位信息
if
(
StringUtil
.
isNotEmpty
(
unitInfo
.
getName
()))
{
String
materialUnit
=
diEx
.
getMaterialUnit
();
stock
=
unitService
.
parseStockByUnit
(
stock
,
unitInfo
,
materialUnit
);
}
}
item
.
put
(
"stock"
,
stock
);
...
...
@@ -252,7 +240,6 @@ public class DepotItemController {
return
res
;
}
/**
* 获取扩展信息
*
...
...
jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java
View file @
5df71b26
...
...
@@ -208,14 +208,11 @@ public class MaterialController {
for
(
MaterialVo4Unit
material
:
dataList
)
{
JSONObject
item
=
new
JSONObject
();
item
.
put
(
"id"
,
material
.
getMeId
());
//商品扩展表的id
String
ratio
;
//比例
String
ratio
Str
;
//比例
if
(
material
.
getUnitId
()
==
null
||
material
.
getUnitId
().
equals
(
""
))
{
ratio
=
""
;
ratio
Str
=
""
;
}
else
{
ratio
=
material
.
getUnitName
();
if
(
ratio
!=
null
)
{
ratio
=
ratio
.
substring
(
ratio
.
indexOf
(
"("
));
}
ratioStr
=
"[多单位]"
;
}
item
.
put
(
"mBarCode"
,
material
.
getmBarCode
());
item
.
put
(
"name"
,
material
.
getName
());
...
...
@@ -223,7 +220,7 @@ public class MaterialController {
item
.
put
(
"standard"
,
material
.
getStandard
());
item
.
put
(
"model"
,
material
.
getModel
());
item
.
put
(
"color"
,
material
.
getColor
());
item
.
put
(
"unit"
,
material
.
getCommodityUnit
()
+
ratio
);
item
.
put
(
"unit"
,
material
.
getCommodityUnit
()
+
ratio
Str
);
item
.
put
(
"sku"
,
material
.
getSku
());
item
.
put
(
"enableSerialNumber"
,
material
.
getEnableSerialNumber
());
item
.
put
(
"enableBatchNumber"
,
material
.
getEnableBatchNumber
());
...
...
@@ -234,11 +231,8 @@ public class MaterialController {
stock
=
depotItemService
.
getStockByParam
(
depotId
,
material
.
getId
(),
null
,
null
);
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
()),
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
}
String
commodityUnit
=
material
.
getCommodityUnit
();
stock
=
unitService
.
parseStockByUnit
(
stock
,
unit
,
commodityUnit
);
}
}
item
.
put
(
"stock"
,
stock
);
...
...
@@ -578,11 +572,8 @@ public class MaterialController {
stock
=
depotItemService
.
getStockByParam
(
mvo
.
getDepotId
(),
mvo
.
getId
(),
null
,
null
);
if
(
mvo
.
getUnitId
()
!=
null
)
{
Unit
unit
=
unitService
.
getUnit
(
mvo
.
getUnitId
());
if
(
mvo
.
getCommodityUnit
().
equals
(
unit
.
getOtherUnit
()))
{
if
(
unit
.
getRatio
()
!=
0
)
{
stock
=
stock
.
divide
(
BigDecimal
.
valueOf
(
unit
.
getRatio
()),
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
}
String
commodityUnit
=
mvo
.
getCommodityUnit
();
stock
=
unitService
.
parseStockByUnit
(
stock
,
unit
,
commodityUnit
);
}
}
mvo
.
setStock
(
stock
);
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/Unit.java
View file @
5df71b26
...
...
@@ -9,8 +9,16 @@ public class Unit {
private
String
otherUnit
;
private
String
otherUnitTwo
;
private
String
otherUnitThree
;
private
Integer
ratio
;
private
Integer
ratioTwo
;
private
Integer
ratioThree
;
private
Long
tenantId
;
private
String
deleteFlag
;
...
...
@@ -47,6 +55,22 @@ public class Unit {
this
.
otherUnit
=
otherUnit
==
null
?
null
:
otherUnit
.
trim
();
}
public
String
getOtherUnitTwo
()
{
return
otherUnitTwo
;
}
public
void
setOtherUnitTwo
(
String
otherUnitTwo
)
{
this
.
otherUnitTwo
=
otherUnitTwo
==
null
?
null
:
otherUnitTwo
.
trim
();
}
public
String
getOtherUnitThree
()
{
return
otherUnitThree
;
}
public
void
setOtherUnitThree
(
String
otherUnitThree
)
{
this
.
otherUnitThree
=
otherUnitThree
==
null
?
null
:
otherUnitThree
.
trim
();
}
public
Integer
getRatio
()
{
return
ratio
;
}
...
...
@@ -55,6 +79,22 @@ public class Unit {
this
.
ratio
=
ratio
;
}
public
Integer
getRatioTwo
()
{
return
ratioTwo
;
}
public
void
setRatioTwo
(
Integer
ratioTwo
)
{
this
.
ratioTwo
=
ratioTwo
;
}
public
Integer
getRatioThree
()
{
return
ratioThree
;
}
public
void
setRatioThree
(
Integer
ratioThree
)
{
this
.
ratioThree
=
ratioThree
;
}
public
Long
getTenantId
()
{
return
tenantId
;
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/UnitExample.java
View file @
5df71b26
...
...
@@ -374,6 +374,146 @@ public class UnitExample {
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoIsNull
()
{
addCriterion
(
"other_unit_two is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoIsNotNull
()
{
addCriterion
(
"other_unit_two is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoEqualTo
(
String
value
)
{
addCriterion
(
"other_unit_two ="
,
value
,
"otherUnitTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoNotEqualTo
(
String
value
)
{
addCriterion
(
"other_unit_two <>"
,
value
,
"otherUnitTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoGreaterThan
(
String
value
)
{
addCriterion
(
"other_unit_two >"
,
value
,
"otherUnitTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"other_unit_two >="
,
value
,
"otherUnitTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoLessThan
(
String
value
)
{
addCriterion
(
"other_unit_two <"
,
value
,
"otherUnitTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"other_unit_two <="
,
value
,
"otherUnitTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoLike
(
String
value
)
{
addCriterion
(
"other_unit_two like"
,
value
,
"otherUnitTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoNotLike
(
String
value
)
{
addCriterion
(
"other_unit_two not like"
,
value
,
"otherUnitTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoIn
(
List
<
String
>
values
)
{
addCriterion
(
"other_unit_two in"
,
values
,
"otherUnitTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"other_unit_two not in"
,
values
,
"otherUnitTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"other_unit_two between"
,
value1
,
value2
,
"otherUnitTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitTwoNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"other_unit_two not between"
,
value1
,
value2
,
"otherUnitTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeIsNull
()
{
addCriterion
(
"other_unit_three is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeIsNotNull
()
{
addCriterion
(
"other_unit_three is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeEqualTo
(
String
value
)
{
addCriterion
(
"other_unit_three ="
,
value
,
"otherUnitThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeNotEqualTo
(
String
value
)
{
addCriterion
(
"other_unit_three <>"
,
value
,
"otherUnitThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeGreaterThan
(
String
value
)
{
addCriterion
(
"other_unit_three >"
,
value
,
"otherUnitThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"other_unit_three >="
,
value
,
"otherUnitThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeLessThan
(
String
value
)
{
addCriterion
(
"other_unit_three <"
,
value
,
"otherUnitThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"other_unit_three <="
,
value
,
"otherUnitThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeLike
(
String
value
)
{
addCriterion
(
"other_unit_three like"
,
value
,
"otherUnitThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeNotLike
(
String
value
)
{
addCriterion
(
"other_unit_three not like"
,
value
,
"otherUnitThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeIn
(
List
<
String
>
values
)
{
addCriterion
(
"other_unit_three in"
,
values
,
"otherUnitThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"other_unit_three not in"
,
values
,
"otherUnitThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"other_unit_three between"
,
value1
,
value2
,
"otherUnitThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andOtherUnitThreeNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"other_unit_three not between"
,
value1
,
value2
,
"otherUnitThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioIsNull
()
{
addCriterion
(
"ratio is null"
);
return
(
Criteria
)
this
;
...
...
@@ -434,6 +574,126 @@ public class UnitExample {
return
(
Criteria
)
this
;
}
public
Criteria
andRatioTwoIsNull
()
{
addCriterion
(
"ratio_two is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioTwoIsNotNull
()
{
addCriterion
(
"ratio_two is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioTwoEqualTo
(
Integer
value
)
{
addCriterion
(
"ratio_two ="
,
value
,
"ratioTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioTwoNotEqualTo
(
Integer
value
)
{
addCriterion
(
"ratio_two <>"
,
value
,
"ratioTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioTwoGreaterThan
(
Integer
value
)
{
addCriterion
(
"ratio_two >"
,
value
,
"ratioTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioTwoGreaterThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"ratio_two >="
,
value
,
"ratioTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioTwoLessThan
(
Integer
value
)
{
addCriterion
(
"ratio_two <"
,
value
,
"ratioTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioTwoLessThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"ratio_two <="
,
value
,
"ratioTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioTwoIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"ratio_two in"
,
values
,
"ratioTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioTwoNotIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"ratio_two not in"
,
values
,
"ratioTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioTwoBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"ratio_two between"
,
value1
,
value2
,
"ratioTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioTwoNotBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"ratio_two not between"
,
value1
,
value2
,
"ratioTwo"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioThreeIsNull
()
{
addCriterion
(
"ratio_three is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioThreeIsNotNull
()
{
addCriterion
(
"ratio_three is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioThreeEqualTo
(
Integer
value
)
{
addCriterion
(
"ratio_three ="
,
value
,
"ratioThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioThreeNotEqualTo
(
Integer
value
)
{
addCriterion
(
"ratio_three <>"
,
value
,
"ratioThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioThreeGreaterThan
(
Integer
value
)
{
addCriterion
(
"ratio_three >"
,
value
,
"ratioThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioThreeGreaterThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"ratio_three >="
,
value
,
"ratioThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioThreeLessThan
(
Integer
value
)
{
addCriterion
(
"ratio_three <"
,
value
,
"ratioThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioThreeLessThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"ratio_three <="
,
value
,
"ratioThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioThreeIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"ratio_three in"
,
values
,
"ratioThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioThreeNotIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"ratio_three not in"
,
values
,
"ratioThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioThreeBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"ratio_three between"
,
value1
,
value2
,
"ratioThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andRatioThreeNotBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"ratio_three not between"
,
value1
,
value2
,
"ratioThree"
);
return
(
Criteria
)
this
;
}
public
Criteria
andTenantIdIsNull
()
{
addCriterion
(
"tenant_id is null"
);
return
(
Criteria
)
this
;
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotItem/DepotItemService.java
View file @
5df71b26
...
...
@@ -382,12 +382,14 @@ public class DepotItemService {
Unit
unitInfo
=
materialService
.
findUnit
(
materialExtend
.
getMaterialId
());
//查询计量单位信息
if
(
StringUtil
.
isNotEmpty
(
unitInfo
.
getName
()))
{
String
basicUnit
=
unitInfo
.
getBasicUnit
();
//基本单位
String
otherUnit
=
unitInfo
.
getOtherUnit
();
//副单位
Integer
ratio
=
unitInfo
.
getRatio
();
//比例
if
(
unit
.
equals
(
basicUnit
))
{
//如果等于基础单位
depotItem
.
setBasicNumber
(
oNumber
);
//数量一致
}
else
if
(
unit
.
equals
(
otherUnit
))
{
//如果等于副单位
depotItem
.
setBasicNumber
(
oNumber
.
multiply
(
new
BigDecimal
(
ratio
))
);
//数量乘以比例
}
else
if
(
unit
.
equals
(
unitInfo
.
getOtherUnit
()))
{
//如果等于副单位
depotItem
.
setBasicNumber
(
oNumber
.
multiply
(
new
BigDecimal
(
unitInfo
.
getRatio
()))
);
//数量乘以比例
}
else
if
(
unit
.
equals
(
unitInfo
.
getOtherUnitTwo
()))
{
//如果等于副单位2
depotItem
.
setBasicNumber
(
oNumber
.
multiply
(
new
BigDecimal
(
unitInfo
.
getRatioTwo
()))
);
//数量乘以比例
}
else
if
(
unit
.
equals
(
unitInfo
.
getOtherUnitThree
()))
{
//如果等于副单位3
depotItem
.
setBasicNumber
(
oNumber
.
multiply
(
new
BigDecimal
(
unitInfo
.
getRatioThree
()))
);
//数量乘以比例
}
}
else
{
depotItem
.
setBasicNumber
(
oNumber
);
//其他情况
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/unit/UnitService.java
View file @
5df71b26
...
...
@@ -22,6 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -102,7 +103,7 @@ public class UnitService {
Unit
unit
=
JSONObject
.
parseObject
(
obj
.
toJSONString
(),
Unit
.
class
);
int
result
=
0
;
try
{
unit
.
se
t
Name
(
unit
.
getBasicUnit
()
+
","
+
unit
.
getOtherUnit
()
+
"(1:"
+
unit
.
getRatio
()
+
")"
);
par
seName
ByUnit
(
unit
);
result
=
unitMapper
.
insertSelective
(
unit
);
logService
.
insertLog
(
"计量单位"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_ADD
).
append
(
unit
.
getName
()).
toString
(),
request
);
...
...
@@ -117,7 +118,7 @@ public class UnitService {
Unit
unit
=
JSONObject
.
parseObject
(
obj
.
toJSONString
(),
Unit
.
class
);
int
result
=
0
;
try
{
unit
.
se
t
Name
(
unit
.
getBasicUnit
()
+
","
+
unit
.
getOtherUnit
()
+
"(1:"
+
unit
.
getRatio
()
+
")"
);
par
seName
ByUnit
(
unit
);
result
=
unitMapper
.
updateByPrimaryKeySelective
(
unit
);
logService
.
insertLog
(
"计量单位"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_EDIT
).
append
(
unit
.
getName
()).
toString
(),
request
);
...
...
@@ -127,6 +128,21 @@ public class UnitService {
return
result
;
}
/**
* 根据单位信息生成名称的格式
* @param unit
*/
private
void
parseNameByUnit
(
Unit
unit
)
{
String
unitName
=
unit
.
getBasicUnit
()
+
"/"
+
"("
+
unit
.
getOtherUnit
()
+
"="
+
unit
.
getRatio
().
toString
()
+
unit
.
getBasicUnit
()
+
")"
;
if
(
StringUtil
.
isNotEmpty
(
unit
.
getOtherUnitTwo
())
&&
unit
.
getRatioTwo
()!=
null
)
{
unitName
+=
"/"
+
"("
+
unit
.
getOtherUnitTwo
()
+
"="
+
unit
.
getRatioTwo
().
toString
()
+
unit
.
getBasicUnit
()
+
")"
;
if
(
StringUtil
.
isNotEmpty
(
unit
.
getOtherUnitThree
())
&&
unit
.
getRatioThree
()!=
null
)
{
unitName
+=
"/"
+
"("
+
unit
.
getOtherUnitThree
()
+
"="
+
unit
.
getRatioThree
().
toString
()
+
unit
.
getBasicUnit
()
+
")"
;
}
}
unit
.
setName
(
unitName
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteUnit
(
Long
id
,
HttpServletRequest
request
)
throws
Exception
{
return
batchDeleteUnitByIds
(
id
.
toString
());
...
...
@@ -199,4 +215,24 @@ public class UnitService {
}
return
unitId
;
}
/**
* 根据多单位的比例进行库存换算(保留两位小数)
* @param stock
* @param unitInfo
* @param materialUnit
* @return
*/
public
BigDecimal
parseStockByUnit
(
BigDecimal
stock
,
Unit
unitInfo
,
String
materialUnit
)
{
if
(
materialUnit
.
equals
(
unitInfo
.
getOtherUnit
())
&&
unitInfo
.
getRatio
()
!=
0
)
{
stock
=
stock
.
divide
(
BigDecimal
.
valueOf
(
unitInfo
.
getRatio
()),
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
if
(
materialUnit
.
equals
(
unitInfo
.
getOtherUnitTwo
())
&&
unitInfo
.
getRatioTwo
()
!=
0
)
{
stock
=
stock
.
divide
(
BigDecimal
.
valueOf
(
unitInfo
.
getRatioTwo
()),
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
if
(
materialUnit
.
equals
(
unitInfo
.
getOtherUnitThree
())
&&
unitInfo
.
getRatioThree
()
!=
0
)
{
stock
=
stock
.
divide
(
BigDecimal
.
valueOf
(
unitInfo
.
getRatioThree
()),
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
return
stock
;
}
}
jshERP-boot/src/main/resources/mapper_xml/DepotItemMapperEx.xml
View file @
5df71b26
...
...
@@ -32,10 +32,6 @@
<result
column=
"enable_batch_number"
jdbcType=
"VARCHAR"
property=
"enableBatchNumber"
/>
<result
column=
"DepotName"
jdbcType=
"VARCHAR"
property=
"DepotName"
/>
<result
column=
"AnotherDepotName"
jdbcType=
"VARCHAR"
property=
"AnotherDepotName"
/>
<result
column=
"UnitId"
jdbcType=
"BIGINT"
property=
"UnitId"
/>
<result
column=
"unit_name"
jdbcType=
"VARCHAR"
property=
"unitName"
/>
<result
column=
"ratio"
jdbcType=
"INTEGER"
property=
"ratio"
/>
<result
column=
"other_unit"
jdbcType=
"INTEGER"
property=
"otherUnit"
/>
<result
column=
"barCode"
jdbcType=
"VARCHAR"
property=
"barCode"
/>
</resultMap>
...
...
@@ -180,11 +176,10 @@
<select
id=
"getDetailList"
parameterType=
"com.jsh.erp.datasource.entities.DepotItemExample"
resultMap=
"ResultWithInfoExMap"
>
select di.*,m.name MName,m.model MModel,m.unit MaterialUnit,m.color MColor,m.standard MStandard,m.mfrs MMfrs,
m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,m.enable_serial_number, m.enable_batch_number,
dp1.name DepotName,dp2.name AnotherDepotName,
u.id UnitId, u.name unit_name, u.ratio, u.other_unit,
me.bar_code barCode
dp1.name DepotName,dp2.name AnotherDepotName, me.bar_code barCode
from jsh_depot_item di
left join jsh_material m on di.material_id=m.id and ifnull(m.delete_flag,'0') !='1'
left join jsh_material_extend me on me.id=di.material_extend_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
left join jsh_depot dp1 on di.depot_id=dp1.id and ifnull(dp1.delete_Flag,'0') !='1'
left join jsh_depot dp2 on di.another_depot_id=dp2.id and ifnull(dp2.delete_Flag,'0') !='1'
where di.header_id = #{headerId}
...
...
jshERP-boot/src/main/resources/mapper_xml/MaterialMapperEx.xml
View file @
5df71b26
...
...
@@ -143,7 +143,7 @@
</foreach>
</if>
and ifnull(m.delete_flag,'0') !='1'
ORDER BY m.id desc,me.default_flag desc
ORDER BY m.id desc,
me.default_flag desc
, me.id asc
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
</if>
...
...
jshERP-boot/src/main/resources/mapper_xml/UnitMapper.xml
View file @
5df71b26
...
...
@@ -6,7 +6,11 @@
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"basic_unit"
jdbcType=
"VARCHAR"
property=
"basicUnit"
/>
<result
column=
"other_unit"
jdbcType=
"VARCHAR"
property=
"otherUnit"
/>
<result
column=
"other_unit_two"
jdbcType=
"VARCHAR"
property=
"otherUnitTwo"
/>
<result
column=
"other_unit_three"
jdbcType=
"VARCHAR"
property=
"otherUnitThree"
/>
<result
column=
"ratio"
jdbcType=
"INTEGER"
property=
"ratio"
/>
<result
column=
"ratio_two"
jdbcType=
"INTEGER"
property=
"ratioTwo"
/>
<result
column=
"ratio_three"
jdbcType=
"INTEGER"
property=
"ratioThree"
/>
<result
column=
"tenant_id"
jdbcType=
"BIGINT"
property=
"tenantId"
/>
<result
column=
"delete_flag"
jdbcType=
"VARCHAR"
property=
"deleteFlag"
/>
</resultMap>
...
...
@@ -69,7 +73,8 @@
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, name, basic_unit, other_unit, ratio, tenant_id, delete_flag
id, name, basic_unit, other_unit, other_unit_two, other_unit_three, ratio, ratio_two,
ratio_three, tenant_id, delete_flag
</sql>
<select
id=
"selectByExample"
parameterType=
"com.jsh.erp.datasource.entities.UnitExample"
resultMap=
"BaseResultMap"
>
select
...
...
@@ -103,11 +108,13 @@
</delete>
<insert
id=
"insert"
parameterType=
"com.jsh.erp.datasource.entities.Unit"
>
insert into jsh_unit (id, name, basic_unit,
other_unit, ratio, tenant_id,
delete_flag)
other_unit, other_unit_two, other_unit_three,
ratio, ratio_two, ratio_three,
tenant_id, delete_flag)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{basicUnit,jdbcType=VARCHAR},
#{otherUnit,jdbcType=VARCHAR}, #{ratio,jdbcType=INTEGER}, #{tenantId,jdbcType=BIGINT},
#{deleteFlag,jdbcType=VARCHAR})
#{otherUnit,jdbcType=VARCHAR}, #{otherUnitTwo,jdbcType=VARCHAR}, #{otherUnitThree,jdbcType=VARCHAR},
#{ratio,jdbcType=INTEGER}, #{ratioTwo,jdbcType=INTEGER}, #{ratioThree,jdbcType=INTEGER},
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.jsh.erp.datasource.entities.Unit"
>
insert into jsh_unit
...
...
@@ -124,9 +131,21 @@
<if
test=
"otherUnit != null"
>
other_unit,
</if>
<if
test=
"otherUnitTwo != null"
>
other_unit_two,
</if>
<if
test=
"otherUnitThree != null"
>
other_unit_three,
</if>
<if
test=
"ratio != null"
>
ratio,
</if>
<if
test=
"ratioTwo != null"
>
ratio_two,
</if>
<if
test=
"ratioThree != null"
>
ratio_three,
</if>
<if
test=
"tenantId != null"
>
tenant_id,
</if>
...
...
@@ -147,9 +166,21 @@
<if
test=
"otherUnit != null"
>
#{otherUnit,jdbcType=VARCHAR},
</if>
<if
test=
"otherUnitTwo != null"
>
#{otherUnitTwo,jdbcType=VARCHAR},
</if>
<if
test=
"otherUnitThree != null"
>
#{otherUnitThree,jdbcType=VARCHAR},
</if>
<if
test=
"ratio != null"
>
#{ratio,jdbcType=INTEGER},
</if>
<if
test=
"ratioTwo != null"
>
#{ratioTwo,jdbcType=INTEGER},
</if>
<if
test=
"ratioThree != null"
>
#{ratioThree,jdbcType=INTEGER},
</if>
<if
test=
"tenantId != null"
>
#{tenantId,jdbcType=BIGINT},
</if>
...
...
@@ -179,9 +210,21 @@
<if
test=
"record.otherUnit != null"
>
other_unit = #{record.otherUnit,jdbcType=VARCHAR},
</if>
<if
test=
"record.otherUnitTwo != null"
>
other_unit_two = #{record.otherUnitTwo,jdbcType=VARCHAR},
</if>
<if
test=
"record.otherUnitThree != null"
>
other_unit_three = #{record.otherUnitThree,jdbcType=VARCHAR},
</if>
<if
test=
"record.ratio != null"
>
ratio = #{record.ratio,jdbcType=INTEGER},
</if>
<if
test=
"record.ratioTwo != null"
>
ratio_two = #{record.ratioTwo,jdbcType=INTEGER},
</if>
<if
test=
"record.ratioThree != null"
>
ratio_three = #{record.ratioThree,jdbcType=INTEGER},
</if>
<if
test=
"record.tenantId != null"
>
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
...
...
@@ -199,7 +242,11 @@
name = #{record.name,jdbcType=VARCHAR},
basic_unit = #{record.basicUnit,jdbcType=VARCHAR},
other_unit = #{record.otherUnit,jdbcType=VARCHAR},
other_unit_two = #{record.otherUnitTwo,jdbcType=VARCHAR},
other_unit_three = #{record.otherUnitThree,jdbcType=VARCHAR},
ratio = #{record.ratio,jdbcType=INTEGER},
ratio_two = #{record.ratioTwo,jdbcType=INTEGER},
ratio_three = #{record.ratioThree,jdbcType=INTEGER},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
...
...
@@ -218,9 +265,21 @@
<if
test=
"otherUnit != null"
>
other_unit = #{otherUnit,jdbcType=VARCHAR},
</if>
<if
test=
"otherUnitTwo != null"
>
other_unit_two = #{otherUnitTwo,jdbcType=VARCHAR},
</if>
<if
test=
"otherUnitThree != null"
>
other_unit_three = #{otherUnitThree,jdbcType=VARCHAR},
</if>
<if
test=
"ratio != null"
>
ratio = #{ratio,jdbcType=INTEGER},
</if>
<if
test=
"ratioTwo != null"
>
ratio_two = #{ratioTwo,jdbcType=INTEGER},
</if>
<if
test=
"ratioThree != null"
>
ratio_three = #{ratioThree,jdbcType=INTEGER},
</if>
<if
test=
"tenantId != null"
>
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
...
...
@@ -235,7 +294,11 @@
set name = #{name,jdbcType=VARCHAR},
basic_unit = #{basicUnit,jdbcType=VARCHAR},
other_unit = #{otherUnit,jdbcType=VARCHAR},
other_unit_two = #{otherUnitTwo,jdbcType=VARCHAR},
other_unit_three = #{otherUnitThree,jdbcType=VARCHAR},
ratio = #{ratio,jdbcType=INTEGER},
ratio_two = #{ratioTwo,jdbcType=INTEGER},
ratio_three = #{ratioThree,jdbcType=INTEGER},
tenant_id = #{tenantId,jdbcType=BIGINT},
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
...
...
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