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
00933e42
Commit
00933e42
authored
Dec 26, 2018
by
季圣华
Browse files
解决商品不能录入的问题
parent
9790eb63
Changes
5
Hide whitespace changes
Inline
Side-by-side
erp_web/pages/materials/material.html
View file @
00933e42
...
...
@@ -349,7 +349,7 @@
for
(
var
i
=
0
;
i
<
materialCategoryList
.
length
;
i
++
)
{
var
materialCategory
=
materialCategoryList
[
i
];
if
(
0
==
i
)
{
m
aterialID
=
materialCategory
.
id
;
m
cId
=
materialCategory
.
id
;
}
options
+=
'
<option value="
'
+
materialCategory
.
id
+
'
">
'
+
materialCategory
.
name
+
'
</option>
'
;
if
(
lei
==
"
search_second
"
||
lei
==
"
type_second
"
||
lei
==
"
search_three
"
)
{
...
...
@@ -1276,7 +1276,8 @@
priceStrategy
.
push
(
basic
);
priceStrategy
.
push
(
other
);
var
objInfo
=
JSON
.
stringify
(
$
(
"
#materialFM
"
).
serializeObject
());
var
objInfo
=
$
(
"
#materialFM
"
).
serializeObject
();
objInfo
.
UnitId
=
$
(
"
#manyUnit
"
).
val
();
objInfo
.
CategoryId
=
parent
;
objInfo
.
PriceStrategy
=
JSON
.
stringify
(
priceStrategy
);
//价格列表
$
.
ajax
({
...
...
@@ -1285,7 +1286,7 @@
dataType
:
"
json
"
,
async
:
false
,
data
:
({
info
:
objInfo
info
:
JSON
.
stringify
(
objInfo
)
}),
success
:
function
(
res
)
{
if
(
res
&&
res
.
code
===
200
)
{
...
...
@@ -1384,8 +1385,8 @@
$
(
"
#Unit
"
).
val
(
materialInfo
[
4
]
==
"
undefined
"
?
""
:
materialInfo
[
4
]);
$
(
"
#RetailPrice
"
).
val
(
materialInfo
[
5
]
==
"
undefined
"
?
""
:
materialInfo
[
5
]);
$
(
"
#LowPrice
"
).
val
(
materialInfo
[
6
]
==
"
undefined
"
?
""
:
materialInfo
[
6
]);
$
(
"
#PresetPriceOne
"
).
val
(
materialInfo
[
7
]);
$
(
"
#PresetPriceTwo
"
).
val
(
materialInfo
[
8
]);
$
(
"
#PresetPriceOne
"
).
val
(
materialInfo
[
7
]
==
"
undefined
"
?
""
:
materialInfo
[
7
]
);
$
(
"
#PresetPriceTwo
"
).
val
(
materialInfo
[
8
]
==
"
undefined
"
?
""
:
materialInfo
[
8
]
);
$
(
"
#Remark
"
).
val
(
materialInfo
[
9
]);
$
(
"
#manyUnit
"
).
val
(
materialInfo
[
16
]);
if
(
materialInfo
[
16
]
!=
"
undefined
"
)
{
...
...
src/main/java/com/jsh/erp/controller/MaterialController.java
View file @
00933e42
...
...
@@ -31,7 +31,7 @@ public class MaterialController {
private
MaterialService
materialService
;
@GetMapping
(
value
=
"/checkIsExist"
)
public
String
checkIsExist
(
@RequestParam
(
"
materialI
d"
)
Long
id
,
@RequestParam
(
"name"
)
String
name
,
public
String
checkIsExist
(
@RequestParam
(
"
i
d"
)
Long
id
,
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
"model"
)
String
model
,
@RequestParam
(
"color"
)
String
color
,
@RequestParam
(
"standard"
)
String
standard
,
@RequestParam
(
"mfrs"
)
String
mfrs
,
@RequestParam
(
"otherField1"
)
String
otherField1
,
@RequestParam
(
"otherField2"
)
String
otherField2
,
...
...
src/main/java/com/jsh/erp/datasource/mappers/MaterialMapper.java
View file @
00933e42
...
...
@@ -118,4 +118,7 @@ public interface MaterialMapper {
List
<
MaterialVo4Unit
>
findBySelect
();
int
updatePriceNullByPrimaryKey
(
Long
id
);
int
updateUnitIdNullByPrimaryKey
(
Long
id
);
}
\ No newline at end of file
src/main/java/com/jsh/erp/service/material/MaterialService.java
View file @
00933e42
...
...
@@ -72,13 +72,21 @@ public class MaterialService {
public
int
insertMaterial
(
String
beanJson
,
HttpServletRequest
request
)
{
Material
material
=
JSONObject
.
parseObject
(
beanJson
,
Material
.
class
);
material
.
setEnabled
(
true
);
return
materialMapper
.
insertSelective
(
material
);
}
public
int
updateMaterial
(
String
beanJson
,
Long
id
)
{
Material
material
=
JSONObject
.
parseObject
(
beanJson
,
Material
.
class
);
material
.
setId
(
id
);
return
materialMapper
.
updateByPrimaryKeySelective
(
material
);
int
res
=
materialMapper
.
updateByPrimaryKeySelective
(
material
);
Long
unitId
=
material
.
getUnitid
();
if
(
unitId
!=
null
)
{
materialMapper
.
updatePriceNullByPrimaryKey
(
id
);
//将价格置空
}
else
{
materialMapper
.
updateUnitIdNullByPrimaryKey
(
id
);
//将多单位置空
}
return
res
;
}
public
int
deleteMaterial
(
Long
id
)
{
...
...
@@ -102,17 +110,18 @@ public class MaterialService {
public
int
checkIsExist
(
Long
id
,
String
name
,
String
model
,
String
color
,
String
standard
,
String
mfrs
,
String
otherField1
,
String
otherField2
,
String
otherField3
,
String
unit
,
Long
unitId
)
{
MaterialExample
example
=
new
MaterialExample
();
MaterialExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andNameEqualTo
(
name
).
andModelEqualTo
(
model
).
andColorEqualTo
(
color
)
.
andStandardEqualTo
(
standard
).
andMfrsEqualTo
(
mfrs
)
.
andOtherfield1EqualTo
(
otherField1
).
andOtherfield2EqualTo
(
otherField2
).
andOtherfield2EqualTo
(
otherField3
);
if
(
id
>
0
)
{
example
.
createC
riteria
()
.
andIdNotEqualTo
(
id
);
c
riteria
.
andIdNotEqualTo
(
id
);
}
example
.
createCriteria
().
andNameEqualTo
(
name
).
andModelEqualTo
(
model
).
andColorEqualTo
(
color
)
.
andStandardEqualTo
(
standard
).
andMfrsEqualTo
(
mfrs
)
.
andOtherfield1EqualTo
(
otherField1
).
andOtherfield2EqualTo
(
otherField2
).
andOtherfield2EqualTo
(
otherField3
);
if
(
unit
!=
null
)
{
example
.
createCriteria
().
andUnitEqualTo
(
unit
);
if
(!
StringUtil
.
isEmpty
(
unit
))
{
criteria
.
andUnitEqualTo
(
unit
);
}
if
(
unitId
!=
null
)
{
example
.
createC
riteria
()
.
andUnitidEqualTo
(
unitId
);
c
riteria
.
andUnitidEqualTo
(
unitId
);
}
List
<
Material
>
list
=
materialMapper
.
selectByExample
(
example
);
return
list
.
size
();
...
...
src/main/resources/mapper_xml/MaterialMapperEx.xml
View file @
00933e42
...
...
@@ -60,4 +60,21 @@
<select
id=
"findBySelect"
parameterType=
"com.jsh.erp.datasource.entities.MaterialExample"
resultMap=
"ResultAndUnitMap"
>
select m.*,u.UName from jsh_material m left join jsh_unit u on m.UnitId=u.id where m.enabled=1 ORDER BY Id asc
</select>
<update
id=
"updatePriceNullByPrimaryKey"
parameterType=
"java.lang.Long"
>
update jsh_material
set
RetailPrice = null,
LowPrice = null,
PresetPriceOne = null,
PresetPriceTwo = null
where Id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateUnitIdNullByPrimaryKey"
parameterType=
"java.lang.Long"
>
update jsh_material
set
UnitId = null
where Id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
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