Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xnr-interface
Project
Project
Details
Activity
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
heli_wms
xnr-interface
Commits
83b056b6
Commit
83b056b6
authored
Dec 01, 2019
by
tank.li@mushiny.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拣货任务完善,出库单与系统绑定 完成后反馈
parent
8f71bebc
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
665 additions
and
70 deletions
+665
-70
ICQAController.java
.../java/com/mushiny/heli/xnr/controller/ICQAController.java
+135
-0
WMSController.java
...n/java/com/mushiny/heli/xnr/controller/WMSController.java
+15
-16
ICQAService.java
src/main/java/com/mushiny/heli/xnr/service/ICQAService.java
+414
-0
InboundService.java
...ain/java/com/mushiny/heli/xnr/service/InboundService.java
+41
-47
OutboundService.java
...in/java/com/mushiny/heli/xnr/service/OutboundService.java
+1
-1
Sql_Table.java
src/main/java/com/mushiny/heli/xnr/service/Sql_Table.java
+49
-2
WMSService.java
src/main/java/com/mushiny/heli/xnr/service/WMSService.java
+10
-4
No files found.
src/main/java/com/mushiny/heli/xnr/controller/ICQAController.java
0 → 100644
View file @
83b056b6
package
com
.
mushiny
.
heli
.
xnr
.
controller
;
import
com.mushiny.heli.xnr.comm.CommonUtils
;
import
com.mushiny.heli.xnr.comm.JsonUtils
;
import
com.mushiny.heli.xnr.dto.MessageDTO
;
import
com.mushiny.heli.xnr.service.ICQAService
;
import
com.mushiny.heli.xnr.service.InboundService
;
import
com.mushiny.heli.xnr.service.WMSService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Map
;
/**
* Created by Lisi on 2019-11-30.
*/
@RestController
@RequestMapping
(
"/icqa"
)
public
class
ICQAController
{
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ICQAController
.
class
);
@Autowired
private
WMSService
wmsService
;
@Autowired
private
ICQAService
icqaService
;
@Autowired
private
InboundService
inboundService
;
@PostMapping
(
value
=
"/check"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
MessageDTO
>
check
(
@RequestBody
String
json
){
Map
data
=
JsonUtils
.
json2Map
(
json
);
int
stored
=
CommonUtils
.
parseInteger
(
"counted"
,
data
);
String
skuId
=
CommonUtils
.
parseString
(
"skuId"
,
data
);
String
factory
=
CommonUtils
.
parseString
(
"factory"
,
data
);
String
section
=
CommonUtils
.
parseString
(
"section"
,
data
);
String
entryId
=
CommonUtils
.
parseString
(
"taskId"
,
data
);
//货架的货位 P0000008AA01
String
containerId
=
CommonUtils
.
parseString
(
"containerId"
,
data
);
MessageDTO
dto
=
this
.
icqaService
.
check
(
skuId
,
stored
,
containerId
,
factory
,
section
,
entryId
);
return
ResponseEntity
.
ok
(
dto
);
}
/**
* 当前任务
* @param json
* @return
*/
@PostMapping
(
value
=
"/currentPodTask"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
String
>
currentPodTask
(
@RequestBody
String
json
){
Map
station
=
JsonUtils
.
json2Map
(
json
);
//工作站号码
Map
dto
=
this
.
icqaService
.
currentPodTask
(
CommonUtils
.
parseString
(
"stationName"
,
station
));
return
ResponseEntity
.
ok
(
JsonUtils
.
map2Json
(
dto
));
}
@PostMapping
(
value
=
"/createICQAOrder"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
MessageDTO
>
createICQAOrder
(
@RequestBody
String
json
){
Map
data
=
JsonUtils
.
json2Map
(
json
);
logger
.
debug
(
"收到创建盘点任务指令:"
+
json
);
MessageDTO
dto
=
MessageDTO
.
success
();
try
{
this
.
wmsService
.
createICQAOrder
(
data
);
}
catch
(
Exception
e
)
{
dto
.
setMESSAGE
(
e
.
getMessage
());
dto
.
setCODE
(
1
);
}
return
ResponseEntity
.
ok
(
dto
);
}
@PostMapping
(
value
=
"/searchIcqa"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
String
>
searchIcqa
(
@RequestBody
String
json
){
Map
data
=
JsonUtils
.
json2Map
(
json
);
Map
resData
=
this
.
icqaService
.
searchIcqa
(
data
);
return
ResponseEntity
.
ok
(
JsonUtils
.
map2Json
(
resData
));
}
/**
* 查找明细
* @param json
* @return
*/
@PostMapping
(
value
=
"/searchIcqaInfo"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
String
>
searchIcqaInfo
(
@RequestBody
String
json
){
Map
data
=
JsonUtils
.
json2Map
(
json
);
Map
resData
=
this
.
icqaService
.
searchIcqaInfo
(
data
);
return
ResponseEntity
.
ok
(
JsonUtils
.
map2Json
(
resData
));
}
@PostMapping
(
value
=
"/startTasks"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
MessageDTO
>
startTasks
(
@RequestBody
String
json
){
Map
data
=
JsonUtils
.
json2Map
(
json
);
MessageDTO
resData
=
this
.
icqaService
.
startTasks
(
data
);
return
ResponseEntity
.
ok
(
resData
);
}
/**
* 终止盘点任务
* @param json
* @return
*/
@PostMapping
(
value
=
"/taskFinish"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
MessageDTO
>
taskFinish
(
@RequestBody
String
json
){
Map
data
=
JsonUtils
.
json2Map
(
json
);
MessageDTO
dto
=
this
.
icqaService
.
taskFinish
(
data
);
return
ResponseEntity
.
ok
(
dto
);
}
/**
* 退出盘点 如果stowpod任务还在 就提示并强制退出
* @param json
* @return
*/
@PostMapping
(
value
=
"/endICQA"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
MessageDTO
>
endICQA
(
@RequestBody
String
json
){
Map
station
=
JsonUtils
.
json2Map
(
json
);
//用跟上架 同一个代码
MessageDTO
dto
=
this
.
inboundService
.
endInbound
(
CommonUtils
.
parseString
(
"stationName"
,
station
));
return
ResponseEntity
.
ok
(
dto
);
}
}
src/main/java/com/mushiny/heli/xnr/controller/WMSController.java
View file @
83b056b6
...
...
@@ -28,22 +28,6 @@ public class WMSController {
@Autowired
private
WMSService
wmsService
;
@PostMapping
(
value
=
"/createICQAOrder"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
MessageDTO
>
createICQAOrder
(
@RequestBody
String
json
){
Map
data
=
JsonUtils
.
json2Map
(
json
);
logger
.
debug
(
"收到创建盘点任务指令:"
+
json
);
MessageDTO
dto
=
MessageDTO
.
success
();
try
{
this
.
wmsService
.
createICQAOrder
(
data
);
}
catch
(
Exception
e
)
{
dto
.
setMESSAGE
(
e
.
getMessage
());
dto
.
setCODE
(
1
);
}
return
ResponseEntity
.
ok
(
dto
);
}
@PostMapping
(
value
=
"/syncItem"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
MessageDTO
>
syncItem
(
@RequestBody
String
json
){
...
...
@@ -88,4 +72,19 @@ public class WMSController {
}
return
ResponseEntity
.
ok
(
dto
);
}
@PostMapping
(
value
=
"/podRelease"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
MessageDTO
>
podRelease
(
@RequestBody
String
json
){
Map
req
=
JsonUtils
.
json2Map
(
json
);
logger
.
debug
(
"收到出库单下发指令:"
+
json
);
MessageDTO
dto
=
MessageDTO
.
success
();
try
{
this
.
wmsService
.
podRelease
(
req
);
}
catch
(
Exception
e
)
{
dto
.
setMESSAGE
(
e
.
getMessage
());
dto
.
setCODE
(
1
);
}
return
ResponseEntity
.
ok
(
dto
);
}
}
src/main/java/com/mushiny/heli/xnr/service/ICQAService.java
0 → 100644
View file @
83b056b6
package
com
.
mushiny
.
heli
.
xnr
.
service
;
import
com.mushiny.heli.xnr.beans.BaseBpo
;
import
com.mushiny.heli.xnr.comm.CommonUtils
;
import
com.mushiny.heli.xnr.comm.JsonUtils
;
import
com.mushiny.heli.xnr.dto.MessageDTO
;
import
com.mushiny.heli.xnr.dto.StorageLocation
;
import
com.mushiny.heli.xnr.jdbc.repositories.JdbcRepository
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
javax.transaction.Transactional
;
import
java.util.*
;
@Service
@Transactional
public
class
ICQAService
{
@Autowired
private
JdbcRepository
jdbcRepository
;
//TODO 依赖关系不对
@Autowired
private
InboundService
inboundService
;
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ICQAService
.
class
);
@Autowired
private
SystemPropertiesManager
systemPropertiesManager
;
/**
* 当前货架的盘点任务
* @param stationName
* @return
*/
public
Map
currentPodTask
(
String
stationName
)
{
Map
dto
=
new
HashMap
();
//如果没有锁定 就没有任务
if
(
isLocked
(
stationName
)
){
dto
.
put
(
"CODE"
,
1
);
dto
.
put
(
"MSG"
,
"工作站"
+
stationName
+
"被占用,没有当前任务!"
);
return
dto
;
}
List
<
Map
>
datas
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_CURRENTPOD
,
stationName
);
//先找再工作站的货架
if
(
datas
.
isEmpty
()){
dto
.
put
(
"CODE"
,
1
);
dto
.
put
(
"MSG"
,
"没有找到当前在工作站的货架"
);
return
dto
;
}
//MD_POD.ID, MD_POD.POD_INDEX, MD_POD.TOWARD, MD_WORKSTATION.WORKING_FACE_ORIENTATION
Map
data
=
datas
.
get
(
0
);
Integer
pod_toward
=
CommonUtils
.
parseInteger
(
"TOWARD"
,
data
);
Integer
pod_index
=
CommonUtils
.
parseInteger
(
"POD_INDEX"
,
data
);
Integer
wsFace
=
CommonUtils
.
parseInteger
(
"WORKING_FACE_ORIENTATION"
,
data
);
String
podId
=
CommonUtils
.
parseString
(
"ID"
,
data
);
String
face
=
InboundService
.
getFace
(
wsFace
,
pod_toward
);
/*`ID` varchar(255) NOT NULL,
`ENTRYID` varchar(255) NOT NULL,
`ENTRYPOSITIONID` varchar(255) NOT NULL,
`SKUID` varchar(255) NOT NULL,
`POD_ID` varchar(255) NOT NULL,
`POD_FACE` varchar(255) NOT NULL,
`POD_LOCATE` varchar(255) NOT NULL,
`PODINDEX` int(11) DEFAULT NULL COMMENT '货架编号',
`STATE` varchar(255) COMMENT '状态',*/
//拼接后去找有没有要拣的任务单 WMS_INBOUND_PODORDER 根据 货架 面
List
<
Map
>
podTask
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_PODORDRTASK_ICQA
,
podId
,
face
);
if
(
podTask
.
isEmpty
()){
dto
.
put
(
"CODE"
,
1
);
dto
.
put
(
"MSG"
,
"当前货架:POD:"
+
pod_index
+
" 没有盘点任务,请释放"
);
return
dto
;
}
Map
podOrder
=
podTask
.
get
(
0
);
String
skuId
=
CommonUtils
.
parseString
(
"SKUID"
,
podOrder
);
List
<
Map
>
skus
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERYITEM_BYSKUNO
,
skuId
);
if
(
skus
.
isEmpty
()){
dto
.
put
(
"CODE"
,
1
);
dto
.
put
(
"MSG"
,
"没有找到当前盘点的商品信息, SKU:"
+
skuId
);
return
dto
;
}
Map
sku
=
skus
.
get
(
0
);
data
.
put
(
"SKUNAME"
,
CommonUtils
.
parseString
(
"NAME"
,
sku
));
data
.
putAll
(
podOrder
);
return
data
;
}
/*如果工作站开启了 启动货架搬运任务 生成RCS_TRIP/POSITION表记录*/
private
boolean
isLocked
(
String
stationId
)
{
List
<
Map
>
rows
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_WORKSTATION
,
stationId
);
if
(
rows
.
isEmpty
()){
return
false
;
}
Map
data
=
rows
.
get
(
0
);
String
operator_id
=
CommonUtils
.
parseString
(
"OPERATOR_ID"
,
data
);
String
station_name
=
CommonUtils
.
parseString
(
"STATION_NAME"
,
data
);
if
(!
CommonUtils
.
isEmpty
(
operator_id
)
&&
!
Objects
.
equals
(
operator_id
,
"LISI"
)
&&
!
Objects
.
equals
(
station_name
,
"IcqaPod"
)){
return
true
;
}
return
false
;
}
/**
* 定时启动任务
*/
@Scheduled
(
fixedDelay
=
10
*
1000L
)
public
void
startICQATrip
(){
//6db9c7c0-4f93-4fa1-82c0-fb6435af7aae
if
(
isLocked
(
"6db9c7c0-4f93-4fa1-82c0-fb6435af7aae"
)){
logger
.
error
(
"工作站被锁定,无法启动盘点任务!"
);
return
;
}
//TODO 根据工作站查找
String
pods
=
this
.
systemPropertiesManager
.
getProperty
(
"EN_ROUTE_MAX_PODS_BINCHENK"
,
Sql_Table
.
WAREHOUSE
);
List
<
Map
>
runningPods
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_RUNNINGPODS
,
"ICQAPod"
,
Sql_Table
.
AVAILABLE
,
Sql_Table
.
PROCESS
);
Integer
limit
=
Integer
.
parseInt
(
pods
)
-
runningPods
.
size
();
//TODO 按工作站区分
//先找这么多货架 然后加载所有任务
List
<
Map
>
podIds
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_ICQAPODS
,
"ICQAPod"
,
Sql_Table
.
AVAILABLE
);
for
(
int
i
=
0
;
i
<
podIds
.
size
()
&&
i
<
limit
;
i
++)
{
Map
map
=
podIds
.
get
(
i
);
String
podId
=
CommonUtils
.
parseString
(
"POD_ID"
,
map
);
String
workStation
=
CommonUtils
.
parseString
(
"WORKSTATION_ID"
,
map
);
List
<
Map
>
orderPosition
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_PODORDERS
,
podId
,
Sql_Table
.
NEW
);
//New Available Finish 没有Process
BaseBpo
baseBpo
=
new
BaseBpo
();
baseBpo
.
setTable
(
"RCS_TRIP"
);
String
tripId
=
CommonUtils
.
genUUID
();
baseBpo
.
addKV
(
"ID"
,
tripId
);
baseBpo
.
addKV
(
"POD_ID"
,
podId
);
baseBpo
.
addKV
(
"TRIP_TYPE"
,
"StowPod"
);
baseBpo
.
addKV
(
"WORKSTATION_ID"
,
workStation
);
baseBpo
.
addKV
(
"TRIP_STATE"
,
"New"
);
baseBpo
.
addKV
(
"WAREHOUSE_ID"
,
CommonUtils
.
parseString
(
"WAREHOUSE_ID"
,
map
));
baseBpo
.
addKV
(
"SECTION_ID"
,
CommonUtils
.
parseString
(
"SECTION_ID"
,
map
));
this
.
jdbcRepository
.
insertBusinessObject
(
baseBpo
);
//序号生成 从1开始
//Map<String,Integer> index = this.genIndexMap();
for
(
int
j
=
0
;
j
<
orderPosition
.
size
();
j
++)
{
//如果存在RCS_TRIPPOSITION就不要再创建
Map
podOrder
=
orderPosition
.
get
(
j
);
String
needFace
=
CommonUtils
.
parseString
(
"POD_FACE"
,
map
);
//int sameFaceIndex = index.get(needFace);
String
tripPositionID
;
List
<
Map
>
tripPositions
=
this
.
inboundService
.
existTripPosition
(
workStation
,
podId
,
needFace
,
"ICQAPod"
);
if
(
tripPositions
.
isEmpty
())
{
BaseBpo
baseBpo2
=
new
BaseBpo
();
baseBpo2
.
setTable
(
"RCS_TRIPPOSITION"
);
tripPositionID
=
CommonUtils
.
genUUID
();
baseBpo2
.
addKV
(
"ID"
,
tripPositionID
);
baseBpo2
.
addKV
(
"TRIP_ID"
,
tripId
);
baseBpo2
.
addKV
(
"POD_USING_FACE"
,
needFace
);
baseBpo2
.
addKV
(
"POSITION_NO"
,
j
+
1
);
baseBpo2
.
addKV
(
"WAREHOUSE_ID"
,
CommonUtils
.
parseString
(
"WAREHOUSE_ID"
,
map
));
baseBpo2
.
addKV
(
"SECTION_ID"
,
CommonUtils
.
parseString
(
"SECTION_ID"
,
map
));
this
.
jdbcRepository
.
insertBusinessObject
(
baseBpo2
);
}
else
{
Map
data
=
tripPositions
.
get
(
0
);
tripPositionID
=
CommonUtils
.
parseString
(
"ID"
,
data
);
}
Map
newValue
=
new
HashMap
();
newValue
.
put
(
"STATE"
,
Sql_Table
.
AVAILABLE
);
//生成就结束了 是不是执行完看TRIPPOSITION_ID
newValue
.
put
(
"TRIPPOSITION_ID"
,
tripPositionID
);
newValue
.
put
(
"TRIPPOSITION_ID"
,
tripPositionID
);
CommonUtils
.
modifyUselessInfo
(
newValue
);
Map
con
=
new
HashMap
();
con
.
put
(
"ID"
,
CommonUtils
.
parseString
(
"ID"
,
podOrder
));
this
.
jdbcRepository
.
updateRecords
(
Sql_Table
.
WMS_INBOUND_PODORDER
,
newValue
,
con
);
}
}
}
public
Map
searchIcqa
(
Map
data
)
{
String
taskId
=
CommonUtils
.
parseString
(
"taskId"
,
data
);
StringBuilder
stringBuilder
=
new
StringBuilder
();
stringBuilder
.
append
(
Sql_Table
.
SQL_QUERY_ICQA
);
List
params
=
new
ArrayList
();
if
(!
CommonUtils
.
isEmpty
(
taskId
))
{
stringBuilder
.
append
(
" AND TASKID=? "
);
params
.
add
(
taskId
);
}
List
<
Map
>
rows
=
this
.
jdbcRepository
.
queryBySql
(
stringBuilder
.
toString
(),
params
);
data
.
put
(
"tasks"
,
rows
);
return
data
;
}
public
MessageDTO
startTasks
(
Map
data
)
{
MessageDTO
messageDTO
=
MessageDTO
.
success
();
//启动时 如果包含全库启动的 只能单起 不能混合
String
type
=
CommonUtils
.
parseString
(
"type"
,
data
);
String
stationName
=
CommonUtils
.
parseString
(
"stationName"
,
data
);
if
(!
this
.
inboundService
.
lockStowStation
(
stationName
))
{
messageDTO
.
setCODE
(
1
);
messageDTO
.
setMESSAGE
(
"工作站不存在 或 锁定工作站失败:"
+
stationName
);
return
messageDTO
;
}
if
(
Objects
.
equals
(
type
,
Sql_Table
.
ALL_TYPE
))
{
List
<
String
>
taskIds
=
(
List
)
data
.
get
(
"tasks"
);
if
(
taskIds
.
size
()
>
1
)
{
messageDTO
.
setCODE
(
1
);
messageDTO
.
setMESSAGE
(
"数据错误,全库盘点只能上传一条任务编号!"
);
return
messageDTO
;
}
//只取第一条
String
taskId
=
taskIds
.
get
(
0
);
List
<
Map
>
rows
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_ICQA_BY_ID
,
taskId
,
Sql_Table
.
AVAILABLE
);
if
(
rows
.
isEmpty
())
{
messageDTO
.
setCODE
(
1
);
messageDTO
.
setMESSAGE
(
"数据错误,没有找到这条状态为Available的记录! taskId:"
+
taskId
);
return
messageDTO
;
}
List
<
Map
>
pos
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_ICQAPOSITIONS
,
taskId
,
Sql_Table
.
AVAILABLE
);
//为每条记录生成盘点任务,分配到Pod 面 上
for
(
int
i
=
0
;
i
<
pos
.
size
();
i
++)
{
Map
icqaPosition
=
pos
.
get
(
i
);
MessageDTO
dto
=
this
.
genIcqaPodOrder
(
icqaPosition
,
taskId
,
stationName
);
if
(
dto
.
getCODE
()
==
1
){
return
dto
;
}
}
messageDTO
.
setMESSAGE
(
"全库盘点启动成功: taskId"
+
taskId
);
return
messageDTO
;
}
else
{
//多条明细记录盘点
List
<
String
>
taskIds
=
(
List
)
data
.
get
(
"tasks"
);
for
(
int
i
=
0
;
i
<
taskIds
.
size
();
i
++)
{
String
taskId
=
taskIds
.
get
(
i
);
//copy code
List
<
Map
>
rows
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_ICQA_BY_ID
,
taskId
,
Sql_Table
.
AVAILABLE
);
if
(
rows
.
isEmpty
())
{
messageDTO
.
setCODE
(
1
);
messageDTO
.
setMESSAGE
(
"数据错误,没有找到这条状态为Available的记录! taskId:"
+
taskId
);
return
messageDTO
;
}
List
<
Map
>
pos
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_ICQAPOSITIONS
,
taskId
,
Sql_Table
.
AVAILABLE
);
//为每条记录生成盘点任务,分配到Pod 面 上
for
(
int
j
=
0
;
j
<
pos
.
size
();
j
++)
{
Map
icqaPosition
=
pos
.
get
(
j
);
MessageDTO
dto
=
this
.
genIcqaPodOrder
(
icqaPosition
,
taskId
,
stationName
);
if
(
dto
.
getCODE
()
==
1
){
return
dto
;
}
}
messageDTO
.
setMESSAGE
(
"SKU盘点启动成功: taskIds:"
+
JsonUtils
.
list2Json
(
taskIds
));
return
messageDTO
;
}
}
return
messageDTO
;
}
private
MessageDTO
genIcqaPodOrder
(
Map
map
,
String
taskId
,
String
stationName
)
{
MessageDTO
dto
=
MessageDTO
.
success
();
String
skuId
=
CommonUtils
.
parseString
(
"SKUID"
,
map
);
StorageLocation
storageLocation
=
this
.
inboundService
.
findStorageLocation
(
skuId
);
if
(
storageLocation
==
null
)
{
logger
.
error
(
"SKU没有找到对应存储位,将随机分配空的存储位 SKU:"
+
skuId
);
dto
.
setCODE
(
1
);
dto
.
setMESSAGE
(
"无法为SKU分配库位! SKU:"
+
skuId
);
return
dto
;
}
/* CREATE TABLE `WMS_ICQA_PODORDER` (
`ID` VARCHAR(255) NOT NULL,
`TASKID` VARCHAR(255) NOT NULL,
`TASKPOSITIONID` VARCHAR(255) NOT NULL,
`SKUID` VARCHAR(255) NOT NULL,
`POD_ID` VARCHAR(255) NOT NULL,
`POD_FACE` VARCHAR(255) NOT NULL,
`STORAGENAME` VARCHAR(255) DEFAULT NULL,
`POD_LOCATE` VARCHAR(255) NOT NULL,
`WORKSTATION_ID` VARCHAR(255) DEFAULT NULL,
`PODINDEX` INT(11) DEFAULT NULL COMMENT '货架编号',
`STATE` VARCHAR(255) DEFAULT NULL COMMENT '状态',
`AMOUNT` INT(11) DEFAULT NULL COMMENT '数量',
`CREATED_DATE` TIMESTAMP NULL DEFAULT NULL,
`CREATED_BY` VARCHAR(255) DEFAULT NULL,
`MODIFIED_DATE` TIMESTAMP NULL DEFAULT NULL,
`MODIFIED_BY` VARCHAR(255) DEFAULT NULL,
`ADDITIONAL_CONTENT` VARCHAR(255) DEFAULT NULL,
`ENTITY_LOCK` INT(11) DEFAULT NULL,
`VERSION` INT(11) NOT NULL,
`WAREHOUSE_ID` VARCHAR(255) NOT NULL COMMENT 'FACTORY',
`SECTION_ID` VARCHAR(255) DEFAULT NULL COMMENT '物理区域SECTION',
`TRIPPOSITION_ID` VARCHAR(255) DEFAULT NULL,,*/
BaseBpo
baseBpo
=
new
BaseBpo
();
baseBpo
.
setTable
(
Sql_Table
.
WMS_INBOUND_PODORDER
);
baseBpo
.
addKV
(
"ID"
,
CommonUtils
.
genUUID
());
baseBpo
.
addKV
(
"TASKID"
,
taskId
);
baseBpo
.
addKV
(
"TASKPOSITIONID"
,
CommonUtils
.
parseString
(
"ID"
,
map
));
baseBpo
.
addKV
(
"POD_ID"
,
storageLocation
.
getPodId
());
baseBpo
.
addKV
(
"SKUID"
,
skuId
);
baseBpo
.
addKV
(
"POD_FACE"
,
storageLocation
.
getPodFace
());
baseBpo
.
addKV
(
"STORAGENAME"
,
storageLocation
.
getLocate
());
baseBpo
.
addKV
(
"POD_LOCATE"
,
storageLocation
.
getLocate
());
baseBpo
.
addKV
(
"WORKSTATION_ID"
,
stationName
);
baseBpo
.
addKV
(
"PODINDEX"
,
storageLocation
.
getPodIndex
());
baseBpo
.
addKV
(
"AMOUNT"
,
CommonUtils
.
parseString
(
"AMOUNT"
,
map
));
baseBpo
.
addKV
(
"STATE"
,
Sql_Table
.
NEW
);
baseBpo
.
addKV
(
"WAREHOUSE_ID"
,
CommonUtils
.
parseString
(
"WAREHOUSE_ID"
,
map
));
baseBpo
.
addKV
(
"SECTION_ID"
,
CommonUtils
.
parseString
(
"SECTION_ID"
,
map
));
//插入货架搬运任务 指令
this
.
jdbcRepository
.
insertBusinessObject
(
baseBpo
);
return
dto
;
}
public
MessageDTO
taskFinish
(
Map
data
)
{
String
taskId
=
CommonUtils
.
parseString
(
"taskId"
,
data
);
MessageDTO
messageDTO
=
MessageDTO
.
success
();
BaseBpo
baseBpo
=
new
BaseBpo
();
baseBpo
.
setIdName
(
"TASKID"
);
baseBpo
.
setTable
(
Sql_Table
.
WMS_ICQA_ORDER
);
baseBpo
.
setId
(
taskId
);
baseBpo
.
addKV
(
"STATE"
,
Sql_Table
.
FINISH
);
int
result
=
this
.
jdbcRepository
.
updateBusinessObject
(
baseBpo
);
if
(
result
==
0
)
{
messageDTO
.
setMESSAGE
(
"更新失败,没有更新记录!"
);
messageDTO
.
setCODE
(
1
);
}
return
messageDTO
;
}
public
Map
searchIcqaInfo
(
Map
data
)
{
String
taskId
=
CommonUtils
.
parseString
(
"taskId"
,
data
);
Map
ret
=
new
HashMap
();
List
<
Map
>
taskInfo
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_ICQAPOSITIONS
,
taskId
);
ret
.
put
(
"taskId"
,
taskId
);
ret
.
put
(
"content"
,
taskInfo
);
return
ret
;
}
/**
* 盘点检查确认
* @param skuId
* @param checked
* @param containerId
* @param factory
* @param section
* @param taskId
* @return
*/
public
MessageDTO
check
(
String
skuId
,
int
checked
,
String
containerId
,
String
factory
,
String
section
,
String
taskId
)
{
MessageDTO
messageDTO
=
MessageDTO
.
success
();
List
<
Map
>
invs
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_INV_UNITLOADID
,
containerId
);
if
(
invs
.
isEmpty
()){
messageDTO
.
setCODE
(
1
);
messageDTO
.
setMESSAGE
(
"没有找到该容器:"
+
containerId
);
return
messageDTO
;
}
List
<
Map
>
items
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERYITEM_BYSKUNO
,
skuId
);
if
(
items
.
isEmpty
()){
messageDTO
.
setCODE
(
1
);
messageDTO
.
setMESSAGE
(
"没有找到该商品信息:"
+
skuId
);
return
messageDTO
;
}
Map
item
=
items
.
get
(
0
);
String
mID
=
CommonUtils
.
parseString
(
"ID"
,
item
);
//货位信息
Map
data
=
invs
.
get
(
0
);
String
uid
=
CommonUtils
.
parseString
(
"ID"
,
data
);
//查询入库单的入库数量
Map
icqaOrderPosition
=
this
.
getIcqaOrderPosition
(
taskId
,
skuId
);
String
pId
=
CommonUtils
.
parseString
(
"ID"
,
icqaOrderPosition
);
//更新入库单状态
this
.
updateIcqaOrderStatus
(
pId
,
taskId
,
skuId
,
Sql_Table
.
FINISH
,
checked
);
return
messageDTO
;
}
private
void
updateIcqaOrderStatus
(
String
pId
,
String
taskId
,
String
skuId
,
String
finish
,
int
checked
)
{
MessageDTO
messageDTO
=
MessageDTO
.
success
();
Map
newValue
=
new
HashMap
();
newValue
.
put
(
"STATE"
,
finish
);
newValue
.
put
(
"COUNT"
,
checked
);
CommonUtils
.
modifyUselessInfo
(
newValue
);
Map
con
=
new
HashMap
();
con
.
put
(
"SKUID"
,
skuId
);
con
.
put
(
"ENTRYID"
,
taskId
);
//
int
count
=
this
.
jdbcRepository
.
updateRecords
(
Sql_Table
.
WMS_INBOUND_ORDERPOSITION
,
newValue
,
con
);
if
(
count
==
0
){
messageDTO
.
setMESSAGE
(
"更新失败,entryId:"
+
taskId
+
" skuId:"
+
skuId
);
messageDTO
.
setCODE
(
1
);
}
}
private
Map
getIcqaOrderPosition
(
String
taskId
,
String
skuId
)
{
List
<
Map
>
data
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_INBOUNDORDERPOSITION
,
taskId
,
skuId
);
if
(
data
.
isEmpty
()){
return
null
;
}
return
data
.
get
(
0
);
}
}
src/main/java/com/mushiny/heli/xnr/service/InboundService.java
View file @
83b056b6
...
...
@@ -20,13 +20,8 @@ import java.util.*;
@Service
@Transactional
public
class
InboundService
{
public
static
final
String
SQL_SEARCHINBOUND_FACTORY
=
" AND WAREHOUSE_ID=? "
;
public
static
final
String
SQL_SEARCHINBOUND_SECTION
=
" AND SECTION_ID=? "
;
public
static
final
String
SQL_SEARCHINBOUNDINFO
=
"SELECT SKUID,AMOUNT,IFNULL(STORED,0) AS STORED,STATE FROM WMS_INBOUND_ORDERPOSITION WHERE ENTRYID = ?"
;
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
InboundService
.
class
);
private
static
final
String
SQL_SEARCHINBOUND_ENTRYID
=
" AND ENTRYID like ? "
;
@Autowired
...
...
@@ -35,27 +30,22 @@ public class InboundService {
@Autowired
private
SystemPropertiesManager
systemPropertiesManager
;
public
static
final
String
SQL_SEARCHINBOUND
=
"SELECT ENTRYID,STATE,DATE_FORMAT(CREATED_DATE,'%Y-%m-%d %H:%i:%s') as CREATED_DATE"
+
",WAREHOUSE_ID FACTORY,SECTION_ID as SECTION "
+
"FROM WMS_INBOUND_ORDER WHERE 1=1 "
;
public
List
<
Map
>
searchInbound
(
String
entryId
,
String
warehouseId
,
String
sectionId
)
{
List
params
=
new
ArrayList
();
StringBuilder
sql
=
new
StringBuilder
();
sql
.
append
(
SQL_SEARCHINBOUND
);
sql
.
append
(
S
ql_Table
.
S
QL_SEARCHINBOUND
);
if
(!
CommonUtils
.
isEmpty
(
warehouseId
)){
sql
.
append
(
SQL_SEARCHINBOUND_ENTRYID
);
sql
.
append
(
S
ql_Table
.
S
QL_SEARCHINBOUND_ENTRYID
);
params
.
add
(
entryId
);
}
if
(!
CommonUtils
.
isEmpty
(
warehouseId
)){
sql
.
append
(
SQL_SEARCHINBOUND_FACTORY
);
sql
.
append
(
S
ql_Table
.
S
QL_SEARCHINBOUND_FACTORY
);
params
.
add
(
warehouseId
);
}
if
(!
CommonUtils
.
isEmpty
(
sectionId
)){
sql
.
append
(
SQL_SEARCHINBOUND_SECTION
);
sql
.
append
(
S
ql_Table
.
S
QL_SEARCHINBOUND_SECTION
);
params
.
add
(
warehouseId
);
}
...
...
@@ -65,7 +55,7 @@ public class InboundService {
public
List
<
Map
>
searchInboundInfo
(
String
entryId
)
{
List
params
=
new
ArrayList
();
StringBuilder
sql
=
new
StringBuilder
();
sql
.
append
(
SQL_SEARCHINBOUNDINFO
);
sql
.
append
(
S
ql_Table
.
S
QL_SEARCHINBOUNDINFO
);
params
.
add
(
entryId
);
List
<
Map
>
data
=
this
.
jdbcRepository
.
queryBySql
(
sql
.
toString
(),
params
);
return
data
;
...
...
@@ -87,12 +77,6 @@ public class InboundService {
return
messageDTO
;
}
public
static
final
String
SQL_INV_UNITLOADID
=
"SELECT INV_UNITLOAD.ID FROM INV_UNITLOAD,MD_STORAGELOCATION WHERE MD_STORAGELOCATION.NAME=? "
+
"AND MD_STORAGELOCATION.ID=INV_UNITLOAD.STORAGELOCATION_ID"
;
public
static
final
String
SQL_MD_ITEMDATA
=
"SELECT ID FROM MD_ITEMDATA WHERE SKUID=?"
;
/**
* 上架到货位
* @param skuId
...
...
@@ -106,7 +90,7 @@ public class InboundService {
public
MessageDTO
store
(
String
skuId
,
int
stored
,
String
containerId
,
String
factory
,
String
section
,
String
entryId
)
{
MessageDTO
messageDTO
=
MessageDTO
.
success
();
List
<
Map
>
invs
=
this
.
jdbcRepository
.
queryBySql
(
SQL_INV_UNITLOADID
,
containerId
);
List
<
Map
>
invs
=
this
.
jdbcRepository
.
queryBySql
(
S
ql_Table
.
S
QL_INV_UNITLOADID
,
containerId
);
if
(
invs
.
isEmpty
()){
messageDTO
.
setCODE
(
1
);
messageDTO
.
setMESSAGE
(
"没有找到该容器:"
+
containerId
);
...
...
@@ -225,12 +209,6 @@ public class InboundService {
}
public
static
final
String
STATION_ID
=
"6db9c7c0-4f93-4fa1-82c0-fb6435af7aae"
;
//NTYH01S1-S001-1
public
static
final
String
STOW_OPERATOR_ID
=
"stowPod_user"
;
//NTYH01S1-S001-1
public
static
final
String
ICQA_OPERATOR_ID
=
"icqaPod_user"
;
//NTYH01S1-S001-1
public
static
final
String
STATION_NAME_STOWPOD
=
"STOWPOD_STATION"
;
//NTYH01S1-S001-1
public
static
final
String
STATION_NAME_ICQAPOD
=
"ICQAPOD_STATION"
;
//NTYH01S1-S001-1
/**
* 批量生成上架任务
...
...
@@ -305,7 +283,6 @@ public class InboundService {
return
dto
;
}
public
static
final
String
WAREHOUSE
=
"456e94fe-127d-4861-9948-cc38760801b4"
;
/**
* 定时启动任务
*/
...
...
@@ -318,8 +295,9 @@ public class InboundService {
}
//TODO 根据工作站查找
String
pods
=
this
.
systemPropertiesManager
.
getProperty
(
"StowPodStationMaxPod"
,
WAREHOUSE
);
List
<
Map
>
runningPods
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_RUNNINGPODS
,
"StowPod"
,
Sql_Table
.
AVAILABLE
);
String
pods
=
this
.
systemPropertiesManager
.
getProperty
(
"StowPodStationMaxPod"
,
Sql_Table
.
WAREHOUSE
);
List
<
Map
>
runningPods
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_RUNNINGPODS
,
"StowPod"
,
Sql_Table
.
AVAILABLE
,
Sql_Table
.
PROCESS
);
Integer
limit
=
Integer
.
parseInt
(
pods
)
-
runningPods
.
size
();
//TODO 按工作站区分
//先找这么多货架 然后加载所有任务
List
<
Map
>
podIds
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_PODS
,
"StowPod"
,
Sql_Table
.
AVAILABLE
);
...
...
@@ -348,7 +326,7 @@ public class InboundService {
String
needFace
=
CommonUtils
.
parseString
(
"POD_FACE"
,
map
);
//int sameFaceIndex = index.get(needFace);
String
tripPositionID
;
List
<
Map
>
tripPositions
=
existTripPosition
(
workStation
,
podId
,
needFace
);
List
<
Map
>
tripPositions
=
existTripPosition
(
workStation
,
podId
,
needFace
,
"StowPod"
);
if
(
tripPositions
.
isEmpty
())
{
BaseBpo
baseBpo2
=
new
BaseBpo
();
baseBpo2
.
setTable
(
"RCS_TRIPPOSITION"
);
...
...
@@ -388,20 +366,14 @@ public class InboundService {
return
map
;
}
p
rivate
List
<
Map
>
existTripPosition
(
String
workStation
,
String
podId
,
String
needFac
e
)
{
p
ublic
List
<
Map
>
existTripPosition
(
String
workStation
,
String
podId
,
String
needFace
,
String
typ
e
)
{
List
<
Map
>
datas
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_TRIPPOSITION
,
needFace
,
workStation
,
podId
);
needFace
,
workStation
,
type
,
podId
);
return
datas
;
}
public
static
final
String
SQL_NEWSTORAGELOCATION
=
"SELECT MD_STORAGELOCATION.* FROM MD_STORAGELOCATION,INV_UNITLOAD \n"
+
"WHERE MD_STORAGELOCATION.ID=INV_UNITLOAD.STORAGELOCATION_ID \n"
+
"AND MD_STORAGELOCATION.POD_ID IS NOT NULL AND INV_UNITLOAD.ID NOT IN \n"
+
"(SELECT UNITLOAD_ID from \n"
+
"(SELECT sum(AMOUNT) as SUMALL,UNITLOAD_ID \n"
+
"FROM INV_STOCKUNIT group by UNITLOAD_ID )UNITLOAD WHERE UNITLOAD.SUMALL>0) limit 1"
;
private
StorageLocation
newStorageLocation
()
{
List
<
Map
>
list
=
this
.
jdbcRepository
.
queryBySql
(
SQL_NEWSTORAGELOCATION
);
List
<
Map
>
list
=
this
.
jdbcRepository
.
queryBySql
(
S
ql_Table
.
S
QL_NEWSTORAGELOCATION
);
if
(
list
.
isEmpty
()){
return
null
;
}
...
...
@@ -411,7 +383,7 @@ public class InboundService {
return
storageLocation
;
}
p
rivate
StorageLocation
findStorageLocation
(
String
skuId
)
{
p
ublic
StorageLocation
findStorageLocation
(
String
skuId
)
{
StorageLocation
storageLocation
=
new
StorageLocation
();
List
<
Map
>
data
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERYSTORAGELOCATION_BYSKU
,
skuId
);
if
(
data
.
isEmpty
()){
...
...
@@ -437,7 +409,7 @@ public class InboundService {
storageLocation
.
setpName
(
pName
);
}
p
rivate
synchronized
boolean
lockStowStation
(
String
stationId
)
{
p
ublic
synchronized
boolean
lockStowStation
(
String
stationId
)
{
List
<
Map
>
stations
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_WORKSTATION
,
stationId
);
if
(
stations
.
isEmpty
()){
...
...
@@ -466,8 +438,10 @@ public class InboundService {
}
Map
data
=
rows
.
get
(
0
);
String
operator_id
=
CommonUtils
.
parseString
(
"OPERATOR_ID"
,
data
);
String
station_name
=
CommonUtils
.
parseString
(
"STATION_NAME"
,
data
);
if
(!
CommonUtils
.
isEmpty
(
operator_id
)
&&
!
Objects
.
equals
(
operator_id
,
"LISI"
)){
&&
!
Objects
.
equals
(
operator_id
,
"LISI"
)
&&
!
Objects
.
equals
(
station_name
,
"StowPod"
)){
return
true
;
}
return
false
;
...
...
@@ -475,9 +449,29 @@ public class InboundService {
public
MessageDTO
endInbound
(
String
stationName
)
{
MessageDTO
messageDTO
=
MessageDTO
.
success
();
/*if(){
List
<
Map
>
stations
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_WORKSTATION
,
stationName
);
if
(
stations
.
isEmpty
()){
messageDTO
.
setMESSAGE
(
" 没有这个工作站: stationName:"
+
stationName
);
messageDTO
.
setCODE
(
1
);
return
messageDTO
;
}
Map
data
=
stations
.
get
(
0
);
Integer
version
=
CommonUtils
.
parseInteger
(
"VERSION"
,
data
);
Map
newValue
=
new
HashMap
();
newValue
.
put
(
"VERSION"
,
version
+
1
);
newValue
.
put
(
"ISCALLPOD"
,
Boolean
.
FALSE
);
newValue
.
put
(
"OPERATOR_ID"
,
""
);
newValue
.
put
(
"STATION_NAME"
,
""
);
Map
con
=
new
HashMap
();
con
.
put
(
"ID"
,
stationName
);
con
.
put
(
"VERSION"
,
version
);
}*/
int
count
=
this
.
jdbcRepository
.
updateRecords
(
Sql_Table
.
TABLE_MD_WORKSTATION
,
newValue
,
con
);
if
(
count
!=
1
){
messageDTO
.
setMESSAGE
(
"解锁工作站失败: stationName:"
+
stationName
);
messageDTO
.
setCODE
(
1
);
}
return
messageDTO
;
}
...
...
@@ -537,7 +531,7 @@ public class InboundService {
return
data
;
}
//ABCD 从上往下看
p
rivate
static
String
getFace
(
Integer
wsFace
,
Integer
pod_toward
)
{
p
ublic
static
String
getFace
(
Integer
wsFace
,
Integer
pod_toward
)
{
if
(
wsFace
%
90
!=
0
||
pod_toward
%
90
!=
0
){
return
"A"
;
//默认A面
}
...
...
src/main/java/com/mushiny/heli/xnr/service/OutboundService.java
View file @
83b056b6
...
...
@@ -24,7 +24,7 @@ public class OutboundService {
@Scheduled
(
fixedDelay
=
10
*
1000L
)
public
void
checkAndResponse
(){
List
<
Map
>
finishedObps
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_OBORDER
,
Sql_Table
.
FINISH
);
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_OBORDER
);
for
(
int
i
=
0
;
i
<
finishedObps
.
size
();
i
++)
{
Map
obs
=
finishedObps
.
get
(
i
);
Map
newValue
=
new
HashMap
();
...
...
src/main/java/com/mushiny/heli/xnr/service/Sql_Table.java
View file @
83b056b6
...
...
@@ -58,8 +58,12 @@ public interface Sql_Table {
" FROM WMS_INBOUND_PODORDER"
+
" WHERE POD_ID NOT IN (SELECT POD_ID FROM RCS_TRIP WHERE TRIP_TYPE=? AND TRIP_STATE=?) "
+
" LIMIT 10"
;
String
SQL_QUERY_ICQAPODS
=
"SELECT DISTINCT POD_ID,WORKSTATION_ID,WAREHOUSE_ID,SECTION_ID "
+
" FROM WMS_ICQA_PODORDER"
+
" WHERE POD_ID NOT IN (SELECT POD_ID FROM RCS_TRIP WHERE TRIP_TYPE=? AND TRIP_STATE=?) "
+
" LIMIT 10"
;
String
SQL_QUERY_RUNNINGPODS
=
"SELECT DISTINCT POD_ID "
+
"FROM RCS_TRIP WHERE TRIP_TYPE=? AND
TRIP_STATE=?
"
+
"FROM RCS_TRIP WHERE TRIP_TYPE=? AND
(TRIP_STATE=? OR TRIP_STATE=?)
"
+
" LIMIT 10"
;
String
SQL_QUERY_PODORDERS
=
"SELECT * FROM WMS_INBOUND_PODORDER WHERE POD_ID=? AND STATE=? "
;
String
TABLE_MD_WORKSTATION
=
"MD_WORKSTATION"
;
...
...
@@ -69,11 +73,16 @@ public interface Sql_Table {
String
WMS_OUTBOUND_ORDERPOSITION
=
"WMS_OUTBOUND_ORDERPOSITION"
;
String
SQL_QUERY_INBOUNDORDERPOSITION
=
"SELECT * FROM WMS_INBOUND_ORDERPOSITION "
+
"WHERE ENTRYID=? AND SKUID=?"
;
String
SQL_QUERY_INBOUNDORDERPOSITION_ICQA
=
"SELECT * FROM WMS_ICQA_ORDERPOSITION "
+
"WHERE TASKID=? AND SKUID=?"
;
String
SQL_QUERY_TRIPPOSITION
=
"SELECT RCS_TRIPPOSITION.ID FROM RCS_TRIP,RCS_TRIPPOSITION \n"
+
"WHERE RCS_TRIP.ID=RCS_TRIPPOSITION.TRIP_ID \n"
+
"AND RCS_TRIPPOSITION.TRIPPOSITION_STATE='Available'\n"
+
"AND RCS_TRIPPOSITION.POD_USING_FACE=?\n"
+
"AND RCS_TRIP.WORKSTATION_ID=? "
+
"AND RCS_TRIP.TRIP_TYPE=? "
+
"AND RCS_TRIP.POD_ID=? limit 1"
;
String
SQL_QUERY_CURRENTPOD
=
"SELECT MD_POD.ID, MD_POD.POD_INDEX, MD_POD.TOWARD, \n"
+
...
...
@@ -87,7 +96,14 @@ public interface Sql_Table {
" where WMS_INBOUND_PODORDER.ENTRYPOSITIONID = WMS_INBOUND_ORDERPOSITION.ID\n"
+
" and WMS_INBOUND_PODORDER.STATE = 'Available' \n"
+
" and WMS_INBOUND_PODORDER.POD_ID=? and WMS_INBOUND_PODORDER.POD_FACE=?\n"
+
" OrDER BY WMS_INBOUND_PODORDER.CREATED_DATE DESC limit 1"
;
" ORDER BY WMS_INBOUND_PODORDER.CREATED_DATE DESC limit 1"
;
String
SQL_QUERY_PODORDRTASK_ICQA
=
"select WMS_ICQA_PODORDER.* from WMS_ICQA_PODORDER, WMS_ICQA_ORDERPOSITION \n"
+
" where WMS_ICQA_PODORDER.TASKID = WMS_ICQA_ORDERPOSITION.ID\n"
+
" and WMS_ICQA_PODORDER.STATE = 'Available' \n"
+
" and WMS_ICQA_PODORDER.POD_ID=? and WMS_ICQA_PODORDER.POD_FACE=?\n"
+
" ORDER BY WMS_ICQA_PODORDER.CREATED_DATE DESC limit 1"
;
String
NEW
=
"New"
;
String
TABLE_OB_CUSTOMERSHIPMENT
=
"OB_CUSTOMERSHIPMENT"
;
String
TABLE_OB_CUSTOMERSHIPMENTPOSITION
=
"OB_CUSTOMERSHIPMENTPOSITION"
;
...
...
@@ -99,4 +115,35 @@ public interface Sql_Table {
"AND NOT EXISTS (SELECT 1 FROM WMS_OUTBOUND_ORDERPOSITION \n"
+
"WHERE WMS_OUTBOUND_ORDERPOSITION.ORDERID=WMS_OUTBOUND_ORDER.ORDERID \n"
+
"AND WMS_OUTBOUND_ORDERPOSITION.STATE<>'Finish')"
;
String
SQL_QUERY_ICQA
=
"SELECT * FROM WMS_ICQA_ORDER WHERE 1=1 "
;
String
ALL_TYPE
=
"all"
;
String
SKU_TYPE
=
"sku"
;
String
SQL_QUERY_ICQA_BY_ID
=
"SELECT * FROM WMS_ICQA_ORDER WHERE TASKID=? AND STATE=?"
;
String
SQL_QUERY_ICQAPOSITIONS
=
"SELECT * FROM WMS_ICQA_ORDERPOSITION WHERE TASKID=?"
;
String
SQL_SEARCHINBOUND_FACTORY
=
" AND WAREHOUSE_ID=? "
;
String
SQL_SEARCHINBOUND_SECTION
=
" AND SECTION_ID=? "
;
String
SQL_SEARCHINBOUNDINFO
=
"SELECT SKUID,AMOUNT,IFNULL(STORED,0) AS STORED,STATE FROM WMS_INBOUND_ORDERPOSITION WHERE ENTRYID = ?"
;
String
SQL_SEARCHINBOUND_ENTRYID
=
" AND ENTRYID like ? "
;
String
SQL_SEARCHINBOUND
=
"SELECT ENTRYID,STATE,DATE_FORMAT(CREATED_DATE,'%Y-%m-%d %H:%i:%s') as CREATED_DATE"
+
",WAREHOUSE_ID FACTORY,SECTION_ID as SECTION "
+
"FROM WMS_INBOUND_ORDER WHERE 1=1 "
;
String
SQL_INV_UNITLOADID
=
"SELECT INV_UNITLOAD.ID FROM INV_UNITLOAD,MD_STORAGELOCATION WHERE MD_STORAGELOCATION.NAME=? "
+
"AND MD_STORAGELOCATION.ID=INV_UNITLOAD.STORAGELOCATION_ID"
;
String
SQL_MD_ITEMDATA
=
"SELECT ID FROM MD_ITEMDATA WHERE SKUID=?"
;
String
STATION_ID
=
"6db9c7c0-4f93-4fa1-82c0-fb6435af7aae"
;
//NTYH01S1-S001-1
String
STOW_OPERATOR_ID
=
"stowPod_user"
;
//NTYH01S1-S001-1
String
ICQA_OPERATOR_ID
=
"icqaPod_user"
;
//NTYH01S1-S001-1
String
STATION_NAME_STOWPOD
=
"STOWPOD_STATION"
;
//NTYH01S1-S001-1
String
STATION_NAME_ICQAPOD
=
"ICQAPOD_STATION"
;
//NTYH01S1-S001-1
String
WAREHOUSE
=
"456e94fe-127d-4861-9948-cc38760801b4"
;
String
SQL_NEWSTORAGELOCATION
=
"SELECT MD_STORAGELOCATION.* FROM MD_STORAGELOCATION,INV_UNITLOAD \n"
+
"WHERE MD_STORAGELOCATION.ID=INV_UNITLOAD.STORAGELOCATION_ID \n"
+
"AND MD_STORAGELOCATION.POD_ID IS NOT NULL AND INV_UNITLOAD.ID NOT IN \n"
+
"(SELECT UNITLOAD_ID from \n"
+
"(SELECT sum(AMOUNT) as SUMALL,UNITLOAD_ID \n"
+
"FROM INV_STOCKUNIT group by UNITLOAD_ID )UNITLOAD WHERE UNITLOAD.SUMALL>0) limit 1"
;
}
src/main/java/com/mushiny/heli/xnr/service/WMSService.java
View file @
83b056b6
...
...
@@ -208,14 +208,14 @@ public class WMSService {
BaseBpo
order
=
new
BaseBpo
();
order
.
setTable
(
Sql_Table
.
WMS_ICQA_ORDER
);
String
orderId
=
CommonUtils
.
genUUID
();
order
.
addKV
(
"
ICQA
ID"
,
orderId
);
order
.
addKV
(
"
TASK
ID"
,
orderId
);
order
.
addKV
(
"CREATED_DATE"
,
new
Date
(
System
.
currentTimeMillis
()));
order
.
addKV
(
"FACTORY"
,
CommonUtils
.
parseString
(
"FACTORY"
,
data
));
order
.
addKV
(
"SECTION"
,
CommonUtils
.
parseString
(
"SECTION"
,
data
));
order
.
addKV
(
"SECTION"
,
CommonUtils
.
parseString
(
"SECTION"
,
data
));
if
(
CommonUtils
.
parseInteger
(
"ALL"
,
data
)==
1
){
//"type":"all"
if
(
Objects
.
equals
(
CommonUtils
.
parseString
(
"type"
,
data
),
Sql_Table
.
ALL_TYPE
)
){
order
.
addKV
(
"TYPE"
,
Sql_Table
.
ALL_TYPE
);
//检查是否有全盘在执行 如果没完成不能再生成
List
<
Map
>
rows
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_QUERY_ICQA_BY_TYPE
,
"Finish"
);
if
(
rows
!=
null
&&
rows
.
size
()>
0
){
...
...
@@ -239,6 +239,7 @@ public class WMSService {
}
else
{
//从 DATA选sku
order
.
addKV
(
"TYPE"
,
Sql_Table
.
SKU_TYPE
);
//两种类型
List
<
Map
>
skus
=
(
List
<
Map
>)
data
.
get
(
"DATA"
);
//查找所有存在盘点任务的SKU过滤
List
<
Map
>
allTaskingSKU
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
SQL_ALL_TASKING_SKU
,
"Finish"
);
...
...
@@ -285,4 +286,9 @@ public class WMSService {
}
return
set
;
}
//TODO
public
void
podRelease
(
Map
req
)
{
}
}
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