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
2bd1d998
Commit
2bd1d998
authored
Jan 23, 2019
by
cjl
Browse files
添加序列号功能
parent
fd76355f
Changes
29
Hide whitespace changes
Inline
Side-by-side
erp_web/pages/manage/serialNumber.html
0 → 100644
View file @
2bd1d998
<!DOCTYPE html>
<html>
<head>
<title>
序列号
</title>
<meta
charset=
"utf-8"
>
<!-- 指定以IE8的方式来渲染 -->
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=EmulateIE8"
/>
<link
rel=
"shortcut icon"
href=
"/images/favicon.ico"
type=
"image/x-icon"
/>
<script
type=
"text/javascript"
src=
"/js/jquery-1.8.0.min.js"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/js/easyui-1.3.5/themes/default/easyui.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/js/easyui-1.3.5/themes/icon.css"
/>
<link
type=
"text/css"
rel=
"stylesheet"
href=
"/css/common.css"
/>
<link
type=
"text/css"
rel=
"stylesheet"
href=
"/css/material.css"
/>
<script
type=
"text/javascript"
src=
"/js/easyui-1.3.5/jquery.easyui.min.js"
></script>
<script
type=
"text/javascript"
src=
"/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"
></script>
<script
type=
"text/javascript"
src=
"/js/common/outlook_in.js"
></script>
<script
type=
"text/javascript"
src=
"/js/common/common.js"
></script>
</head>
<body>
<!-- 查询 -->
<div
id=
"searchPanel"
class=
"easyui-panel"
style=
"padding:10px;"
title=
"查询窗口"
iconCls=
"icon-search"
collapsible=
"true"
closable=
"false"
>
<table
id=
"searchTable"
>
<tr>
<td>
商品名称:
</td>
<td>
<input
name=
"materialName_s"
id=
"materialName_s"
style=
"width:80px;"
/>
</td>
<td>
</td>
<td>
序列号:
</td>
<td>
<input
name=
"serialNumber_s"
id=
"serialNumber_s"
style=
"width:80px;"
/>
</td>
<td>
</td>
<td>
<a
href=
"javascript:void(0)"
class=
"easyui-linkbutton"
iconCls=
"icon-search"
id=
"searchBtn"
>
查询
</a>
<a
href=
"javascript:void(0)"
class=
"easyui-linkbutton"
iconCls=
"icon-redo"
id=
"searchResetBtn"
>
重置
</a>
</td>
</tr>
</table>
</div>
<!-- 数据显示table -->
<div
id=
"tablePanel"
class=
"easyui-panel"
style=
"padding:1px;top:300px;"
title=
"序列号列表"
iconCls=
"icon-list"
collapsible=
"true"
closable=
"false"
>
<table
id=
"tableData"
style=
"top:300px;border-bottom-color:#FFFFFF"
></table>
</div>
<div
id=
"serialNumberDetailListDlg"
class=
"easyui-dialog"
style=
"width:900px;height:500px;padding:10px 20px"
closed=
"true"
modal=
"true"
collapsible=
"false"
closable=
"true"
>
<table
id=
"serialNumberTableData"
style=
"top:50px;border-bottom-color:#FFFFFF"
></table>
</div>
<div
id=
"serialNumberDlg"
class=
"easyui-dialog"
style=
"width:860px;height:420px;padding:10px 20px"
closed=
"true"
buttons=
"#dlg-buttons"
modal=
"true"
collapsible=
"false"
closable=
"true"
>
<form
id=
"serialNumberFM"
method=
"post"
novalidate
>
<div
id=
"tt"
class=
"easyui-tabs"
style=
"width:800px;height:320px;"
>
<div
title=
"基本信息"
style=
"padding:20px;"
>
<table>
<tr>
<td
style=
"width:60px; height:30px;"
>
商品名称
</td>
<td
style=
"padding:5px;width:180px;"
>
<input
name=
"materialId"
id=
"materialId"
type=
"hidden"
/>
<input
name=
"materialName"
id=
"materialName"
class=
"easyui-validatebox"
data-options=
"required:false,validType:'length[2,30]'"
style=
"width: 180px;height: 20px"
/>
</td>
<td
style=
"width:80px;"
>
序列号
</td>
<td
style=
"padding:5px;width:180px;"
>
<input
name=
"serialNumberId"
id=
"serialNumberId"
type=
"hidden"
/>
<input
name=
"serialNumber"
id=
"serialNumber"
class=
"easyui-validatebox"
data-options=
"required:true,validType:'length[1,30]'"
style=
"width: 180px;height: 20px"
/>
</td>
<td
style=
"width:200px;"
></td>
</tr>
<tr>
<td
style=
"height:30px;"
>
备注
</td>
<td
style=
"padding:5px"
colspan=
"3"
>
<textarea
name=
"remark"
id=
"remark"
rows=
"2"
cols=
"2"
placeholder=
"暂无备注信息"
style=
"width: 468px; height:40px;"
></textarea>
</td>
<td></td>
</tr>
</table>
</div>
</div>
</form>
</div>
<div
id=
"dlg-buttons"
>
<a
href=
"javascript:void(0)"
id=
"saveSerialNumber"
class=
"easyui-linkbutton"
iconCls=
"icon-ok"
>
保存
</a>
<a
href=
"javascript:void(0)"
id=
"cancelSerialNumber"
class=
"easyui-linkbutton"
iconCls=
"icon-cancel"
onclick=
"javascript:$('#serialNumberDlg').dialog('close')"
>
取消
</a>
</div>
<script
type=
"text/javascript"
>
var
url
;
//初始化界面
$
(
function
()
{
//初始化系统基础信息
initTableData
();
ininPager
();
initForm
();
});
//防止表单提交重复
function
initForm
()
{
$
(
'
#serialNumberFM
'
).
form
({
onSubmit
:
function
()
{
return
false
;
}
});
}
//初始化表格数据
function
initTableData
()
{
//改变宽度和高度
$
(
"
#searchPanel
"
).
panel
({
width
:
webW
-
2
});
$
(
"
#tablePanel
"
).
panel
({
width
:
webW
-
2
});
$
(
'
#tableData
'
).
datagrid
({
//title:'商品列表',
//iconCls:'icon-save',
//width:700,
height
:
heightInfo
,
nowrap
:
false
,
rownumbers
:
false
,
//动画效果
animate
:
false
,
//选中单行
singleSelect
:
true
,
collapsible
:
false
,
selectOnCheck
:
false
,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
pagination
:
true
,
//交替出现背景
striped
:
true
,
//loadFilter: pagerFilter,
pageSize
:
initPageSize
,
pageList
:
initPageNum
,
columns
:
[[
{
field
:
'
id
'
,
width
:
35
,
align
:
"
center
"
,
checkbox
:
true
},
{
title
:
'
操作
'
,
field
:
'
op
'
,
align
:
"
center
"
,
width
:
60
,
formatter
:
function
(
value
,
rec
)
{
var
str
=
''
;
var
rowInfo
=
rec
.
id
+
'
AaBb
'
+
rec
.
materialId
+
'
AaBb
'
+
rec
.
materialName
+
'
AaBb
'
+
rec
.
serialNumber
+
'
AaBb
'
+
rec
.
isSell
+
'
AaBb
'
+
rec
.
remark
+
'
AaBb
'
+
rec
.
deleteFlag
+
'
AaBb
'
+
rec
.
createTime
+
'
AaBb
'
+
rec
.
updateTime
+
'
AaBb
'
+
rec
.
creator
+
'
AaBb
'
+
rec
.
updater
+
'
AaBb
'
+
rec
.
creatorName
+
'
AaBb
'
+
rec
.
updaterName
;
str
+=
'
<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSerialNumber(
\'
'
+
rowInfo
+
'
\'
);"/>
'
;
str
+=
'
<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteSerialNumber(
'
+
rec
.
id
+
'
);"/>
'
;
return
str
;
}
},
{
title
:
'
商品名称
'
,
field
:
'
materialName
'
,
width
:
100
},
{
title
:
'
序列号
'
,
field
:
'
serialNumber
'
,
width
:
80
},
{
title
:
'
已卖出
'
,
field
:
'
isSell
'
,
width
:
150
,
formatter
:
function
(
value
)
{
return
value
?
"
是
"
:
"
否
"
;
}
},
{
title
:
'
已删除
'
,
field
:
'
deleteFlag
'
,
width
:
60
,
formatter
:
function
(
value
)
{
return
value
?
"
是
"
:
"
否
"
;
}
},
{
title
:
'
创建时间
'
,
field
:
'
createTime
'
,
width
:
70
},
{
title
:
'
更新时间
'
,
field
:
'
updateTime
'
,
width
:
70
},
{
title
:
'
备注
'
,
field
:
'
remark
'
,
width
:
300
}
]],
toolbar
:
[
{
id
:
'
addSerialNumber
'
,
text
:
'
增加
'
,
iconCls
:
'
icon-add
'
,
handler
:
function
()
{
addSerialNumber
();
}
},
'
-
'
,
{
id
:
'
batDeleteSerialNumber
'
,
text
:
'
删除
'
,
iconCls
:
'
icon-remove
'
,
handler
:
function
()
{
batDeleteSerialNumber
();
}
},
],
onLoadError
:
function
()
{
$
.
messager
.
alert
(
'
页面加载提示
'
,
'
页面加载异常,请稍后再试!
'
,
'
error
'
);
return
;
}
});
showSerialNumberDetails
(
1
,
initPageSize
);
}
//初始化键盘enter事件
$
(
document
).
keydown
(
function
(
event
)
{
//兼容 IE和firefox 事件
var
e
=
window
.
event
||
event
;
var
k
=
e
.
keyCode
||
e
.
which
||
e
.
charCode
;
//兼容 IE,firefox 兼容
var
obj
=
e
.
srcElement
?
e
.
srcElement
:
e
.
target
;
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
if
(
k
==
"
13
"
&&
(
obj
.
id
==
"
CategoryLevel
"
||
obj
.
id
==
"
Name
"
))
{
$
(
"
#saveMaterial
"
).
click
();
}
//搜索按钮添加快捷键
if
(
k
==
"
13
"
&&
(
obj
.
id
==
"
searchCategoryId
"
||
(
obj
.
id
==
"
searchName
"
)))
{
$
(
"
#searchBtn
"
).
click
();
}
});
//分页信息处理
function
ininPager
()
{
try
{
var
opts
=
$
(
"
#tableData
"
).
datagrid
(
'
options
'
);
var
pager
=
$
(
"
#tableData
"
).
datagrid
(
'
getPager
'
);
pager
.
pagination
({
onSelectPage
:
function
(
pageNum
,
pageSize
)
{
opts
.
pageNumber
=
pageNum
;
opts
.
pageSize
=
pageSize
;
pager
.
pagination
(
'
refresh
'
,
{
pageNumber
:
pageNum
,
pageSize
:
pageSize
});
showMaterialDetails
(
pageNum
,
pageSize
);
}
});
}
catch
(
e
)
{
$
.
messager
.
alert
(
'
异常处理提示
'
,
"
分页信息异常 :
"
+
e
.
name
+
"
:
"
+
e
.
message
,
'
error
'
);
}
}
//删除序列号信息
function
deleteSerialNumber
(
id
)
{
$
.
messager
.
confirm
(
'
删除确认
'
,
'
确定要删除此序列号信息吗?
'
,
function
(
r
)
{
if
(
r
)
{
$
.
ajax
({
type
:
"
post
"
,
url
:
"
/serialNumber/
"
+
id
+
"
/delete
"
,
dataType
:
"
json
"
,
success
:
function
(
res
)
{
if
(
res
&&
res
.
code
==
200
)
{
$
(
"
#searchBtn
"
).
click
();
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除序列号信息失败,请稍后再试!
'
,
'
error
'
);
}
},
//此处添加错误处理
error
:
function
()
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除序列号信息异常,请稍后再试!
'
,
'
error
'
);
return
;
}
});
}
});
}
//批量删除序列号
function
batDeleteSerialNumber
()
{
var
row
=
$
(
'
#tableData
'
).
datagrid
(
'
getChecked
'
);
if
(
row
.
length
==
0
)
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
没有记录被选中!
'
,
'
info
'
);
return
;
}
if
(
row
.
length
>
0
)
{
$
.
messager
.
confirm
(
'
删除确认
'
,
'
确定要删除选中的
'
+
row
.
length
+
'
条序列号信息吗?
'
,
function
(
r
)
{
if
(
r
)
{
var
ids
=
""
;
for
(
var
i
=
0
;
i
<
row
.
length
;
i
++
)
{
if
(
i
==
row
.
length
-
1
)
{
ids
+=
row
[
i
].
id
;
break
;
}
//alert(row[i].id);
ids
+=
row
[
i
].
id
+
"
,
"
;
}
$
.
ajax
({
type
:
"
post
"
,
url
:
"
/serialNumber/batchDelete
"
,
dataType
:
"
json
"
,
async
:
false
,
data
:
({
ids
:
ids
}),
success
:
function
(
res
)
{
if
(
res
&&
res
.
code
===
200
)
{
$
(
"
#searchBtn
"
).
click
();
$
(
"
:checkbox
"
).
attr
(
"
checked
"
,
false
);
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除序列号信息失败,请稍后再试!
'
,
'
error
'
);
}
},
//此处添加错误处理
error
:
function
()
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除序列号信息异常,请稍后再试!
'
,
'
error
'
);
return
;
}
});
}
});
}
}
//增加
function
addSerialNumber
()
{
$
(
'
#serialNumberDlg
'
).
dialog
(
'
open
'
).
dialog
(
'
setTitle
'
,
'
<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加序列号信息
'
);
$
(
"
.window-mask
"
).
css
({
width
:
webW
,
height
:
webH
});
$
(
'
#materialId
'
).
val
(
''
);
$
(
'
#materialName
'
).
val
(
''
);
$
(
'
#serialNumberId
'
).
val
(
''
);
$
(
'
#serialNumber
'
).
val
(
''
);
$
(
'
#remark
'
).
val
(
''
);
url
=
'
/serialNumber/addSerialNumber
'
;
}
//检查商品名称和序列号是否存在
function
checkIsExist
()
{
var
materialName
=
$
.
trim
(
$
(
"
#materialName
"
).
val
());
var
serialNumber
=
$
.
trim
(
$
(
"
#serialNumber
"
).
val
());
var
id
=
$
.
trim
(
$
(
"
#serialNumberId
"
).
val
());
//开始ajax名称检验,不能重名(新增或编辑)
$
.
ajax
({
type
:
"
post
"
,
url
:
"
/serialNumber/checkIsExist
"
,
dataType
:
"
json
"
,
async
:
false
,
data
:
({
materialName
:
materialName
,
serialNumber
:
serialNumber
,
id
:
id
}),
success
:
function
(
res
)
{
if
(
res
&&
res
.
code
!=
200
)
{
if
(
res
.
msg
)
{
$
.
messager
.
alert
(
'
提示
'
,
res
.
msg
,
'
error
'
);
return
;
}
}
},
//此处添加错误处理
error
:
function
()
{
$
.
messager
.
alert
(
'
提示
'
,
'
检查序列号信息是否存在异常,请稍后再试!
'
,
'
error
'
);
return
;
}
});
return
false
;
}
//保存信息
$
(
"
#saveSerialNumber
"
).
off
(
"
click
"
).
on
(
"
click
"
,
function
()
{
if
(
!
$
(
'
#serialNumber
'
).
val
())
{
$
.
messager
.
alert
(
'
提示
'
,
'
序列号不能为空!
'
,
'
warning
'
);
return
;
}
if
(
checkIsExist
())
{
return
;
}
//构造序列号json
var
objInfo
=
$
(
"
#serialNumberFM
"
).
serializeObject
();
objInfo
.
id
=
objInfo
.
serialNumberId
;
$
.
ajax
({
type
:
"
post
"
,
url
:
url
,
dataType
:
"
json
"
,
async
:
false
,
data
:
({
info
:
JSON
.
stringify
(
objInfo
)
}),
success
:
function
(
res
)
{
if
(
res
&&
res
.
code
===
200
)
{
$
(
'
#serialNumberDlg
'
).
dialog
(
'
close
'
);
//加载完以后重新初始化
var
opts
=
$
(
"
#tableData
"
).
datagrid
(
'
options
'
);
showSerialNumberDetails
(
opts
.
pageNumber
,
opts
.
pageSize
);
}
},
//此处添加错误处理
error
:
function
()
{
$
.
messager
.
alert
(
'
提示
'
,
'
保存序列化信息异常,请稍后再试!
'
,
'
error
'
);
return
;
}
});
});
//编辑信息
function
editSerialNumber
(
serialNumberInfo
)
{
var
serialNumberInfo
=
serialNumberInfo
.
split
(
"
AaBb
"
);
$
(
"
#serialNumberId
"
).
focus
().
val
(
serialNumberInfo
[
0
]);
$
(
"
#materialId
"
).
focus
().
val
(
serialNumberInfo
[
1
]);
$
(
"
#materialName
"
).
focus
().
val
(
serialNumberInfo
[
2
]);
$
(
"
#serialNumber
"
).
focus
().
val
(
serialNumberInfo
[
3
]);
$
(
"
#remark
"
).
focus
().
val
(
serialNumberInfo
[
5
]);
$
(
'
#serialNumberDlg
'
).
dialog
(
'
open
'
).
dialog
(
'
setTitle
'
,
'
<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑序列号信息
'
);
$
(
"
.window-mask
"
).
css
({
width
:
webW
,
height
:
webH
});
//选中基本资料tab
$
(
"
#serialNumberFM #tt .tabs li
"
).
first
().
click
();
url
=
'
/serialNumber/updateSerialNumber
'
;
}
//搜索处理
$
(
"
#searchBtn
"
).
unbind
().
bind
({
click
:
function
()
{
showSerialNumberDetails
(
1
,
initPageSize
);
var
opts
=
$
(
"
#tableData
"
).
datagrid
(
'
options
'
);
var
pager
=
$
(
"
#tableData
"
).
datagrid
(
'
getPager
'
);
opts
.
pageNumber
=
1
;
opts
.
pageSize
=
initPageSize
;
pager
.
pagination
(
'
refresh
'
,
{
pageNumber
:
1
,
pageSize
:
initPageSize
});
}
});
function
showSerialNumberDetails
(
pageNo
,
pageSize
)
{
var
materialName
=
$
.
trim
(
$
(
"
#materialName_s
"
).
val
());
var
serialNumber
=
$
.
trim
(
$
(
"
#serialNumber_s
"
).
val
());
$
.
ajax
({
type
:
"
get
"
,
url
:
"
/serialNumber/list
"
,
dataType
:
"
json
"
,
data
:
({
search
:
JSON
.
stringify
({
materialName
:
materialName
,
serialNumber
:
serialNumber
}),
currentPage
:
pageNo
,
pageSize
:
pageSize
}),
success
:
function
(
res
)
{
if
(
res
&&
res
.
code
===
200
){
if
(
res
.
data
&&
res
.
data
.
page
)
{
if
(
res
.
data
.
page
.
total
==
0
){
$
.
messager
.
alert
(
'
查询提示
'
,
'
没有对应数据!
'
,
'
warning
'
);
}
$
(
"
#tableData
"
).
datagrid
(
'
loadData
'
,
res
.
data
.
page
);
}
}
},
//此处添加错误处理
error
:
function
()
{
$
.
messager
.
alert
(
'
查询提示
'
,
'
查询数据后台异常,请稍后再试!
'
,
'
error
'
);
return
;
}
});
}
//重置按钮
$
(
"
#searchResetBtn
"
).
unbind
().
bind
({
click
:
function
()
{
$
(
"
#materialName_s
"
).
val
(
""
);
$
(
"
#serialNumber_s
"
).
val
(
""
);
//加载完以后重新初始化
$
(
"
#searchBtn
"
).
click
();
}
});
</script>
</body>
</html>
erp_web/pages/materials/material.html
View file @
2bd1d998
...
...
@@ -90,6 +90,16 @@
</td>
<td></td>
</tr>
<tr>
<td
style=
"width:80px;"
>
序列号
</td>
<td
style=
"padding:5px;width:180px;"
>
<select
name=
"enableSerialNumber"
id=
"enableSerialNumber"
class=
"easyui-combobox"
style=
"width:152px;height: 20px"
>
<option
value=
"1"
>
启用
</option>
<option
value=
"0"
>
禁用
</option>
</select>
</td>
<td></td>
</tr>
<tr>
<td
style=
"height:30px;"
>
备注
</td>
<td
style=
"padding:5px"
colspan=
"3"
>
...
...
@@ -611,7 +621,7 @@
+
'
AaBb
'
+
rec
.
lowprice
+
'
AaBb
'
+
rec
.
presetpriceone
+
'
AaBb
'
+
rec
.
presetpricetwo
+
'
AaBb
'
+
rec
.
remark
+
'
AaBb
'
+
rec
.
standard
+
'
AaBb
'
+
rec
.
color
+
'
AaBb
'
+
rec
.
packing
+
'
AaBb
'
+
rec
.
safetystock
+
'
AaBb
'
+
rec
.
categoryid
+
'
AaBb
'
+
rec
.
categoryName
+
'
AaBb
'
+
rec
.
unitid
+
'
AaBb
'
+
rec
.
unitName
+
'
AaBb
'
+
rec
.
firstoutunit
+
'
AaBb
'
+
rec
.
firstinunit
+
'
AaBb
'
+
rec
.
mfrs
+
'
AaBb
'
+
rec
.
otherfield1
+
'
AaBb
'
+
rec
.
otherfield2
+
'
AaBb
'
+
rec
.
otherfield3
;
+
'
AaBb
'
+
rec
.
mfrs
+
'
AaBb
'
+
rec
.
otherfield1
+
'
AaBb
'
+
rec
.
otherfield2
+
'
AaBb
'
+
rec
.
otherfield3
+
'
AaBb
'
+
rec
.
enableSerialNumber
;
str
+=
'
<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editMaterial(
\'
'
+
rowInfo
+
'
\'
);"/>
'
;
str
+=
'
<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteMaterial(
'
+
rec
.
id
+
'
);"/>
'
;
return
str
;
...
...
@@ -671,6 +681,11 @@
title
:
'
状态
'
,
field
:
'
enabled
'
,
width
:
50
,
align
:
"
center
"
,
formatter
:
function
(
value
)
{
return
value
?
"
启用
"
:
"
禁用
"
;
}
},
{
title
:
'
序列号
'
,
field
:
'
enableSerialNumber
'
,
width
:
70
,
align
:
"
center
"
,
formatter
:
function
(
value
)
{
return
value
?
"
启用
"
:
"
禁用
"
;
}
}
]],
toolbar
:
[
...
...
@@ -1145,7 +1160,7 @@
$
(
'
#materialFM input
'
).
val
(
""
);
//将输入框全部清空
bindMProperty
();
//根据商品属性绑定
$
(
"
#enableSerialNumber
"
).
combobox
(
'
setValue
'
,
'
0
'
);
$
(
'
#materialDlg
'
).
dialog
(
'
open
'
).
dialog
(
'
setTitle
'
,
'
<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加商品信息
'
);
$
(
"
.window-mask
"
).
css
({
width
:
webW
,
height
:
webH
});
$
(
"
#Name
"
).
val
(
""
).
focus
();
...
...
@@ -1271,11 +1286,13 @@
basicList
.
LowPrice
=
$
(
"
#basicLowPrice
"
).
val
();
basicList
.
PresetPriceOne
=
$
(
"
#basicPresetPriceOne
"
).
val
();
basicList
.
PresetPriceTwo
=
$
(
"
#basicPresetPriceTwo
"
).
val
();
basicList
.
enableSerialNumber
=
$
(
"
#enableSerialNumber
"
).
combobox
(
'
getValue
'
);
otherList
.
Unit
=
$
(
"
#otherUnit
"
).
text
();
otherList
.
RetailPrice
=
$
(
"
#otherRetailPrice
"
).
val
();
otherList
.
LowPrice
=
$
(
"
#otherLowPrice
"
).
val
();
otherList
.
PresetPriceOne
=
$
(
"
#otherPresetPriceOne
"
).
val
();
otherList
.
PresetPriceTwo
=
$
(
"
#otherPresetPriceTwo
"
).
val
();
var
basic
=
{};
var
other
=
{};
basic
.
basic
=
basicList
;
...
...
@@ -1341,6 +1358,10 @@
$
(
"
#Name
"
).
focus
().
val
(
materialInfo
[
1
]);
$
(
"
#Color
"
).
focus
().
val
(
materialInfo
[
11
]);
// console.log("enableSerialNumber:"+(materialInfo[24]=='true'?'1':'0'));
// console.log("enableSerialNumber:"+materialInfo[24]);
$
(
"
#enableSerialNumber
"
).
combobox
(
'
setValue
'
,
materialInfo
[
24
]
==
'
true
'
?
'
1
'
:
'
0
'
);
// console.log($("#enableSerialNumber").val());
var
categoryName
=
""
;
//类型名称
mId
=
materialInfo
[
14
];
...
...
pom.xml
View file @
2bd1d998
...
...
@@ -101,6 +101,12 @@
<artifactId>
jxl
</artifactId>
<version>
2.6.3
</version>
</dependency>
<!-- lombok -->
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
1.16.12
</version>
</dependency>
</dependencies>
<repositories>
...
...
sql/jsh_erp.sql
View file @
2bd1d998
...
...
@@ -5179,3 +5179,23 @@ INSERT INTO `jsh_userbusiness` VALUES ('24', 'UserDepot', '65', '[1]', null);
INSERT INTO `jsh_userbusiness` VALUES ('25', 'UserCustomer', '64', '[5][2]', null);
INSERT INTO `jsh_userbusiness` VALUES ('26', 'UserCustomer', '65', '[6]', null);
INSERT INTO `jsh_userbusiness` VALUES ('27', 'UserCustomer', '63', '[5][2]', null);
--添加序列号表
DROP TABLE IF EXISTS `jsh_serial_number`;
CREATE TABLE `jsh_serial_number` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`material_Id` bigint(20) DEFAULT NULL COMMENT '产品表id',
`serial_Number` varchar(64) DEFAULT NULL COMMENT '序列号',
`is_Sell` bit(1) DEFAULT 0 COMMENT '是否卖出,0未卖出,1卖出',
`remark` varchar(1024) DEFAULT NULL COMMENT '备注',
`delete_Flag` bit(1) DEFAULT 0 COMMENT '删除标记,0未删除,1删除',
`create_Time` datetime DEFAULT NULL COMMENT '创建时间',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`update_Time` datetime DEFAULT NULL COMMENT '更新时间',
`updater` bigint(20) DEFAULT NULL COMMENT '更新人',
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='序列号表';
--产品表新增字段是否启用序列号
alter table jsh_material add enableSerialNumber bit(1) DEFAULT 0 COMMENT '是否开启序列号,0否,1是';
sql/华夏ERP数据库设计汇总.xlsx
View file @
2bd1d998
No preview for this file type
src/main/java/com/jsh/erp/ErpApplication.java
View file @
2bd1d998
package
com.jsh.erp
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.web.servlet.DispatcherServlet
;
@SpringBootApplication
@MapperScan
(
basePackages
=
{
"com.jsh.erp.datasource.mappers"
})
...
...
@@ -15,4 +19,5 @@ public class ErpApplication{
}
src/main/java/com/jsh/erp/constants/BusinessConstants.java
0 → 100644
View file @
2bd1d998
package
com.jsh.erp.constants
;
/**
* @ClassName:BusinessConstants
* @Description 业务字典类
* @Author linshengming
* @Date 2018-9-15 17:58
* @Version 1.0
**/
public
class
BusinessConstants
{
/**
* 默认的日期格式
*/
public
static
final
String
DEFAULT_DATETIME_FORMAT
=
"yyyy-MM-dd HH:mm:ss"
;
/**
* 默认的分页起始页页码
*/
public
static
final
String
DEFAULT_PAGINATION_PAGE_NUMBER
=
"1"
;
/**
* 默认的分页页数
*/
public
static
final
String
DEFAULT_PAGINATION_PAGE_SIZE
=
"10"
;
}
src/main/java/com/jsh/erp/constants/ExceptionConstants.java
0 → 100644
View file @
2bd1d998
package
com.jsh.erp.constants
;
import
com.alibaba.fastjson.JSONObject
;
public
class
ExceptionConstants
{
/**
* code 格式 type+五位数字,例如3500000
* ResourceInfo(value = "inOutItem", type = 35)
*
* */
public
static
final
String
GLOBAL_RETURNS_CODE
=
"code"
;
public
static
final
String
GLOBAL_RETURNS_MESSAGE
=
"msg"
;
public
static
final
String
GLOBAL_RETURNS_DATA
=
"data"
;
/**
* 正常返回/操作成功
**/
public
static
final
int
SERVICE_SUCCESS_CODE
=
200
;
public
static
final
String
SERVICE_SUCCESS_MSG
=
"操作成功"
;
/**
* 系统运行时未知错误
**/
public
static
final
int
SERVICE_SYSTEM_ERROR_CODE
=
500
;
public
static
final
String
SERVICE_SYSTEM_ERROR_MSG
=
"未知异常"
;
/**
* 序列号
* type = 105
* */
/**序列号已存在*/
public
static
final
int
SERIAL_NUMBERE_ALREADY_EXISTS_CODE
=
10500000
;
public
static
final
String
SERIAL_NUMBERE_ALREADY_EXISTS_MSG
=
"序列号已存在"
;
/**序列号不能为为空*/
public
static
final
int
SERIAL_NUMBERE_NOT_BE_EMPTY_CODE
=
10500000
;
public
static
final
String
SERIAL_NUMBERE_NOT_BE_EMPTY_MSG
=
"序列号不能为为空"
;
/**
* 商品信息
* type = 80
* */
//商品信息不存在
public
static
final
int
MATERIAL_NOT_EXISTS_CODE
=
8000000
;
public
static
final
String
MATERIAL_NOT_EXISTS__MSG
=
"商品信息不存在"
;
//商品信息不唯一
public
static
final
int
MATERIAL_NOT_ONLY_CODE
=
8000001
;
public
static
final
String
MATERIAL_NOT_ONLY__MSG
=
"商品信息不唯一"
;
/**
* 标准正常返回/操作成功返回
* @return
*/
public
static
JSONObject
standardSuccess
()
{
JSONObject
success
=
new
JSONObject
();
success
.
put
(
GLOBAL_RETURNS_CODE
,
SERVICE_SUCCESS_CODE
);
success
.
put
(
GLOBAL_RETURNS_MESSAGE
,
SERVICE_SUCCESS_MSG
);
return
success
;
}
}
src/main/java/com/jsh/erp/controller/SerialNumberController.java
0 → 100644
View file @
2bd1d998
package
com.jsh.erp.controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.SerialNumberEx
;
import
com.jsh.erp.exception.BusinessParamCheckingException
;
import
com.jsh.erp.service.serialNumber.SerialNumberService
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
/**
* Description
*
* @Author: cjl
* @Date: 2019/1/22 10:29
*/
@RestController
public
class
SerialNumberController
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
SerialNumberController
.
class
);
@Resource
private
SerialNumberService
serialNumberService
;
/**
* create by: cjl
* description:
* 检查序列号是否存在
* create time: 2019/1/22 11:02
* @Param: id
* @Param: materialName
* @Param: serialNumber
* @Param: request
* @return java.lang.Object
*/
@PostMapping
(
"/serialNumber/checkIsExist"
)
@ResponseBody
public
Object
checkIsExist
(
@RequestParam
(
"id"
)
Long
id
,
@RequestParam
(
"materialName"
)
String
materialName
,
@RequestParam
(
"serialNumber"
)
String
serialNumber
,
HttpServletRequest
request
)
throws
Exception
{
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
if
(
StringUtil
.
isEmpty
(
serialNumber
)){
throw
new
BusinessParamCheckingException
(
ExceptionConstants
.
SERIAL_NUMBERE_NOT_BE_EMPTY_CODE
,
ExceptionConstants
.
SERIAL_NUMBERE_NOT_BE_EMPTY_MSG
);
}
serialNumberService
.
checkIsExist
(
id
,
materialName
,
serialNumber
);
return
result
;
}
/**
* create by: cjl
* description:
* 新增序列号信息
* create time: 2019/1/22 17:10
* @Param: beanJson
* @Param: request
* @return java.lang.Object
*/
@PostMapping
(
"/serialNumber/addSerialNumber"
)
@ResponseBody
public
Object
addSerialNumber
(
@RequestParam
(
"info"
)
String
beanJson
){
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
SerialNumberEx
sne
=
JSON
.
parseObject
(
beanJson
,
SerialNumberEx
.
class
);
serialNumberService
.
addSerialNumber
(
sne
);
return
result
;
}
/**
* create by: cjl
* description:
* 修改序列号信息
* create time: 2019/1/23 13:56
* @Param: beanJson
* @return java.lang.Object
*/
@PostMapping
(
"/serialNumber/updateSerialNumber"
)
@ResponseBody
public
Object
updateSerialNumber
(
@RequestParam
(
"info"
)
String
beanJson
){
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
SerialNumberEx
sne
=
JSON
.
parseObject
(
beanJson
,
SerialNumberEx
.
class
);
serialNumberService
.
updateSerialNumber
(
sne
);
return
result
;
}
}
src/main/java/com/jsh/erp/datasource/entities/Material.java
View file @
2bd1d998
...
...
@@ -186,6 +186,11 @@ public class Material {
* @mbggenerated
*/
private
String
otherfield3
;
/**
* 2019-01-21新增字段enableSerialNumber
*是否开启序列号
* */
private
Boolean
enableSerialNumber
;
/**
* This method was generated by MyBatis Generator.
...
...
@@ -738,4 +743,12 @@ public class Material {
public
void
setOtherfield3
(
String
otherfield3
)
{
this
.
otherfield3
=
otherfield3
==
null
?
null
:
otherfield3
.
trim
();
}
public
Boolean
getEnableSerialNumber
()
{
return
enableSerialNumber
;
}
public
void
setEnableSerialNumber
(
Boolean
enableSerialNumber
)
{
this
.
enableSerialNumber
=
enableSerialNumber
;
}
}
\ No newline at end of file
src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java
View file @
2bd1d998
...
...
@@ -55,6 +55,11 @@ public class MaterialVo4Unit {
private
String
categoryName
;
private
String
materialOther
;
/**
* 2019-01-21新增字段enableSerialNumber
*是否开启序列号
* */
private
Boolean
enableSerialNumber
;
public
Long
getId
()
{
return
id
;
...
...
@@ -263,4 +268,12 @@ public class MaterialVo4Unit {
public
void
setMaterialOther
(
String
materialOther
)
{
this
.
materialOther
=
materialOther
;
}
public
Boolean
getEnableSerialNumber
()
{
return
enableSerialNumber
;
}
public
void
setEnableSerialNumber
(
Boolean
enableSerialNumber
)
{
this
.
enableSerialNumber
=
enableSerialNumber
;
}
}
\ No newline at end of file
src/main/java/com/jsh/erp/datasource/entities/SerialNumberEx.java
0 → 100644
View file @
2bd1d998
package
com.jsh.erp.datasource.entities
;
/**
* Description
*
* @Author: cjl
* @Date: 2019/1/21 17:32
*/
public
class
SerialNumberEx
extends
SerialNumber
{
/**
* 商品名称
* */
private
String
materialName
;
/**
* 创建者名称
* */
private
String
creatorName
;
/**
* 更新者名称
* */
private
String
updaterName
;
public
String
getMaterialName
()
{
return
materialName
;
}
public
void
setMaterialName
(
String
materialName
)
{
this
.
materialName
=
materialName
;
}
public
String
getCreatorName
()
{
return
creatorName
;
}
public
void
setCreatorName
(
String
creatorName
)
{
this
.
creatorName
=
creatorName
;
}
public
String
getUpdaterName
()
{
return
updaterName
;
}
public
void
setUpdaterName
(
String
updaterName
)
{
this
.
updaterName
=
updaterName
;
}
}
src/main/java/com/jsh/erp/datasource/mappers/MaterialMapper.java
View file @
2bd1d998
...
...
@@ -96,35 +96,5 @@ public interface MaterialMapper {
*/
int
updateByPrimaryKey
(
Material
record
);
List
<
MaterialVo4Unit
>
selectByConditionMaterial
(
@Param
(
"name"
)
String
name
,
@Param
(
"model"
)
String
model
,
@Param
(
"categoryId"
)
Long
categoryId
,
@Param
(
"categoryIds"
)
String
categoryIds
,
@Param
(
"mpList"
)
String
mpList
,
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"rows"
)
Integer
rows
);
int
countsByMaterial
(
@Param
(
"name"
)
String
name
,
@Param
(
"model"
)
String
model
,
@Param
(
"categoryId"
)
Long
categoryId
,
@Param
(
"categoryIds"
)
String
categoryIds
,
@Param
(
"mpList"
)
String
mpList
);
String
findUnitName
(
@Param
(
"mId"
)
Long
mId
);
List
<
MaterialVo4Unit
>
findById
(
@Param
(
"id"
)
Long
id
);
List
<
MaterialVo4Unit
>
findBySelect
();
int
updatePriceNullByPrimaryKey
(
Long
id
);
int
updateUnitIdNullByPrimaryKey
(
Long
id
);
List
<
MaterialVo4Unit
>
findByAll
(
@Param
(
"name"
)
String
name
,
@Param
(
"model"
)
String
model
,
@Param
(
"categoryId"
)
Long
categoryId
,
@Param
(
"categoryIds"
)
String
categoryIds
);
}
\ No newline at end of file
src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java
0 → 100644
View file @
2bd1d998
package
com.jsh.erp.datasource.mappers
;
import
com.jsh.erp.datasource.entities.Material
;
import
com.jsh.erp.datasource.entities.MaterialVo4Unit
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* Description
*
* @Author: cjl
* @Date: 2019/1/22 14:54
*/
public
interface
MaterialMapperEx
{
List
<
MaterialVo4Unit
>
selectByConditionMaterial
(
@Param
(
"name"
)
String
name
,
@Param
(
"model"
)
String
model
,
@Param
(
"categoryId"
)
Long
categoryId
,
@Param
(
"categoryIds"
)
String
categoryIds
,
@Param
(
"mpList"
)
String
mpList
,
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"rows"
)
Integer
rows
);
int
countsByMaterial
(
@Param
(
"name"
)
String
name
,
@Param
(
"model"
)
String
model
,
@Param
(
"categoryId"
)
Long
categoryId
,
@Param
(
"categoryIds"
)
String
categoryIds
,
@Param
(
"mpList"
)
String
mpList
);
String
findUnitName
(
@Param
(
"mId"
)
Long
mId
);
List
<
MaterialVo4Unit
>
findById
(
@Param
(
"id"
)
Long
id
);
List
<
MaterialVo4Unit
>
findBySelect
();
int
updatePriceNullByPrimaryKey
(
Long
id
);
int
updateUnitIdNullByPrimaryKey
(
Long
id
);
List
<
MaterialVo4Unit
>
findByAll
(
@Param
(
"name"
)
String
name
,
@Param
(
"model"
)
String
model
,
@Param
(
"categoryId"
)
Long
categoryId
,
@Param
(
"categoryIds"
)
String
categoryIds
);
/**
* 通过商品名称查询商品信息
* */
List
<
Material
>
findByMaterialName
(
@Param
(
"name"
)
String
name
);
}
src/main/java/com/jsh/erp/datasource/mappers/SerialNumberMapperEx.java
0 → 100644
View file @
2bd1d998
package
com.jsh.erp.datasource.mappers
;
import
com.jsh.erp.datasource.entities.SerialNumber
;
import
com.jsh.erp.datasource.entities.SerialNumberEx
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* Description
*
* @Author: cjl
* @Date: 2019/1/21 17:09
*/
public
interface
SerialNumberMapperEx
{
/**
* 根据条件查询序列号列表
* */
List
<
SerialNumberEx
>
selectByConditionSerialNumber
(
@Param
(
"serialNumber"
)
String
serialNumber
,
@Param
(
"materialName"
)
String
materialName
,
@Param
(
"offset"
)
Integer
offset
,
@Param
(
"rows"
)
Integer
rows
);
/**
* 根据条件查询序列号数量
* */
int
countSerialNumber
(
@Param
(
"serialNumber"
)
String
serialNumber
,
@Param
(
"materialName"
)
String
materialName
);
/**
* 通过id查询序列号复合信息
* */
List
<
SerialNumberEx
>
findById
(
Long
id
);
/**
* 通过序列号查询序列号实体信息
* */
List
<
SerialNumberEx
>
findBySerialNumber
(
@Param
(
"serialNumber"
)
String
serialNumber
);
/**
* 新增序列号信息
* */
int
addSerialNumber
(
SerialNumberEx
serialNumberEx
);
/**
* 修改序列号信息
* */
int
updateSerialNumber
(
SerialNumberEx
serialNumberEx
);
}
src/main/java/com/jsh/erp/exception/BusinessParamCheckingException.java
0 → 100644
View file @
2bd1d998
package
com.jsh.erp.exception
;
import
lombok.Getter
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
@Getter
public
class
BusinessParamCheckingException
extends
Exception
{
private
static
final
long
serialVersionUID
=
1L
;
private
int
code
;
private
String
reason
;
public
BusinessParamCheckingException
(
int
code
,
String
reason
)
{
super
(
reason
);
this
.
code
=
code
;
this
.
reason
=
reason
;
}
public
BusinessParamCheckingException
(
int
code
,
String
reason
,
Throwable
throwable
)
{
super
(
reason
,
throwable
);
this
.
code
=
code
;
this
.
reason
=
reason
;
}
}
src/main/java/com/jsh/erp/exception/BusinessRunTimeException.java
0 → 100644
View file @
2bd1d998
package
com.jsh.erp.exception
;
import
lombok.Getter
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
@Getter
public
class
BusinessRunTimeException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
1L
;
private
int
code
;
private
String
reason
;
public
BusinessRunTimeException
(
int
code
,
String
reason
)
{
super
(
reason
);
this
.
code
=
code
;
this
.
reason
=
reason
;
}
public
BusinessRunTimeException
(
int
code
,
String
reason
,
Throwable
throwable
)
{
super
(
reason
,
throwable
);
this
.
code
=
code
;
this
.
reason
=
reason
;
}
}
src/main/java/com/jsh/erp/exception/GlobalExceptionHandler.java
0 → 100644
View file @
2bd1d998
package
com.jsh.erp.exception
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
javax.servlet.http.HttpServletRequest
;
@Slf4j
@RestControllerAdvice
public
class
GlobalExceptionHandler
{
@ExceptionHandler
(
value
=
Exception
.
class
)
@ResponseBody
public
Object
handleException
(
Exception
e
,
HttpServletRequest
request
)
{
JSONObject
status
=
new
JSONObject
();
// 针对业务参数异常的处理
if
(
e
instanceof
BusinessParamCheckingException
)
{
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_CODE
,
((
BusinessParamCheckingException
)
e
).
getCode
());
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_MESSAGE
,
((
BusinessParamCheckingException
)
e
).
getReason
());
return
status
;
}
//针对业务运行时异常的处理
if
(
e
instanceof
BusinessRunTimeException
)
{
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_CODE
,
((
BusinessRunTimeException
)
e
).
getCode
());
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_MESSAGE
,
((
BusinessRunTimeException
)
e
).
getReason
());
return
status
;
}
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_CODE
,
ExceptionConstants
.
SERVICE_SYSTEM_ERROR_CODE
);
status
.
put
(
ExceptionConstants
.
GLOBAL_RETURNS_MESSAGE
,
ExceptionConstants
.
SERVICE_SYSTEM_ERROR_MSG
);
log
.
error
(
"Global Exception Occured => url : {}, msg : {}"
,
request
.
getRequestURL
(),
e
.
getMessage
());
e
.
printStackTrace
();
return
status
;
}
}
\ No newline at end of file
src/main/java/com/jsh/erp/service/material/MaterialService.java
View file @
2bd1d998
...
...
@@ -5,6 +5,7 @@ import com.jsh.erp.datasource.entities.Material;
import
com.jsh.erp.datasource.entities.MaterialExample
;
import
com.jsh.erp.datasource.entities.MaterialVo4Unit
;
import
com.jsh.erp.datasource.mappers.MaterialMapper
;
import
com.jsh.erp.datasource.mappers.MaterialMapperEx
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.StringUtil
;
import
org.slf4j.Logger
;
...
...
@@ -25,6 +26,8 @@ public class MaterialService {
@Resource
private
MaterialMapper
materialMapper
;
@Resource
private
MaterialMapperEx
materialMapperEx
;
public
Material
getMaterial
(
long
id
)
{
return
materialMapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -38,7 +41,7 @@ public class MaterialService {
public
List
<
MaterialVo4Unit
>
select
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
,
String
mpList
,
int
offset
,
int
rows
)
{
String
[]
mpArr
=
mpList
.
split
(
","
);
List
<
MaterialVo4Unit
>
resList
=
new
ArrayList
<
MaterialVo4Unit
>();
List
<
MaterialVo4Unit
>
list
=
materialMapper
.
selectByConditionMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
,
offset
,
rows
);
List
<
MaterialVo4Unit
>
list
=
materialMapper
Ex
.
selectByConditionMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
,
offset
,
rows
);
if
(
null
!=
list
)
{
for
(
MaterialVo4Unit
m
:
list
)
{
//扩展信息
...
...
@@ -71,7 +74,7 @@ public class MaterialService {
}
public
int
countMaterial
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
,
String
mpList
)
{
return
materialMapper
.
countsByMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
);
return
materialMapper
Ex
.
countsByMaterial
(
name
,
model
,
categoryId
,
categoryIds
,
mpList
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
...
...
@@ -88,9 +91,9 @@ public class MaterialService {
int
res
=
materialMapper
.
updateByPrimaryKeySelective
(
material
);
Long
unitId
=
material
.
getUnitid
();
if
(
unitId
!=
null
)
{
materialMapper
.
updatePriceNullByPrimaryKey
(
id
);
//将价格置空
materialMapper
Ex
.
updatePriceNullByPrimaryKey
(
id
);
//将价格置空
}
else
{
materialMapper
.
updateUnitIdNullByPrimaryKey
(
id
);
//将多单位置空
materialMapper
Ex
.
updateUnitIdNullByPrimaryKey
(
id
);
//将多单位置空
}
return
res
;
}
...
...
@@ -146,15 +149,15 @@ public class MaterialService {
}
public
String
findUnitName
(
Long
mId
){
return
materialMapper
.
findUnitName
(
mId
);
return
materialMapper
Ex
.
findUnitName
(
mId
);
}
public
List
<
MaterialVo4Unit
>
findById
(
Long
id
){
return
materialMapper
.
findById
(
id
);
return
materialMapper
Ex
.
findById
(
id
);
}
public
List
<
MaterialVo4Unit
>
findBySelect
(){
return
materialMapper
.
findBySelect
();
return
materialMapper
Ex
.
findBySelect
();
}
public
List
<
Material
>
findByOrder
(){
...
...
@@ -165,7 +168,7 @@ public class MaterialService {
public
List
<
MaterialVo4Unit
>
findByAll
(
String
name
,
String
model
,
Long
categoryId
,
String
categoryIds
)
{
List
<
MaterialVo4Unit
>
resList
=
new
ArrayList
<
MaterialVo4Unit
>();
List
<
MaterialVo4Unit
>
list
=
materialMapper
.
findByAll
(
name
,
model
,
categoryId
,
categoryIds
);
List
<
MaterialVo4Unit
>
list
=
materialMapper
Ex
.
findByAll
(
name
,
model
,
categoryId
,
categoryIds
);
if
(
null
!=
list
)
{
for
(
MaterialVo4Unit
m
:
list
)
{
resList
.
add
(
m
);
...
...
src/main/java/com/jsh/erp/service/serialNumber/SerialNumberComponent.java
0 → 100644
View file @
2bd1d998
package
com.jsh.erp.service.serialNumber
;
import
com.jsh.erp.service.ICommonQuery
;
import
com.jsh.erp.service.material.MaterialResource
;
import
com.jsh.erp.service.material.MaterialService
;
import
com.jsh.erp.utils.Constants
;
import
com.jsh.erp.utils.QueryUtils
;
import
com.jsh.erp.utils.StringUtil
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.Map
;
/**
* Description
*
* @Author: cjl
* @Date: 2019/1/21 16:33
*/
@Service
(
value
=
"serialNumber_component"
)
@SerialNumberResource
public
class
SerialNumberComponent
implements
ICommonQuery
{
@Resource
private
SerialNumberService
serialNumberService
;
@Override
public
Object
selectOne
(
String
condition
)
{
return
null
;
}
@Override
public
List
<?>
select
(
Map
<
String
,
String
>
map
)
{
return
getSerialNumberList
(
map
);
}
private
List
<?>
getSerialNumberList
(
Map
<
String
,
String
>
map
)
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
serialNumber
=
StringUtil
.
getInfo
(
search
,
"serialNumber"
);
String
materialName
=
StringUtil
.
getInfo
(
search
,
"materialName"
);
return
serialNumberService
.
select
(
serialNumber
,
materialName
,
QueryUtils
.
offset
(
map
),
QueryUtils
.
rows
(
map
));
}
@Override
public
int
counts
(
Map
<
String
,
String
>
map
)
{
String
search
=
map
.
get
(
Constants
.
SEARCH
);
String
serialNumber
=
StringUtil
.
getInfo
(
search
,
"serialNumber"
);
String
materialName
=
StringUtil
.
getInfo
(
search
,
"materialName"
);
return
serialNumberService
.
countSerialNumber
(
serialNumber
,
materialName
);
}
@Override
public
int
insert
(
String
beanJson
,
HttpServletRequest
request
)
{
return
serialNumberService
.
insertSerialNumber
(
beanJson
,
request
);
}
@Override
public
int
update
(
String
beanJson
,
Long
id
)
{
return
serialNumberService
.
updateSerialNumber
(
beanJson
,
id
);
}
@Override
public
int
delete
(
Long
id
)
{
return
serialNumberService
.
deleteSerialNumber
(
id
);
}
@Override
public
int
batchDelete
(
String
ids
)
{
return
serialNumberService
.
batchDeleteSerialNumber
(
ids
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
serialNumber
)
{
return
serialNumberService
.
checkIsNameExist
(
id
,
serialNumber
);
}
}
Prev
1
2
Next
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