Browse Source

fix: 手持、自动工单、点位编码

master
李永德 1 year ago
parent
commit
a365a3bfb6
  1. 21
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/CodeUtil.java
  2. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/coderule/impl/SysCodeRuleServiceImpl.java
  3. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/autotask/AutoIssueWorkOrder.java
  4. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java
  5. 14
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/controller/PdaController.java
  6. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/PdaService.java
  7. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.java
  8. 18
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.xml
  9. 18
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/vo/RequestMaterialInfoVo.java
  10. 21
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java
  11. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/dao/mapper/PdmBdWorkorderMapper.xml
  12. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java
  13. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/ISchBasePointService.java
  14. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/mapper/SchBasePointMapper.java
  15. 8
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/mapper/SchBasePointMapper.xml
  16. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java
  17. 31
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoRestorePoint.java
  18. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java
  19. 1
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJSLTask.java
  20. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java
  21. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yao/CYZCTask.java
  22. 2
      lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml
  23. 5
      lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue

21
lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/CodeUtil.java

@ -1,19 +1,36 @@
package org.nl.common.utils;
import lombok.SneakyThrows;
import org.nl.common.exception.BadRequestException;
import org.nl.config.SpringContextHolder;
import org.nl.system.service.coderule.ISysCodeRuleService;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import java.util.*;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
public class CodeUtil {
@SneakyThrows
public static String getNewCode(String ruleCode){
synchronized (ruleCode){
RedissonClient redissonClient = SpringContextHolder.getBean(RedissonClient.class);
RLock lock = redissonClient.getLock(ruleCode);
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
try {
if (tryLock) {
String flag = "1";
HashMap<String,String> map = new HashMap<>();
map.put("flag",flag);
map.put("code",ruleCode);
return SpringContextHolder.getBean(ISysCodeRuleService.class).codeDemo(map);
} else {
throw new BadRequestException("系统繁忙,稍后在试");
}
} finally {
if (tryLock) {
lock.unlock();
}
}
}

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

@ -59,6 +59,7 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
return page;
}
@SneakyThrows
@Override
@Transactional(propagation=Propagation.REQUIRES_NEW)
public String codeDemo(Map form) {
@ -66,7 +67,9 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
String id = codeRuleMapper.selectOne(new LambdaQueryWrapper<SysCodeRule>().eq(SysCodeRule::getCode, code)).getId();
// 如果flag = 1就执行更新数据库的操作
String flag = (String) form.get("flag");
List<SysCodeRuleDetail> ruleDetails = codeRuleDetailMapper.selectList(new LambdaQueryWrapper<SysCodeRuleDetail>().eq(SysCodeRuleDetail::getCode_rule_id, id));
List<SysCodeRuleDetail> ruleDetails = codeRuleDetailMapper.selectList(new LambdaQueryWrapper<SysCodeRuleDetail>()
.eq(SysCodeRuleDetail::getCode_rule_id, id)
.orderByAsc(SysCodeRuleDetail::getSort_num));
String demo = "";
boolean isSame = true;
for(SysCodeRuleDetail detail : ruleDetails) {
@ -96,7 +99,7 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
String numValue = "";
int step = Integer.parseInt(detail.getStep());
Long maxValue = Long.valueOf(detail.getMax_value());
if (!isSame && (Long.valueOf(detail.getCurrent_value()) + step) > maxValue) {
if (!isSame || (Long.valueOf(detail.getCurrent_value()) + step) > maxValue) {
numValue = detail.getInit_value();
} else {
numValue = Integer.parseInt(detail.getCurrent_value()) + step + "";

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

@ -53,6 +53,9 @@ public class AutoIssueWorkOrder {
// 判断是否有工单
List<PdmBdWorkorder> lists = workorderService.getTheDayProducedWorkOrderByDevice(s.getPoint_code());
if (lists.size() > 0) return;
// 已生产就退出
if (s.getWorkorder_status().equals(WorkOrderStatusEnum.PRODUCING.getCode())
|| s.getWorkorder_code().equals(WorkOrderStatusEnum.ISSUED.getCode())) return;
AcsWorkOrderVo acsWorkOrderVo = workorderService.toAcsWorkOrderById(s.getWorkorder_id());
// 获取一个下发
List<AcsWorkOrderVo> list = new CopyOnWriteArrayList<>();
@ -60,6 +63,7 @@ public class AutoIssueWorkOrder {
AcsResponse resultForAcs;
try {
resultForAcs = wmsToAcsService.order(list);
log.info("自动下发工单:{}", list);
} catch (Exception e) {
log.error("工单下发异常:" + e.getMessage());
// 通知

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java

@ -56,4 +56,6 @@ public interface AcsToWmsService {
GetPalletizeResponse getVehicleInfo(JSONObject param);
/** 实时修改点位状态 */
BaseResponse realTimeSetPoint(JSONObject param);
/** 布料记录 - 上传MES */
// BaseResponse applyOneGrab(JSONObject param);
}

14
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/controller/PdaController.java

@ -13,6 +13,7 @@ import org.nl.wms.das.device.operation.service.dao.DasDeviceOperationRecord;
import org.nl.wms.pda.service.PdaService;
import org.nl.wms.pda.service.dao.dto.*;
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
import org.nl.wms.pda.service.dao.vo.RequestMaterialInfoVo;
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
import org.springframework.beans.factory.annotation.Autowired;
@ -261,4 +262,17 @@ public class PdaController {
return new ResponseEntity<>(pdaService.updateData(shelfSaveDto), HttpStatus.OK);
}
@PostMapping("/mix/requestInfo")
@Log("要料信息-查询")
@ApiOperation("要料信息-查询")
public ResponseEntity<Object>requestInfo(){
return new ResponseEntity<>(pdaService.requestInfo(), HttpStatus.OK);
}
@PostMapping("/mix/deleteInfo")
@Log("要料信息-查询")
@ApiOperation("要料信息-查询")
public ResponseEntity<PdaResponseVo>deleteMaterialInfo(@RequestBody RequestMaterialInfoVo requestMaterialInfoVo){
return new ResponseEntity<>(pdaService.deleteMaterialInfo(requestMaterialInfoVo), HttpStatus.OK);
}
}

5
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/PdaService.java

@ -2,6 +2,7 @@ package org.nl.wms.pda.service;
import org.nl.wms.pda.service.dao.dto.*;
import org.nl.wms.pda.service.dao.vo.*;
import org.nl.wms.pdm.record.service.dao.PdmBdRequestMaterialRecord;
import java.util.List;
@ -65,4 +66,8 @@ public interface PdaService {
PdaResponseVo updateData(ShelfSaveDto shelfSaveDto);
List<DropdownListVo> pressPointList();
List<RequestMaterialInfoVo> requestInfo();
PdaResponseVo deleteMaterialInfo(RequestMaterialInfoVo requestMaterialInfoVo);
}

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

@ -71,4 +71,10 @@ public interface PdaMapper {
* @return
*/
List<DropdownListVo> getAllPressPoint();
/**
* 要料信息
* @return
*/
List<RequestMaterialInfoVo> requestInfo();
}

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

@ -149,4 +149,22 @@
p.region_code = 'YZ'
AND p.point_type = '2'
</select>
<select id="requestInfo" resultType="org.nl.wms.pda.service.dao.vo.RequestMaterialInfoVo">
SELECT
pr.record_id,
pr.device_code,
pr.material_id,
pr.workorder_id,
pr.create_time,
CASE pr.is_finish
WHEN 0 THEN
'否'
ELSE
'是'
END AS is_finish
FROM
`pdm_bd_request_material_record` pr
WHERE pr.is_delete = false
ORDER BY pr.create_time ASC
</select>
</mapper>

18
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/vo/RequestMaterialInfoVo.java

@ -0,0 +1,18 @@
package org.nl.wms.pda.service.dao.vo;
import lombok.Data;
/**
* @Author: lyd
* @Description: 请求物料信息
* @Date: 2023/11/10
*/
@Data
public class RequestMaterialInfoVo {
private String record_id;
private String device_code;
private String material_id;
private String workorder_id;
private String create_time;
private String is_finish;
}

21
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java

@ -17,6 +17,8 @@ import org.nl.wms.pda.service.PdaService;
import org.nl.wms.pda.service.dao.dto.*;
import org.nl.wms.pda.service.dao.mapper.PdaMapper;
import org.nl.wms.pda.service.dao.vo.*;
import org.nl.wms.pdm.record.service.IPdmBdRequestMaterialRecordService;
import org.nl.wms.pdm.record.service.dao.PdmBdRequestMaterialRecord;
import org.nl.wms.pdm.vehiclebiding.service.IPdmBdVehicleBindingService;
import org.nl.wms.pdm.vehiclebiding.service.dao.PdmBdVehicleBinding;
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
@ -64,6 +66,8 @@ public class PdaServiceImpl implements PdaService {
private IPdmBdVehicleBindingService vehicleBindingService;
@Autowired
private WmsToAcsService wmsToAcsService;
@Autowired
private IPdmBdRequestMaterialRecordService requestMaterialRecordService;
@Override
public List<DropdownListVo> getDeviceInfo() {
// 暂定压机区域
@ -389,6 +393,23 @@ public class PdaServiceImpl implements PdaService {
return pdaMapper.getAllPressPoint();
}
@Override
public List<RequestMaterialInfoVo> requestInfo() {
return pdaMapper.requestInfo();
}
@Override
public PdaResponseVo deleteMaterialInfo(RequestMaterialInfoVo requestMaterialInfoVo) {
PdmBdRequestMaterialRecord materialRecord = requestMaterialRecordService.getById(
requestMaterialInfoVo.getRecord_id());
if (ObjectUtil.isEmpty(materialRecord) || materialRecord.getIs_delete()) {
throw new BadRequestException(requestMaterialInfoVo.getRecord_id() + "不存在或已删除");
}
materialRecord.setIs_delete(true);
requestMaterialRecordService.updateById(materialRecord);
return PdaResponseVo.pdaResultOk("删除成功");
}
/**
* 保存组盘信息
* @param shelfSaveDto

5
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/dao/mapper/PdmBdWorkorderMapper.xml

@ -37,7 +37,7 @@
w.plan_qty,
m.half_material_code AS material_code,
m.material_spec AS product_code,
m.material_spec AS brick_code,
0 AS brick_code,
m.material_model AS formula,
IF(LENGTH(m.a_long_side) > 0,m.a_long_side,0) AS a,
IF(LENGTH(m.b_short_side) > 0,m.b_short_side,0) AS b,
@ -94,7 +94,7 @@
w.plan_qty,
m.half_material_code AS material_code,
m.material_spec AS product_code,
m.material_spec AS brick_code,
0 AS brick_code,
m.material_model AS formula,
IF(LENGTH(m.a_long_side) > 0,m.a_long_side,0) AS a,
IF(LENGTH(m.b_short_side) > 0,m.b_short_side,0) AS b,
@ -136,6 +136,7 @@
`pdm_bd_workorder` w
WHERE w.produce_date = CURDATE() AND w.region_code = 'YZ'
AND w.workorder_status IN ('1','2','3')
ORDER BY w.workorder_status DESC, w.planproducestart_date
) AS ranked
WHERE row_num = 1
</select>

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

@ -85,12 +85,9 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper,
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
String today = DateUtil.format(DateUtil.date(), "yyyyMMdd");
Integer integer = pdmBdWorkorderMapper.selectCount(new LambdaQueryWrapper<PdmBdWorkorder>()
.eq(PdmBdWorkorder::getProduce_date, today));
// 点位编码和点位名称为父点位
entity.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextIdStr());
// entity.setWorkorder_code(CodeUtil.getNewCode("PDM_SHIFTORDER"));
entity.setWorkorder_code(today + String.format("%03d", integer));
entity.setWorkorder_code(CodeUtil.getNewCode("PDM_SHIFTORDER"));
entity.setCreate_id(currentUserId);
entity.setCreate_name(nickName);
entity.setCreate_time(now);

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/ISchBasePointService.java

@ -61,4 +61,10 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
* @param points
*/
void changeLock(JSONObject points);
/**
* 获取所有未解锁的点位
* @return
*/
List<SchBasePoint> getAllUnlockAbnormalPoints();
}

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/mapper/SchBasePointMapper.java

@ -17,4 +17,6 @@ public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
* @param used
*/
void batchChangeUsed(List<String> pointCodes, Boolean used);
List<SchBasePoint> getAllUnlockAbnormalPoints();
}

8
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/mapper/SchBasePointMapper.xml

@ -12,4 +12,12 @@
</foreach>
</where>
</update>
<select id="getAllUnlockAbnormalPoints" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
SELECT
p.*
FROM
`sch_base_point` p
LEFT JOIN sch_base_task t ON t.task_code = p.ing_task_code
WHERE p.ing_task_code IS NOT NULL AND p.ing_task_code != '' AND (t.task_status = '5' OR t.task_status = '6')
</select>
</mapper>

5
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java

@ -203,4 +203,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
this.updateBatchById(pointList);
}
@Override
public List<SchBasePoint> getAllUnlockAbnormalPoints() {
return pointMapper.getAllUnlockAbnormalPoints();
}
}

31
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoRestorePoint.java

@ -0,0 +1,31 @@
package org.nl.wms.sch.task_manage;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.wms.sch.point.service.ISchBasePointService;
import org.nl.wms.sch.point.service.dao.SchBasePoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Author: lyd
* @Description: 自动恢复异常点位
* @Date: 2023/11/15
*/
@Slf4j
@Component
@Order(value = 1)
public class AutoRestorePoint {
@Autowired
private ISchBasePointService pointService;
@SneakyThrows
public void run() {
List<SchBasePoint> pointList = pointService.getAllUnlockAbnormalPoints();
pointList.forEach(point -> point.setIng_task_code(""));
pointService.updateBatchById(pointList);
}
}

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

@ -203,6 +203,9 @@ public class FJMKTask extends AbstractTask {
JSONObject stackParameters = param.getJSONObject("palletize");
String deviceCode = param.getString("device_code");
String vehicleCode = TaskUtils.defaultVehicleCode(param.getString("vehicle_code"));
if (vehicleCode == null) {
throw new BadRequestException("载具号不能为空");
}
String isFull = param.getString("is_full");
if (isFull == null) {
isFull = GeneralDefinition.YES;

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

@ -135,6 +135,7 @@ public class FJSLTask extends AbstractTask {
.or()
.eq(SchBasePoint::getIng_task_code, ""))
.eq(SchBasePoint::getIs_used, true)
.ne(SchBasePoint::getLayer_num, "3")
.orderByAsc(SchBasePoint::getIn_order_seq)
.orderByAsc(SchBasePoint::getPoint_code);
List<SchBasePoint> schBasePoints = pointService.list(lam);

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

@ -244,9 +244,9 @@ public class HNMLTask extends AbstractTask {
if (ObjectUtil.isNotEmpty(one)) {
// 给组盘数据设置批次:压制工单+混砂机号+碾次
groupEntity.setWorkorder_code(one.getWorkorder_code());
StringBuilder pcsn = new StringBuilder();
pcsn.append(one.getWorkorder_code()).append(groupEntity.getPoint_code()).append(groupEntity.getMix_times());
groupEntity.setPcsn(pcsn.toString());
// StringBuilder pcsn = new StringBuilder();
// pcsn.append(one.getWorkorder_code()).append(groupEntity.getPoint_code()).append(groupEntity.getMix_times());
// groupEntity.setPcsn(pcsn.toString());
groupEntity.setPoint_code(endPointObj.getPoint_code()); // 当前位置
groupEntity.setPoint_name(endPointObj.getPoint_name());
groupEntity.setMove_way(groupEntity.getMove_way() + " -> " + endPointObj.getPoint_code());
@ -333,6 +333,7 @@ public class HNMLTask extends AbstractTask {
groupEntity.setMove_way(basePoint.getPoint_code()); // 头次
groupEntity.setMix_times(mixTimes); // 碾次
groupEntity.setInstorage_time(DateUtil.now());
groupEntity.setPcsn(packNo); // update: 11/15批次修改成吨袋号
groupEntity.setMaterial_weight(ObjectUtil.isNotEmpty(weight)// 重量
? weight
: BigDecimal.valueOf(0));

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

@ -139,6 +139,9 @@ public class CYZCTask extends AbstractTask {
// 查找组盘表信息,不做修改
String vehicleCode = TaskUtils.defaultVehicleCode(param.getString("vehicle_code"));
String vehicleType = param.getString("vehicle_type");
if (ObjectUtil.isEmpty(vehicleCode)) {
throw new BadRequestException("载具号不能为空");
}
if (vehicleCode == null) {
vehicleType = GeneralDefinition.STEEL_TRAY;
}

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

@ -123,7 +123,7 @@ mybatis-plus:
configuration:
map-underscore-to-camel-case: false
jdbc-type-for-null: null
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations:
- classpath:org.nl.**.mapper/*.xml
global-config:

5
lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue

@ -628,7 +628,10 @@ export default {
this.form.raw_material_code = row.material_code
}
this.form.pack_method = row.pack_method
this.form.vehicle_type = row.pack_palletspec
const result = Object.keys(this.dict.label.vehicle_type).find(key => this.dict.label.vehicle_type[key] === row.pack_palletspec)
if (result) {
this.form.vehicle_type = result
}
},
clearRecordMesOrder() {
this.form.order_no = null

Loading…
Cancel
Save