Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mes
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
ximai
mes
Commits
3614a628
Commit
3614a628
authored
Jun 09, 2026
by
chicheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工序报工支持修改、手动推送
工序报工接口添加(切换原来的工序转移单接口)
parent
acea36a3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
693 additions
and
74 deletions
+693
-74
FeedbackSapPushConst.java
...ain/java/com/ximai/mes/constant/FeedbackSapPushConst.java
+26
-0
ProFeedbackController.java
...a/com/ximai/mes/pro/controller/ProFeedbackController.java
+22
-3
ProFeedback.java
mes/src/main/java/com/ximai/mes/pro/domain/ProFeedback.java
+10
-0
ProFeedbackModifyRecord.java
...ava/com/ximai/mes/pro/domain/ProFeedbackModifyRecord.java
+43
-0
ProFeedbackVo.java
.../main/java/com/ximai/mes/pro/domain/vo/ProFeedbackVo.java
+10
-0
FeedbackSapPushResult.java
...ain/java/com/ximai/mes/pro/dto/FeedbackSapPushResult.java
+27
-0
FeedbackDto.java
...src/main/java/com/ximai/mes/pro/dto/task/FeedbackDto.java
+2
-0
ProFeedbackMapper.java
...main/java/com/ximai/mes/pro/mapper/ProFeedbackMapper.java
+2
-0
ProFeedbackModifyRecordMapper.java
...m/ximai/mes/pro/mapper/ProFeedbackModifyRecordMapper.java
+15
-0
IProFeedbackService.java
...n/java/com/ximai/mes/pro/service/IProFeedbackService.java
+22
-0
ProFeedbackServiceImpl.java
...om/ximai/mes/pro/service/impl/ProFeedbackServiceImpl.java
+226
-49
ProTaskAssistProcessServiceImpl.java
...ro/service/impl/task/ProTaskAssistProcessServiceImpl.java
+3
-1
ProTaskServiceImpl.java
...m/ximai/mes/pro/service/impl/task/ProTaskServiceImpl.java
+45
-21
IProTaskService.java
.../java/com/ximai/mes/pro/service/task/IProTaskService.java
+5
-0
ErpService.java
mes/src/main/java/com/ximai/mes/remote/ErpService.java
+5
-0
FinishStockInCreateDetail.java
...a/com/ximai/mes/remote/dto/FinishStockInCreateDetail.java
+12
-0
ProcessReportCreate.java
...in/java/com/ximai/mes/remote/dto/ProcessReportCreate.java
+62
-0
FinishStockInCreateProcess.java
.../ximai/mes/remote/process/FinishStockInCreateProcess.java
+3
-0
ProcessReportCreateProcess.java
.../ximai/mes/remote/process/ProcessReportCreateProcess.java
+62
-0
ErpMachineTimeConverter.java
...va/com/ximai/mes/remote/util/ErpMachineTimeConverter.java
+32
-0
ProFeedbackMapper.xml
mes/src/main/resources/mapper/pro/ProFeedbackMapper.xml
+24
-0
ProFeedbackModifyRecordMapper.xml
...in/resources/mapper/pro/ProFeedbackModifyRecordMapper.xml
+35
-0
No files found.
mes/src/main/java/com/ximai/mes/constant/FeedbackSapPushConst.java
0 → 100644
View file @
3614a628
package
com
.
ximai
.
mes
.
constant
;
/**
* 报工 SAP 推送状态
*/
public
final
class
FeedbackSapPushConst
{
/** 未推送 */
public
static
final
String
NOT_PUSHED
=
"0"
;
/** 已推送 */
public
static
final
String
PUSHED
=
"1"
;
/** 生产转移单(已废弃,保留兼容) */
public
static
final
String
TYPE_TRANSFER
=
"TRANSFER"
;
/** 工序报工单 */
public
static
final
String
TYPE_REPORT
=
"REPORT"
;
/** 生产入库 */
public
static
final
String
TYPE_STOCK_IN
=
"STOCK_IN"
;
private
FeedbackSapPushConst
()
{
}
public
static
boolean
isPushed
(
String
sapPushStatus
)
{
return
PUSHED
.
equals
(
sapPushStatus
);
}
}
mes/src/main/java/com/ximai/mes/pro/controller/ProFeedbackController.java
View file @
3614a628
...
...
@@ -103,7 +103,7 @@ public class ProFeedbackController extends BaseController {
query
.
eq
(
StringUtils
.
isNotEmpty
(
proFeedbackCheckListDto
.
getTaskBatch
()),
"SUBSTRING_INDEX(ta.task_batch, '-', -1)"
,
proFeedbackCheckListDto
.
getTaskBatch
());
query
.
between
(
proFeedbackCheckListDto
.
getFeedbackTimeStart
()
!=
null
&&
proFeedbackCheckListDto
.
getFeedbackTimeEnd
()
!=
null
,
"f.feedback_time"
,
proFeedbackCheckListDto
.
getFeedbackTimeStart
(),
proFeedbackCheckListDto
.
getFeedbackTimeEnd
());
query
.
orderBy
Asc
(
"f.feedback
_time"
);
query
.
orderBy
Desc
(
"f.create
_time"
);
startPage
();
List
<
ProFeedbackVo
>
list
=
proFeedbackService
.
queryProFeedbackListJoinTaskWorkUnit
(
query
);
List
<
ProFeedbackVo
>
proFeedbackVoList
=
new
ArrayList
<>();
...
...
@@ -166,7 +166,7 @@ public class ProFeedbackController extends BaseController {
query
.
eq
(
StringUtils
.
isNotEmpty
(
proFeedbackCheckListDto
.
getTaskBatch
()),
"SUBSTRING_INDEX(ta.task_batch, '-', -1)"
,
proFeedbackCheckListDto
.
getTaskBatch
());
query
.
between
(
proFeedbackCheckListDto
.
getFeedbackTimeStart
()
!=
null
&&
proFeedbackCheckListDto
.
getFeedbackTimeEnd
()
!=
null
,
"f.feedback_time"
,
proFeedbackCheckListDto
.
getFeedbackTimeStart
(),
proFeedbackCheckListDto
.
getFeedbackTimeEnd
());
query
.
orderBy
Asc
(
"f.feedback
_time"
);
query
.
orderBy
Desc
(
"f.create
_time"
);
List
<
ProFeedbackVo
>
list
=
proFeedbackService
.
queryProFeedbackListJoinTaskWorkUnit
(
query
);
List
<
ProFeedbackVo
>
proFeedbackVoList
=
new
ArrayList
<>();
if
(
proFeedback
.
getUserId
()
!=
null
)
{
...
...
@@ -216,7 +216,7 @@ public class ProFeedbackController extends BaseController {
query
.
between
(
StringUtils
.
isNotEmpty
(
proFeedback
.
getCreateStartTime
())
&&
StringUtils
.
isNotEmpty
(
proFeedback
.
getCreateEndTime
()),
"f.update_time"
,
proFeedback
.
getCreateStartTime
(),
proFeedback
.
getCreateEndTime
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proFeedback
.
getNickName
()),
"f.nick_name"
,
proFeedback
.
getNickName
());
query
.
notIn
(
"tw.status"
,
TaskWorkunitStatusEnum
.
CLOSE
.
getStatus
());
query
.
orderBy
Asc
(
"f.feedback
_time"
);
query
.
orderBy
Desc
(
"f.create
_time"
);
List
<
ProFeedbackVo
>
list
=
proFeedbackService
.
queryProFeedbackListJoinTaskWorkUnit
(
query
);
List
<
ProFeedbackVo
>
proFeedbackVoList
=
new
ArrayList
<>();
if
(
proFeedback
.
getUserId
()
!=
null
)
{
...
...
@@ -313,5 +313,24 @@ public class ProFeedbackController extends BaseController {
return
toAjax
(
proFeedbackService
.
syncSap
(
recordId
));
}
/**
* 批量推送 SAP:末道工序推生产入库,非末道工序推生产转移单
*/
@PreAuthorize
(
"@ss.hasPermi('mes:pro:feedback:edit')"
)
@Log
(
title
=
"生产报工推送SAP"
,
businessType
=
BusinessType
.
UPDATE
)
@PostMapping
(
"/syncSap"
)
public
AjaxResult
syncSapBatch
(
@RequestBody
Long
[]
recordIds
)
{
return
AjaxResult
.
success
(
proFeedbackService
.
syncSapBatch
(
recordIds
));
}
/**
* 报工修改记录
*/
@PreAuthorize
(
"@ss.hasPermi('mes:pro:feedback:query')"
)
@GetMapping
(
"/modifyRecord/{recordId}"
)
public
AjaxResult
listModifyRecord
(
@PathVariable
Long
recordId
)
{
return
AjaxResult
.
success
(
proFeedbackService
.
listModifyRecord
(
recordId
));
}
}
mes/src/main/java/com/ximai/mes/pro/domain/ProFeedback.java
View file @
3614a628
...
...
@@ -336,6 +336,16 @@ public class ProFeedback extends BaseEntity {
private
String
sapRequestParam
;
private
String
sapResponse
;
@ApiModelProperty
(
"SAP推送状态:0未推送 1已推送"
)
private
String
sapPushStatus
;
@ApiModelProperty
(
"SAP推送类型:TRANSFER转移单 STOCK_IN入库"
)
private
String
sapPushType
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
"SAP推送时间"
)
private
Date
sapPushTime
;
@ApiModelProperty
(
"异常原因ID"
)
private
Long
abnormalId
;
...
...
mes/src/main/java/com/ximai/mes/pro/domain/ProFeedbackModifyRecord.java
0 → 100644
View file @
3614a628
package
com
.
ximai
.
mes
.
pro
.
domain
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.ximai.common.core.domain.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 报工修改记录 pro_feedback_modify_record
*/
@Data
public
class
ProFeedbackModifyRecord
extends
BaseEntity
{
@TableId
private
Long
id
;
@ApiModelProperty
(
"报工记录ID"
)
private
Long
recordId
;
@ApiModelProperty
(
"报工单编号"
)
private
String
feedbackCode
;
@ApiModelProperty
(
"工单ID"
)
private
Long
workorderId
;
@ApiModelProperty
(
"工单编号"
)
private
String
workorderCode
;
@ApiModelProperty
(
"任务ID"
)
private
Long
taskId
;
@ApiModelProperty
(
"工序名称"
)
private
String
processName
;
@ApiModelProperty
(
"修改前后JSON"
)
private
String
requestBody
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
}
mes/src/main/java/com/ximai/mes/pro/domain/vo/ProFeedbackVo.java
View file @
3614a628
...
...
@@ -315,4 +315,14 @@ public class ProFeedbackVo {
@Excel
(
name
=
"销售序号"
)
private
String
orderSerial
;
@ApiModelProperty
(
"SAP推送状态:0未推送 1已推送"
)
private
String
sapPushStatus
;
@ApiModelProperty
(
"SAP推送类型"
)
private
String
sapPushType
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
"SAP推送时间"
)
private
Date
sapPushTime
;
}
mes/src/main/java/com/ximai/mes/pro/dto/FeedbackSapPushResult.java
0 → 100644
View file @
3614a628
package
com
.
ximai
.
mes
.
pro
.
dto
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 报工记录批量推送 SAP 结果
*/
@Data
public
class
FeedbackSapPushResult
{
private
int
successCount
;
private
int
failCount
;
private
List
<
String
>
messages
=
new
ArrayList
<>();
public
void
addSuccess
(
Long
recordId
,
String
pushType
)
{
successCount
++;
messages
.
add
(
String
.
format
(
"报工记录 %d 推送成功(%s)"
,
recordId
,
pushType
));
}
public
void
addFail
(
Long
recordId
,
String
reason
)
{
failCount
++;
messages
.
add
(
String
.
format
(
"报工记录 %d 推送失败:%s"
,
recordId
,
reason
));
}
}
mes/src/main/java/com/ximai/mes/pro/dto/task/FeedbackDto.java
View file @
3614a628
...
...
@@ -14,4 +14,6 @@ public class FeedbackDto {
ProTask
nextTask
;
ProTaskWorkunit
currTaskWorkunit
;
ProTaskWorkunit
nextTaskWorkunit
;
/** 报工表 machine_time(分钟) */
String
machineTime
;
}
mes/src/main/java/com/ximai/mes/pro/mapper/ProFeedbackMapper.java
View file @
3614a628
...
...
@@ -130,6 +130,8 @@ public interface ProFeedbackMapper {
void
updateLastFeedback
(
@Param
(
"qrcode"
)
String
qrcode
,
@Param
(
"taskId"
)
Long
taskId
);
int
markSapPushed
(
@Param
(
"recordId"
)
Long
recordId
,
@Param
(
"pushType"
)
String
pushType
,
@Param
(
"pushTime"
)
java
.
util
.
Date
pushTime
);
List
<
FeedbackResponse
>
getList
(
FeedbackRequest
feedbackRequest
);
List
<
FeedbackResponse
>
getListByWorkOrder
(
FeedbackRequest
feedbackRequest
);
...
...
mes/src/main/java/com/ximai/mes/pro/mapper/ProFeedbackModifyRecordMapper.java
0 → 100644
View file @
3614a628
package
com
.
ximai
.
mes
.
pro
.
mapper
;
import
com.ximai.mes.pro.domain.ProFeedbackModifyRecord
;
import
java.util.List
;
/**
* 报工修改记录 Mapper
*/
public
interface
ProFeedbackModifyRecordMapper
{
int
insertProFeedbackModifyRecord
(
ProFeedbackModifyRecord
record
);
List
<
ProFeedbackModifyRecord
>
selectByRecordId
(
Long
recordId
);
}
mes/src/main/java/com/ximai/mes/pro/service/IProFeedbackService.java
View file @
3614a628
...
...
@@ -2,6 +2,7 @@ package com.ximai.mes.pro.service;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.ximai.mes.pro.domain.ProFeedback
;
import
com.ximai.mes.pro.domain.ProFeedbackModifyRecord
;
import
com.ximai.mes.pro.domain.task.ProTask
;
import
com.ximai.mes.pro.domain.task.ProTaskAssistProcess
;
import
com.ximai.mes.pro.domain.vo.ProFeedbackSplitInfo
;
...
...
@@ -9,8 +10,10 @@ import com.ximai.mes.pro.domain.vo.ProFeedbackVo;
import
com.ximai.mes.pro.domain.vo.ProPackagePrintResult
;
import
com.ximai.mes.pro.domain.vo.feedbackTaskVo
;
import
com.ximai.mes.pro.domain.vo.task.FeedbackValidateSerialNoParams
;
import
com.ximai.mes.pro.dto.FeedbackSapPushResult
;
import
com.ximai.mes.pro.dto.ProFeedbackDto
;
import
java.math.BigDecimal
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
...
...
@@ -105,6 +108,13 @@ public interface IProFeedbackService {
*/
Double
selectQuantityQualifySum
(
ProFeedback
proFeedback
);
/**
* 非首工序:本工序良品报工合计(含本次变更)不得超过上工序良品报工合计
*
* @param excludeQualify 修改场景排除原记录良品数,新增传 null
*/
void
validateQualifyNotExceedPreviousProcess
(
Long
taskId
,
Long
workorderId
,
BigDecimal
excludeQualify
,
BigDecimal
newQualify
);
LinkedHashMap
<
String
,
ProFeedbackSplitInfo
>
taskFeedback
(
ProTask
proTask
,
ProFeedback
mainFeedBack
);
...
...
@@ -112,6 +122,18 @@ public interface IProFeedbackService {
int
syncSap
(
Long
recordId
);
FeedbackSapPushResult
syncSapBatch
(
Long
[]
recordIds
);
/**
* 自动推送成功后标记 SAP 已推送(受 ERP 开关控制)
*/
void
markSapPushedAfterAuto
(
Long
recordId
,
String
erpSwitchKey
,
String
pushType
);
/**
* 查询报工修改记录
*/
List
<
ProFeedbackModifyRecord
>
listModifyRecord
(
Long
recordId
);
int
insertObj
(
ProFeedback
proFeedback
);
List
<
feedbackTaskVo
>
selectProFeedbackreport
(
feedbackTaskVo
feedbackTaskVo
);
...
...
mes/src/main/java/com/ximai/mes/pro/service/impl/ProFeedbackServiceImpl.java
View file @
3614a628
This diff is collapsed.
Click to expand it.
mes/src/main/java/com/ximai/mes/pro/service/impl/task/ProTaskAssistProcessServiceImpl.java
View file @
3614a628
...
...
@@ -343,10 +343,12 @@ public class ProTaskAssistProcessServiceImpl implements IProTaskAssistProcessSer
proTaskService
.
updateProTask
(
task
);
proTaskWorkunitService
.
updateProTaskWorkunit
(
taskWorkunit
);
// 末道工序:与普通报工 doFeedBack 一致,回写工单并触发 ERP 完工入库(reportUpdateProWorkorder)
// 末道工序:与普通报工 doFeedBack 一致,回写工单并触发 ERP 完工入库(reportUpdateProWorkorder
,开关 erp.finish.stockin.create.enable
)
if
(
nextTask
==
null
&&
quantityQualify
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
if
(
workorder
!=
null
)
{
proWorkorderService
.
reportUpdateProWorkorder
(
workorder
,
quantityQualify
,
quantityUnQualify
);
proFeedbackService
.
markSapPushedAfterAuto
(
feedback
.
getRecordId
(),
"erp.finish.stockin.create.enable"
,
com
.
ximai
.
mes
.
constant
.
FeedbackSapPushConst
.
TYPE_STOCK_IN
);
}
tryFinishWorkorderOnLastProcessComplete
(
task
);
}
...
...
mes/src/main/java/com/ximai/mes/pro/service/impl/task/ProTaskServiceImpl.java
View file @
3614a628
...
...
@@ -56,7 +56,7 @@ import com.ximai.mes.pro.service.proWorkOrder.IProWorkorderService;
import
com.ximai.mes.pro.service.task.IProTaskService
;
import
com.ximai.mes.pro.service.task.IProTaskWorkunitService
;
import
com.ximai.mes.qc.service.IQcIpqcService
;
import
com.ximai.mes.remote.process.Process
Transfer
CreateProcess
;
import
com.ximai.mes.remote.process.Process
Report
CreateProcess
;
import
com.ximai.mes.tm.domain.vo.TmToolRequestItemVo
;
import
com.ximai.mes.tm.service.ITmToolMachinesService
;
import
com.ximai.mes.tm.service.ITmToolRequestService
;
...
...
@@ -866,22 +866,18 @@ public class ProTaskServiceImpl implements IProTaskService, ApplicationContextAw
queryWrapper
.
eq
(
"t1.workorder_code"
,
task
.
getArrangeCode
());
queryWrapper
.
notIn
(
"t1.status"
,
Arrays
.
asList
(
WorkorderStatusEnum
.
CLOSE
.
getValue
(),
WorkorderStatusEnum
.
CANCEL
.
getValue
(),
WorkorderStatusEnum
.
CANCELED
.
getValue
()));
List
<
ProWorkorder
>
proWorkorders
=
proWorkorderService
.
selectListByQw
(
queryWrapper
);
//检查该工单绑定的生产版本是否允许超报,PS只有首工序允许
if
(
taskQuantityWaitConst
.
compareTo
(
feedbackQualifyConst
.
add
(
fuantityUnqualify
))
<
0
){
if
(
task
.
getOrdinal
()
==
1
){
if
(
proWorkorders
.
size
()
>
0
&&
proWorkorders
.
get
(
0
).
getProductionSolutionId
()
!=
null
){
ProProductionSolution
proProductionSolution
=
proProductionSolutionMapper
.
selectProProductionSolutionByProductionSolutionId
(
proWorkorders
.
get
(
0
).
getProductionSolutionId
());
if
(
proProductionSolution
!=
null
&&
proProductionSolution
.
getSurpassState
()
!=
null
){
if
(!
proProductionSolution
.
getSurpassState
()){
//不允许超报 可报工数目 - (合格数 + 不合格数)不能小于 0
ExceptionUtil
.
checkTrueThrowException
(
taskQuantityWaitConst
.
compareTo
(
feedbackQualifyConst
.
add
(
fuantityUnqualify
))
<
0
,
"工单关联的生产版本不允许超报行为"
);
}
if
(
task
.
getOrdinal
()
!=
null
&&
task
.
getOrdinal
()
!=
1
)
{
proFeedbackService
.
validateQualifyNotExceedPreviousProcess
(
task
.
getTaskId
(),
feedback
.
getWorkorderId
(),
null
,
feedbackQualifyConst
);
}
else
if
(
taskQuantityWaitConst
.
compareTo
(
feedbackQualifyConst
.
add
(
fuantityUnqualify
))
<
0
)
{
if
(
proWorkorders
.
size
()
>
0
&&
proWorkorders
.
get
(
0
).
getProductionSolutionId
()
!=
null
)
{
ProProductionSolution
proProductionSolution
=
proProductionSolutionMapper
.
selectProProductionSolutionByProductionSolutionId
(
proWorkorders
.
get
(
0
).
getProductionSolutionId
());
if
(
proProductionSolution
!=
null
&&
proProductionSolution
.
getSurpassState
()
!=
null
)
{
if
(!
proProductionSolution
.
getSurpassState
())
{
ExceptionUtil
.
checkTrueThrowException
(
taskQuantityWaitConst
.
compareTo
(
feedbackQualifyConst
.
add
(
fuantityUnqualify
))
<
0
,
"工单关联的生产版本不允许超报行为"
);
}
}
}
else
{
ExceptionUtil
.
checkTrueThrowException
(
true
,
"非首工序不允许超过可报工数报工"
);
}
}
...
...
@@ -945,20 +941,31 @@ public class ProTaskServiceImpl implements IProTaskService, ApplicationContextAw
if
(
StringUtils
.
isEmpty
(
nextTask
))
{
feedbackWorkorder
.
forEach
((
k
,
v
)
->
{
proWorkorderService
.
reportUpdateProWorkorder
(
v
.
getWorkorder
(),
v
.
getQuantityQualify
(),
v
.
getQuantityUnqualify
());
v
.
getFeedbackList
().
forEach
(
f
->
proFeedbackService
.
markSapPushedAfterAuto
(
f
.
getRecordId
(),
"erp.finish.stockin.create.enable"
,
com
.
ximai
.
mes
.
constant
.
FeedbackSapPushConst
.
TYPE_STOCK_IN
));
});
}
}
proTaskWorkunitService
.
updateProTaskWorkunit
(
taskWorkunit
);
feedbackWorkorder
.
forEach
((
k
,
v
)
->
{
FeedbackDto
feedbackDto
=
FeedbackDto
.
builder
().
workorder
(
v
.
getWorkorder
()).
currTask
(
task
).
currTaskWorkunit
(
taskWorkunit
)
.
nextTask
(
nextTask
).
nextTaskWorkunit
(
nextTaskWorkunit
.
get
()).
build
();
applicationContext
.
getBean
(
ProTaskServiceImpl
.
class
).
feedbackToErp
(
feedbackDto
,
v
.
getQuantityQualify
(),
v
.
getQuantityUnqualify
());
});
if
(
nextTask
!=
null
)
{
feedbackWorkorder
.
forEach
((
k
,
v
)
->
{
String
machineTimeMinutes
=
v
.
getFeedbackList
().
stream
()
.
map
(
f
->
DataUtil
.
getNormalData
(
f
.
getMachineTime
(),
BigDecimal
.
class
))
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
)
.
stripTrailingZeros
()
.
toPlainString
();
FeedbackDto
feedbackDto
=
FeedbackDto
.
builder
().
workorder
(
v
.
getWorkorder
()).
currTask
(
task
).
currTaskWorkunit
(
taskWorkunit
)
.
nextTask
(
nextTask
).
nextTaskWorkunit
(
nextTaskWorkunit
.
get
()).
machineTime
(
machineTimeMinutes
).
build
();
applicationContext
.
getBean
(
ProTaskServiceImpl
.
class
).
feedbackToErp
(
feedbackDto
,
v
.
getQuantityQualify
(),
v
.
getQuantityUnqualify
());
v
.
getFeedbackList
().
forEach
(
f
->
proFeedbackService
.
markSapPushedAfterAuto
(
f
.
getRecordId
(),
"erp.process.report.create.enable"
,
com
.
ximai
.
mes
.
constant
.
FeedbackSapPushConst
.
TYPE_REPORT
));
});
}
return
response
;
}
@MethodExtendedProcesses
(
config
={
@MethodExtendedProcess
(
sysSwitchParam
=
"erp.process.
finish.create.enable"
,
processClz
=
ProcessTransfer
CreateProcess
.
class
,
@MethodExtendedProcess
(
sysSwitchParam
=
"erp.process.
report.create.enable"
,
processClz
=
ProcessReport
CreateProcess
.
class
,
newThread
=
true
,
errorCatch
=
true
)
})
@Override
...
...
@@ -1394,6 +1401,23 @@ public class ProTaskServiceImpl implements IProTaskService, ApplicationContextAw
return
tasks
.
get
(
0
);
}
@Override
public
ProTask
getPreviousTaskByTaskId
(
Long
taskId
)
{
ProTask
thisProTask
=
this
.
selectProTaskByTaskId
(
taskId
);
if
(
thisProTask
==
null
||
thisProTask
.
getOrdinal
()
==
null
||
thisProTask
.
getOrdinal
()
<=
1
)
{
return
null
;
}
QueryWrapper
<
ProTask
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"task_batch"
,
thisProTask
.
getTaskBatch
());
queryWrapper
.
lt
(
"ordinal"
,
thisProTask
.
getOrdinal
());
queryWrapper
.
orderByDesc
(
"ordinal"
);
List
<
ProTask
>
tasks
=
proTaskMapper
.
selectListByQw
(
queryWrapper
);
if
(
tasks
.
isEmpty
())
{
return
null
;
}
return
tasks
.
get
(
0
);
}
@Override
public
List
<
ProTask
>
selectListByQw
(
QueryWrapper
<
ProTask
>
proTaskQueryWrapper
)
{
return
proTaskMapper
.
selectListJoinByQw
(
proTaskQueryWrapper
);
...
...
mes/src/main/java/com/ximai/mes/pro/service/task/IProTaskService.java
View file @
3614a628
...
...
@@ -188,6 +188,11 @@ public interface IProTaskService {
ProTask
getNextTaskByTaskId
(
Long
taskId
);
/**
* 获取上一道工序任务(同排产批次)
*/
ProTask
getPreviousTaskByTaskId
(
Long
taskId
);
ProTask
selectBaseById
(
Long
taskId
);
List
<
ProTask
>
getTaskList
(
ProTaskQuery
proTask
);
...
...
mes/src/main/java/com/ximai/mes/remote/ErpService.java
View file @
3614a628
...
...
@@ -79,4 +79,9 @@ public interface ErpService {
@PostMapping
(
value
=
"/sfctb/processTransfer"
)
ErpResponseResult
<
Object
>
processTransfer
(
ProcessTransferCreate
create
);
@ApiLog
(
businessType
=
BusinessType
.
UPDATE
,
inOutType
=
InOutType
.
OUT
)
@ApiOperation
(
value
=
"ERP工序报工"
)
@PostMapping
(
value
=
"/sfctd/processReport"
)
ErpResponseResult
<
Object
>
processReportCreate
(
ProcessReportCreate
create
);
}
mes/src/main/java/com/ximai/mes/remote/dto/FinishStockInCreateDetail.java
View file @
3614a628
...
...
@@ -34,6 +34,18 @@ public class FinishStockInCreateDetail
@JsonProperty
(
"tg013"
)
private
BigDecimal
checkQuantity
;
@ApiModelProperty
(
"报废数量"
)
@JsonProperty
(
"tg012"
)
private
BigDecimal
scrapQuantity
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"验退数量"
)
@JsonProperty
(
"tg023"
)
private
BigDecimal
returnQuantity
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"破坏数量"
)
@JsonProperty
(
"tg032"
)
private
BigDecimal
destroyQuantity
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"批号"
)
@JsonProperty
(
"tg017"
)
private
String
batchNo
;
...
...
mes/src/main/java/com/ximai/mes/remote/dto/ProcessReportCreate.java
0 → 100644
View file @
3614a628
package
com
.
ximai
.
mes
.
remote
.
dto
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
* 工序报工单创建
*/
@Data
public
class
ProcessReportCreate
{
@ApiModelProperty
(
"报工单单别"
)
@JsonProperty
(
"td001"
)
private
String
reportType
=
"D30"
;
@ApiModelProperty
(
"工单单别"
)
@JsonProperty
(
"te006"
)
private
String
workOrderType
;
@ApiModelProperty
(
"工单单号"
)
@JsonProperty
(
"te007"
)
private
String
workOrderNo
;
@ApiModelProperty
(
"工序(加工顺序)"
)
@JsonProperty
(
"te008"
)
private
String
processSeq
;
@ApiModelProperty
(
"工序号"
)
@JsonProperty
(
"te009"
)
private
String
processRef
;
@ApiModelProperty
(
"类型(1:正常完成 2:返工完成 3:报废)"
)
@JsonProperty
(
"te010"
)
private
String
type
=
"1"
;
@ApiModelProperty
(
"报工数量(合格)"
)
@JsonProperty
(
"te011"
)
private
BigDecimal
reportQty
;
@ApiModelProperty
(
"不合格数量(固定0,不推送MES不合格数)"
)
@JsonProperty
(
"unQualifyQty"
)
private
BigDecimal
unQualifyQty
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"使用机时(秒)"
)
@JsonProperty
(
"te013"
)
private
Integer
machineHours
;
@ApiModelProperty
(
"员工编号"
)
@JsonProperty
(
"te004"
)
private
String
employeeNo
;
@ApiModelProperty
(
"机器编号"
)
@JsonProperty
(
"te005"
)
private
String
machineNo
;
@ApiModelProperty
(
"工序名称/备注"
)
@JsonProperty
(
"te015"
)
private
String
processName
;
}
mes/src/main/java/com/ximai/mes/remote/process/FinishStockInCreateProcess.java
View file @
3614a628
...
...
@@ -44,6 +44,9 @@ public class FinishStockInCreateProcess implements IExtendedProcess {
detail
.
setWorkorderCode
(
workorder
.
getWorkorderCode
());
detail
.
setCheckQuantity
(
qualifyQuantity
);
detail
.
setInQuantity
(
qualifyQuantity
);
detail
.
setScrapQuantity
(
BigDecimal
.
ZERO
);
detail
.
setReturnQuantity
(
BigDecimal
.
ZERO
);
detail
.
setDestroyQuantity
(
BigDecimal
.
ZERO
);
detail
.
setBatchNo
(
LocalDateTime
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyyMMdd"
)));
details
.
add
(
detail
);
create
.
setDetails
(
details
);
...
...
mes/src/main/java/com/ximai/mes/remote/process/ProcessReportCreateProcess.java
0 → 100644
View file @
3614a628
package
com
.
ximai
.
mes
.
remote
.
process
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.ximai.mes.aspect.IExtendedProcess
;
import
com.ximai.mes.pro.domain.proWorkOrder.ProWorkOrderProcess
;
import
com.ximai.mes.pro.domain.task.ProTask
;
import
com.ximai.mes.pro.dto.task.FeedbackDto
;
import
com.ximai.mes.pro.service.proWorkOrder.IProWorkOrderProcessService
;
import
com.ximai.mes.remote.ErpService
;
import
com.ximai.mes.remote.dto.ProcessReportCreate
;
import
com.ximai.mes.remote.util.ErpMachineTimeConverter
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.util.List
;
@ApiOperation
(
"工序报工"
)
@Component
public
class
ProcessReportCreateProcess
implements
IExtendedProcess
{
@Autowired
ErpService
erpService
;
@Autowired
IProWorkOrderProcessService
workOrderProcessService
;
@Override
public
void
process
(
Object
[]
args
,
Object
returnResult
)
{
FeedbackDto
feedbackDto
=
(
FeedbackDto
)
args
[
0
];
BigDecimal
qualifyQuantity
=
(
BigDecimal
)
args
[
1
];
ProTask
currTask
=
feedbackDto
.
getCurrTask
();
ProcessReportCreate
create
=
new
ProcessReportCreate
();
create
.
setWorkOrderType
(
feedbackDto
.
getWorkorder
().
getWorkorderType
());
create
.
setWorkOrderNo
(
feedbackDto
.
getWorkorder
().
getWorkorderCode
());
create
.
setProcessSeq
(
currTask
.
getIdx
());
create
.
setProcessName
(
currTask
.
getProcessName
());
create
.
setReportQty
(
qualifyQuantity
);
create
.
setUnQualifyQty
(
BigDecimal
.
ZERO
);
create
.
setType
(
"1"
);
create
.
setMachineHours
(
ErpMachineTimeConverter
.
toMachineSeconds
(
feedbackDto
.
getMachineTime
()));
List
<
ProWorkOrderProcess
>
workorderProcessList
=
workOrderProcessService
.
selectListByQw
(
new
QueryWrapper
<
ProWorkOrderProcess
>()
.
eq
(
"t1.workorder_id"
,
feedbackDto
.
getWorkorder
().
getWorkorderId
())
.
eq
(
"t1.process_id"
,
currTask
.
getProcessId
()));
String
processNo
=
currTask
.
getProcessCode
();
if
(!
workorderProcessList
.
isEmpty
())
{
ProWorkOrderProcess
workOrderProcess
=
workorderProcessList
.
get
(
0
);
if
(
StringUtils
.
isBlank
(
processNo
))
{
processNo
=
workOrderProcess
.
getProcessRef
();
}
}
if
(
StringUtils
.
isBlank
(
processNo
))
{
processNo
=
currTask
.
getIdx
();
}
create
.
setProcessRef
(
StringUtils
.
left
(
processNo
,
4
));
erpService
.
processReportCreate
(
create
);
}
}
mes/src/main/java/com/ximai/mes/remote/util/ErpMachineTimeConverter.java
0 → 100644
View file @
3614a628
package
com
.
ximai
.
mes
.
remote
.
util
;
import
org.apache.commons.lang3.StringUtils
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
/**
* 报工 machine_time 转 ERP 机时(秒)
* <p>
* pro_feedback.machine_time 在自动报工时由开工记录秒数 / 60 写入,单位为<strong>分钟</strong>;
* SFCTE.TE013 单位为秒。
*/
public
final
class
ErpMachineTimeConverter
{
private
ErpMachineTimeConverter
()
{
}
public
static
int
toMachineSeconds
(
String
machineTimeMinutes
)
{
if
(
StringUtils
.
isBlank
(
machineTimeMinutes
))
{
return
0
;
}
try
{
return
new
BigDecimal
(
machineTimeMinutes
.
trim
())
.
multiply
(
BigDecimal
.
valueOf
(
60
))
.
setScale
(
0
,
RoundingMode
.
HALF_UP
)
.
intValue
();
}
catch
(
NumberFormatException
e
)
{
return
0
;
}
}
}
mes/src/main/resources/mapper/pro/ProFeedbackMapper.xml
View file @
3614a628
...
...
@@ -16,6 +16,9 @@
<result
property=
"sapFeedbackItemCode"
column=
"sap_feedback_item_code"
/>
<result
property=
"sapRequestParam"
column=
"sap_request_param"
/>
<result
property=
"sapResponse"
column=
"sap_response"
/>
<result
property=
"sapPushStatus"
column=
"sap_push_status"
/>
<result
property=
"sapPushType"
column=
"sap_push_type"
/>
<result
property=
"sapPushTime"
column=
"sap_push_time"
/>
<result
property=
"workorderId"
column=
"workorder_id"
/>
<result
property=
"workorderCode"
column=
"workorder_code"
/>
<result
property=
"workorderName"
column=
"workorder_name"
/>
...
...
@@ -68,6 +71,9 @@
f.workstation_name,
f.sap_request_param,
f.sap_response,
f.sap_push_status,
f.sap_push_type,
f.sap_push_time,
f.sap_feedback_code,
f.sap_feedback_item_code,
f.machine_time,
...
...
@@ -1046,6 +1052,9 @@
<if
test=
"sapFeedbackItemCode != null"
>
sap_feedback_item_code,
</if>
<if
test=
"sapRequestParam != null"
>
sap_request_param,
</if>
<if
test=
"sapResponse != null"
>
sap_response,
</if>
<if
test=
"sapPushStatus != null"
>
sap_push_status,
</if>
<if
test=
"sapPushType != null"
>
sap_push_type,
</if>
<if
test=
"sapPushTime != null"
>
sap_push_time,
</if>
<if
test=
"processId != null"
>
process_id,
</if>
<if
test=
"processCode != null"
>
process_code,
</if>
<if
test=
"processName != null"
>
process_name,
</if>
...
...
@@ -1105,6 +1114,9 @@
<if
test=
"sapFeedbackItemCode != null"
>
#{sapFeedbackItemCode},
</if>
<if
test=
"sapRequestParam != null"
>
#{sapRequestParam},
</if>
<if
test=
"sapResponse != null"
>
#{sapResponse},
</if>
<if
test=
"sapPushStatus != null"
>
#{sapPushStatus},
</if>
<if
test=
"sapPushType != null"
>
#{sapPushType},
</if>
<if
test=
"sapPushTime != null"
>
#{sapPushTime},
</if>
<if
test=
"processId != null"
>
#{processId},
</if>
<if
test=
"processCode != null"
>
#{processCode},
</if>
<if
test=
"processName != null"
>
#{processName},
</if>
...
...
@@ -1168,6 +1180,9 @@
<if
test=
"sapFeedbackItemCode != null"
>
sap_feedback_item_code = #{sapFeedbackItemCode},
</if>
<if
test=
"sapRequestParam != null"
>
sap_request_param = #{sapRequestParam},
</if>
<if
test=
"sapResponse != null"
>
sap_response = #{sapResponse},
</if>
<if
test=
"sapPushStatus != null"
>
sap_push_status = #{sapPushStatus},
</if>
<if
test=
"sapPushType != null"
>
sap_push_type = #{sapPushType},
</if>
<if
test=
"sapPushTime != null"
>
sap_push_time = #{sapPushTime},
</if>
<if
test=
"processId != null"
>
process_id = #{processId},
</if>
<if
test=
"processCode != null"
>
process_code = #{processCode},
</if>
<if
test=
"processName != null"
>
process_name = #{processName},
</if>
...
...
@@ -1223,6 +1238,15 @@
<update
id=
"updateLastFeedback"
>
update pro_feedback set last_feedback = false where qrcode = #{qrcode} and task_id = #{taskId}
</update>
<update
id=
"markSapPushed"
>
update pro_feedback
set sap_push_status = '1',
sap_push_type = #{pushType},
sap_push_time = #{pushTime},
update_time = #{pushTime}
where record_id = #{recordId}
and (sap_push_status is null or sap_push_status = '0')
</update>
<delete
id=
"deleteProFeedbackByRecordId"
parameterType=
"Long"
>
delete
...
...
mes/src/main/resources/mapper/pro/ProFeedbackModifyRecordMapper.xml
0 → 100644
View file @
3614a628
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ximai.mes.pro.mapper.ProFeedbackModifyRecordMapper"
>
<resultMap
type=
"com.ximai.mes.pro.domain.ProFeedbackModifyRecord"
id=
"ProFeedbackModifyRecordResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"recordId"
column=
"record_id"
/>
<result
property=
"feedbackCode"
column=
"feedback_code"
/>
<result
property=
"workorderId"
column=
"workorder_id"
/>
<result
property=
"workorderCode"
column=
"workorder_code"
/>
<result
property=
"taskId"
column=
"task_id"
/>
<result
property=
"processName"
column=
"process_name"
/>
<result
property=
"requestBody"
column=
"request_body"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"remark"
column=
"remark"
/>
</resultMap>
<insert
id=
"insertProFeedbackModifyRecord"
parameterType=
"com.ximai.mes.pro.domain.ProFeedbackModifyRecord"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into pro_feedback_modify_record
(record_id, feedback_code, workorder_id, workorder_code, task_id, process_name, request_body, create_by, create_time, remark)
values
(#{recordId}, #{feedbackCode}, #{workorderId}, #{workorderCode}, #{taskId}, #{processName}, #{requestBody},
#{createBy}, #{createTime}, #{remark})
</insert>
<select
id=
"selectByRecordId"
resultMap=
"ProFeedbackModifyRecordResult"
>
select id, record_id, feedback_code, workorder_id, workorder_code, task_id, process_name,
request_body, create_by, create_time, remark
from pro_feedback_modify_record
where record_id = #{recordId}
order by create_time desc
</select>
</mapper>
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