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
96a24bf9
Commit
96a24bf9
authored
May 20, 2026
by
chicheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
报表相关调整
撤销排产后回写工单状态:已发布
parent
854d585d
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
805 additions
and
15 deletions
+805
-15
ProFeedbackController.java
...a/com/ximai/mes/pro/controller/ProFeedbackController.java
+9
-1
ProWorkorderController.java
...s/pro/controller/proWorkOrder/ProWorkorderController.java
+485
-1
ProWorkorder.java
...a/com/ximai/mes/pro/domain/proWorkOrder/ProWorkorder.java
+5
-0
ProTaskWorkunit.java
...n/java/com/ximai/mes/pro/domain/task/ProTaskWorkunit.java
+6
-0
ProFeedbackVo.java
.../main/java/com/ximai/mes/pro/domain/vo/ProFeedbackVo.java
+6
-0
WorkorderFirstProcessNameVo.java
.../ximai/mes/pro/domain/vo/WorkorderFirstProcessNameVo.java
+12
-0
WorkorderFirstUnfinishedProcessVo.java
.../mes/pro/domain/vo/WorkorderFirstUnfinishedProcessVo.java
+12
-0
ProTaskWorkunitQuery.java
...om/ximai/mes/pro/domain/vo/task/ProTaskWorkunitQuery.java
+8
-0
ProFeedbackCheckListDto.java
...n/java/com/ximai/mes/pro/dto/ProFeedbackCheckListDto.java
+17
-0
ProFeedbackMapper.java
...main/java/com/ximai/mes/pro/mapper/ProFeedbackMapper.java
+3
-1
ProWorkOrderProcessMapper.java
...es/pro/mapper/proWorkOrder/ProWorkOrderProcessMapper.java
+6
-0
ProTaskMapper.java
...ain/java/com/ximai/mes/pro/mapper/task/ProTaskMapper.java
+6
-0
ProTaskWorkunitMapper.java
.../com/ximai/mes/pro/mapper/task/ProTaskWorkunitMapper.java
+1
-1
ProTaskServiceImpl.java
...m/ximai/mes/pro/service/impl/task/ProTaskServiceImpl.java
+37
-4
ProTaskWorkunitServiceImpl.java
...mes/pro/service/impl/task/ProTaskWorkunitServiceImpl.java
+4
-2
WorkOrderProgressController.java
...ai/mes/report/controller/WorkOrderProgressController.java
+6
-4
FeedbackRequest.java
...in/java/com/ximai/mes/report/request/FeedbackRequest.java
+14
-0
WorkOrderProgressRequest.java
...om/ximai/mes/report/request/WorkOrderProgressRequest.java
+10
-0
FeedbackResponse.java
.../java/com/ximai/mes/report/response/FeedbackResponse.java
+5
-0
FeedbackResponseExportByList.java
...mai/mes/report/response/FeedbackResponseExportByList.java
+5
-0
WorkOrderProgressListResponse.java
...ai/mes/report/response/WorkOrderProgressListResponse.java
+10
-0
WorkOrderProgressServiceImp.java
.../mes/report/service/impl/WorkOrderProgressServiceImp.java
+34
-0
ProFeedbackMapper.xml
mes/src/main/resources/mapper/pro/ProFeedbackMapper.xml
+50
-0
ProWorkOrderProcessMapper.xml
...ces/mapper/pro/proWorkOrder/ProWorkOrderProcessMapper.xml
+22
-0
ProWorkorderMapper.xml
.../resources/mapper/pro/proWorkOrder/ProWorkorderMapper.xml
+9
-1
ProTaskMapper.xml
mes/src/main/resources/mapper/pro/task/ProTaskMapper.xml
+23
-0
No files found.
mes/src/main/java/com/ximai/mes/pro/controller/ProFeedbackController.java
View file @
96a24bf9
...
...
@@ -99,6 +99,10 @@ 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
.
like
(
StringUtils
.
isNotEmpty
(
proFeedbackCheckListDto
.
getProcessName
()),
"f.process_name"
,
proFeedbackCheckListDto
.
getProcessName
());
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
.
orderByAsc
(
"f.feedback_time"
);
startPage
();
List
<
ProFeedbackVo
>
list
=
proFeedbackService
.
queryProFeedbackListJoinTaskWorkUnit
(
query
);
...
...
@@ -158,6 +162,10 @@ 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
.
like
(
StringUtils
.
isNotEmpty
(
proFeedbackCheckListDto
.
getProcessName
()),
"f.process_name"
,
proFeedbackCheckListDto
.
getProcessName
());
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
.
orderByAsc
(
"f.feedback_time"
);
List
<
ProFeedbackVo
>
list
=
proFeedbackService
.
queryProFeedbackListJoinTaskWorkUnit
(
query
);
List
<
ProFeedbackVo
>
proFeedbackVoList
=
new
ArrayList
<>();
...
...
@@ -181,7 +189,7 @@ public class ProFeedbackController extends BaseController {
ExcelUtil
<
ProFeedbackVo
>
util
=
new
ExcelUtil
<>(
ProFeedbackVo
.
class
);
util
.
exportExcel
(
response
,
l
ist
,
"生产报工记录列表"
,
"生产报工记录列表"
);
util
.
exportExcel
(
response
,
proFeedbackVoL
ist
,
"生产报工记录列表"
,
"生产报工记录列表"
);
}
/**
* 查询生产报工记录列表
...
...
mes/src/main/java/com/ximai/mes/pro/controller/proWorkOrder/ProWorkorderController.java
View file @
96a24bf9
package
com
.
ximai
.
mes
.
pro
.
controller
.
proWorkOrder
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.ximai.common.annotation.Log
;
import
com.ximai.common.constant.UserConstants
;
import
com.ximai.common.core.controller.BaseController
;
import
com.ximai.common.core.domain.AjaxResult
;
import
com.ximai.common.core.page.TableDataInfo
;
import
com.ximai.common.enums.BusinessType
;
import
com.ximai.common.exception.ServiceException
;
import
com.ximai.common.utils.MessageUtils
;
import
com.ximai.common.utils.data.ExceptionUtil
;
import
com.ximai.common.utils.data.StringUtils
;
import
com.ximai.common.utils.excel.ExcelWriter
;
import
com.ximai.mes.constant.WorkorderStatusEnum
;
import
com.ximai.mes.md.domain.MdProductBom
;
import
com.ximai.mes.md.service.IMdBaseInfoService
;
import
com.ximai.mes.md.service.IMdProductBomService
;
import
com.ximai.mes.pro.domain.ProWorkorderBomm
;
import
com.ximai.mes.pro.domain.proWorkOrder.ProWorkOrderSoDirective
;
import
com.ximai.mes.pro.domain.proWorkOrder.ProWorkOrderSoSizeItem
;
import
com.ximai.mes.pro.domain.proWorkOrder.ProWorkorder
;
import
com.ximai.mes.pro.domain.task.ProPackagePrintRecord
;
import
com.ximai.mes.pro.domain.task.ProTask
;
import
com.ximai.mes.pro.domain.vo.ProPackagePrintResult
;
import
com.ximai.mes.pro.domain.vo.ProWorkOrderProcessVo
;
import
com.ximai.mes.pro.domain.vo.ProWorkorderQuery
;
import
com.ximai.mes.pro.domain.vo.ProWorkorderVo
;
import
com.ximai.mes.pro.domain.vo.proWorkOrder.BuildPackageParams2
;
import
com.ximai.mes.pro.domain.vo.proWorkOrder.ProWorkorderPrintTab
;
import
com.ximai.mes.pro.domain.vo.proWorkOrder.WorkorderProofMakeProduction
;
import
com.ximai.mes.pro.dto.ProWorkorderExcelExport
;
import
com.ximai.mes.pro.mapper.proWorkOrder.ProWorkOrderProcessMapper
;
import
com.ximai.mes.pro.service.IProWorkorderBomService
;
import
com.ximai.mes.pro.service.proWorkOrder.IProWorkOrderSoDirectiveService
;
import
com.ximai.mes.pro.service.proWorkOrder.IProWorkOrderSoSizeItemService
;
import
com.ximai.mes.pro.service.proWorkOrder.IProWorkorderService
;
import
com.ximai.mes.pro.service.task.IProTaskService
;
import
com.ximai.system.strategy.AutoCodeUtil
;
import
io.swagger.annotations.ApiOperation
;
import
org.aspectj.bridge.Message
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.util.*
;
/** * 生产工单Controller * * @date 2022-05-09 */
@RestController
@RequestMapping
(
"/mes/pro/workorder"
)
public
class
ProWorkorderController
extends
BaseController
{
@Autowired
private
IProWorkorderService
proWorkorderService
;
@Resource
private
ProWorkOrderProcessMapper
proWorkOrderProcessMapper
;
@Autowired
private
IProWorkorderBomService
proWorkorderBomService
;
@Autowired
private
IMdProductBomService
mdProductBomService
;
@Autowired
private
IProTaskService
proTaskService
;
@Autowired
private
IProWorkOrderSoSizeItemService
proWorkOrderSoSizeItemService
;
@Autowired
private
IProWorkOrderSoDirectiveService
proWorkOrderSoDirectiveService
;
@Autowired
private
IMdBaseInfoService
mdBaseInfoService
;
@Autowired
AutoCodeUtil
autoCodeUtil
;
/** * 查询生产工单列表 */
@ApiOperation
(
"工单查询"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
<
ProWorkorder
>
list
(
ProWorkorderQuery
proWorkorder
)
{
startPage
();
List
<
ProWorkorder
>
list
=
proWorkorderService
.
selectProWorkorderList
(
proWorkorder
);
return
getDataTable
(
list
);
}
/** * 查询待排产生产工单列表 */
@ApiOperation
(
"查询待排产生产工单列表"
)
@GetMapping
(
"/scheduleList"
)
public
TableDataInfo
<
ProWorkorder
>
scheduleList
(
ProWorkorderQuery
proWorkorder
)
{
startPage
();
QueryWrapper
<
ProWorkorder
>
query
=
new
QueryWrapper
<>();
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getOrderCode
()),
"t1.order_code"
,
proWorkorder
.
getOrderCode
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getOrderSerial
()),
"t1.order_serial"
,
proWorkorder
.
getOrderSerial
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getCustomerProjectNo
()),
"t1.customer_project_no"
,
proWorkorder
.
getCustomerProjectNo
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getWorkorderCode
()),
"t1.workorder_code"
,
proWorkorder
.
getWorkorderCode
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getProductCode
()),
"t1.product_code"
,
proWorkorder
.
getProductCode
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getOrderCode
()),
"t1.order_code"
,
proWorkorder
.
getOrderCode
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getOrderSerial
()),
"t1.order_serial"
,
proWorkorder
.
getOrderSerial
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getCustomerDrawingNo
()),
"t1.customer_Drawing_No"
,
proWorkorder
.
getCustomerDrawingNo
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getProductName
()),
"t1.product_name"
,
proWorkorder
.
getProductName
());
query
.
in
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getStatusArr
()),
"t1.status"
,
proWorkorder
.
getStatusArr
());
query
.
in
(
"t1.status"
,
new
String
[]{
WorkorderStatusEnum
.
PREPARE
.
getValue
(),
WorkorderStatusEnum
.
PUBLISHED
.
getValue
(),
WorkorderStatusEnum
.
ISSUED
.
getValue
(),
WorkorderStatusEnum
.
PRODUCING
.
getValue
()});
query
.
gt
(
"t1.quantity-t1.quantity_scheduled"
,
0
);
query
.
orderByAsc
(
"request_date"
,
"t1.order_code"
);
List
<
ProWorkorder
>
list
=
proWorkorderService
.
selectListByQw
(
query
);
return
getDataTable
(
list
);
}
/** * 查询生产工单列表 */
@ApiOperation
(
"查询工单打印数据"
)
@GetMapping
(
"/printInfo"
)
public
AjaxResult
printInfo
(
ProWorkorderQuery
proWorkorder
)
{
List
<
ProWorkorderPrintTab
>
list
=
proWorkorderService
.
selectWorkorderPrintTab
(
proWorkorder
);
return
AjaxResult
.
success
(
list
);
}
@ApiOperation
(
"查询生产工单列表,并联查指令与SIZE数据"
)
@GetMapping
(
"/listWithSizeAndDirective"
)
public
TableDataInfo
<
ProWorkorderVo
>
listWithSizeAndDirective
(
ProWorkorderQuery
proWorkorder
)
{
List
<
ProWorkorderVo
>
list
=
proWorkorderService
.
getFeedBackRecord
(
proWorkorder
);
return
getDataTable
(
list
);
}
@ApiOperation
(
"工单关联属性查询"
)
@GetMapping
(
"/linkInfo"
)
public
AjaxResult
<
ProWorkorderVo
>
linkInfo
(
Long
workorderId
)
{
ProWorkorderVo
rst
=
new
ProWorkorderVo
();
ProWorkorder
proWorkorder
=
proWorkorderService
.
selectWorkorderById
(
workorderId
);
BeanUtil
.
copyProperties
(
proWorkorder
,
rst
);
ProWorkOrderSoDirective
directiveQuery
=
new
ProWorkOrderSoDirective
();
directiveQuery
.
setWorkorderId
(
proWorkorder
.
getWorkorderId
());
List
<
ProWorkOrderSoDirective
>
directiveList
=
proWorkOrderSoDirectiveService
.
selectProWorkOrderSoDirectiveList
(
directiveQuery
);
ProWorkOrderSoSizeItem
sizeQuery
=
new
ProWorkOrderSoSizeItem
();
sizeQuery
.
setWorkorderId
(
proWorkorder
.
getWorkorderId
());
List
<
ProWorkOrderSoSizeItem
>
sizeList
=
proWorkOrderSoSizeItemService
.
selectProWorkOrderSoSizeItemList
(
sizeQuery
);
rst
.
setSaleDirectiveList
(
directiveList
);
rst
.
setSizeList
(
sizeList
);
if
(
directiveList
.
size
()
==
1
)
{
if
(
directiveList
.
get
(
0
).
getPackNum
()
!=
null
&&
rst
.
getUsagePackNum
()
==
null
)
{
rst
.
setUsagePackNum
(
directiveList
.
get
(
0
).
getPackNum
().
intValue
());
}
}
if
(
proWorkorder
.
getUsageEncasementNum
()
!=
null
)
{
rst
.
setUsageEncasementNum
(
proWorkorder
.
getUsageEncasementNum
());
}
if
(
proWorkorder
.
getUsagePackNum
()
!=
null
)
{
rst
.
setUsagePackNum
(
proWorkorder
.
getUsagePackNum
());
}
return
AjaxResult
.
success
(
rst
);
}
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
IMPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:user:import')"
)
@PostMapping
(
"/importData"
)
public
AjaxResult
importData
(
MultipartFile
file
)
throws
Exception
{
String
message
=
proWorkorderService
.
importWorkOrder
(
file
);
return
AjaxResult
.
success
(
message
);
}
@GetMapping
(
value
=
"/getChildWorkorderCode/{workOrderCode}"
)
public
AjaxResult
getChildOrderCode
(
@PathVariable
(
"workOrderCode"
)
String
workorderCode
)
{
if
(
workorderCode
==
null
||
""
.
equals
(
workorderCode
))
{
throw
new
RuntimeException
(
"工单编码传递为空"
);
}
Integer
i
=
proWorkorderService
.
countByParentCode
(
workorderCode
);
// 补料单生成编号 Map<String, String> map = new HashMap<>(); map.put("code", workorderCode + "-" + ((i == null ? 0 : i) + 1)); return AjaxResult.success(map); } @PostMapping("/importTemplate") public void importTemplate(HttpServletResponse response) throws IOException { proWorkorderService.importTemplate(response); } /** * 获取生产工单详细信息 */ @GetMapping(value = "/{workorderId}") public AjaxResult getInfo(@PathVariable("workorderId") Long workorderId) { return AjaxResult.success(proWorkorderService.selectProWorkorderByWorkorderId(workorderId)); } /** * 获取生产工单详细信息 */ @PostMapping(value = "/getQcCondition") public AjaxResult getQcCondition(@RequestBody ProWorkorder proWorkorder) { QueryWrapper<ProWorkorder> queryWrapper = new QueryWrapper<>(); queryWrapper.eq(StringUtils.isNotEmpty(proWorkorder.getWorkorderCode()), "workorder_code", proWorkorder.getWorkorderCode()); queryWrapper.eq(StringUtils.isNotEmpty(proWorkorder.getArrangeCode()), "arrange_code", proWorkorder.getArrangeCode()); List<ProWorkorder> proWorkorders = proWorkorderService.selectListByQw(queryWrapper); ExceptionUtil.checkTrueThrowException(CollectionUtil.isEmpty(proWorkorders), MessageUtils.message("pro.workOrder.error.not.exist")); ProWorkorder proWorkorder1 = proWorkorders.get(0); List<ProWorkOrderProcessVo> proWorkOrderProcessList = proWorkOrderProcessMapper.selectProWorkOrderProcessByWorkOrderId(proWorkorder1.getWorkorderId()); ProWorkorderVo proWorkorderVo = proWorkorder1.deepCopyObj(ProWorkorderVo.class); proWorkorderVo.setProcessList(proWorkOrderProcessList); return AjaxResult.success(proWorkorderVo); } /** * 新增生产工单 */ @ApiOperation("生产工单新增") @PreAuthorize("@ss.hasPermi('mes:pro:workorder:add')") @Log(title = "生产工单", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ProWorkorderVo proWorkorderVo) { ProWorkorder proWorkorder = proWorkorderVo.deepCopyObj(ProWorkorder.class); ExceptionUtil.checkTrueThrowException(!proWorkorderService.checkWorkorderIsExsit(proWorkorder), MessageUtils.message("pro.workOrder.error.workOrderNo.exist")); ProWorkorder proWorkorderNew = proWorkorderService.insertObj(proWorkorder, proWorkorderVo); return AjaxResult.success(proWorkorderNew.getWorkorderId()); } /** * 修改生产工单 */ @PreAuthorize("@ss.hasPermi('mes:pro:workorder:edit')") @Log(title = "生产工单", businessType = BusinessType.UPDATE) @PutMapping("/close") public AjaxResult close(@RequestBody List<ProWorkorderVo> proWorkorderVos) { for (ProWorkorderVo proWorkorderVo : proWorkorderVos) { proWorkorderService.updateObject(proWorkorderVo); } return AjaxResult.success(); } @PreAuthorize("@ss.hasPermi('mes:pro:workorder:add')") @Log(title = "生产补单工单", businessType = BusinessType.INSERT) @PostMapping("/addComplements") public AjaxResult addComplements(@RequestBody ProWorkorderVo proWorkorderVo) { proWorkorderService.addComplements(proWorkorderVo); return AjaxResult.success(); } /** * 修改生产工单 */ @ApiOperation("生产工单修改") @PreAuthorize("@ss.hasPermi('mes:pro:workorder:edit')") @Log(title = "生产工单", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ProWorkorderVo proWorkorderVo) { int ret = proWorkorderService.updateObject(proWorkorderVo); return toAjax(ret); } /** * 修改生产工单 */ @ApiOperation("生产工单修改生产版本以及工艺路线") @PreAuthorize("@ss.hasPermi('mes:pro:workorder:edit')") @Log(title = "生产工单", businessType = BusinessType.UPDATE) @PutMapping("/updateWorkProcess") public AjaxResult updateWorkProcess(@RequestBody ProWorkorderVo proWorkorderVo) { int ret = proWorkorderService.updateWorkProcess(proWorkorderVo); return toAjax(ret); } /** * 删除生产工单 */ @PreAuthorize("@ss.hasPermi('mes:pro:workorder:remove')") @Log(title = "生产工单", businessType = BusinessType.DELETE) @DeleteMapping("/{workorderIds}") public AjaxResult remove(@PathVariable Long[] workorderIds) { for (Long id : workorderIds) { ProWorkorderVo workorder = proWorkorderService.selectProWorkorderByWorkorderId(id); if (!UserConstants.ORDER_STATUS_PREPARE.equals(workorder.getStatus())) { return AjaxResult.error(MessageUtils.message("pro.workOrder.error.limit.delete")); } proWorkorderBomService.deleteProWorkorderBomByWorkorderId(id); } return toAjax(proWorkorderService.deleteProWorkorderByWorkorderIds(workorderIds)); } /** * 获取当前工单的物料需求清单 */ @PreAuthorize("@ss.hasPermi('mes:pro:workorder:list')") @GetMapping("/listItems") public TableDataInfo listItemss(ProWorkorder proWorkorder) { List<MdProductBom> result = new ArrayList<MdProductBom>(); ProWorkorderBomm param = new ProWorkorderBomm(); param.setWorkorderId(proWorkorder.getWorkorderId()); List<ProWorkorderBomm> boms = proWorkorderBomService.selectProWorkorderBomList(param); if (!CollectionUtils.isEmpty(boms)) { for (ProWorkorderBomm bom : boms ) { MdProductBom theBom = new MdProductBom(); theBom.setBomItemId(bom.getItemId()); result.addAll(getBoms(theBom, bom.getQuantity(), 0)); } } return getDataTable(result); } private List<MdProductBom> getBoms(MdProductBom item, BigDecimal quantity, int count) { MdProductBom param = new MdProductBom(); List<MdProductBom> results = new ArrayList<MdProductBom>(); if (count > 20) { return results; } param.setItemId(item.getBomItemId()); List<MdProductBom> boms = mdProductBomService.selectMdProductBomList(param); if (CollUtil.isNotEmpty(boms)) { //最多20层依赖 count++; for (MdProductBom bomItem : boms) { bomItem.setQuantity(quantity.multiply(bomItem.getQuantity())); results.addAll(getBoms(bomItem, bomItem.getQuantity(), count)); } } else { results.add(item); } return results; } /** * 完成工单 * * @param workorderId * @return */ @PreAuthorize("@ss.hasPermi('mes:pro:workorder:edit')") @Log(title = "生产工单", businessType = BusinessType.UPDATE) @Transactional @PutMapping("/{workorderId}") public AjaxResult dofinish(@PathVariable Long workorderId) { ProWorkorderVo proWorkorderVo = proWorkorderService.selectProWorkorderByWorkorderId(workorderId); ProWorkorder workorder = proWorkorderVo.deepCopyObj(ProWorkorder.class); //将此工单下所有的生产任务状态设置为已完成 ProTask param = new ProTask(); param.setArrangeCode(workorder.getArrangeCode()); List<ProTask> tasks = proTaskService.selectProTaskList(param); if (!CollectionUtils.isEmpty(tasks)) { for (ProTask task : tasks) { task.setStatus(UserConstants.ORDER_STATUS_FINISHED); proTaskService.updateProTask(task); } } workorder.setStatus(UserConstants.ORDER_STATUS_FINISHED); //更新工单的状态 proWorkorderService.updateProWorkorder(workorder); return AjaxResult.success(); } /** * 生产工单工装量具齐套检查 */ @PostMapping(value = "/checkToolNum") public void checkToolNum(@RequestBody ProWorkorderVo proWorkorderVo) { proWorkorderService.checkToolNum(proWorkorderVo.getWorkorderIds()); } /** * 生产工单将草稿状态改为已确认 */ @GetMapping(value = "/setStatus/{workorderId}") public void setStaus(@PathVariable("workorderId") Long workorderId) { ProWorkorder workorder = proWorkorderService.selectWorkorderById(workorderId); proWorkorderService.updateWorkorderState(workorder, WorkorderStatusEnum.PUBLISHED); } @PostMapping(value = "/proofMakeProduction") public AjaxResult proofMakeProduction(@RequestBody WorkorderProofMakeProduction production) { proWorkorderService.proofMakeProduction(production); return AjaxResult.success(); } /** * 导出生产工单列表 */ @PreAuthorize("@ss.hasPermi('mes:pro:workorder:export')") @Log(title = "生产工单", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ProWorkorderQuery proWorkorder) throws IOException { List<ProWorkorder> list = proWorkorderService.selectProWorkorderList(proWorkorder); List<ProWorkorderExcelExport> exportList = BeanUtil.copyToList(list, ProWorkorderExcelExport.class); ExcelWriter.write(response,ProWorkorderExcelExport.class,exportList); } /** * 同步ERP数据 */ @PreAuthorize("@ss.hasPermi('mes:pro:workorder:sync')") @Log(title = "工单同步", businessType = BusinessType.SYNC_DATA) @PostMapping("/syncData") public AjaxResult syncData() { proWorkorderService.syncErpData(); return AjaxResult.success(); } }
\ No newline at end of file
package
com
.
ximai
.
mes
.
pro
.
controller
.
proWorkOrder
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.ximai.common.annotation.Log
;
import
com.ximai.common.constant.UserConstants
;
import
com.ximai.common.core.controller.BaseController
;
import
com.ximai.common.core.domain.AjaxResult
;
import
com.ximai.common.core.page.TableDataInfo
;
import
com.ximai.common.enums.BusinessType
;
import
com.ximai.common.exception.ServiceException
;
import
com.ximai.common.utils.MessageUtils
;
import
com.ximai.common.utils.data.ExceptionUtil
;
import
com.ximai.common.utils.data.StringUtils
;
import
com.ximai.common.utils.excel.ExcelWriter
;
import
com.ximai.mes.constant.WorkorderStatusEnum
;
import
com.ximai.mes.md.domain.MdProductBom
;
import
com.ximai.mes.md.service.IMdBaseInfoService
;
import
com.ximai.mes.md.service.IMdProductBomService
;
import
com.ximai.mes.pro.domain.ProWorkorderBomm
;
import
com.ximai.mes.pro.domain.proWorkOrder.ProWorkOrderSoDirective
;
import
com.ximai.mes.pro.domain.proWorkOrder.ProWorkOrderSoSizeItem
;
import
com.ximai.mes.pro.domain.proWorkOrder.ProWorkorder
;
import
com.ximai.mes.pro.domain.task.ProPackagePrintRecord
;
import
com.ximai.mes.pro.domain.task.ProTask
;
import
com.ximai.mes.pro.domain.vo.ProPackagePrintResult
;
import
com.ximai.mes.pro.domain.vo.ProWorkOrderProcessVo
;
import
com.ximai.mes.pro.domain.vo.ProWorkorderQuery
;
import
com.ximai.mes.pro.domain.vo.ProWorkorderVo
;
import
com.ximai.mes.pro.domain.vo.proWorkOrder.BuildPackageParams2
;
import
com.ximai.mes.pro.domain.vo.proWorkOrder.ProWorkorderPrintTab
;
import
com.ximai.mes.pro.domain.vo.proWorkOrder.WorkorderProofMakeProduction
;
import
com.ximai.mes.pro.dto.ProWorkorderExcelExport
;
import
com.ximai.mes.pro.mapper.proWorkOrder.ProWorkOrderProcessMapper
;
import
com.ximai.mes.pro.service.IProWorkorderBomService
;
import
com.ximai.mes.pro.service.proWorkOrder.IProWorkOrderSoDirectiveService
;
import
com.ximai.mes.pro.service.proWorkOrder.IProWorkOrderSoSizeItemService
;
import
com.ximai.mes.pro.service.proWorkOrder.IProWorkorderService
;
import
com.ximai.mes.pro.service.task.IProTaskService
;
import
com.ximai.system.strategy.AutoCodeUtil
;
import
io.swagger.annotations.ApiOperation
;
import
org.aspectj.bridge.Message
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.util.*
;
/**
* 生产工单Controller
*
* @date 2022-05-09
*/
@RestController
@RequestMapping
(
"/mes/pro/workorder"
)
public
class
ProWorkorderController
extends
BaseController
{
@Autowired
private
IProWorkorderService
proWorkorderService
;
@Resource
private
ProWorkOrderProcessMapper
proWorkOrderProcessMapper
;
@Autowired
private
IProWorkorderBomService
proWorkorderBomService
;
@Autowired
private
IMdProductBomService
mdProductBomService
;
@Autowired
private
IProTaskService
proTaskService
;
@Autowired
private
IProWorkOrderSoSizeItemService
proWorkOrderSoSizeItemService
;
@Autowired
private
IProWorkOrderSoDirectiveService
proWorkOrderSoDirectiveService
;
@Autowired
private
IMdBaseInfoService
mdBaseInfoService
;
@Autowired
AutoCodeUtil
autoCodeUtil
;
/**
* 查询生产工单列表
*/
@ApiOperation
(
"工单查询"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
<
ProWorkorder
>
list
(
ProWorkorderQuery
proWorkorder
)
{
startPage
();
List
<
ProWorkorder
>
list
=
proWorkorderService
.
selectProWorkorderList
(
proWorkorder
);
return
getDataTable
(
list
);
}
/**
* 查询待排产生产工单列表
*/
@ApiOperation
(
"查询待排产生产工单列表"
)
@GetMapping
(
"/scheduleList"
)
public
TableDataInfo
<
ProWorkorder
>
scheduleList
(
ProWorkorderQuery
proWorkorder
)
{
startPage
();
QueryWrapper
<
ProWorkorder
>
query
=
new
QueryWrapper
<>();
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getOrderCode
()),
"t1.order_code"
,
proWorkorder
.
getOrderCode
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getOrderSerial
()),
"t1.order_serial"
,
proWorkorder
.
getOrderSerial
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getCustomerProjectNo
()),
"t1.customer_project_no"
,
proWorkorder
.
getCustomerProjectNo
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getWorkorderCode
()),
"t1.workorder_code"
,
proWorkorder
.
getWorkorderCode
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getProductCode
()),
"t1.product_code"
,
proWorkorder
.
getProductCode
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getOrderCode
()),
"t1.order_code"
,
proWorkorder
.
getOrderCode
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getOrderSerial
()),
"t1.order_serial"
,
proWorkorder
.
getOrderSerial
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getCustomerDrawingNo
()),
"t1.customer_Drawing_No"
,
proWorkorder
.
getCustomerDrawingNo
());
query
.
like
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getProductName
()),
"t1.product_name"
,
proWorkorder
.
getProductName
());
query
.
in
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getStatusArr
()),
"t1.status"
,
proWorkorder
.
getStatusArr
());
query
.
in
(
"t1.status"
,
new
String
[]{
WorkorderStatusEnum
.
PREPARE
.
getValue
(),
WorkorderStatusEnum
.
PUBLISHED
.
getValue
(),
WorkorderStatusEnum
.
ISSUED
.
getValue
(),
WorkorderStatusEnum
.
PRODUCING
.
getValue
()});
query
.
gt
(
"t1.quantity-t1.quantity_scheduled"
,
0
);
query
.
orderByAsc
(
"request_date"
,
"t1.order_code"
);
List
<
ProWorkorder
>
list
=
proWorkorderService
.
selectListByQw
(
query
);
fillFirstProcessName
(
list
);
return
getDataTable
(
list
);
}
/**
* 填充工单工艺路线首道工序名称
*/
private
void
fillFirstProcessName
(
List
<
ProWorkorder
>
list
)
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
;
}
List
<
Long
>
workorderIds
=
new
ArrayList
<>();
for
(
ProWorkorder
wo
:
list
)
{
if
(
wo
.
getWorkorderId
()
!=
null
)
{
workorderIds
.
add
(
wo
.
getWorkorderId
());
}
}
if
(
workorderIds
.
isEmpty
())
{
return
;
}
List
<
com
.
ximai
.
mes
.
pro
.
domain
.
vo
.
WorkorderFirstProcessNameVo
>
firstList
=
proWorkOrderProcessMapper
.
selectFirstProcessNameByWorkorderIds
(
workorderIds
);
if
(
CollectionUtils
.
isEmpty
(
firstList
))
{
return
;
}
Map
<
Long
,
String
>
nameMap
=
new
HashMap
<>(
firstList
.
size
());
for
(
com
.
ximai
.
mes
.
pro
.
domain
.
vo
.
WorkorderFirstProcessNameVo
vo
:
firstList
)
{
if
(
vo
.
getWorkorderId
()
!=
null
)
{
nameMap
.
put
(
vo
.
getWorkorderId
(),
vo
.
getFirstProcessName
());
}
}
for
(
ProWorkorder
wo
:
list
)
{
if
(
wo
.
getWorkorderId
()
!=
null
)
{
wo
.
setFirstProcessName
(
nameMap
.
get
(
wo
.
getWorkorderId
()));
}
}
}
/**
* 查询生产工单列表
*/
@ApiOperation
(
"查询工单打印数据"
)
@GetMapping
(
"/printInfo"
)
public
AjaxResult
printInfo
(
ProWorkorderQuery
proWorkorder
)
{
List
<
ProWorkorderPrintTab
>
list
=
proWorkorderService
.
selectWorkorderPrintTab
(
proWorkorder
);
return
AjaxResult
.
success
(
list
);
}
@ApiOperation
(
"查询生产工单列表,并联查指令与SIZE数据"
)
@GetMapping
(
"/listWithSizeAndDirective"
)
public
TableDataInfo
<
ProWorkorderVo
>
listWithSizeAndDirective
(
ProWorkorderQuery
proWorkorder
)
{
List
<
ProWorkorderVo
>
list
=
proWorkorderService
.
getFeedBackRecord
(
proWorkorder
);
return
getDataTable
(
list
);
}
@ApiOperation
(
"工单关联属性查询"
)
@GetMapping
(
"/linkInfo"
)
public
AjaxResult
<
ProWorkorderVo
>
linkInfo
(
Long
workorderId
)
{
ProWorkorderVo
rst
=
new
ProWorkorderVo
();
ProWorkorder
proWorkorder
=
proWorkorderService
.
selectWorkorderById
(
workorderId
);
BeanUtil
.
copyProperties
(
proWorkorder
,
rst
);
ProWorkOrderSoDirective
directiveQuery
=
new
ProWorkOrderSoDirective
();
directiveQuery
.
setWorkorderId
(
proWorkorder
.
getWorkorderId
());
List
<
ProWorkOrderSoDirective
>
directiveList
=
proWorkOrderSoDirectiveService
.
selectProWorkOrderSoDirectiveList
(
directiveQuery
);
ProWorkOrderSoSizeItem
sizeQuery
=
new
ProWorkOrderSoSizeItem
();
sizeQuery
.
setWorkorderId
(
proWorkorder
.
getWorkorderId
());
List
<
ProWorkOrderSoSizeItem
>
sizeList
=
proWorkOrderSoSizeItemService
.
selectProWorkOrderSoSizeItemList
(
sizeQuery
);
rst
.
setSaleDirectiveList
(
directiveList
);
rst
.
setSizeList
(
sizeList
);
if
(
directiveList
.
size
()
==
1
)
{
if
(
directiveList
.
get
(
0
).
getPackNum
()
!=
null
&&
rst
.
getUsagePackNum
()
==
null
)
{
rst
.
setUsagePackNum
(
directiveList
.
get
(
0
).
getPackNum
().
intValue
());
}
}
if
(
proWorkorder
.
getUsageEncasementNum
()
!=
null
)
{
rst
.
setUsageEncasementNum
(
proWorkorder
.
getUsageEncasementNum
());
}
if
(
proWorkorder
.
getUsagePackNum
()
!=
null
)
{
rst
.
setUsagePackNum
(
proWorkorder
.
getUsagePackNum
());
}
return
AjaxResult
.
success
(
rst
);
}
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
IMPORT
)
@PreAuthorize
(
"@ss.hasPermi('system:user:import')"
)
@PostMapping
(
"/importData"
)
public
AjaxResult
importData
(
MultipartFile
file
)
throws
Exception
{
String
message
=
proWorkorderService
.
importWorkOrder
(
file
);
return
AjaxResult
.
success
(
message
);
}
@GetMapping
(
value
=
"/getChildWorkorderCode/{workOrderCode}"
)
public
AjaxResult
getChildOrderCode
(
@PathVariable
(
"workOrderCode"
)
String
workorderCode
)
{
if
(
workorderCode
==
null
||
""
.
equals
(
workorderCode
))
{
throw
new
RuntimeException
(
"工单编码传递为空"
);
}
Integer
i
=
proWorkorderService
.
countByParentCode
(
workorderCode
);
// 补料单生成编号
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"code"
,
workorderCode
+
"-"
+
((
i
==
null
?
0
:
i
)
+
1
));
return
AjaxResult
.
success
(
map
);
}
@PostMapping
(
"/importTemplate"
)
public
void
importTemplate
(
HttpServletResponse
response
)
throws
IOException
{
proWorkorderService
.
importTemplate
(
response
);
}
/**
* 获取生产工单详细信息
*/
@GetMapping
(
value
=
"/{workorderId}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"workorderId"
)
Long
workorderId
)
{
return
AjaxResult
.
success
(
proWorkorderService
.
selectProWorkorderByWorkorderId
(
workorderId
));
}
/**
* 获取生产工单详细信息
*/
@PostMapping
(
value
=
"/getQcCondition"
)
public
AjaxResult
getQcCondition
(
@RequestBody
ProWorkorder
proWorkorder
)
{
QueryWrapper
<
ProWorkorder
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getWorkorderCode
()),
"workorder_code"
,
proWorkorder
.
getWorkorderCode
());
queryWrapper
.
eq
(
StringUtils
.
isNotEmpty
(
proWorkorder
.
getArrangeCode
()),
"arrange_code"
,
proWorkorder
.
getArrangeCode
());
List
<
ProWorkorder
>
proWorkorders
=
proWorkorderService
.
selectListByQw
(
queryWrapper
);
ExceptionUtil
.
checkTrueThrowException
(
CollectionUtil
.
isEmpty
(
proWorkorders
),
MessageUtils
.
message
(
"pro.workOrder.error.not.exist"
));
ProWorkorder
proWorkorder1
=
proWorkorders
.
get
(
0
);
List
<
ProWorkOrderProcessVo
>
proWorkOrderProcessList
=
proWorkOrderProcessMapper
.
selectProWorkOrderProcessByWorkOrderId
(
proWorkorder1
.
getWorkorderId
());
ProWorkorderVo
proWorkorderVo
=
proWorkorder1
.
deepCopyObj
(
ProWorkorderVo
.
class
);
proWorkorderVo
.
setProcessList
(
proWorkOrderProcessList
);
return
AjaxResult
.
success
(
proWorkorderVo
);
}
/**
* 新增生产工单
*/
@ApiOperation
(
"生产工单新增"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:workorder:add')"
)
@Log
(
title
=
"生产工单"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
ProWorkorderVo
proWorkorderVo
)
{
ProWorkorder
proWorkorder
=
proWorkorderVo
.
deepCopyObj
(
ProWorkorder
.
class
);
ExceptionUtil
.
checkTrueThrowException
(!
proWorkorderService
.
checkWorkorderIsExsit
(
proWorkorder
),
MessageUtils
.
message
(
"pro.workOrder.error.workOrderNo.exist"
));
ProWorkorder
proWorkorderNew
=
proWorkorderService
.
insertObj
(
proWorkorder
,
proWorkorderVo
);
return
AjaxResult
.
success
(
proWorkorderNew
.
getWorkorderId
());
}
/**
* 修改生产工单
*/
@PreAuthorize
(
"@ss.hasPermi('mes:pro:workorder:edit')"
)
@Log
(
title
=
"生产工单"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/close"
)
public
AjaxResult
close
(
@RequestBody
List
<
ProWorkorderVo
>
proWorkorderVos
)
{
for
(
ProWorkorderVo
proWorkorderVo
:
proWorkorderVos
)
{
proWorkorderService
.
updateObject
(
proWorkorderVo
);
}
return
AjaxResult
.
success
();
}
@PreAuthorize
(
"@ss.hasPermi('mes:pro:workorder:add')"
)
@Log
(
title
=
"生产补单工单"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"/addComplements"
)
public
AjaxResult
addComplements
(
@RequestBody
ProWorkorderVo
proWorkorderVo
)
{
proWorkorderService
.
addComplements
(
proWorkorderVo
);
return
AjaxResult
.
success
();
}
/**
* 修改生产工单
*/
@ApiOperation
(
"生产工单修改"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:workorder:edit')"
)
@Log
(
title
=
"生产工单"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
ProWorkorderVo
proWorkorderVo
)
{
int
ret
=
proWorkorderService
.
updateObject
(
proWorkorderVo
);
return
toAjax
(
ret
);
}
/**
* 修改生产工单
*/
@ApiOperation
(
"生产工单修改生产版本以及工艺路线"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:workorder:edit')"
)
@Log
(
title
=
"生产工单"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/updateWorkProcess"
)
public
AjaxResult
updateWorkProcess
(
@RequestBody
ProWorkorderVo
proWorkorderVo
)
{
int
ret
=
proWorkorderService
.
updateWorkProcess
(
proWorkorderVo
);
return
toAjax
(
ret
);
}
/**
* 删除生产工单
*/
@PreAuthorize
(
"@ss.hasPermi('mes:pro:workorder:remove')"
)
@Log
(
title
=
"生产工单"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{workorderIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
workorderIds
)
{
for
(
Long
id
:
workorderIds
)
{
ProWorkorderVo
workorder
=
proWorkorderService
.
selectProWorkorderByWorkorderId
(
id
);
if
(!
UserConstants
.
ORDER_STATUS_PREPARE
.
equals
(
workorder
.
getStatus
()))
{
return
AjaxResult
.
error
(
MessageUtils
.
message
(
"pro.workOrder.error.limit.delete"
));
}
proWorkorderBomService
.
deleteProWorkorderBomByWorkorderId
(
id
);
}
return
toAjax
(
proWorkorderService
.
deleteProWorkorderByWorkorderIds
(
workorderIds
));
}
/**
* 获取当前工单的物料需求清单
*/
@PreAuthorize
(
"@ss.hasPermi('mes:pro:workorder:list')"
)
@GetMapping
(
"/listItems"
)
public
TableDataInfo
listItemss
(
ProWorkorder
proWorkorder
)
{
List
<
MdProductBom
>
result
=
new
ArrayList
<
MdProductBom
>();
ProWorkorderBomm
param
=
new
ProWorkorderBomm
();
param
.
setWorkorderId
(
proWorkorder
.
getWorkorderId
());
List
<
ProWorkorderBomm
>
boms
=
proWorkorderBomService
.
selectProWorkorderBomList
(
param
);
if
(!
CollectionUtils
.
isEmpty
(
boms
))
{
for
(
ProWorkorderBomm
bom
:
boms
)
{
MdProductBom
theBom
=
new
MdProductBom
();
theBom
.
setBomItemId
(
bom
.
getItemId
());
result
.
addAll
(
getBoms
(
theBom
,
bom
.
getQuantity
(),
0
));
}
}
return
getDataTable
(
result
);
}
private
List
<
MdProductBom
>
getBoms
(
MdProductBom
item
,
BigDecimal
quantity
,
int
count
)
{
MdProductBom
param
=
new
MdProductBom
();
List
<
MdProductBom
>
results
=
new
ArrayList
<
MdProductBom
>();
if
(
count
>
20
)
{
return
results
;
}
param
.
setItemId
(
item
.
getBomItemId
());
List
<
MdProductBom
>
boms
=
mdProductBomService
.
selectMdProductBomList
(
param
);
if
(
CollUtil
.
isNotEmpty
(
boms
))
{
//最多20层依赖
count
++;
for
(
MdProductBom
bomItem
:
boms
)
{
bomItem
.
setQuantity
(
quantity
.
multiply
(
bomItem
.
getQuantity
()));
results
.
addAll
(
getBoms
(
bomItem
,
bomItem
.
getQuantity
(),
count
));
}
}
else
{
results
.
add
(
item
);
}
return
results
;
}
/**
* 完成工单
*
* @param workorderId
* @return
*/
@PreAuthorize
(
"@ss.hasPermi('mes:pro:workorder:edit')"
)
@Log
(
title
=
"生产工单"
,
businessType
=
BusinessType
.
UPDATE
)
@Transactional
@PutMapping
(
"/{workorderId}"
)
public
AjaxResult
dofinish
(
@PathVariable
Long
workorderId
)
{
ProWorkorderVo
proWorkorderVo
=
proWorkorderService
.
selectProWorkorderByWorkorderId
(
workorderId
);
ProWorkorder
workorder
=
proWorkorderVo
.
deepCopyObj
(
ProWorkorder
.
class
);
//将此工单下所有的生产任务状态设置为已完成
ProTask
param
=
new
ProTask
();
param
.
setArrangeCode
(
workorder
.
getArrangeCode
());
List
<
ProTask
>
tasks
=
proTaskService
.
selectProTaskList
(
param
);
if
(!
CollectionUtils
.
isEmpty
(
tasks
))
{
for
(
ProTask
task
:
tasks
)
{
task
.
setStatus
(
UserConstants
.
ORDER_STATUS_FINISHED
);
proTaskService
.
updateProTask
(
task
);
}
}
workorder
.
setStatus
(
UserConstants
.
ORDER_STATUS_FINISHED
);
//更新工单的状态
proWorkorderService
.
updateProWorkorder
(
workorder
);
return
AjaxResult
.
success
();
}
/**
* 生产工单工装量具齐套检查
*/
@PostMapping
(
value
=
"/checkToolNum"
)
public
void
checkToolNum
(
@RequestBody
ProWorkorderVo
proWorkorderVo
)
{
proWorkorderService
.
checkToolNum
(
proWorkorderVo
.
getWorkorderIds
());
}
/**
* 生产工单将草稿状态改为已确认
*/
@GetMapping
(
value
=
"/setStatus/{workorderId}"
)
public
void
setStaus
(
@PathVariable
(
"workorderId"
)
Long
workorderId
)
{
ProWorkorder
workorder
=
proWorkorderService
.
selectWorkorderById
(
workorderId
);
proWorkorderService
.
updateWorkorderState
(
workorder
,
WorkorderStatusEnum
.
PUBLISHED
);
}
@PostMapping
(
value
=
"/proofMakeProduction"
)
public
AjaxResult
proofMakeProduction
(
@RequestBody
WorkorderProofMakeProduction
production
)
{
proWorkorderService
.
proofMakeProduction
(
production
);
return
AjaxResult
.
success
();
}
/**
* 导出生产工单列表
*/
@PreAuthorize
(
"@ss.hasPermi('mes:pro:workorder:export')"
)
@Log
(
title
=
"生产工单"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
ProWorkorderQuery
proWorkorder
)
throws
IOException
{
List
<
ProWorkorder
>
list
=
proWorkorderService
.
selectProWorkorderList
(
proWorkorder
);
List
<
ProWorkorderExcelExport
>
exportList
=
BeanUtil
.
copyToList
(
list
,
ProWorkorderExcelExport
.
class
);
ExcelWriter
.
write
(
response
,
ProWorkorderExcelExport
.
class
,
exportList
);
}
/**
* 同步ERP数据
*/
@PreAuthorize
(
"@ss.hasPermi('mes:pro:workorder:sync')"
)
@Log
(
title
=
"工单同步"
,
businessType
=
BusinessType
.
SYNC_DATA
)
@PostMapping
(
"/syncData"
)
public
AjaxResult
syncData
()
{
proWorkorderService
.
syncErpData
();
return
AjaxResult
.
success
();
}
}
mes/src/main/java/com/ximai/mes/pro/domain/proWorkOrder/ProWorkorder.java
View file @
96a24bf9
...
...
@@ -382,6 +382,11 @@ public class ProWorkorder extends TreeEntity {
@TableField
(
exist
=
false
)
private
String
combinationCode
;
/** 工单工艺路线首道工序名称(列表展示用) */
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"工单首工序名称"
)
private
String
firstProcessName
;
@TableField
(
exist
=
false
)
private
String
workorderIds
;
...
...
mes/src/main/java/com/ximai/mes/pro/domain/task/ProTaskWorkunit.java
View file @
96a24bf9
...
...
@@ -233,6 +233,12 @@ public class ProTaskWorkunit extends BaseEntity {
@Excel
(
name
=
"排产次数"
)
private
String
taskBatch
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"排产日期"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Excel
(
name
=
"排产日期"
,
width
=
20
,
dateFormat
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
scheduleDocCreateTime
;
@ApiModelProperty
(
"标准工时"
)
private
BigDecimal
stdWorkingTime
;
...
...
mes/src/main/java/com/ximai/mes/pro/domain/vo/ProFeedbackVo.java
View file @
96a24bf9
...
...
@@ -106,6 +106,12 @@ public class ProFeedbackVo {
@Excel
(
name
=
"生产任务编号"
)
private
String
taskCode
;
/**
* 排产次数
*/
@Excel
(
name
=
"排产次数"
)
private
String
taskBatch
;
/**
* 产品物料ID
*/
...
...
mes/src/main/java/com/ximai/mes/pro/domain/vo/WorkorderFirstProcessNameVo.java
0 → 100644
View file @
96a24bf9
package
com
.
ximai
.
mes
.
pro
.
domain
.
vo
;
import
lombok.Data
;
/**
* 工单首工序名称(待排产列表等)
*/
@Data
public
class
WorkorderFirstProcessNameVo
{
private
Long
workorderId
;
private
String
firstProcessName
;
}
mes/src/main/java/com/ximai/mes/pro/domain/vo/WorkorderFirstUnfinishedProcessVo.java
0 → 100644
View file @
96a24bf9
package
com
.
ximai
.
mes
.
pro
.
domain
.
vo
;
import
lombok.Data
;
/**
* 工单首道未完成工序名称(生产进度等)
*/
@Data
public
class
WorkorderFirstUnfinishedProcessVo
{
private
String
workorderCode
;
private
String
firstUnfinishedProcessName
;
}
mes/src/main/java/com/ximai/mes/pro/domain/vo/task/ProTaskWorkunitQuery.java
View file @
96a24bf9
...
...
@@ -69,6 +69,14 @@ public class ProTaskWorkunitQuery extends BaseEntity {
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
scheduleEndDateTo
;
@ApiModelProperty
(
"排产日期-开始"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
scheduleDocCreateTimeFrom
;
@ApiModelProperty
(
"排产日期-结束"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
scheduleDocCreateTimeTo
;
@ApiModelProperty
(
"工作中心Id"
)
private
Long
workCenterId
;
...
...
mes/src/main/java/com/ximai/mes/pro/dto/ProFeedbackCheckListDto.java
View file @
96a24bf9
package
com
.
ximai
.
mes
.
pro
.
dto
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.ximai.mes.pro.domain.ProFeedback
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
ProFeedbackCheckListDto
extends
ProFeedback
{
Boolean
isCheckUser
=
false
;
...
...
@@ -16,4 +19,18 @@ public class ProFeedbackCheckListDto extends ProFeedback {
@ApiModelProperty
(
"产品图号"
)
@TableField
(
exist
=
false
)
private
String
customerDrawingNo
;
@ApiModelProperty
(
"排产次数"
)
private
String
taskBatch
;
@ApiModelProperty
(
"工序名称"
)
private
String
processName
;
@ApiModelProperty
(
"报工时间-开始"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
feedbackTimeStart
;
@ApiModelProperty
(
"报工时间-结束"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
feedbackTimeEnd
;
}
mes/src/main/java/com/ximai/mes/pro/mapper/ProFeedbackMapper.java
View file @
96a24bf9
...
...
@@ -58,7 +58,9 @@ public interface ProFeedbackMapper {
"\t workorder.order_code,\n"
+
"\t workorder.order_serial,\n"
+
"\t workorder.customer_drawing_no,\n"
+
"\tit.sap_item_code,ta.arrange_code \n"
+
"\tit.sap_item_code,\n"
+
"\tta.arrange_code,\n"
+
"\tSUBSTRING_INDEX(ta.task_batch, '-', -1) AS task_batch \n"
+
"FROM\n"
+
"\tpro_feedback f\n"
+
"\tLEFT JOIN pro_task_workunit tw ON tw.task_workunit_id = f.task_workunit_id\n"
+
...
...
mes/src/main/java/com/ximai/mes/pro/mapper/proWorkOrder/ProWorkOrderProcessMapper.java
View file @
96a24bf9
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.ximai.mes.pro.domain.proWorkOrder.ProWorkOrderProcess
;
import
com.ximai.mes.pro.domain.proWorkOrder.ProWorkOrderProcessItem
;
import
com.ximai.mes.pro.domain.vo.ProWorkOrderProcessVo
;
import
com.ximai.mes.pro.domain.vo.WorkorderFirstProcessNameVo
;
import
org.apache.ibatis.annotations.Delete
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
...
...
@@ -26,6 +27,11 @@ public interface ProWorkOrderProcessMapper {
*/
List
<
ProWorkOrderProcessVo
>
selectProWorkOrderProcessByWorkOrderId
(
Long
workorderId
);
/**
* 批量查询工单工艺路线首道工序名称(按 idx 升序取第一条)
*/
List
<
WorkorderFirstProcessNameVo
>
selectFirstProcessNameByWorkorderIds
(
@Param
(
"workorderIds"
)
List
<
Long
>
workorderIds
);
/**
* 查询所属所有工序
...
...
mes/src/main/java/com/ximai/mes/pro/mapper/task/ProTaskMapper.java
View file @
96a24bf9
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.ximai.mes.pro.domain.task.ProTask
;
import
com.ximai.mes.pro.domain.vo.ProTaskVo
;
import
com.ximai.mes.pro.domain.vo.WorkorderFirstUnfinishedProcessVo
;
import
com.ximai.mes.report.response.WorkOrderProgressProcessListResponse
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
...
...
@@ -203,4 +204,9 @@ public interface ProTaskMapper extends BaseMapper<ProTask> {
void
deleteByTaskBatch
(
@Param
(
"taskBatch"
)
String
taskBatch
);
List
<
WorkOrderProgressProcessListResponse
>
getProcessList
(
@Param
(
"workorderCode"
)
String
workorderCode
);
/**
* 批量查询工单首道未完成工序名称(按 idx 升序,与生产进度工序状态判定一致)
*/
List
<
WorkorderFirstUnfinishedProcessVo
>
selectFirstUnfinishedProcessNameByWorkorderCodes
(
@Param
(
"workorderCodes"
)
List
<
String
>
workorderCodes
);
}
mes/src/main/java/com/ximai/mes/pro/mapper/task/ProTaskWorkunitMapper.java
View file @
96a24bf9
...
...
@@ -152,7 +152,7 @@ public interface ProTaskWorkunitMapper extends BaseMapper<ProTaskWorkunit> {
"\t, t.client_id, t.client_code, t.client_name, t.client_nick, t.is_last_process, ptw.schedule_start_date\n"
+
"\t, t.duration, ptw.schedule_end_date, t.color_code, t.request_date\n"
+
"\t, t.attr1, t.attr2, t.attr3, t.attr4\n"
+
"\t, t.create_time, t.update_by, t.update_time, ptw.STATUS, ptw.quantity_qualify, ptw.remark\n"
+
"\t, t.create_time
as schedule_doc_create_time
, t.update_by, t.update_time, ptw.STATUS, ptw.quantity_qualify, ptw.remark\n"
+
"\t,ptw.source_task_workunit_id, ptw.quantity_unqualify, ptw.outsource_unit_price,ptw.outsourced, ptw.vendor_id,ptw.vendor_name, mw.workunit_id, mw.workunit_code, mw.workunit_name, ptw.std_working_time,ptw.std_working_time_uom, wo.workorder_code\n"
+
"\t, (case ptw.STATUS when 'BEGINNING' then 1 when 'PREPARE' then 2 when 'PAUSE' then 3 when 'ERROR_STOP' then 4 end) statusIndex\n"
+
"from pro_task_workunit ptw\n"
+
...
...
mes/src/main/java/com/ximai/mes/pro/service/impl/task/ProTaskServiceImpl.java
View file @
96a24bf9
...
...
@@ -1475,8 +1475,8 @@ public class ProTaskServiceImpl implements IProTaskService, ApplicationContextAw
if
(
params
.
getTaskBatchList
()
==
null
||
params
.
getTaskBatchList
().
size
()
<
1
)
return
;
params
.
setTaskBatchList
(
params
.
getTaskBatchList
().
stream
().
distinct
().
collect
(
Collectors
.
toList
()));
Set
<
String
>
affectedWorkorderCodes
=
new
HashSet
<>();
//1.pro_task 2.pro_task_workorder ,3.pro_task_workunit 4.pro_product_qrcode_record 5.pro_workorder
//获取该批次下所有数据
for
(
String
taskBatch
:
params
.
getTaskBatchList
()){
ProTask
proTaskCheck
=
new
ProTask
();
proTaskCheck
.
setTaskBatch
(
taskBatch
);
...
...
@@ -1486,12 +1486,45 @@ public class ProTaskServiceImpl implements IProTaskService, ApplicationContextAw
ExceptionUtil
.
checkTrueThrowException
(
proTasks
.
stream
().
filter
(
proTask
->
!
proTask
.
getStatus
().
equals
(
"NORMARL"
)).
count
()
>
0
,
MessageUtils
.
message
(
"rollback.schedule.status.err"
,
taskBatch
));
ExceptionUtil
.
checkTrueThrowException
(
proFeedbackMapper
.
selectCount
(
proTasks
.
stream
().
map
(
proTask
->
proTask
.
getTaskId
()).
collect
(
Collectors
.
toList
()))
>
0
,
MessageUtils
.
message
(
"rollback.schedule.status.err"
,
taskBatch
));
proTaskMapper
.
deleteByTaskBatch
(
taskBatch
);
proTaskWorkunitMapper
.
deleteByTaskIds
(
proTasks
.
stream
().
map
(
proTask
->
proTask
.
getTaskId
()
).
collect
(
Collectors
.
toList
()));
proTaskWorkorderMapper
.
deleteByTaskIds
(
proTasks
.
stream
().
map
(
proTask
->
proTask
.
getTaskId
()
).
collect
(
Collectors
.
toList
()));
proTaskWorkunitMapper
.
deleteByTaskIds
(
proTasks
.
stream
().
map
(
ProTask:
:
getTaskId
).
collect
(
Collectors
.
toList
()));
proTaskWorkorderMapper
.
deleteByTaskIds
(
proTasks
.
stream
().
map
(
ProTask:
:
getTaskId
).
collect
(
Collectors
.
toList
()));
proProductQrcodeRecordMapper
.
deleteProProductQrcodeRecordByTaskBatch
(
taskBatch
);
proWorkorderMapper
.
rollBACKschedule
(
proTasks
.
get
(
0
).
getArrangeCode
(),
proTasks
.
get
(
0
).
getQuantity
(),
SecurityUtils
.
getUsername
());
String
workorderCode
=
proTasks
.
get
(
0
).
getArrangeCode
();
proWorkorderMapper
.
rollBACKschedule
(
workorderCode
,
proTasks
.
get
(
0
).
getQuantity
(),
SecurityUtils
.
getUsername
());
affectedWorkorderCodes
.
add
(
workorderCode
);
}
for
(
String
workorderCode
:
affectedWorkorderCodes
)
{
resetWorkorderToPublishedIfAllScheduleCancelled
(
workorderCode
);
}
}
/**
* 工单下排产任务已全部取消时,回写工单状态为已发布并清零已排产数量
*/
private
void
resetWorkorderToPublishedIfAllScheduleCancelled
(
String
workorderCode
)
{
if
(
StringUtils
.
isEmpty
(
workorderCode
))
{
return
;
}
ProTask
taskQuery
=
new
ProTask
();
taskQuery
.
setArrangeCode
(
workorderCode
);
if
(
proTaskMapper
.
selectProTaskList
(
taskQuery
).
size
()
>
0
)
{
return
;
}
ProWorkorder
workorder
=
proWorkorderMapper
.
selectProWorkorderWorderCode
(
workorderCode
);
if
(
workorder
==
null
)
{
return
;
}
String
status
=
workorder
.
getStatus
();
if
(!
WorkorderStatusEnum
.
SCHEDULED
.
getValue
().
equals
(
status
)
&&
!
WorkorderStatusEnum
.
ISSUED
.
getValue
().
equals
(
status
)
&&
!
WorkorderStatusEnum
.
PRODUCING
.
getValue
().
equals
(
status
))
{
return
;
}
workorder
.
setStatus
(
WorkorderStatusEnum
.
PUBLISHED
.
getValue
());
workorder
.
setQuantityScheduled
(
BigDecimal
.
ZERO
);
workorder
.
setUpdateBy
(
SecurityUtils
.
getUsername
());
workorder
.
setUpdateTime
(
DateUtils
.
getNowDate
());
proWorkorderService
.
updateProWorkorder
(
workorder
);
}
@Override
...
...
mes/src/main/java/com/ximai/mes/pro/service/impl/task/ProTaskWorkunitServiceImpl.java
View file @
96a24bf9
...
...
@@ -444,8 +444,10 @@ public class ProTaskWorkunitServiceImpl implements IProTaskWorkunitService {
query
.
like
(
StringUtils
.
isNotEmpty
(
proTaskWorkunit
.
getProcessName
()),
"t.process_name"
,
proTaskWorkunit
.
getProcessName
());
query
.
gt
(
proTaskWorkunit
.
getScheduleStartDateFrom
()
!=
null
,
"ptw.schedule_start_date"
,
proTaskWorkunit
.
getScheduleStartDateFrom
());
query
.
le
(
proTaskWorkunit
.
getScheduleStartDateTo
()
!=
null
,
"ptw.schedule_start_date"
,
proTaskWorkunit
.
getScheduleStartDateTo
());
query
.
gt
(
proTaskWorkunit
.
getScheduleEndDateFrom
()
!=
null
,
"ptw.schedule_start_date"
,
proTaskWorkunit
.
getScheduleEndDateFrom
());
query
.
le
(
proTaskWorkunit
.
getScheduleEndDateTo
()
!=
null
,
"ptw.schedule_start_date"
,
proTaskWorkunit
.
getScheduleEndDateTo
());
query
.
gt
(
proTaskWorkunit
.
getScheduleEndDateFrom
()
!=
null
,
"ptw.schedule_end_date"
,
proTaskWorkunit
.
getScheduleEndDateFrom
());
query
.
le
(
proTaskWorkunit
.
getScheduleEndDateTo
()
!=
null
,
"ptw.schedule_end_date"
,
proTaskWorkunit
.
getScheduleEndDateTo
());
query
.
ge
(
proTaskWorkunit
.
getScheduleDocCreateTimeFrom
()
!=
null
,
"t.create_time"
,
proTaskWorkunit
.
getScheduleDocCreateTimeFrom
());
query
.
le
(
proTaskWorkunit
.
getScheduleDocCreateTimeTo
()
!=
null
,
"t.create_time"
,
proTaskWorkunit
.
getScheduleDocCreateTimeTo
());
query
.
eq
(
StringUtils
.
isNotEmpty
(
proTaskWorkunit
.
getArrangeCode
()),
"t.arrange_code"
,
proTaskWorkunit
.
getArrangeCode
());
query
.
eq
(
proTaskWorkunit
.
getOutsourced
()!=
null
,
"ptw.outsourced"
,
proTaskWorkunit
.
getOutsourced
());
query
.
eq
(
StringUtils
.
isNotEmpty
(
proTaskWorkunit
.
getCustomerProjectNo
()),
"wo.customer_project_no"
,
proTaskWorkunit
.
getCustomerProjectNo
());
...
...
mes/src/main/java/com/ximai/mes/report/controller/WorkOrderProgressController.java
View file @
96a24bf9
...
...
@@ -49,11 +49,13 @@ public class WorkOrderProgressController extends BaseController {
@PostMapping
(
"/getList/export"
)
public
void
export
(
HttpServletResponse
response
,
WorkOrderProgressRequest
workOrderProgressRequest
)
{
List
<
WorkOrderProgressListResponse
>
workOrderProgressListResponses
=
workOrderProgressService
.
getList
(
workOrderProgressRequest
);
workOrderProgressListResponses
.
stream
().
forEach
(
workOrderProgressListResponse
->{
workOrderProgressListResponse
.
setStatus
(
WorkorderStatusEnum
.
get
(
workOrderProgressListResponse
.
getStatus
()).
getEnumName
());
workOrderProgressListResponses
.
forEach
(
workOrderProgressListResponse
->
{
WorkorderStatusEnum
statusEnum
=
WorkorderStatusEnum
.
get
(
workOrderProgressListResponse
.
getStatus
());
if
(
statusEnum
!=
null
)
{
workOrderProgressListResponse
.
setStatus
(
statusEnum
.
getEnumName
());
}
workOrderProgressListResponse
.
setWorkorderType
(
dictDataService
.
getDictLabel
(
"mes_workorder_type"
,
workOrderProgressListResponse
.
getWorkorderType
()));
}
);
});
ExcelUtil
<
WorkOrderProgressListResponse
>
util
=
new
ExcelUtil
<>(
WorkOrderProgressListResponse
.
class
);
util
.
exportExcel
(
response
,
workOrderProgressListResponses
,
"生产进度-明细界面导出"
);
}
...
...
mes/src/main/java/com/ximai/mes/report/request/FeedbackRequest.java
View file @
96a24bf9
...
...
@@ -24,6 +24,12 @@ public class FeedbackRequest {
@ApiModelProperty
(
"订单单号"
)
private
String
orderCode
;
@ApiModelProperty
(
"订单序号"
)
private
String
orderSerial
;
@ApiModelProperty
(
"排产次数"
)
private
String
taskBatch
;
/**
* 工单编码
*/
...
...
@@ -119,6 +125,14 @@ public class FeedbackRequest {
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
endDate
;
@ApiModelProperty
(
"计划开始时间-开始"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
scheduleStartDateFrom
;
@ApiModelProperty
(
"计划开始时间-结束"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
scheduleStartDateTo
;
@ApiModelProperty
(
"是否筛查不良"
)
private
Boolean
defectStatus
;
...
...
mes/src/main/java/com/ximai/mes/report/request/WorkOrderProgressRequest.java
View file @
96a24bf9
package
com
.
ximai
.
mes
.
report
.
request
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.ximai.common.annotation.Excel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.List
;
@Data
...
...
@@ -52,4 +54,12 @@ public class WorkOrderProgressRequest {
private
String
orderSerial
;
@ApiModelProperty
(
"排产次数"
)
private
String
taskBatch
;
@ApiModelProperty
(
"排产日期-开始"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
scheduleDateFrom
;
@ApiModelProperty
(
"排产日期-结束"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
scheduleDateTo
;
}
mes/src/main/java/com/ximai/mes/report/response/FeedbackResponse.java
View file @
96a24bf9
...
...
@@ -170,6 +170,11 @@ public class FeedbackResponse extends ProFeedback {
@Excel
(
name
=
"实际工时"
)
private
String
machineTime
;
@ApiModelProperty
(
"计划开始时间"
)
@Excel
(
name
=
"计划开始时间"
,
dateFormat
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
scheduleStartDate
;
/**
* 预计结束时间
*/
...
...
mes/src/main/java/com/ximai/mes/report/response/FeedbackResponseExportByList.java
View file @
96a24bf9
...
...
@@ -153,6 +153,11 @@ public class FeedbackResponseExportByList {
// @ApiModelProperty("实际工时")
// @Excel(name = "实际工时")
private
BigDecimal
machineTimeBigDecimal
;
@ApiModelProperty
(
"计划开始时间"
)
@Excel
(
name
=
"计划开始时间"
,
dateFormat
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
scheduleStartDate
;
/**
* 预计结束时间
*/
...
...
mes/src/main/java/com/ximai/mes/report/response/WorkOrderProgressListResponse.java
View file @
96a24bf9
...
...
@@ -33,7 +33,12 @@ public class WorkOrderProgressListResponse {
private
String
lineName
;
@ApiModelProperty
(
"工单状态"
)
@Excel
(
name
=
"工单状态"
)
private
String
status
;
@ApiModelProperty
(
"生产中状态:首道未完成工序名"
)
@Excel
(
name
=
"生产中状态:首道未完成工序名"
)
private
String
firstUnfinishedProcessName
;
/**
* 工单类型
*/
...
...
@@ -83,5 +88,10 @@ public class WorkOrderProgressListResponse {
@ApiModelProperty
(
"排产次数"
)
@Excel
(
name
=
"排产次数"
)
private
String
taskBatch
;
@ApiModelProperty
(
"排产日期"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Excel
(
name
=
"排产日期"
,
width
=
20
,
dateFormat
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
scheduleDate
;
}
mes/src/main/java/com/ximai/mes/report/service/impl/WorkOrderProgressServiceImp.java
View file @
96a24bf9
package
com
.
ximai
.
mes
.
report
.
service
.
impl
;
import
com.ximai.common.utils.data.StringUtils
;
import
com.ximai.mes.constant.TaskStatusEnum
;
import
com.ximai.mes.constant.WorkorderStatusEnum
;
import
com.ximai.mes.pro.domain.ProFeedback
;
import
com.ximai.mes.pro.domain.proWorkOrder.ProWorkorder
;
import
com.ximai.mes.pro.domain.task.ProTask
;
import
com.ximai.mes.pro.domain.task.ProTaskWorkunit
;
import
com.ximai.mes.pro.domain.vo.WorkorderFirstUnfinishedProcessVo
;
import
com.ximai.mes.pro.mapper.ProFeedbackMapper
;
import
com.ximai.mes.pro.mapper.proWorkOrder.ProWorkorderMapper
;
import
com.ximai.mes.pro.mapper.task.ProTaskMapper
;
...
...
@@ -23,6 +26,8 @@ import java.math.BigDecimal;
import
java.math.RoundingMode
;
import
java.text.NumberFormat
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Service
public
class
WorkOrderProgressServiceImp
implements
WorkOrderProgressService
{
...
...
@@ -53,9 +58,38 @@ public class WorkOrderProgressServiceImp implements WorkOrderProgressService {
}
}
fillFirstUnfinishedProcessName
(
workOrderProgressListResponses
);
return
workOrderProgressListResponses
;
}
/**
* 生产中工单填充首道未完成工序名(与工序明细状态判定一致)
*/
private
void
fillFirstUnfinishedProcessName
(
List
<
WorkOrderProgressListResponse
>
list
)
{
if
(
list
==
null
||
list
.
isEmpty
())
{
return
;
}
List
<
String
>
producingCodes
=
list
.
stream
()
.
filter
(
r
->
WorkorderStatusEnum
.
PRODUCING
.
getValue
().
equals
(
r
.
getStatus
()))
.
map
(
WorkOrderProgressListResponse:
:
getWorkorderCode
)
.
filter
(
StringUtils:
:
isNotEmpty
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
if
(
producingCodes
.
isEmpty
())
{
return
;
}
List
<
WorkorderFirstUnfinishedProcessVo
>
rows
=
proTaskMapper
.
selectFirstUnfinishedProcessNameByWorkorderCodes
(
producingCodes
);
Map
<
String
,
String
>
nameMap
=
rows
.
stream
().
collect
(
Collectors
.
toMap
(
WorkorderFirstUnfinishedProcessVo:
:
getWorkorderCode
,
WorkorderFirstUnfinishedProcessVo:
:
getFirstUnfinishedProcessName
,
(
a
,
b
)
->
a
));
for
(
WorkOrderProgressListResponse
item
:
list
)
{
if
(
WorkorderStatusEnum
.
PRODUCING
.
getValue
().
equals
(
item
.
getStatus
()))
{
item
.
setFirstUnfinishedProcessName
(
nameMap
.
get
(
item
.
getWorkorderCode
()));
}
}
}
@Override
public
List
<
WorkOrderProgressProcessListResponse
>
getProcessList
(
String
workorderCode
)
{
List
<
WorkOrderProgressProcessListResponse
>
workOrderProgressProcessListResponses
=
proTaskMapper
.
getProcessList
(
workorderCode
);
...
...
mes/src/main/resources/mapper/pro/ProFeedbackMapper.xml
View file @
96a24bf9
...
...
@@ -194,6 +194,7 @@
f.machine_time,
f.feedback_time,
workunit.std_working_time,
workunit.schedule_start_date,
workunit.schedule_end_date,
SUBSTRING_INDEX(pt.task_batch, '-', -1) task_batch
...
...
@@ -208,6 +209,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -255,6 +259,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -305,6 +312,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -350,6 +360,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -395,6 +408,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -440,6 +456,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -485,6 +504,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -566,6 +588,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -619,6 +644,7 @@
CAST(f.machine_time AS DECIMAL(10, 2)) as machine_time,
f.feedback_time,
workunit.std_working_time,
workunit.schedule_start_date,
workunit.schedule_end_date
from pro_feedback f
left join pro_task_workunit workunit on workunit.task_id = f.task_id
...
...
@@ -631,6 +657,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -680,6 +709,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -731,6 +763,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -778,6 +813,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -825,6 +863,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -872,6 +913,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -918,6 +962,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
@@ -964,6 +1011,9 @@
<if
test=
"workorderType != null and workorderType != ''"
>
and workorder.workorder_Type = #{workorderType}
</if>
<if
test=
"customerProjectNo!= null and customerProjectNo != '' "
>
and workorder.customer_Project_No like '%${customerProjectNo}%'
</if>
<if
test=
"orderCode != null and orderCode != '' "
>
and workorder.order_Code like '%${orderCode}%'
</if>
<if
test=
"orderSerial != null and orderSerial != ''"
>
and workorder.order_serial like '%${orderSerial}%'
</if>
<if
test=
"taskBatch != null and taskBatch != ''"
>
and SUBSTRING_INDEX(pt.task_batch, '-', -1) = #{taskBatch}
</if>
<if
test=
"scheduleStartDateFrom != null"
>
and workunit.schedule_start_date
>
= #{scheduleStartDateFrom} and workunit.schedule_start_date
<
= #{scheduleStartDateTo}
</if>
<if
test=
"workorderCode != null and workorderCode != '' "
>
and workorder.workorder_Code like '%${workorderCode}%'
</if>
<if
test=
"taskCode != null and taskCode != '' "
>
and pt.task_Code like '%${taskCode}%'
</if>
<if
test=
"productCode != null and productCode != '' "
>
and workorder.product_Code like '%${productCode}%'
</if>
...
...
mes/src/main/resources/mapper/pro/proWorkOrder/ProWorkOrderProcessMapper.xml
View file @
96a24bf9
...
...
@@ -93,6 +93,28 @@
parameterType=
"Long"
resultMap=
"ProWorkOrderProcessResult"
>
<include
refid=
"selectProWorkOrderProcessVo"
/>
where pwop.workorder_id = #{workorderId}
order by pwop.idx asc
</select>
<select
id=
"selectFirstProcessNameByWorkorderIds"
resultType=
"com.ximai.mes.pro.domain.vo.WorkorderFirstProcessNameVo"
>
SELECT workorder_id, process_name AS first_process_name
FROM (
SELECT pwop.workorder_id,
pp.process_name,
ROW_NUMBER() OVER (PARTITION BY pwop.workorder_id ORDER BY pwop.idx ASC, pwop.workorder_process_id ASC) AS rn
FROM pro_work_order_process pwop
LEFT JOIN pro_process pp ON pwop.process_id = pp.process_id
<where>
<if
test=
"workorderIds != null and workorderIds.size() > 0"
>
AND pwop.workorder_id IN
<foreach
collection=
"workorderIds"
item=
"id"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</if>
</where>
) t
WHERE t.rn = 1
</select>
<select
id=
"selectProWorkOrderProcessByWorkorderProcessId"
parameterType=
"Long"
...
...
mes/src/main/resources/mapper/pro/proWorkOrder/ProWorkorderMapper.xml
View file @
96a24bf9
...
...
@@ -267,6 +267,7 @@
pw.erp_update_time ,
item.line_name,
SUBSTRING_INDEX(task.task_batch, '-', -1) task_batch,
MIN(task.create_time) schedule_date,
sum(case task.is_last_process when 0 THEN 0 ELSE fe.quantity_qualify + fe.quantity_unqualify END) as quantity_produced
FROM
pro_workorder pw
...
...
@@ -368,6 +369,9 @@
pw.erp_update_time,
SUBSTRING_INDEX(task.task_batch, '-', -1) ,
item.line_name
<if
test=
"scheduleDateFrom != null"
>
HAVING MIN(task.create_time)
>
= #{scheduleDateFrom} AND MIN(task.create_time)
<
= #{scheduleDateTo}
</if>
</select>
<!-- 进度报表:主表列表,按工单排产时间降序。工序数/报工和用 JOIN 聚合表一次算出,避免每行相关子查询 -->
...
...
@@ -721,7 +725,11 @@
where workorder_id = #{workorderId}
</update>
<update
id=
"rollBACKschedule"
>
update pro_workorder set quantity_scheduled = quantity_scheduled - #{quantity} , update_By = #{quantity}, update_time = now() where workorder_code = #{workorderCode}
update pro_workorder
set quantity_scheduled = quantity_scheduled - #{quantity},
update_by = #{username},
update_time = now()
where workorder_code = #{workorderCode}
</update>
<delete
id=
"deleteProWorkorderByWorkorderId"
parameterType=
"Long"
>
...
...
mes/src/main/resources/mapper/pro/task/ProTaskMapper.xml
View file @
96a24bf9
...
...
@@ -473,6 +473,29 @@
select * from pro_task where arrange_code = #{workorderCode} order by task_id
</select>
<select
id=
"selectFirstUnfinishedProcessNameByWorkorderCodes"
resultType=
"com.ximai.mes.pro.domain.vo.WorkorderFirstUnfinishedProcessVo"
>
SELECT arrange_code AS workorder_code, process_name AS first_unfinished_process_name
FROM (
SELECT t.arrange_code,
t.process_name,
ROW_NUMBER() OVER (PARTITION BY t.arrange_code ORDER BY t.idx ASC, t.task_id ASC) AS rn
FROM pro_task t
WHERE t.arrange_code IN
<foreach
collection=
"workorderCodes"
item=
"code"
open=
"("
separator=
","
close=
")"
>
#{code}
</foreach>
AND (
NOT EXISTS (SELECT 1 FROM pro_task_workunit tw WHERE tw.task_id = t.task_id)
OR (
(SELECT COUNT(*) FROM pro_task_workunit tw WHERE tw.task_id = t.task_id)
>
(SELECT COUNT(*) FROM pro_task_workunit tw WHERE tw.task_id = t.task_id AND tw.status = 'FINISHED')
)
)
) x
WHERE x.rn = 1
</select>
<insert
id=
"insertProTask"
parameterType=
"ProTask"
useGeneratedKeys=
"true"
keyProperty=
"taskId"
>
insert into pro_task
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
...
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