fix: mes对接

This commit is contained in:
2023-09-20 17:18:53 +08:00
parent 852a705ffb
commit d8d9c21be6
44 changed files with 1350 additions and 220 deletions

View File

@@ -78,4 +78,7 @@ public class MdBaseBrickInfo implements Serializable {
@ApiModelProperty(value = "是否组盘")
private Boolean is_group;
@ApiModelProperty(value = "工单号")
private String workorder_code;
}

View File

@@ -1,6 +1,7 @@
package org.nl.wms.database.brick.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -12,6 +13,8 @@ import org.nl.wms.database.brick.service.IMdBaseBrickInfoService;
import org.nl.wms.database.brick.service.dao.MdBaseBrickInfo;
import org.nl.wms.database.brick.service.dao.mapper.MdBaseBrickInfoMapper;
import org.nl.wms.ext.acs.service.dto.BrickInfoDto;
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -19,19 +22,21 @@ import java.util.Map;
import java.util.Set;
/**
* @description 服务实现
* @author lyd
* @date 2023-07-19
**/
* @author lyd
* @description 服务实现
* @date 2023-07-19
**/
@Slf4j
@Service
public class MdBaseBrickInfoServiceImpl extends ServiceImpl<MdBaseBrickInfoMapper, MdBaseBrickInfo> implements IMdBaseBrickInfoService {
@Autowired
private MdBaseBrickInfoMapper mdBaseBrickInfoMapper;
@Autowired
private IPdmBdWorkorderService workorderService;
@Override
public IPage<MdBaseBrickInfo> queryAll(Map whereJson, PageQuery page){
public IPage<MdBaseBrickInfo> queryAll(Map whereJson, PageQuery page) {
LambdaQueryWrapper<MdBaseBrickInfo> lam = new LambdaQueryWrapper<>();
IPage<MdBaseBrickInfo> pages = new Page<>(page.getPage() + 1, page.getSize());
mdBaseBrickInfoMapper.selectPage(pages, lam);
@@ -74,8 +79,11 @@ public class MdBaseBrickInfoServiceImpl extends ServiceImpl<MdBaseBrickInfoMappe
}
private MdBaseBrickInfo toBrickInfoMapper(BrickInfoDto dto) {
// 获取压机工单
PdmBdWorkorder productionTask = workorderService.getDeviceProductionTask(dto.getGet_station());
MdBaseBrickInfo brickInfo = new MdBaseBrickInfo();
brickInfo.setBrick_id(IdUtil.getSnowflake(1,1).nextIdStr());
brickInfo.setWorkorder_code(ObjectUtil.isNotEmpty(productionTask) ? productionTask.getWorkorder_code() : null);
brickInfo.setBrick_id(IdUtil.getSnowflake(1, 1).nextIdStr());
brickInfo.setGet_station(dto.getGet_station());
brickInfo.setPut_station(dto.getPut_station());
brickInfo.setIs_qualified(dto.getIs_qualified().equals("1"));

View File

@@ -492,11 +492,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (bdWorkorder == null) {
return BaseResponse.responseError(requestNo, "未找到工单号[" + workorderCode + "]的记录!");
}
// todo: 统计当前设备的不合格位置的数量作为不合格数并标记是否组盘为true
bdWorkorder.setWorkorder_status(WorkOrderStatusEnum.COMPLETE.getCode());
bdWorkorder.setRealproduceend_date(DateUtil.now());
TaskUtils.setWorkOrderUpdateByAcs(bdWorkorder);
workorderService.updateById(bdWorkorder);
// todo: 统计当前设备的不合格位置的数量作为不合格数并上报给mes
wmsToMesService.reportPressUnusedMaterial(bdWorkorder);
return BaseResponse.responseOk(requestNo);
}

View File

@@ -0,0 +1,62 @@
package org.nl.wms.ext.mes.autotask;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.system.service.notice.ISysNoticeService;
import org.nl.wms.ext.mes.service.WmsToMesService;
import org.nl.wms.ext.mes.service.dao.mapper.MesRequestMapper;
import org.nl.wms.ext.mes.service.dto.MesGdyInfoDto;
import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @Author: lyd
* @Description: 定时插入窑内的数据到mes数据库
* @Date: 2023/9/19
*/
@Slf4j
@Component
@Order(value = 1)
public class AutoSaveGdyInfo {
@Autowired
private WmsToMesService wmsToMesService;
@Autowired
private MesRequestMapper mesRequestMapper;
@Autowired
private ISysNoticeService noticeService;
@SneakyThrows
public void run() {
// 获取当前窑内信息
List<MesGdyInfoDto> list = wmsToMesService.getAllMesGdyInfos();
AtomicInteger successNum = new AtomicInteger();
long startTime = System.currentTimeMillis();
// 插入数据
list.forEach(mesGdyInfoDto -> {
mesGdyInfoDto.setMSGID(IdUtil.getSnowflake(1,1).nextIdStr());
mesGdyInfoDto.setSEND_TM(DateUtil.now());
mesGdyInfoDto.setPRO_SUBUNIT("");
mesGdyInfoDto.setDEVICE("1");
mesGdyInfoDto.setCREATE_TM(DateUtil.now());
mesGdyInfoDto.setOP_FLAG(GeneralDefinition.NO);
try {
mesRequestMapper.insertGdyMaterial(mesGdyInfoDto);
successNum.incrementAndGet();
} catch (Exception e) {
log.error("插入窑内失败的数据: {}", mesGdyInfoDto);
log.error("插入窑内失败的信息:{}", e.getMessage());
// notice通知
noticeService.createNotice(e.getMessage(), "窑内数据同步失败" + mesGdyInfoDto.getMSGID(), NoticeTypeEnum.NOTIFICATION.getCode());
}
});
long endTime = System.currentTimeMillis();
log.info("干燥窑数据有" + list.size() + "条,成功" + successNum.get() + "条, 消耗时长:" + (endTime - startTime) + "ms");
}
}

View File

@@ -0,0 +1,59 @@
package org.nl.wms.ext.mes.autotask;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.system.service.notice.ISysNoticeService;
import org.nl.wms.ext.mes.service.WmsToMesService;
import org.nl.wms.ext.mes.service.dto.MesSemiProductionInfo;
import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @Author: lyd
* @Description: 定时插入滚筒线内的数据到mes数据库
* @Date: 2023/9/19
*/
@Slf4j
@Component
@Order(value = 1)
public class AutoSaveProductionInfo {
@Autowired
private WmsToMesService wmsToMesService;
@Autowired
private ISysNoticeService noticeService;
@SneakyThrows
public void run() {
// 1、获取所有滚筒线内数据
List<MesSemiProductionInfo> list = wmsToMesService.getAllMesSemiProductionInfos();
AtomicInteger successNum = new AtomicInteger();
long startTime = System.currentTimeMillis();
// 2、设置唯一标识
list.forEach(mi -> {
mi.setMSGID(IdUtil.getSnowflake(1,1).nextIdStr());
mi.setSEND_TM(DateUtil.now());
mi.setSTOCK_UNIT("");
mi.setCREATE_TM(DateUtil.now());
mi.setOP_FLAG(GeneralDefinition.NO);
// 3、批量插入MES数据库
try {
wmsToMesService.saveSemiProductionBatchToMes(mi);
successNum.getAndIncrement();
} catch (Exception e) {
log.error("插入滚筒线内失败的数据: {}", mi);
log.error("插入滚筒线内失败的信息:{}", e.getMessage());
// notice通知
noticeService.createNotice(e.getMessage(), "滚筒线内数据同步失败" + mi.getMSGID(), NoticeTypeEnum.NOTIFICATION.getCode());
}
});
long endTime = System.currentTimeMillis();
log.info("滚筒线数据有" + list.size() + "条,成功" + successNum.get() + "条, 消耗时长:" + (endTime - startTime) + "ms");
}
}

View File

@@ -1,6 +1,11 @@
package org.nl.wms.ext.mes.service;
import org.nl.wms.ext.mes.service.dto.MesGdyInfoDto;
import org.nl.wms.ext.mes.service.dto.MesMudConsumptionDto;
import org.nl.wms.ext.mes.service.dto.MesSemiProductionInfo;
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
import java.util.List;
/**
* @Author: lyd
@@ -50,4 +55,16 @@ public interface WmsToMesService {
* @param groupId
*/
void reportGdyMaterialInfoOut(String groupId);
List<MesSemiProductionInfo> getAllMesSemiProductionInfos();
void saveSemiProductionBatchToMes(MesSemiProductionInfo obj);
List<MesGdyInfoDto> getAllMesGdyInfos();
/**
* 上报压机判废信息
* @param workorderCode
*/
void reportPressUnusedMaterial(PdmBdWorkorder workorderCode);
}

View File

@@ -36,4 +36,16 @@ public interface MesRequestMapper {
void insertGdyMaterialIn(MesGdyMaterialInDto gdyMaterialInDto);
@DS("oracle")
void insertGdyMaterialOut(MesGdyMaterialOutDto gdyMaterialOutDto);
@DS("mysql")
List<MesSemiProductionInfo> getAllMesSemiProductionInfos();
@DS("oracle")
void saveSemiProductionBatchToMes(MesSemiProductionInfo obj);
@DS("mysql")
List<MesGdyInfoDto> getAllMesGdyInfos();
@DS("oracle")
void insertGdyMaterial(MesGdyInfoDto mesGdyInfoDto);
@DS("mysql")
int countFPNumber(String workorderCode, String pointCode);
@DS("oracle")
void insertMesUnusedInfo(MesUnusedDto mesUnusedDto);
}

View File

@@ -15,9 +15,9 @@
</insert>
<insert id="insertSemiProductInfo" parameterType="org.nl.wms.ext.mes.service.dto.MesSemiProductionInfoInDto">
INSERT INTO "LMSTELCOM"."RECEIVE_CS_SEMIPROINFO_IN"(MSGID, FORDER_NO, PRESSUNIT, FSCHEDULE_ID, FPRODUCT_MATERIAL_ID
, FPRODUCT_MATERIAL_NAME, FMATSPEC, FMATMODEL, BATCHNO, PRESSUNIT, FTEAM, TRAY_NO, PRO_SUBNUM, PRO_SUBUNIT
, FPRODUCT_MATERIAL_NAME, FMATSPEC, FMATMODEL, BATCHNO, FTEAM, TRAY_NO, PRO_SUBNUM, PRO_SUBUNIT
, CHECKERIN_TIM, PRODATE, CREATE_TM, OP_FLAG) VALUES (#{MSGID}, #{FORDER_NO}, #{PRESSUNIT}, #{FSCHEDULE_ID}, #{FPRODUCT_MATERIAL_ID}
, #{FPRODUCT_MATERIAL_NAME}, #{FMATSPEC}, #{FMATMODEL}, #{BATCHNO}, #{PRESSUNIT}, #{FTEAM}, #{TRAY_NO}, #{PRO_SUBNUM}
, #{FPRODUCT_MATERIAL_NAME}, #{FMATSPEC}, #{FMATMODEL}, #{BATCHNO}, #{FTEAM}, #{TRAY_NO}, #{PRO_SUBNUM}
, #{PRO_SUBUNIT}, #{CHECKERIN_TIM}, #{PRODATE}, #{CREATE_TM}, #{OP_FLAG})
</insert>
<insert id="insertSemiProductOutInfo" parameterType="org.nl.wms.ext.mes.service.dto.MesSemiProductionInfoOutDto">
@@ -41,6 +41,29 @@
, #{FMATSPEC}, #{FMATMODE}, #{BATCHNO}, #{PRESSUNIT}, #{PRO_SUBNUM}, #{PRO_SUBUNIT}, #{FCONVERTRATE}
, #{STOCK}, #{DEVICE}, #{OUT_DATE}, #{CREATE_TM}, #{OP_FLAG})
</insert>
<insert id="saveSemiProductionBatchToMes" parameterType="org.nl.wms.ext.mes.service.dto.MesSemiProductionInfo">
INSERT INTO "LMSTELCOM"."RECEIVE_CS_SEMIPRODUCTIONINFO"(MSGID, SEND_TM, BATCHNO, ORDER_NO, STOCK_NUM
, STOCK_UNIT, MATERIAL_ID, MATERIAL_NAME, PROSPEC, PROMODEL, PRODATE, PRESSUNIT, CREATE_TM, OP_FLAG)
VALUES
(#{MSGID}, #{SEND_TM}, #{BATCHNO}, #{ORDER_NO}, #{STOCK_NUM}
, #{STOCK_UNIT}, #{MATERIAL_ID}, #{MATERIAL_NAME}, #{PROSPEC}, #{PROMODEL}
, #{PRODATE}, #{PRESSUNIT}, #{CREATE_TM}, #{OP_FLAG})
</insert>
<insert id="insertGdyMaterial" parameterType="org.nl.wms.ext.mes.service.dto.MesGdyInfoDto">
INSERT INTO "LMSTELCOM"."RECEIVE_GDY_MAT"(MSGID, SEND_TM, TRAY_NO, FPRODUCT_MATERIAL_ID, FPRODUCT_MATERIAL_NAME
, FMATSPEC, FMATMODEL, BATCHNO, PRESSUNIT, PRO_SUBNUM, PRO_SUBUNIT, DEVICE, DEVICEUNITPOST, IN_DATE, CREATE_TM
, OP_FLAG)
VALUES (#{MSGID}, #{SEND_TM}, #{TRAY_NO}, #{FPRODUCT_MATERIAL_ID}, #{FPRODUCT_MATERIAL_NAME}
, #{FMATSPEC}, #{FMATMODEL}, #{BATCHNO}, #{PRESSUNIT}, #{PRO_SUBNUM}, #{PRO_SUBUNIT}, #{DEVICE}, #{DEVICEUNITPOST}
, #{IN_DATE}, #{CREATE_TM}, #{OP_FLAG})
</insert>
<insert id="insertMesUnusedInfo" parameterType="org.nl.wms.ext.mes.service.dto.MesUnusedDto">
INSERT INTO "LMSTELCOM"."RECEIVE_R_SEMIPRODUCT_JKPF"(MSGID, FORDER_NO, PWORKSCHE_ID, FPRODUCT_MATERIAL_ID
, FPRODUCT_MATERIAL_NAME, FMATSPEC, FMATMODEL, BATCHNO, PRESSUNIT, FTEAM, FPSUBNUM, FP_SUBUNIT, PRODATE
, CREATE_TM, OP_FLAG)
VALUES (#{MSGID}, #{FORDER_NO}, #{PWORKSCHE_ID}, #{FPRODUCT_MATERIAL_ID}, #{FPRODUCT_MATERIAL_NAME}, #{FMATSPEC}
, #{FMATMODEL}, #{BATCHNO}, #{PRESSUNIT}, #{FTEAM}, #{FPSUBNUM}, #{FP_SUBUNIT}, #{PRODATE}, #{CREATE_TM}, #{OP_FLAG})
</insert>
<update id="updateWorkOrderRead" parameterType="java.util.List">
UPDATE "LMSTELCOM"."SEND_POP_SCHEDULE_PRESS"
SET OP_FLAG = '1'
@@ -105,4 +128,53 @@
"LMSTELCOM"."SEND_POP_SCHEDULE_PRESS"
WHERE OP_FLAG = '0'
</select>
<select id="getAllMesSemiProductionInfos" resultType="org.nl.wms.ext.mes.service.dto.MesSemiProductionInfo">
SELECT
pw.batch_no AS BATCHNO,
pw.produce_order AS ORDER_NO,
pw.produce_date AS PRODATE,
vg.material_qty AS STOCK_NUM,
mm.material_code AS MATERIAL_ID,
mm.material_name AS MATERIAL_NAME,
mm.material_spec AS PROSPEC,
mm.material_model AS PROMODEL,
p2.ext_point_code AS PRESSUNIT
FROM
`sch_base_vehiclematerialgroup` vg
LEFT JOIN pdm_bd_workorder pw ON pw.workorder_code = vg.workorder_code
LEFT JOIN md_base_material mm ON mm.material_id = vg.material_id
LEFT JOIN sch_base_point p ON p.point_code = vg.source_vehicle_code
LEFT JOIN sch_base_point p2 ON p.parent_point_code = p2.point_code
WHERE
vg.point_code IN ('HCSSX01','HCSSX63') AND pw.workorder_code IS NOT NULL
</select>
<select id="getAllMesGdyInfos" resultType="org.nl.wms.ext.mes.service.dto.MesGdyInfoDto">
SELECT
ROW_NUMBER() OVER (ORDER BY vg.into_kiln_time DESC) AS DEVICEUNITPOST,
vg.into_kiln_time AS IN_DATE,
vg.vehicle_code AS TRAY_NO,
m.material_id AS FPRODUCT_MATERIAL_ID,
m.material_name AS FPRODUCT_MATERIAL_NAME,
m.material_spec AS FMATSPEC,
m.material_model AS FMATMODEL,
pw.batch_no AS BATCHNO,
p2.ext_point_code AS PRESSUNIT,
vg.material_qty AS PRO_SUBNUM
FROM
`sch_base_vehiclematerialgroup` vg
LEFT JOIN md_base_material m ON m.material_id = vg.material_id
LEFT JOIN pdm_bd_workorder pw ON pw.workorder_code = vg.workorder_code
LEFT JOIN sch_base_point p ON p.point_code = vg.source_vehicle_code
LEFT JOIN sch_base_point p2 ON p.parent_point_code = p2.point_code
WHERE
vg.into_kiln_time IS NOT NULL
AND vg.out_kiln_time IS NULL
</select>
<select id="countFPNumber" resultType="java.lang.Integer">
SELECT
COUNT(*) AS number
FROM
`md_base_brick_info` mi
WHERE mi.workorder_code = #{workorderCode} AND mi.get_station = #{pointCode} AND mi.put_station LIKE 'YZBHGW%'
</select>
</mapper>

View File

@@ -0,0 +1,35 @@
package org.nl.wms.ext.mes.service.dto;
import lombok.Data;
/**
* @Author: lyd
* @Description: 窑内信息
* @Date: 2023/9/19
*/
@Data
public class MesGdyInfoDto {
private String MSGID;
private String SEND_TM;
private String TRAY_NO;
private String FPRODUCT_MATERIAL_ID;
private String FPRODUCT_MATERIAL_NAME;
private String FMATSPEC;
private String FMATMODEL;
private String BATCHNO;
private String PRESSUNIT;
private String PRO_NUM;
private String PRO_UNIT;
private String PRO_SUBNUM;
private String PRO_SUBUNIT;
private String FCONVERTRATE;
private String STOCK;
private String DEVICE;
private String DEVICEUNITPOST;
private String IN_DATE;
private String PREOUT_DATE;
private String CREATE_TM;
private String OP_FLAG;
private String OP_TM;
}

View File

@@ -0,0 +1,32 @@
package org.nl.wms.ext.mes.service.dto;
import lombok.Data;
/**
* @Author: lyd
* @Description: 滚筒线内
* @Date: 2023/9/19
*/
@Data
public class MesSemiProductionInfo {
private String MSGID;
private String SEND_TM;
private String BATCHNO;
private String ORDER_NO;
private String STOCK_NUM;
private String STOCK_UNIT;
private String STOCK_SUBNUM;
private String STOCK_SUBUNIT;
private String MATERIAL_ID;
private String MATERIAL_NAME;
private String PROSPEC;
private String PROMODEL;
private String PRODATE;
private String STOCK;
private String STOCK_NAME;
private String PRESSUNIT;
private String CREATE_TM;
private String OP_FLAG;
private String OP_TM;
}

View File

@@ -0,0 +1,55 @@
package org.nl.wms.ext.mes.service.dto;
import lombok.Data;
/**
* @Author: lyd
* @Description: 机口判废
* @Date: 2023/9/20
* 唯一标识
* 订单号
* 压机计划号
* 日计划号
* 物料编码
* 物料名称
* 规格
* 型号
* 批次号
* 压机号
* 班组
* 废品重量
* 重量单位
* 废品数量
* 数量单位
* 判废人
* 判废日期
* 生产日期
* 写入时间
* 读取标志,0未读取1已读取
* 读取时间
*/
@Data
public class MesUnusedDto {
private String MSGID;
private String FORDER_NO;
private String PWORKSCHE_ID;
private String FSCHEDULE_ID;
private String FPRODUCT_MATERIAL_ID;
private String FPRODUCT_MATERIAL_NAME;
private String FMATSPEC;
private String FMATMODEL;
private String BATCHNO;
private String PRESSUNIT;
private String FTEAM;
private String FP_NUM;
private String FP_UNIT;
private String FPSUBNUM;
private String FP_SUBUNIT;
private String CHECKERIN;
private String CHECKERIN_TIM;
private String PRODATE;
private String CREATE_TM;
private String OP_FLAG;
private String OP_TM;
}

View File

@@ -2,6 +2,7 @@ package org.nl.wms.ext.mes.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -129,7 +130,7 @@ public class WmsToMesServiceImpl implements WmsToMesService {
mesProductDataDto.setPRO_SUBNUM(BigDecimal.valueOf(vehiclematerialgroup.getMaterial_qty()));// 数量
mesProductDataDto.setPRO_SUBUNIT("");
mesProductDataDto.setCHECKERIN_TIM(DateUtil.now());
mesProductDataDto.setPRODATE(workorder.getProduce_date());
mesProductDataDto.setPRODATE(ObjectUtil.isNotEmpty(workorder.getProduce_date())?workorder.getProduce_date():DateUtil.now());
mesProductDataDto.setCREATE_TM(DateUtil.now());
mesProductDataDto.setOP_FLAG(GeneralDefinition.NO);
log.info("压机产出返给MES的数据{}", mesProductDataDto);
@@ -305,6 +306,54 @@ public class WmsToMesServiceImpl implements WmsToMesService {
}
}
@Override
public List<MesSemiProductionInfo> getAllMesSemiProductionInfos() {
return mesRequestMapper.getAllMesSemiProductionInfos();
}
@Override
public void saveSemiProductionBatchToMes(MesSemiProductionInfo obj) {
mesRequestMapper.saveSemiProductionBatchToMes(obj);
}
@Override
public List<MesGdyInfoDto> getAllMesGdyInfos() {
return mesRequestMapper.getAllMesGdyInfos();
}
@Override
public void reportPressUnusedMaterial(PdmBdWorkorder orderObj) {
// 获取统计数量
int number = mesRequestMapper.countFPNumber(orderObj.getWorkorder_code(), orderObj.getPoint_code());
MdBaseMaterial material = mdBaseMaterialService.getById(orderObj.getMaterial_id());
SchBasePoint basePoint = pointService.getById(orderObj.getPoint_code());
log.info("统计到设备:{} 不合格砖数:{}", orderObj.getPoint_name(), number);
// 设置字段值
MesUnusedDto mesUnusedDto = new MesUnusedDto();
mesUnusedDto.setMSGID(IdUtil.getSnowflake(1,1).nextIdStr());
mesUnusedDto.setFORDER_NO(orderObj.getProduction_order());
mesUnusedDto.setPWORKSCHE_ID(orderObj.getWorkshop_code());
mesUnusedDto.setFPRODUCT_MATERIAL_ID(orderObj.getMaterial_code());
mesUnusedDto.setFPRODUCT_MATERIAL_NAME(orderObj.getMaterial_name());
mesUnusedDto.setFMATSPEC(material.getMaterial_spec());
mesUnusedDto.setFMATMODEL(material.getMaterial_model());
mesUnusedDto.setBATCHNO(orderObj.getBatch_no());
mesUnusedDto.setPRESSUNIT(basePoint.getExt_point_code());
mesUnusedDto.setFTEAM(orderObj.getTeam());
mesUnusedDto.setFPSUBNUM(String.valueOf(number));
mesUnusedDto.setFP_SUBUNIT("");
mesUnusedDto.setPRODATE(orderObj.getProduce_date());
mesUnusedDto.setCREATE_TM(DateUtil.now());
mesUnusedDto.setOP_FLAG(GeneralDefinition.NO);
log.info("插入mes机口判废数据库的数据{}", mesUnusedDto);
// 存入mes数据库
try {
mesRequestMapper.insertMesUnusedInfo(mesUnusedDto);
} catch (Exception e) {
log.error("插入机口判废失败:{}", e.getMessage());
}
}
public List<PdmBdWorkorder> toWorkOrderList(List<MesWorkOrderDto> mesWorkOrderInfos) {
List<PdmBdWorkorder> list = new CopyOnWriteArrayList<>();
mesWorkOrderInfos.forEach(mesWorkOrderDto -> {

View File

@@ -1,5 +1,6 @@
package org.nl.wms.pda.controller;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -9,6 +10,10 @@ import org.nl.wms.das.device.check.service.dao.DasDeviceCheckRecord;
import org.nl.wms.das.device.operation.service.IDasDeviceOperationRecordService;
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.ManualGroupDto;
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -34,6 +39,10 @@ public class PdaController {
private IDasDeviceOperationRecordService deviceOperationRecordService;
@Autowired
private PdaService pdaService;
@Autowired
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
@Autowired
private IPdmBdWorkorderService workorderService;
@PostMapping("/deviceCheck/verify")
@Log("设备点检")
@ApiOperation("设备点检")
@@ -68,4 +77,25 @@ public class PdaController {
public ResponseEntity<Object> deviceSwitchover(@Validated @RequestBody DasDeviceOperationRecord entity){
return new ResponseEntity<>(deviceOperationRecordService.create(entity), HttpStatus.OK);
}
@PostMapping("/group/getPressCode")
@Log("获取压机编码")
@ApiOperation("获取压机编码")
public ResponseEntity<Object> getPressCode(){
return new ResponseEntity<>(pdaService.getDeviceInfo(), HttpStatus.OK);
}
@PostMapping("/group/getPressWorkOrder")
@Log("获取压机编码")
@ApiOperation("获取压机编码")
public ResponseEntity<Object> getPressWorkOrder(JSONObject param){
return new ResponseEntity<>(workorderService.getDeviceProductionTask(param.getString("point_code")), HttpStatus.OK);
}
@PostMapping("/group/manual")
@Log("人工组盘")
@ApiOperation("人工组盘")
public ResponseEntity<PdaResponseVo> manualDiskAssembly(@Validated @RequestBody ManualGroupDto entity){
return new ResponseEntity<>(vehiclematerialgroupService.manualCreateByPda(entity), HttpStatus.OK);
}
}

View File

@@ -0,0 +1,19 @@
package org.nl.wms.pda.service.dao.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Author: lyd
* @Description: 人工组盘
* @Date: 2023/9/18
*/
@Data
public class ManualGroupDto {
private String vehicle_code;
private String vehicle_type;
private String point_code;
private String order_code;
private BigDecimal material_weight;
}

View File

@@ -98,6 +98,9 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper,
@Override
public PdmBdWorkorder getDeviceProductionTask(String deviceCode) {
if (ObjectUtil.isEmpty(deviceCode)) {
throw new BadRequestException("根据设备查询工单,设备编码不能为空");
}
// 只能有一个生产中
LambdaQueryWrapper<PdmBdWorkorder> lam = new QueryWrapper<PdmBdWorkorder>().lambda();
lam.eq(PdmBdWorkorder::getPoint_code, deviceCode)

View File

@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.nl.common.domain.query.PageQuery;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.pda.service.dao.dto.ManualGroupDto;
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
import org.nl.wms.sch.group.service.dto.SchBaseVehiclematerialgroupQuery;
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum;
@@ -77,4 +79,6 @@ public interface ISchBaseVehiclematerialgroupService extends IService<SchBaseVeh
* @return
*/
SchBaseVehiclematerialgroup getGroupInfo(String vehicleCode, String value);
PdaResponseVo manualCreateByPda(ManualGroupDto entity);
}

View File

@@ -3,6 +3,7 @@ package org.nl.wms.sch.group.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -13,10 +14,19 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.database.material.service.IMdBaseMaterialService;
import org.nl.wms.database.material.service.dao.MdBaseMaterial;
import org.nl.wms.pda.service.dao.dto.ManualGroupDto;
import org.nl.wms.pda.service.dao.vo.PdaResponseVo;
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
import org.nl.wms.sch.group.service.dao.mapper.SchBaseVehiclematerialgroupMapper;
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
import org.nl.wms.sch.group.service.dto.SchBaseVehiclematerialgroupQuery;
import org.nl.wms.sch.point.service.ISchBasePointService;
import org.nl.wms.sch.point.service.dao.SchBasePoint;
import org.nl.wms.sch.task_manage.enums.GroupStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -34,6 +44,12 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
@Autowired
private SchBaseVehiclematerialgroupMapper vehiclematerialgroupMapper;
@Autowired
private IPdmBdWorkorderService workorderService;
@Autowired
private ISchBasePointService pointService;
@Autowired
private IMdBaseMaterialService materialService;
@Override
public IPage<SchBaseVehiclematerialgroup> queryAll(SchBaseVehiclematerialgroupQuery whereJson, PageQuery page){
@@ -113,4 +129,38 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
return selectOne;
}
@Override
public PdaResponseVo manualCreateByPda(ManualGroupDto entity) {
if (ObjectUtil.isEmpty(entity)) {
throw new BadRequestException("组盘不能为空");
}
// 获取压机工单
PdmBdWorkorder bdWorkorder = workorderService.getByCode(entity.getOrder_code());
// 获取点位
SchBasePoint basePoint = pointService.getById(entity.getPoint_code());
// 获取物料
MdBaseMaterial material = materialService.getById(bdWorkorder.getWorkorder_id());
SchBaseVehiclematerialgroup group = new SchBaseVehiclematerialgroup();
group.setGroup_id(IdUtil.getSnowflake(1,1).nextIdStr());
group.setVehicle_type(entity.getVehicle_type());
group.setVehicle_code(entity.getVehicle_code());
group.setMaterial_id(bdWorkorder.getMaterial_id());
group.setRedundance_material_code(bdWorkorder.getRaw_material_code());
group.setSource_vehicle_code(entity.getPoint_code());
group.setPoint_code(entity.getPoint_code());
group.setPoint_name(basePoint.getPoint_name());
group.setInstorage_time(DateUtil.now());
group.setStanding_time(material.getStanding_time());
group.setMaterial_weight(entity.getMaterial_weight());
group.setWorkorder_code(bdWorkorder.getWorkorder_code());
group.setGroup_status(GroupStatusEnum.IN_STORAGE.getType());
group.setMove_way(basePoint.getPoint_code());
group.setBuss_move_id(IdUtil.getSnowflake(1,1).nextIdStr());
group.setCreate_id(SecurityUtils.getCurrentUserId());
group.setCreate_name(SecurityUtils.getCurrentNickName());
group.setCreate_time(DateUtil.now());
vehiclematerialgroupMapper.insert(group);
return PdaResponseVo.pdaResultOk("组盘成功");
}
}

View File

@@ -29,7 +29,7 @@ public class AutoCreateTask {
@SneakyThrows
public void run() {
log.info("定时任务AutoCreateTask开始执行:");
log.debug("定时任务AutoCreateTask开始执行:");
this.doExecute();
}

View File

@@ -97,7 +97,7 @@ public class CTQKTask extends AbstractTask {
SchBasePoint point = findStartPoint(startRegionStr);
if (ObjectUtil.isEmpty(point)) {
// 消息通知
noticeService.createNotice("拆盘机暂无托盘!", TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice("拆盘机暂无托盘!", TASK_CONFIG_CODE + task.getPoint_code2(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("拆盘机暂无托盘!");
}

View File

@@ -99,7 +99,7 @@ public class DTSKTask extends AbstractTask {
SchBasePoint point = findNextPoint(nextRegionStr);
if (ObjectUtil.isEmpty(point)) {
// 消息通知
noticeService.createNotice("货架暂无货位存放空托盘!", TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice("货架暂无货位存放空托盘!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("货架暂无货位存放空托盘!");
}

View File

@@ -178,7 +178,7 @@ public class FJMKTask extends AbstractTask {
SchBasePoint packagePoint = findNextPoint(nextRegionStr, jsonObject);
if (ObjectUtil.isEmpty(packagePoint)) {
// 消息通知
noticeService.createNotice("包装线不可用!", TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice("包装线不可用!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("包装线不可用!");
}
@@ -212,7 +212,7 @@ public class FJMKTask extends AbstractTask {
/** 覆膜机木托盘位 */
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject);
if (ObjectUtil.isEmpty(LaminatePoint)) {
noticeService.createNotice("覆膜区不可用!", TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice("覆膜区不可用!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
// 消息通知
throw new BadRequestException("覆膜区不可用!");

View File

@@ -84,7 +84,7 @@ public class FJQKTask extends AbstractTask {
task.setRemark("覆膜机不可用!");
taskService.updateById(task);
// 消息通知
noticeService.createNotice(task.getRemark(), TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice(task.getRemark(), TASK_CONFIG_CODE + task.getPoint_code2(),
NoticeTypeEnum.WARN.getCode());
continue;
}

View File

@@ -124,7 +124,7 @@ public class FJQLTask extends AbstractTask {
SchBasePoint point = findStartPoint(startRegionStr, extGroupData);
if (ObjectUtil.isEmpty(point)) {
// 消息通知
noticeService.createNotice("钢托盘缓存货架没有所需物料!", TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice("钢托盘缓存货架没有所需物料!", TASK_CONFIG_CODE + task.getPoint_code2(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("钢托盘缓存货架没有所需物料!");
}

View File

@@ -102,7 +102,7 @@ public class FJRKTask extends AbstractTask {
SchBasePoint point = findNextPoint(nextRegionStr);
if (ObjectUtil.isEmpty(point)) {
// 消息通知
noticeService.createNotice("找不到可用的包装位!", TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice("找不到可用的包装位!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("找不到可用的包装位!");
}

View File

@@ -103,7 +103,7 @@ public class FJSKTask extends AbstractTask {
SchBasePoint point = findNextPoint(nextRegionStr);
if (ObjectUtil.isEmpty(point)) {
// 消息通知
noticeService.createNotice("叠盘架位置不可用!", TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice("叠盘架位置不可用!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("叠盘架位置不可用!");
}

View File

@@ -109,7 +109,7 @@ public class FJSLTask extends AbstractTask {
SchBasePoint point = findNextPoint(nextRegionStr, jsonObject);
if (ObjectUtil.isEmpty(point)) {
// 消息通知
noticeService.createNotice("分拣机械手[" + task.getPoint_code1() + "]未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice("分拣机械手[" + task.getPoint_code1() + "]未找到所需点位!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("分拣机械手[" + task.getPoint_code1() + "]未找到所需点位!");
}

View File

@@ -154,7 +154,7 @@ public class HNMLTask extends AbstractTask {
SchBasePoint point = findNextPoint(nextRegionStr, jsonObject);
if (ObjectUtil.isEmpty(point)) {
// 消息通知
noticeService.createNotice(task.getRemark(), TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice("未存在生产该料的压机!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("未存在生产该料的压机!");
}
@@ -354,7 +354,7 @@ public class HNMLTask extends AbstractTask {
groupEntity.setMaterial_weight(ObjectUtil.isNotEmpty(weight)// 重量
? weight
: BigDecimal.valueOf(0));
groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); // 绑定
groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); // 绑定
groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。
groupEntity.setIs_delete(false);
// groupEntity.setExt_data(packNo);// todo: 对于混碾的组盘 暂时存吨袋号

View File

@@ -115,7 +115,7 @@ public class CYZCTask extends AbstractTask {
SchBasePoint point = findNextPoint(nextRegionStr, jsonObject);
if (ObjectUtil.isEmpty(point)) {
// 消息通知
noticeService.createNotice("未找到钢托盘缓存区域空位!", TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice("未找到钢托盘缓存区域空位!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("未找到钢托盘缓存区域空位!");
}

View File

@@ -107,9 +107,9 @@ public class GZYQLTask extends AbstractTask {
SchBasePoint point = findStartPoint(startRegionStr, jsonObject);
if (ObjectUtil.isEmpty(point)) {
// 消息通知
noticeService.createNotice("入窑口[" + task.getPoint_code1() + "]未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice("入窑口[" + task.getPoint_code2() + "]未找到所需点位!", TASK_CONFIG_CODE + task.getPoint_code2(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("入窑口[" + task.getPoint_code1() + "]未找到所需点位!");
throw new BadRequestException("入窑口[" + task.getPoint_code2() + "]未找到所需点位!");
}
// 设置终点并修改创建成功状态
task.setPoint_code1(point.getPoint_code());

View File

@@ -63,7 +63,7 @@ public class YZQKTask extends AbstractTask {
SchBasePoint point = findStartPoint(startRegionStr, jsonObject);
if (ObjectUtil.isEmpty(point)) {
// 消息通知
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getPoint_code2(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("未找到所需点位!");
}

View File

@@ -52,8 +52,6 @@ import java.util.stream.Collectors;
@TaskType("YZMLTask")
public class YZSLTask extends AbstractTask {
private static String TASK_CONFIG_CODE = "YZMLTask";
private static AtomicInteger countUp = new AtomicInteger(0); // 上层数量
private static AtomicInteger countLower = new AtomicInteger(0); // 下层数量
@Autowired
private ISchBasePointService pointService;
@Autowired
@@ -66,7 +64,6 @@ public class YZSLTask extends AbstractTask {
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
@Autowired
private YZMapper yzMapper;
@Autowired
private ISysNoticeService noticeService;
@Autowired
@@ -99,19 +96,6 @@ public class YZSLTask extends AbstractTask {
NoticeTypeEnum.WARN.getCode());
continue;
}
int up = countUp.get();
int lower = countLower.get();
if (lower == 0 || lower != 5) {
countLower.incrementAndGet();
} else {
countUp.incrementAndGet();
}
if (up == 4) {
countLower = new AtomicInteger(0);
}
if (lower == 4 && up == 4) {
countUp = new AtomicInteger(0);
}
// 设置终点并修改创建成功状态
task.setPoint_code2(point.getPoint_code());
task.setTask_status(TaskStatus.CREATED.getCode());
@@ -143,23 +127,10 @@ public class YZSLTask extends AbstractTask {
SchBasePoint point = findNextPoint(nextRegionStr, jsonObject);
if (ObjectUtil.isEmpty(point)) {
// 消息通知
noticeService.createNotice("压机[" + task.getPoint_code1() + "]未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
noticeService.createNotice("压机[" + task.getPoint_code1() + "]未找到所需点位!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("压机[" + task.getPoint_code1() + "]未找到所需点位!");
}
int up = countUp.get();
int lower = countLower.get();
if (lower == 0 || lower != 5) {
countLower.incrementAndGet();
} else {
countUp.incrementAndGet();
}
if (up == 4) {
countLower = new AtomicInteger(0);
}
if (lower == 4 && up == 4) {
countUp = new AtomicInteger(0);
}
// 设置终点并修改创建成功状态
task.setPoint_code2(point.getPoint_code());
task.setTask_status(TaskStatus.CREATED.getCode());
@@ -208,13 +179,6 @@ public class YZSLTask extends AbstractTask {
}
}
// 双层缓存货架的一上一下的区分 -> 上五下五区分
// 计算缓存上和缓存下的空位数量决定是使用desc还是asc
int up = countUp.get();
int lower = countLower.get();
boolean isASC = false;
if (lower == 0 || lower != 5) {
isASC = true;
}
LambdaQueryWrapper<SchBasePoint> lam = new QueryWrapper<SchBasePoint>().lambda();
lam.eq(SchBasePoint::getRegion_code, regionCode)
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_POINT.getCode())
@@ -223,7 +187,8 @@ public class YZSLTask extends AbstractTask {
.or()
.eq(SchBasePoint::getIng_task_code, ""))
.eq(SchBasePoint::getIs_used, true)
.orderBy(true, isASC, SchBasePoint::getPoint_code);
.ne(SchBasePoint::getVehicle_qty, 5) // 载具数量不能等于5
.orderByDesc(SchBasePoint::getVehicle_qty);
List<SchBasePoint> schBasePoints = pointService.list(lam);
return ObjectUtil.isNotEmpty(schBasePoints) ? schBasePoints.get(0) : null;
}
@@ -307,7 +272,10 @@ public class YZSLTask extends AbstractTask {
groupEntity.setPoint_name(basePoint.getPoint_name());
groupEntity.setSource_vehicle_code(basePoint.getPoint_code());
groupEntity.setMove_way(basePoint.getPoint_code());
groupEntity.setPcsn(DateUtil.format(DateUtil.date(), "yyyyMMdd")); // todo:
// groupEntity.setPcsn(DateUtil.format(DateUtil.date(), "yyyyMMdd")); // 批次号使用自己定义的、暂时没用压机工单
groupEntity.setPcsn(ObjectUtil.isNotEmpty(workorderObject)
? workorderObject.getBatch_no()
: DateUtil.format(DateUtil.date(), "yyyyMMdd"));
groupEntity.setInstorage_time(DateUtil.now());
groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.WAIT_BIND.getValue()); // 待绑定
groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。
@@ -376,7 +344,7 @@ public class YZSLTask extends AbstractTask {
}
// 起点清空
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
PointUtils.clearPoint(startPointObj);
PointUtils.clearPointAndRetainNum(startPointObj);
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark(GeneralDefinition.TASK_FINISH);

View File

@@ -54,6 +54,32 @@ public class PointUtils {
pointService.updateById(point);
}
/**
* 清空点位
* 双层输送线特殊功能:上五下五
* @param point
*/
public static void clearPointAndRetainNum(SchBasePoint point) {
if (ObjectUtil.isEmpty(point)) {
return; // 空直接退出
}
SchBasePointServiceImpl pointService = SpringContextHolder.getBean(SchBasePointServiceImpl.class);
// 获取父点位
String parentPointCode = point.getParent_point_code();
SchBasePoint basePoint = pointService.getById(parentPointCode);
point.setPoint_status(PointStatusEnum.EMPTY_POINT.getCode());
point.setVehicle_type("");
point.setVehicle_code("");
point.setIng_task_code("");
point.setVehicle_qty(point.getVehicle_qty() + 1);
if (basePoint.getVehicle_qty() == 5) { // 等到新的点执行第一托的时候才判断另一个点满足5个托盘的时候就清空
basePoint.setVehicle_qty(0);
pointService.updateById(basePoint);
}
point.setUpdate_time(DateUtil.now());
pointService.updateById(point);
}
/** 点位修改更新信息 **/
public static void setUpdateByAcs(SchBasePoint pointObj) {
pointObj.setUpdate_id(GeneralDefinition.ACS_ID);

View File

@@ -35,9 +35,9 @@ https://juejin.cn/post/6844903775631572999
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<maxHistory>30</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>200MB</maxFileSize>
<maxFileSize>120MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>20GB</totalSizeCap>
</rollingPolicy>
@@ -62,7 +62,7 @@ https://juejin.cn/post/6844903775631572999
</appender>
<!--开发环境:打印控制台-->
<springProfile name="dev">
<root level="DEBUG">
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="asyncLuceneAppender"/>
</root>

View File

@@ -0,0 +1,36 @@
package org.nl.ext;
/**
* @Author: lyd
* @Description:
* @Date: 2023/9/18
*/
public class StorageManager {
private int requestCount = 0;
public String allocateStorage() {
requestCount++;
if (requestCount >= 1 && requestCount <= 5) {
return "上货位";
} else if (requestCount >= 6 && requestCount <= 10) {
return "下货位";
} else {
// 如果请求次数大于10循环上下
requestCount = 1;
return "上货位";
}
}
public static void main(String[] args) {
StorageManager manager = new StorageManager();
// 模拟外部系统的请求
for (int i = 1; i <= 23; i++) {
new Thread(() -> {
String storage = manager.allocateStorage();
System.out.println("" + Thread.currentThread().getName() + " 次请求,分配到:" + storage);
}).start();
}
}
}

View File

@@ -29,20 +29,25 @@ public class TestDemo {
@Test
public void test01() {
for (int i = 0; i < 13; i++) {
toAdd();
int up = countUp.get();
int lower = countLower.get();
if (lower == 0 || lower != 5) {
countLower.incrementAndGet();
} else {
countUp.incrementAndGet();
}
if (up == 4) {
countLower = new AtomicInteger(0);
}
if (lower == 4 && up == 4) {
countUp = new AtomicInteger(0);
}
new Thread(new Runnable() {
@Override
public void run() {
toAdd();
int up = countUp.get();
int lower = countLower.get();
if (lower == 0 || lower != 5) {
countLower.incrementAndGet();
} else {
countUp.incrementAndGet();
}
if (up == 4) {
countLower = new AtomicInteger(0);
}
if (lower == 4 && up == 4) {
countUp = new AtomicInteger(0);
}
}
}).start();
}
}
@@ -50,7 +55,7 @@ public class TestDemo {
int up = countUp.get();
int lower = countLower.get();
boolean isASC = false;
if (lower == 0 || lower != 5) {
if (lower < 5) {
isASC = true;
}
if (isASC) {