|
@@ -1563,9 +1563,9 @@ public class ReportController {
|
|
|
if (Constant.HONG_HU_COMPANY_ID == company.getId()) {
|
|
|
for (Report report : reportList) {
|
|
|
//校验分组为车间的分组时,工单号是否必填
|
|
|
- if (report.getGroupId() != null) {
|
|
|
- String groupName = taskGroupService.getById(report.getGroupId()).getName();
|
|
|
- if (groupName.contains("车间") && StringUtils.isEmpty(report.getExtraField4())) {
|
|
|
+ if (report.getGroupId() != null && report.getGroupId() != 0) {
|
|
|
+ TaskGroup group = taskGroupService.getById(report.getGroupId());
|
|
|
+ if (group != null && group.getName().contains("车间") && StringUtils.isEmpty(report.getExtraField4())) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
httpRespMsg.setError("当前选择了带车间的工时分组,对应的工单号必填");
|
|
|
return httpRespMsg;
|
|
@@ -1577,29 +1577,31 @@ public class ReportController {
|
|
|
if (collect.size() > 0) {
|
|
|
List<ErpOrderInfo> orderList = erpOrderInfoMapper.selectList(new QueryWrapper<ErpOrderInfo>().in("order_id", collect));
|
|
|
for (Report report : reportList) {
|
|
|
- String errorMsg = null;
|
|
|
- Optional<ErpOrderInfo> first = orderList.stream().filter(order -> order.getOrderId().equals(report.getExtraField4())).findFirst();
|
|
|
- if (first.isPresent()) {
|
|
|
- if (first.get().getDeptId() == null) {
|
|
|
- errorMsg = "工单号:"+report.getExtraField4()+"无部门id";
|
|
|
- } else {
|
|
|
- Department deptItem = departmentMapper.selectOne(new QueryWrapper<Department>().eq("dept_code", first.get().getDeptId()));
|
|
|
- if (deptItem != null) {
|
|
|
- if (!deptItem.getDepartmentId().equals(report.getDeptId())) {
|
|
|
- report.setDeptId(deptItem.getDepartmentId());
|
|
|
- report.setIsAssist(true);
|
|
|
- }
|
|
|
+ if (!StringUtils.isEmpty(report.getExtraField4())) {
|
|
|
+ String errorMsg = null;
|
|
|
+ Optional<ErpOrderInfo> first = orderList.stream().filter(order -> order.getOrderId().equals(report.getExtraField4())).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ if (first.get().getDeptId() == null) {
|
|
|
+ errorMsg = "工单号:"+report.getExtraField4()+"无部门id";
|
|
|
} else {
|
|
|
- errorMsg = "工时系统中尚未设置部门编号:"+first.get().getDeptId();
|
|
|
+ Department deptItem = departmentMapper.selectOne(new QueryWrapper<Department>().eq("dept_code", first.get().getDeptId()));
|
|
|
+ if (deptItem != null) {
|
|
|
+ if (!deptItem.getDepartmentId().equals(report.getDeptId())) {
|
|
|
+ report.setDeptId(deptItem.getDepartmentId());
|
|
|
+ report.setIsAssist(true);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ errorMsg = "工时系统中尚未设置部门编号:"+first.get().getDeptId();
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ errorMsg = "erpOrderInfo表中工单号不存在:"+report.getExtraField4();
|
|
|
+ }
|
|
|
+ if (errorMsg != null) {
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ httpRespMsg.setError(errorMsg);
|
|
|
+ return httpRespMsg;
|
|
|
}
|
|
|
- } else {
|
|
|
- errorMsg = "erpOrderInfo表中工单号不存在:"+report.getExtraField4();
|
|
|
- }
|
|
|
- if (errorMsg != null) {
|
|
|
- HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- httpRespMsg.setError(errorMsg);
|
|
|
- return httpRespMsg;
|
|
|
}
|
|
|
}
|
|
|
}
|