新增异常物料进入异常堆,移除工艺不一致导致的拒绝进入
This commit is contained in:
@@ -307,4 +307,10 @@ public class IndustryMaterialController extends BaseController
|
|||||||
industryMaterialService.deleteIndustryMaterialByState(1L);
|
industryMaterialService.deleteIndustryMaterialByState(1L);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@DeleteMapping("/delete/{id}")
|
||||||
|
public AjaxResult delete(@PathVariable("id") String id){
|
||||||
|
return toAjax(industryMaterialService.delIndustryMaterialById(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public interface IIndustryMaterialService
|
|||||||
* @param industryMaterial batchId state=1
|
* @param industryMaterial batchId state=1
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IndustryMaterialVo resourceToWorkAndCreateStep(IndustryMaterial industryMaterial);
|
List<IndustryMaterialVo> resourceToWorkAndCreateStep(IndustryMaterial industryMaterial);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异常料切换
|
* 异常料切换
|
||||||
@@ -133,4 +133,7 @@ public interface IIndustryMaterialService
|
|||||||
*/
|
*/
|
||||||
boolean clearNotProcessMaterial();
|
boolean clearNotProcessMaterial();
|
||||||
|
|
||||||
|
int toCheckErrorMaterial(List<IndustryMaterialVo> successList);
|
||||||
|
|
||||||
|
int delIndustryMaterialById(String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,6 +170,87 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int toCheckErrorMaterial(List<IndustryMaterialVo> successList) {
|
||||||
|
if (successList.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (successList.size() ==1) {
|
||||||
|
// 如果只有一个料直接返回就行了 肯定没问题
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
// 这里successList至少有两个,拿出来第一个作为基准物料工艺
|
||||||
|
|
||||||
|
|
||||||
|
IndustryMaterialVo firstMaterialVo = successList.get(0);
|
||||||
|
for (IndustryMaterialVo industryMaterialVo : successList) {
|
||||||
|
if (!Objects.equals(industryMaterialVo.getSpecification(), firstMaterialVo.getSpecification())
|
||||||
|
||
|
||||||
|
!Objects.equals(industryMaterialVo.getTechnology(), firstMaterialVo.getTechnology())
|
||||||
|
) {
|
||||||
|
// 将不同的状态改为异常
|
||||||
|
industryMaterialVo.setState(3L);
|
||||||
|
industryMaterialMapper.updateIndustryMaterial(industryMaterialVo);
|
||||||
|
// 接下来更新他对应的第一个道次将其改为异常
|
||||||
|
IndustryStep industryStep = new IndustryStep();
|
||||||
|
industryStep.setMaterialId(industryMaterialVo.getId());
|
||||||
|
List<IndustryStepVo> industryStepVos = industryStepMapper.selectIndustryStepList(industryStep);
|
||||||
|
if (!industryStepVos.isEmpty()) {
|
||||||
|
IndustryStepVo industryStepVo = industryStepVos.get(0);
|
||||||
|
// 将其异常处理
|
||||||
|
industryStepVo.setState(2L);
|
||||||
|
industryStepMapper.updateIndustryStep(industryStepVo);
|
||||||
|
}
|
||||||
|
// 如果校验到此物料的规格和工艺不相同则返回2提醒前端
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delIndustryMaterialById(String id) {
|
||||||
|
IndustryMaterialVo industryMaterialVo = industryMaterialMapper.selectIndustryMaterialById(id);
|
||||||
|
Long batchId = industryMaterialVo.getBatchId();
|
||||||
|
IndustryBatchVo industryBatchVo = industryBatchService.selectIndustryBatchById(batchId);
|
||||||
|
industryBatchVo.setBatchSize(industryBatchVo.getBatchSize() - 1);
|
||||||
|
industryBatchService.updateIndustryBatch(industryBatchVo);
|
||||||
|
// 删除此数据
|
||||||
|
industryMaterialMapper.deleteIndustryMaterialById(id);
|
||||||
|
List<IndustryMaterialVo> industryMaterialVos = industryMaterialMapper.selectIndustryMaterialByBatchId(batchId);
|
||||||
|
// 进行重新排列
|
||||||
|
for (int i = 1; i <= industryMaterialVos.size(); i++) {
|
||||||
|
industryMaterialVos.get(i).setSort((long) i);
|
||||||
|
industryMaterialMapper.updateIndustryMaterial(industryMaterialVos.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下面处理redis的问题
|
||||||
|
// redis记录了sort batchSize 以及左右摄像头里面的缓存数据
|
||||||
|
// 处理sort直接拿出来-1就可以了
|
||||||
|
Long sort = redisCache.getCacheObject("sort");
|
||||||
|
Long size = redisCache.getCacheObject("size");
|
||||||
|
sort-=1;
|
||||||
|
size-=1;
|
||||||
|
redisCache.setCacheObject("sort",sort);
|
||||||
|
redisCache.setCacheObject("size",size);
|
||||||
|
|
||||||
|
// 接下来处理左右摄像头数据
|
||||||
|
// leftId和rightId
|
||||||
|
// 判断左摄像头的id是否与当前删除的相同如果相同则删除此缓存
|
||||||
|
if (id.equals(redisCache.getCacheObject("leftId"))) {
|
||||||
|
redisCache.deleteObject("leftId");
|
||||||
|
s7PLC.writeString("DB4.30","\u0000\u0000\u0000\u0000");
|
||||||
|
|
||||||
|
}
|
||||||
|
if (id.equals(redisCache.getCacheObject("rightId"))) {
|
||||||
|
redisCache.deleteObject("rightId");
|
||||||
|
s7PLC.writeString("DB44.30","\u0000\u0000\u0000\u0000");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增钽靶主类
|
* 新增钽靶主类
|
||||||
@@ -218,7 +299,6 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param industryMaterial batchId
|
* @param industryMaterial batchId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -250,6 +330,8 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
public int start(IndustryMaterial industryMaterial) {
|
public int start(IndustryMaterial industryMaterial) {
|
||||||
// 拿到当前正在进行的批次
|
// 拿到当前正在进行的批次
|
||||||
List<IndustryMaterialVo> industryMaterialVos = industryMaterialMapper.selectIndustryMaterialList(industryMaterial);
|
List<IndustryMaterialVo> industryMaterialVos = industryMaterialMapper.selectIndustryMaterialList(industryMaterial);
|
||||||
|
// 二次检查是否有和第一个物料不同工艺规格的,如果没有在放行
|
||||||
|
toCheckErrorMaterial(industryMaterialVos);
|
||||||
IndustryMaterialVo firstMaterial = new IndustryMaterialVo();
|
IndustryMaterialVo firstMaterial = new IndustryMaterialVo();
|
||||||
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
|
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
|
||||||
if (industryMaterialVo.getState() != 3L) {
|
if (industryMaterialVo.getState() != 3L) {
|
||||||
@@ -692,27 +774,27 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public IndustryMaterialVo resourceToWorkAndCreateStep(IndustryMaterial industryMaterial) {
|
public List<IndustryMaterialVo> resourceToWorkAndCreateStep(IndustryMaterial industryMaterial) {
|
||||||
IndustryMaterialVo industryMaterialVo = new IndustryMaterialVo();
|
IndustryMaterialVo industryMaterialVo = new IndustryMaterialVo();
|
||||||
industryMaterialVo.setBatchId(industryMaterial.getBatchId());
|
industryMaterialVo.setBatchId(industryMaterial.getBatchId());
|
||||||
// 获得该批次的所有原料
|
// 获得该批次的所有原料
|
||||||
List<IndustryMaterialVo> industryMaterialVos = industryMaterialMapper.selectIndustryMaterialList(industryMaterialVo);
|
List<IndustryMaterialVo> industryMaterialVos = industryMaterialMapper.selectIndustryMaterialList(industryMaterialVo);
|
||||||
|
|
||||||
// 首先查看是否有该批次的料
|
// 首先查看是否有该批次的料
|
||||||
if (Objects.nonNull(industryMaterialVos.get(0))) {
|
if (Objects.nonNull(industryMaterialVos) && !industryMaterialVos.isEmpty()) {
|
||||||
// 检测他们的工艺是否相同
|
// 检测他们的工艺是否相同
|
||||||
IndustryMaterialVo firstIndustryMaterial = industryMaterialVos.get(0);
|
// IndustryMaterialVo firstIndustryMaterial = industryMaterialVos.get(0);
|
||||||
for (IndustryMaterialVo materialVo : industryMaterialVos) {
|
// for (IndustryMaterialVo materialVo : industryMaterialVos) {
|
||||||
if (!Objects.equals(firstIndustryMaterial.getTechnology(), materialVo.getTechnology())) {
|
// if (!Objects.equals(firstIndustryMaterial.getTechnology(), materialVo.getTechnology())) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
for (IndustryMaterialVo materialVo : industryMaterialVos) {
|
for (IndustryMaterialVo materialVo : industryMaterialVos) {
|
||||||
materialVo.setState(1L);
|
materialVo.setState(1L);
|
||||||
updateIndustryMaterial(materialVo);
|
updateIndustryMaterial(materialVo);
|
||||||
}
|
}
|
||||||
// 到了这里表示工艺都相同返回1
|
// 到了这里表示工艺都相同返回1
|
||||||
return firstIndustryMaterial;
|
return industryMaterialVos;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -744,9 +826,6 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
Long size = redisCache.getCacheObject("size");
|
Long size = redisCache.getCacheObject("size");
|
||||||
|
|
||||||
if (Objects.isNull(sort) || Objects.isNull(batchId) || sort >= 9L || Objects.isNull(size)) {
|
if (Objects.isNull(sort) || Objects.isNull(batchId) || sort >= 9L || Objects.isNull(size)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IndustryBatch industryBatch = new IndustryBatch();
|
IndustryBatch industryBatch = new IndustryBatch();
|
||||||
industryBatch.setBatchSize(0L);
|
industryBatch.setBatchSize(0L);
|
||||||
batchId = industryBatchService.insertIndustryBatch(industryBatch);
|
batchId = industryBatchService.insertIndustryBatch(industryBatch);
|
||||||
@@ -786,8 +865,6 @@ public class IndustryMaterialServiceImpl implements IIndustryMaterialService {
|
|||||||
// 进入这里说明它是个新料,但是可能会出现id相同的问题,则直接删掉原有料
|
// 进入这里说明它是个新料,但是可能会出现id相同的问题,则直接删掉原有料
|
||||||
IndustryMaterial industryMaterial = new IndustryMaterial();
|
IndustryMaterial industryMaterial = new IndustryMaterial();
|
||||||
industryMaterial.setSort(sort);
|
industryMaterial.setSort(sort);
|
||||||
|
|
||||||
|
|
||||||
Float diameter = s7PLC.readFloat32("DB4.10");
|
Float diameter = s7PLC.readFloat32("DB4.10");
|
||||||
Double diameterLeft = MathUtils.floatToDouble(diameter);
|
Double diameterLeft = MathUtils.floatToDouble(diameter);
|
||||||
|
|
||||||
|
|||||||
@@ -441,8 +441,10 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int createStep(IndustryMaterial industryMaterial) {
|
public int createStep(IndustryMaterial industryMaterial) {
|
||||||
IndustryMaterialVo success = industryMaterialService.resourceToWorkAndCreateStep(industryMaterial);
|
List<IndustryMaterialVo> successList = industryMaterialService.resourceToWorkAndCreateStep(industryMaterial);
|
||||||
if (Objects.nonNull(success)) {
|
if (Objects.nonNull(successList) && !successList.isEmpty()) {
|
||||||
|
// 20250809 为了将不同工艺的物料生成不同工艺的道次,此处应该根据每一快物料生成对应的道次数据
|
||||||
|
for (IndustryMaterialVo success : successList) {
|
||||||
// 进入这里说明工艺没问题接下里根据工艺表创建道次
|
// 进入这里说明工艺没问题接下里根据工艺表创建道次
|
||||||
// 判断当前是粗轧还是精轧
|
// 判断当前是粗轧还是精轧
|
||||||
IndustryTechnology industryTechnology = new IndustryTechnology();
|
IndustryTechnology industryTechnology = new IndustryTechnology();
|
||||||
@@ -455,30 +457,33 @@ public class IndustryStepServiceImpl implements IIndustryStepService {
|
|||||||
} else {
|
} else {
|
||||||
industryTechnology.setState(1L);
|
industryTechnology.setState(1L);
|
||||||
}
|
}
|
||||||
|
// 拿到第一个物料对应的工艺要生成的所有道次
|
||||||
List<IndustryTechnologyVo> industryTechnologyVos = industryTechnologyService.selectIndustryTechnologyList(industryTechnology);
|
List<IndustryTechnologyVo> industryTechnologyVos = industryTechnologyService.selectIndustryTechnologyList(industryTechnology);
|
||||||
List<IndustryMaterialVo> industryMaterialVos = industryMaterialService.selectIndustryMaterialByBatchId(industryMaterial.getBatchId());
|
// List<IndustryMaterialVo> industryMaterialVos = industryMaterialService.selectIndustryMaterialByBatchId(industryMaterial.getBatchId());
|
||||||
// 添加特判 当工艺表为空时通知前端无此工艺不可进入轧制页面
|
// 添加特判 当工艺表为空时通知前端无此工艺不可进入轧制页面
|
||||||
if (industryTechnologyVos.isEmpty()) {
|
// if (industryTechnologyVos.isEmpty()) {
|
||||||
// 把状态改回去
|
// // 把状态改回去
|
||||||
if (Objects.nonNull(industryMaterialVos.get(0))) {
|
// success.setState(0L);
|
||||||
for (IndustryMaterialVo materialVo : industryMaterialVos) {
|
// industryMaterialMapper.updateIndustryMaterial(success);
|
||||||
materialVo.setState(0L);
|
// return Constants.NOT_HAVE_TECHNOLOGY;
|
||||||
industryMaterialMapper.updateIndustryMaterial(materialVo);
|
// }
|
||||||
}
|
|
||||||
return Constants.NOT_HAVE_TECHNOLOGY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// TODO 将道次为空的也放入异常
|
||||||
|
|
||||||
for (IndustryMaterialVo industryMaterialVo : industryMaterialVos) {
|
// 也就是说这里不管下面的物料是否为此工艺也按照此工艺生成道次只不过不需要操作
|
||||||
for (IndustryTechnologyVo industryTechnologyVo : industryTechnologyVos) {
|
for (IndustryTechnologyVo industryTechnologyVo : industryTechnologyVos) {
|
||||||
IndustryStep industryStep = getIndustryStep(industryMaterial, industryMaterialVo, industryTechnologyVo);
|
IndustryStep industryStep = getIndustryStep(industryMaterial, success, industryTechnologyVo);
|
||||||
insertIndustryStep(industryStep);
|
insertIndustryStep(industryStep);
|
||||||
}
|
}
|
||||||
industryMaterialVo.setStepSize((long) industryTechnologyVos.size());
|
success.setStepSize((long) industryTechnologyVos.size());
|
||||||
industryMaterialService.updateIndustryMaterial(industryMaterialVo);
|
industryMaterialService.updateIndustryMaterial(success);
|
||||||
|
|
||||||
}
|
}
|
||||||
return 1;
|
|
||||||
|
// 到这里其实就已经完成了进入轧制的操作 接下来进行异常处理也就是将除去第一物料的其他物料工艺直接进行对比
|
||||||
|
// 出现问题则返回2代表存在工艺和规格不同的情况,且已经将异常料推入异常
|
||||||
|
// return 1为正常 2为异常且已经推入异常处理
|
||||||
|
return industryMaterialService.toCheckErrorMaterial(successList);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user