Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kwell-mes
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gavelinfo
kwell-mes
Commits
dd861676
Commit
dd861676
authored
Apr 26, 2022
by
yff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加产品跟踪条码导出功能
parent
15021e7f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
217 additions
and
6 deletions
+217
-6
WosngzController.java
...ain/java/com/gavel/kwell/controller/WosngzController.java
+13
-1
GpfkService.java
gavel/src/main/java/com/gavel/kwell/service/GpfkService.java
+1
-0
UWosnService.java
...l/src/main/java/com/gavel/kwell/service/UWosnService.java
+5
-0
GpfkServiceImpl.java
...in/java/com/gavel/kwell/service/impl/GpfkServiceImpl.java
+6
-2
UWosnServiceImpl.java
...n/java/com/gavel/kwell/service/impl/UWosnServiceImpl.java
+168
-2
HzGylxEnum.java
gavel/src/main/java/com/gavel/kwell/utils/HzGylxEnum.java
+10
-0
生产工单.xls
gavel/src/main/resources/static/model/生产工单.xls
+0
-0
生产工单.xlsx
gavel/src/main/resources/static/model/生产工单.xlsx
+0
-0
index.html
...src/main/resources/templates/views/kmes/wosngz/index.html
+14
-1
No files found.
gavel/src/main/java/com/gavel/kwell/controller/WosngzController.java
View file @
dd861676
...
...
@@ -23,6 +23,7 @@ import com.gavel.common.converter.DataConvert;
import
com.gavel.common.utils.StringUtils
;
import
com.gavel.kwell.service.GpfkService
;
import
com.gavel.kwell.service.GphyService
;
import
com.gavel.kwell.service.UWosnService
;
import
com.gavel.persistence.sql.RecordSet
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -36,6 +37,9 @@ public class WosngzController extends BaseController {
@Autowired
private
GphyService
gphyService
;
@Autowired
private
UWosnService
wosnService
;
@ResourcePermissions
()
@RequestMapping
(
"/index"
)
...
...
@@ -73,10 +77,18 @@ public class WosngzController extends BaseController {
@RequestMapping
(
value
=
BaseURL
.
EXPORT
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
void
export
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@RequestBody
JSONObject
param
)
throws
Exception
{
GpWoCondition
condition
=
DataConvert
.
getCondition
(
param
.
getJSONObject
(
"condition"
),
GpWoCondition
.
class
);
String
wosnid
=
param
.
getString
(
"wosnid"
);
GpWoCondition
condition
=
DataConvert
.
getCondition
(
param
.
getJSONObject
(
"condition"
),
GpWoCondition
.
class
);
RecordSet
<
WosngzVO
>
records
=
gpfkService
.
queryWosngz
(
condition
);
doExport
(
request
,
response
,
param
,
records
.
getRecords
());
}
@RequestMapping
(
value
=
"exportxq"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
void
exportxq
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@RequestBody
JSONObject
param
)
throws
Exception
{
String
wosnid
=
param
.
getString
(
"wosnid"
);
wosnService
.
exportProductFlow
(
request
,
response
,
wosnid
);
}
@ApiOperation
(
value
=
"传入wosnid(条码)"
)
@RequestMapping
(
value
=
"/getWosngzInfo"
,
method
=
RequestMethod
.
POST
)
...
...
gavel/src/main/java/com/gavel/kwell/service/GpfkService.java
View file @
dd861676
...
...
@@ -124,4 +124,5 @@ public interface GpfkService extends BaseEditService {
public
FkVO
gzfk
(
FkCondition
fkCondition
);
/** 科威尔mes工票反馈重写--end */
}
gavel/src/main/java/com/gavel/kwell/service/UWosnService.java
View file @
dd861676
package
com
.
gavel
.
kwell
.
service
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.gavel.common.base.service.BaseEditService
;
import
com.gavel.kwell.vo.UWosnCondition
;
import
com.gavel.kwell.vo.UWosnVO
;
...
...
@@ -16,5 +19,7 @@ public interface UWosnService extends BaseEditService {
public
Wosn
queryWosnByCode
(
String
wosnid
);
public
boolean
queryIfHasPrint
(
String
id
);
public
void
exportProductFlow
(
HttpServletRequest
request
,
HttpServletResponse
response
,
String
wosnid
);
}
gavel/src/main/java/com/gavel/kwell/service/impl/GpfkServiceImpl.java
View file @
dd861676
...
...
@@ -32,6 +32,7 @@ import com.gavel.common.utils.NumberUtils;
import
com.gavel.common.utils.StringUtils
;
import
com.gavel.common.utils.ThreadContext
;
import
com.gavel.common.utils.UserInfoUtil
;
import
com.gavel.framework.service.FrameService
;
import
com.gavel.framework.utils.JwtUtil
;
import
com.gavel.gygl.persistent.Bzgx
;
import
com.gavel.gygl.service.BzgxService
;
...
...
@@ -101,6 +102,8 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
@Autowired
private
GphyDao
gphyDao
;
@Autowired
private
FrameService
frameService
;
@Autowired
private
CommonService
commonService
;
...
...
@@ -844,8 +847,9 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
addReturnData
(
Constants
.
UserInfo
.
TOKEN
,
token
);
addReturnData
(
"roles"
,
roles
);
UserInfoUtil
.
tokenUserMap
.
put
(
token
,
userInfo
);
UsernamePasswordToken
usernamePasswordToken
=
new
UsernamePasswordToken
(
StringUtils
.
upperCase
(
user
.
getUserid
()),
user
.
getPassword
());
SecurityUtils
.
getSubject
().
login
(
usernamePasswordToken
);
frameService
.
login
(
user
.
getUserid
(),
user
.
getPassword
());
// UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(StringUtils.upperCase(user.getUserid()), user.getPassword());
// SecurityUtils.getSubject().login(usernamePasswordToken);
BzgxVO
bzgxVO
=
bzgxVOs
.
get
(
0
);
if
(
StringUtils
.
isNotEmpty
(
YymkFKEnum
.
getNameById
(
bzgxVO
.
getGxlx
())))
{
YymkCondition
yymkCondition
=
new
YymkCondition
();
...
...
gavel/src/main/java/com/gavel/kwell/service/impl/UWosnServiceImpl.java
View file @
dd861676
package
com
.
gavel
.
kwell
.
service
.
impl
;
import
com.gavel.common.base.service.impl.BaseEditServiceImpl
;
import
com.gavel.common.utils.DateUtils
;
import
com.gavel.common.utils.NumberUtils
;
import
com.gavel.common.utils.StringUtils
;
import
com.gavel.kwell.dao.UWosnDao
;
import
com.gavel.kwell.service.GpfkService
;
import
com.gavel.kwell.service.GphyService
;
import
com.gavel.kwell.service.UWosnService
;
import
com.gavel.kwell.utils.HzGylxEnum
;
import
com.gavel.kwell.vo.GpWoCondition
;
import
com.gavel.kwell.vo.GpfkVO
;
import
com.gavel.kwell.vo.GphyCondition
;
import
com.gavel.kwell.vo.GphyVO
;
import
com.gavel.kwell.vo.UWosnCondition
;
import
com.gavel.kwell.vo.UWosnVO
;
import
com.gavel.kwell.vo.WosngzVO
;
import
com.gavel.persistence.sql.RecordSet
;
import
com.gavel.wo.persistent.Wosn
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.poi.ss.usermodel.BorderStyle
;
import
org.apache.poi.ss.usermodel.HorizontalAlignment
;
import
org.apache.poi.xssf.usermodel.XSSFCell
;
import
org.apache.poi.xssf.usermodel.XSSFCellStyle
;
import
org.apache.poi.xssf.usermodel.XSSFRow
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -19,8 +48,12 @@ public class UWosnServiceImpl extends BaseEditServiceImpl implements UWosnServic
@Autowired
private
UWosnDao
uwosnDao
;
@Autowired
private
GpfkService
gpfkService
;
@Autowired
private
GphyService
gphyService
;
@Override
public
void
initService
()
{
addMaster
(
Wosn
.
class
);
...
...
@@ -46,4 +79,137 @@ public class UWosnServiceImpl extends BaseEditServiceImpl implements UWosnServic
Integer
res
=
uwosnDao
.
queryHasPringCount
(
id
);
return
NumberUtils
.
Greater
(
res
,
0
);
}
@Override
public
void
exportProductFlow
(
HttpServletRequest
request
,
HttpServletResponse
response
,
String
wosnid
)
{
Resource
resource
=
new
ClassPathResource
(
"static/model/生产工单.xlsx"
);
FileInputStream
fs
=
null
;
XSSFWorkbook
wb
=
null
;
OutputStream
outputStream
=
null
;
try
{
File
file
=
resource
.
getFile
();
fs
=
new
FileInputStream
(
file
);
wb
=
new
XSSFWorkbook
(
fs
);
List
<
WosngzVO
>
wosngxList
=
null
;
if
(
StringUtils
.
isNotEmpty
(
wosnid
))
{
GpWoCondition
gpWoCondition
=
new
GpWoCondition
();
gpWoCondition
.
setWosnid
(
wosnid
);
RecordSet
<
WosngzVO
>
records
=
gpfkService
.
queryWosngz
(
gpWoCondition
);
wosngxList
=
records
.
getRecords
();
}
if
(
wosngxList
!=
null
&&
wosngxList
.
size
()>
0
)
{
XSSFSheet
sheet
=
wb
.
getSheetAt
(
0
);
WosngzVO
wosngx
=
wosngxList
.
get
(
0
);
List
<
GpfkVO
>
gpfkVOList
=
gpfkService
.
queryWosngzByWosnid
(
wosnid
);
//获取excel产品名称和产品规格列
XSSFRow
row3
=
sheet
.
getRow
(
2
);
XSSFCell
wlxxNameCell
=
row3
.
getCell
(
2
);
wlxxNameCell
.
setCellValue
(
wosngx
.
getWlxxName
());
XSSFCell
wlggCell
=
row3
.
getCell
(
5
);
wlggCell
.
setCellValue
(
wosngx
.
getWlxxGg
());
//获取excel生产订单和生产日期列
XSSFRow
row4
=
sheet
.
getRow
(
3
);
XSSFCell
woDjCell
=
row4
.
getCell
(
2
);
woDjCell
.
setCellValue
(
wosngx
.
getDjid
());
XSSFCell
worqCell
=
row4
.
getCell
(
5
);
if
(
gpfkVOList
!=
null
&&
gpfkVOList
.
size
()>
0
)
{
worqCell
.
setCellValue
(
DateUtils
.
formatDate
(
gpfkVOList
.
get
(
0
).
getFksj
()));
}
//获取excel序列号列
XSSFRow
row5
=
sheet
.
getRow
(
4
);
XSSFCell
wosnCell
=
row5
.
getCell
(
2
);
wosnCell
.
setCellValue
(
wosnid
);
//遍历反馈数据
if
(
gpfkVOList
!=
null
&&
gpfkVOList
.
size
()>
0
)
{
//设置列样式
XSSFCellStyle
cellStyle
=
wb
.
createCellStyle
();
//设置单元格边框
cellStyle
.
setBorderBottom
(
BorderStyle
.
THIN
);
cellStyle
.
setBorderLeft
(
BorderStyle
.
THIN
);
cellStyle
.
setBorderRight
(
BorderStyle
.
THIN
);
cellStyle
.
setBorderTop
(
BorderStyle
.
THIN
);
//设置居中
cellStyle
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
for
(
int
i
=
0
;
i
<
gpfkVOList
.
size
();
i
++)
{
XSSFRow
row
=
sheet
.
createRow
(
6
+
i
);
XSSFCell
bzCell
=
row
.
createCell
(
1
);
bzCell
.
setCellStyle
(
cellStyle
);
XSSFCell
gxCell
=
row
.
createCell
(
2
);
gxCell
.
setCellStyle
(
cellStyle
);
XSSFCell
zynrCell
=
row
.
createCell
(
3
);
zynrCell
.
setCellStyle
(
cellStyle
);
XSSFCell
zyygCell
=
row
.
createCell
(
4
);
zyygCell
.
setCellStyle
(
cellStyle
);
XSSFCell
zysjCell
=
row
.
createCell
(
5
);
zysjCell
.
setCellStyle
(
cellStyle
);
if
(
StringUtils
.
isNotEmpty
(
gpfkVOList
.
get
(
i
).
getBzgxGxlx
()))
{
String
id
=
HzGylxEnum
.
getIdByName
(
gpfkVOList
.
get
(
i
).
getBzgxGxlx
());
bzCell
.
setCellValue
(
id
);
}
if
(
StringUtils
.
isNotEmpty
(
gpfkVOList
.
get
(
i
).
getBzgxName
()))
{
gxCell
.
setCellValue
(
gpfkVOList
.
get
(
i
).
getBzgxName
());
}
if
(
StringUtils
.
isNotEmpty
(
gpfkVOList
.
get
(
i
).
getId
()))
{
GphyCondition
condition
=
new
GphyCondition
();
condition
.
setMid
(
gpfkVOList
.
get
(
i
).
getId
());
List
<
GphyVO
>
gphyVOList
=
gphyService
.
query
(
condition
).
getRecords
();
StringBuilder
cellValue
=
new
StringBuilder
(
""
);
if
(
gphyVOList
!=
null
&&
gphyVOList
.
size
()>
0
)
{
cellValue
.
append
(
"物料名称:"
);
cellValue
.
append
(
gphyVOList
.
get
(
0
).
getWlxxName
());
cellValue
.
append
(
";"
);
cellValue
.
append
(
"物料规格:"
);
cellValue
.
append
(
gphyVOList
.
get
(
0
).
getWlxxGg
());
cellValue
.
append
(
";"
);
cellValue
.
append
(
"物料数量:"
);
cellValue
.
append
(
gphyVOList
.
get
(
0
).
getZpsl
());
cellValue
.
append
(
"。"
);
}
else
{
if
(
StringUtils
.
isNotEmpty
(
gpfkVOList
.
get
(
i
).
getHgbz
())&&
gpfkVOList
.
get
(
i
).
getHgbz
().
equals
(
"Y"
))
{
cellValue
.
append
(
"合格"
);
}
else
{
cellValue
.
append
(
"不合格"
);
}
}
zynrCell
.
setCellValue
(
cellValue
.
toString
());
}
if
(
StringUtils
.
isNotEmpty
(
gpfkVOList
.
get
(
i
).
getFkr
()))
{
zyygCell
.
setCellValue
(
gpfkVOList
.
get
(
i
).
getFkr
());
}
if
(
gpfkVOList
.
get
(
i
).
getFksj
()!=
null
)
{
zysjCell
.
setCellValue
(
DateUtils
.
formatDate
(
gpfkVOList
.
get
(
i
).
getFksj
()));
}
}
}
}
//3.将Excel文件通过Response输出到前端
outputStream
=
response
.
getOutputStream
();
// 清空response
response
.
reset
();
response
.
setContentType
(
"application/vnd.ms-excel"
);
// response.setContentType("application/msexcel");//设置生成的文件类型
response
.
setCharacterEncoding
(
"UTF-8"
);
//设置文件头编码方式和文件名
String
filename
=
wosnid
+
"生产工单流程.xlsx"
;
response
.
setHeader
(
"Content-Disposition"
,
"attachment; "
+
" filename="
+
new
String
(
filename
.
getBytes
(
"utf-8"
),
"ISO8859-1"
));
String
origin
=
request
.
getHeader
(
"Origin"
);
response
.
addHeader
(
"Access-Control-Allow-Origin"
,
origin
);
wb
.
write
(
outputStream
);
outputStream
.
flush
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
wb
.
close
();
outputStream
.
close
();
fs
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
gavel/src/main/java/com/gavel/kwell/utils/HzGylxEnum.java
View file @
dd861676
...
...
@@ -54,4 +54,14 @@ public enum HzGylxEnum {
}
return
list
;
}
public
static
String
getIdByName
(
String
name
)
{
String
id
=
""
;
for
(
HzGylxEnum
e
:
HzGylxEnum
.
values
())
{
if
(
e
.
getId
().
equals
(
name
))
{
id
=
e
.
getName
();
}
}
return
id
;
}
}
gavel/src/main/resources/static/model/生产工单.xls
0 → 100644
View file @
dd861676
File added
gavel/src/main/resources/static/model/生产工单.xlsx
0 → 100644
View file @
dd861676
File added
gavel/src/main/resources/templates/views/kmes/wosngz/index.html
View file @
dd861676
...
...
@@ -4,8 +4,9 @@
<div
id=
"wosngzTable-toolbar"
class=
"gui-toolbar"
data-options=
"grid:{type:'datagrid',id:'wosngzTable'}"
>
<div
class=
"navbar-toolbar"
>
<a
class=
"toolbar-print toolbar"
href=
"javascript:void(0)"
></a>
<
a
class=
"toolbar-export toolbar"
href=
"javascript:void(0)"
></a
>
<
!-- <a class="toolbar-export toolbar" href="javascript:void(0)"></a> --
>
<a
class=
"toolbar-gpmx toolbar"
href=
"javascript:void(0)"
></a>
<a
class=
"toolbar-exportxq toolbar"
href=
"javascript:void(0)"
></a>
</div>
<div
class=
"form-sub"
>
<form
class=
"query-criteria"
>
...
...
@@ -211,5 +212,17 @@
},
});
$
(
"#wosngzTable-toolbar"
).
find
(
'.toolbar-exportxq'
).
iMenubutton
({
iconCls
:
"fa fa-file-excel-o"
,
text
:
'导出工单'
,
onClick
:
function
(){
var
row
=
$
(
'#kwellWosngz'
).
find
(
".toolbar-table"
).
datagrid
(
"getSelected"
);
if
(
!
row
){
gas
.
showTipsWarning
(
"请选择一条数据"
);
return
false
}
HTTP
.
download
(
"kmes/wosngz/exportxq"
,{
wosnid
:
$
(
'#kwellWosngz'
).
find
(
".toolbar-table"
).
datagrid
(
"getSelected"
).
wosnCode
},
"post"
);
},
});
})
</script>
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