Browse Source

fix: 分拣送空托错误、看板数据、工单号重复并发问题

master
李永德 1 year ago
parent
commit
2507655221
  1. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java
  2. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/coderule/impl/SysCodeRuleServiceImpl.java
  3. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/dao/ProductTaskVo.java
  4. 19
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/mapper/CockPitMapper.xml
  5. 1
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/autotask/AutoIssueWorkOrder.java
  6. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.xml
  7. 8
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java
  8. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java
  9. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJSKTask.java
  10. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/CommonUtils.java
  11. 2
      lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml
  12. 2
      lms/nladmin-system/nlsso-server/src/test/java/org/nl/ext/TestDemo.java

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/LogMessageConstant.java

@ -41,6 +41,6 @@ public class LogMessageConstant {
/** 背景颜色:黄色 */ /** 背景颜色:黄色 */
public final static String BACKGROUND_YELLOW = "\u001B[43m"; public final static String BACKGROUND_YELLOW = "\u001B[43m";
/** 索引路径 */ /** 索引路径 */
public final static String INDEX_DIR = "D:\\lucene\\index"; public final static String INDEX_DIR = "E:\\lucene\\index";
} }

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/coderule/impl/SysCodeRuleServiceImpl.java

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.common.domain.query.PageQuery; import org.nl.common.domain.query.PageQuery;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
@ -59,6 +60,7 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
} }
@Override @Override
@Transactional(propagation=Propagation.REQUIRES_NEW)
public String codeDemo(Map form) { public String codeDemo(Map form) {
String code = (String) form.get("code"); String code = (String) form.get("code");
String id = codeRuleMapper.selectOne(new LambdaQueryWrapper<SysCodeRule>().eq(SysCodeRule::getCode, code)).getId(); String id = codeRuleMapper.selectOne(new LambdaQueryWrapper<SysCodeRule>().eq(SysCodeRule::getCode, code)).getId();

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/dao/ProductTaskVo.java

@ -13,6 +13,8 @@ public class ProductTaskVo {
private String workorder_code; private String workorder_code;
private String team; private String team;
private String material_name; private String material_name;
private String material_spec;
private String material_model;
private String planproducestart_date; private String planproducestart_date;
private String plan_qty; private String plan_qty;
private String real_qty; private String real_qty;

19
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/mapper/CockPitMapper.xml

@ -3,10 +3,10 @@
<mapper namespace="org.nl.wms.cockpit.service.mapper.CockPitMapper"> <mapper namespace="org.nl.wms.cockpit.service.mapper.CockPitMapper">
<select id="getPressProductHeaderList" resultType="org.nl.wms.cockpit.service.dao.PressProductHeaderVo"> <select id="getPressProductHeaderList" resultType="org.nl.wms.cockpit.service.dao.PressProductHeaderVo">
SELECT SELECT
SUM(w.plan_qty) AS plan_qty, IF(LENGTH(SUM(w.plan_qty))>0,SUM(w.plan_qty),0) AS plan_qty,
SUM(w.real_qty) AS real_qty, IF(LENGTH(SUM(w.real_qty))>0,SUM(w.real_qty),0) AS real_qty,
SUM(w.qualified_qty) AS qualified_qty, IF(LENGTH(SUM(w.qualified_qty))>0,SUM(w.qualified_qty),0) AS qualified_qty,
SUM(w.unqualified_qty) AS unqualified_qty IF(LENGTH(SUM(w.unqualified_qty))>0,SUM(w.unqualified_qty),0) AS unqualified_qty
FROM FROM
pdm_bd_workorder w pdm_bd_workorder w
WHERE WHERE
@ -38,15 +38,17 @@
</select> </select>
<select id="getProductionTaskList" resultType="org.nl.wms.cockpit.service.dao.ProductTaskVo"> <select id="getProductionTaskList" resultType="org.nl.wms.cockpit.service.dao.ProductTaskVo">
SELECT SELECT
w.point_name AS device, p.ext_point_code AS device,
w.workorder_code, w.workorder_code,
w.team, w.team,
m.material_name, m.material_name,
m.material_spec,
m.material_model,
w.planproducestart_date, w.planproducestart_date,
w.plan_qty, w.plan_qty,
w.real_qty, w.real_qty,
w.unqualified_qty, IF(LENGTH(w.unqualified_qty)>0,w.unqualified_qty,0) AS unqualified_qty,
FORMAT((w.qualified_qty / w.plan_qty) * 100, 1) AS qualified_rate, IF(LENGTH(FORMAT((w.qualified_qty / w.plan_qty) * 100, 1)>0),FORMAT((w.qualified_qty / w.plan_qty) * 100, 1),0) AS qualified_rate,
CASE w.workorder_status CASE w.workorder_status
WHEN '1' THEN '未生产' WHEN '1' THEN '未生产'
WHEN '2' THEN '已下发' WHEN '2' THEN '已下发'
@ -55,12 +57,13 @@
WHEN '5' THEN '完成' WHEN '5' THEN '完成'
ELSE '' ELSE ''
END AS workorder_status, END AS workorder_status,
w.operator, IF(LENGTH(w.operator)>0,w.operator,'-') AS operator,
IF(LENGTH(w.realproducestart_date)>0,w.realproducestart_date,'-') AS realproducestart_date, IF(LENGTH(w.realproducestart_date)>0,w.realproducestart_date,'-') AS realproducestart_date,
IF(LENGTH(w.realproduceend_date)>0,w.realproduceend_date,'-') AS realproduceend_date IF(LENGTH(w.realproduceend_date)>0,w.realproduceend_date,'-') AS realproduceend_date
FROM FROM
`pdm_bd_workorder` w `pdm_bd_workorder` w
LEFT JOIN md_base_material m ON m.material_id = w.material_id LEFT JOIN md_base_material m ON m.material_id = w.material_id
LEFT JOIN sch_base_point p ON w.point_code = p.point_code
WHERE w.region_code = 'YZ' WHERE w.region_code = 'YZ'
ORDER BY w.team DESC, w.workorder_status ORDER BY w.team DESC, w.workorder_status
</select> </select>

1
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/autotask/AutoIssueWorkOrder.java

@ -45,6 +45,7 @@ public class AutoIssueWorkOrder {
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try { try {
if (tryLock) { if (tryLock) {
// todo: 获取每台设备的第一条工单
// 获取所有设备号 // 获取所有设备号
List<String> deviceCodes = workorderService.getTheDayUnProducedDevice(); List<String> deviceCodes = workorderService.getTheDayUnProducedDevice();
// 查找该设备未生产的工单去下发 // 查找该设备未生产的工单去下发

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.xml

@ -70,7 +70,7 @@
FROM FROM
`pdm_bd_workorder` pw `pdm_bd_workorder` pw
LEFT JOIN md_base_material mm ON mm.material_id = pw.material_id LEFT JOIN md_base_material mm ON mm.material_id = pw.material_id
WHERE pw.region_code = 'FJ' AND pw.point_code LIKE 'RG%' AND pw.workorder_status IN ('1','3','4') WHERE pw.region_code = 'FJ' AND pw.point_code LIKE 'RG%' AND pw.workorder_status IN ('1','2','3','4')
</select> </select>
<select id="getRunningTaskByStart" resultType="org.nl.wms.pda.service.dao.vo.TaskShowVo"> <select id="getRunningTaskByStart" resultType="org.nl.wms.pda.service.dao.vo.TaskShowVo">
SELECT SELECT

8
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java

@ -3,6 +3,7 @@ package org.nl.wms.pdm.workorder.service.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpStatus; import cn.hutool.http.HttpStatus;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -10,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.common.domain.query.PageQuery; import org.nl.common.domain.query.PageQuery;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
@ -35,6 +37,7 @@ import org.nl.wms.sch.point.service.dao.SchBasePoint;
import org.nl.wms.sch.task_manage.GeneralDefinition; import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum; import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
import org.nl.wms.sch.task_manage.enums.WorkOrderStatusEnum; import org.nl.wms.sch.task_manage.enums.WorkOrderStatusEnum;
import org.nl.wms.util.CommonUtils;
import org.nl.wms.util.TaskUtils; import org.nl.wms.util.TaskUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -77,18 +80,21 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper,
return pages; return pages;
} }
@SneakyThrows
@Override @Override
public void create(PdmBdWorkorder entity) { public void create(PdmBdWorkorder entity) {
String currentUserId = SecurityUtils.getCurrentUserId(); String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName(); String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now(); String now = DateUtil.now();
String today = DateUtil.format(DateUtil.date(), "yyyyMMdd");
// 点位编码和点位名称为父点位 // 点位编码和点位名称为父点位
entity.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextIdStr()); entity.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextIdStr());
entity.setWorkorder_code(CodeUtil.getNewCode("PDM_SHIFTORDER")); entity.setWorkorder_code(CodeUtil.getNewCode("PDM_SHIFTORDER"));
entity.setCreate_id(currentUserId); entity.setCreate_id(currentUserId);
entity.setCreate_name(nickName); entity.setCreate_name(nickName);
entity.setCreate_time(now); entity.setCreate_time(now);
entity.setTeam(CommonUtils.getDayShift());
entity.setProduce_date(today);
entity.setUpdate_id(currentUserId); entity.setUpdate_id(currentUserId);
entity.setUpdate_name(nickName); entity.setUpdate_name(nickName);
entity.setUpdate_time(now); entity.setUpdate_time(now);

3
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java

@ -375,10 +375,9 @@ public class FJMKTask extends AbstractTask {
PointUtils.setUpdateByType(fjcPointObj, taskFinishedType); PointUtils.setUpdateByType(fjcPointObj, taskFinishedType);
pointService.updateById(fjcPointObj); pointService.updateById(fjcPointObj);
} }
// 组盘设置已经解绑
SchBaseVehiclematerialgroup vehicleMaterialGroupObj = SchBaseVehiclematerialgroup vehicleMaterialGroupObj =
vehiclematerialgroupService.getById(taskObj.getGroup_id()); vehiclematerialgroupService.getById(taskObj.getGroup_id());
vehicleMaterialGroupObj.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue()); // vehicleMaterialGroupObj.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue());
vehicleMaterialGroupObj.setTask_code(taskObj.getTask_code()); vehicleMaterialGroupObj.setTask_code(taskObj.getTask_code());
vehicleMaterialGroupObj.setPoint_code(bzxPointObj.getPoint_code()); // 当前位置 vehicleMaterialGroupObj.setPoint_code(bzxPointObj.getPoint_code()); // 当前位置
vehicleMaterialGroupObj.setPoint_name(bzxPointObj.getPoint_name()); vehicleMaterialGroupObj.setPoint_name(bzxPointObj.getPoint_name());

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJSKTask.java

@ -3,6 +3,7 @@ package org.nl.wms.sch.task_manage.task.tasks.fj;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.esotericsoftware.minlog.Log;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
import org.nl.system.service.notice.ISysNoticeService; import org.nl.system.service.notice.ISysNoticeService;
import org.nl.wms.ext.mes.service.WmsToMesService; import org.nl.wms.ext.mes.service.WmsToMesService;
@ -211,7 +212,11 @@ public class FJSKTask extends AbstractTask {
TaskUtils.setGroupUpdateByType(vehicleMaterialGroupObj, taskFinishedType); TaskUtils.setGroupUpdateByType(vehicleMaterialGroupObj, taskFinishedType);
vehiclematerialgroupService.updateById(vehicleMaterialGroupObj); vehiclematerialgroupService.updateById(vehicleMaterialGroupObj);
// todo: 上报mes, 物料出库 // todo: 上报mes, 物料出库
wmsToMesService.reportSemiProductionInfoOut(taskObj.getGroup_id()); try {
wmsToMesService.reportSemiProductionInfoOut(taskObj.getGroup_id());
} catch (Exception e) {
Log.error("上报MES物料出库失败, {}", e.getMessage());
}
} }
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark(GeneralDefinition.TASK_FINISH); taskObj.setRemark(GeneralDefinition.TASK_FINISH);

9
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/CommonUtils.java

@ -111,13 +111,4 @@ public class CommonUtils {
return list; return list;
} }
public static String CurrentData() {
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
// 格式化日期为"20231030"
String formattedDate = currentDate.format(formatter);
return formattedDate;
}
} }

2
lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml

@ -42,7 +42,7 @@ spring:
freemarker: freemarker:
check-template-location: false check-template-location: false
profiles: profiles:
active: test active: prod
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
data: data:

2
lms/nladmin-system/nlsso-server/src/test/java/org/nl/ext/TestDemo.java

@ -153,5 +153,7 @@ public class TestDemo {
void testNumberStr() { void testNumberStr() {
System.out.println("1234564".matches("\\d+")); System.out.println("1234564".matches("\\d+"));
System.out.println("1234你好564".matches("\\d+")); System.out.println("1234你好564".matches("\\d+"));
System.out.println(DateUtil.format(DateUtil.date(), "yyMMdd"));
System.out.println(String.format("%03d", 12));
} }
} }

Loading…
Cancel
Save