feat: 管芯出入库、子卷下线、货梯状态修改
This commit is contained in:
@@ -15,6 +15,10 @@ public enum TagNameEnum {
|
||||
* LMS系统
|
||||
*/
|
||||
LMS("LMS系统"),
|
||||
GX_IN("手持管芯入库"),
|
||||
GX_OUT("手持管芯出库"),
|
||||
SWITCH_STATUS_OF_LIFT("货梯切换状态"),
|
||||
ERROR_GX_IN_OUT("管芯满入空出异常处理"),
|
||||
/**
|
||||
* 标记符号
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.nl.wms.basedata.material.service.ImdMeMaterialbaseService;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/mdMeMaterialbase")
|
||||
@RequestMapping("/api/mdBaseMaterial")
|
||||
@Slf4j
|
||||
public class MdMeMaterialbaseController {
|
||||
|
||||
|
||||
@@ -23,8 +23,6 @@ public class MdMeMaterialbase extends Model<MdMeMaterialbase> {
|
||||
|
||||
private static final long serialVersionUID = -7739291296662381393L;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
@@ -65,13 +63,13 @@ public class MdMeMaterialbase extends Model<MdMeMaterialbase> {
|
||||
/**
|
||||
* 基本计量单位
|
||||
*/
|
||||
private Long base_unit_id;
|
||||
private String base_unit_id;
|
||||
|
||||
|
||||
/**
|
||||
* 辅助计量单位
|
||||
*/
|
||||
private Long ass_unit_id;
|
||||
private String ass_unit_id;
|
||||
|
||||
|
||||
/**
|
||||
@@ -89,13 +87,13 @@ public class MdMeMaterialbase extends Model<MdMeMaterialbase> {
|
||||
/**
|
||||
* 物料分类标识
|
||||
*/
|
||||
private Long material_type_id;
|
||||
private String material_type_id;
|
||||
|
||||
|
||||
/**
|
||||
* 长度单位
|
||||
*/
|
||||
private Long len_unit_id;
|
||||
private String len_unit_id;
|
||||
|
||||
|
||||
/**
|
||||
@@ -119,7 +117,7 @@ public class MdMeMaterialbase extends Model<MdMeMaterialbase> {
|
||||
/**
|
||||
* 重量单位
|
||||
*/
|
||||
private Long weight_unit_id;
|
||||
private String weight_unit_id;
|
||||
|
||||
|
||||
/**
|
||||
@@ -137,7 +135,7 @@ public class MdMeMaterialbase extends Model<MdMeMaterialbase> {
|
||||
/**
|
||||
* 体积单位
|
||||
*/
|
||||
private Long cubage_unit_id;
|
||||
private String cubage_unit_id;
|
||||
|
||||
|
||||
/**
|
||||
@@ -149,7 +147,7 @@ public class MdMeMaterialbase extends Model<MdMeMaterialbase> {
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long create_id;
|
||||
private String create_id;
|
||||
|
||||
|
||||
/**
|
||||
@@ -168,7 +166,7 @@ public class MdMeMaterialbase extends Model<MdMeMaterialbase> {
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long update_optid;
|
||||
private String update_optid;
|
||||
|
||||
|
||||
/**
|
||||
@@ -207,17 +205,6 @@ public class MdMeMaterialbase extends Model<MdMeMaterialbase> {
|
||||
*/
|
||||
private String ext_id;
|
||||
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.material_id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.nl.wms.pda.st.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pda.st.service.GxPdaService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 管芯手持
|
||||
* @Date: 2024/8/13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/pda/gx")
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class GxPdaController {
|
||||
@Autowired
|
||||
private GxPdaService gxPdaService;
|
||||
@PostMapping("/getGxSpecification")
|
||||
@Log("管芯规格")
|
||||
public ResponseEntity<Object> getGxSpecification() {
|
||||
return new ResponseEntity<>(gxPdaService.getGxSpecification(), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/confirmedInStorage")
|
||||
@Log("管芯确认入库")
|
||||
public ResponseEntity<Object> confirmedInStorage(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(gxPdaService.confirmedInStorage(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/remainingQty")
|
||||
@Log("管芯剩余数量")
|
||||
public ResponseEntity<Object> remainingQty() {
|
||||
return new ResponseEntity<>(gxPdaService.remainingQty(), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/confirmedOutStorage")
|
||||
@Log("管芯确认出库")
|
||||
public ResponseEntity<Object> confirmedOutStorage(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(gxPdaService.confirmedOutStorage(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.nl.wms.pda.st.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pda.st.service.NbjPdaService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 内包间控制层
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/pda/nbj")
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class NbjPdaController {
|
||||
@Autowired
|
||||
private NbjPdaService nbjPdaService;
|
||||
@PostMapping("/confirmedInStorage")
|
||||
@Log("货梯状态切换")
|
||||
public ResponseEntity<Object> changeLiftStatus(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(nbjPdaService.changeLiftStatus(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/getLiftInfos")
|
||||
// @Log("货梯下拉框")
|
||||
public ResponseEntity<Object> getLiftInfos() {
|
||||
return new ResponseEntity<>(nbjPdaService.getLiftInfos(), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/getWeightCacheInfos")
|
||||
// @Log("成品称重暂存区下拉框")
|
||||
public ResponseEntity<Object> getWeightCacheInfos() {
|
||||
return new ResponseEntity<>(nbjPdaService.getWeightCacheInfos(), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/doSubVolumeDown")
|
||||
@Log("子卷下线")
|
||||
public ResponseEntity<Object> doSubVolumeDown(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(nbjPdaService.doSubVolumeDown(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.nl.wms.pda.st.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/8/13
|
||||
*/
|
||||
public interface GxPdaService {
|
||||
/**
|
||||
* 管芯规格下拉框
|
||||
* @return /
|
||||
*/
|
||||
JSONArray getGxSpecification();
|
||||
|
||||
/**
|
||||
* 管芯入库
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject confirmedInStorage(JSONObject param);
|
||||
|
||||
/**
|
||||
* 管芯剩余数量
|
||||
* @return
|
||||
*/
|
||||
int remainingQty();
|
||||
|
||||
/**
|
||||
* 管芯出库
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject confirmedOutStorage(JSONObject param);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.nl.wms.pda.st.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
public interface NbjPdaService {
|
||||
/**
|
||||
* 修改货梯状态
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject changeLiftStatus(JSONObject param);
|
||||
|
||||
/**
|
||||
* 下拉框
|
||||
* @return /
|
||||
*/
|
||||
JSONArray getLiftInfos();
|
||||
|
||||
/**
|
||||
* 子卷称重下拉框
|
||||
* @return /
|
||||
*/
|
||||
JSONArray getWeightCacheInfos();
|
||||
|
||||
/**
|
||||
* 子卷下线
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject doSubVolumeDown(JSONObject param);
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
package org.nl.wms.pda.st.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.lucene.TagNameEnum;
|
||||
import org.nl.wms.basedata.master.classification.service.IMdBaseClassstandardService;
|
||||
import org.nl.wms.basedata.master.classification.service.dao.MdBaseClassstandard;
|
||||
import org.nl.wms.basedata.material.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.basedata.material.service.ImdMeMaterialbaseService;
|
||||
import org.nl.wms.pda.st.service.GxPdaService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task_manage.core.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.tasks.nbj.GxInStorageTask;
|
||||
import org.nl.wms.util.URLEnum;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.nl.wms.util.PointUtils.clearPointNotUpdate;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/8/13
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class GxPdaServiceImpl implements GxPdaService {
|
||||
@Autowired
|
||||
private IMdBaseClassstandardService classstandardService;
|
||||
@Autowired
|
||||
private ImdMeMaterialbaseService meMaterialbaseService;
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private GxInStorageTask gxInStorageTask;
|
||||
@Override
|
||||
public JSONArray getGxSpecification() {
|
||||
MdBaseClassstandard one = classstandardService.getOne(new LambdaQueryWrapper<MdBaseClassstandard>()
|
||||
.eq(MdBaseClassstandard::getClass_code, "0002"));
|
||||
List<MdBaseClassstandard> list = classstandardService.list(new LambdaQueryWrapper<MdBaseClassstandard>()
|
||||
.eq(MdBaseClassstandard::getParent_class_id, one.getClass_id()));
|
||||
JSONArray jsonArray = list.stream()
|
||||
.map(item -> {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("text", item.getClass_name());
|
||||
jsonObject.put("value", item.getClass_code());
|
||||
return jsonObject;
|
||||
})
|
||||
.collect(Collectors.toCollection(JSONArray::new));
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject confirmedInStorage(JSONObject param) {
|
||||
MDC.put("tag_name", TagNameEnum.GX_IN.getTag());
|
||||
log.info("手持确认管芯入库 - {}", param);
|
||||
// row: gx_code, material_code, material_spec
|
||||
// 将每一根存到物料表中,并且创建任务
|
||||
JSONArray row = param.getJSONArray("row");
|
||||
if (row.size() > 5) {
|
||||
throw new BadRequestException("一次性最多只能入5个管芯");
|
||||
}
|
||||
// 找管芯库中的空位。
|
||||
List<SchBasePoint> allGxPoints = pointService.getPointByConditions("A1", "A1-GXK",
|
||||
"2", "1", null, true);
|
||||
if (allGxPoints.size() < row.size()) {
|
||||
throw new BadRequestException("管芯库不够存放,只够存放" + allGxPoints.size() + "个管芯");
|
||||
}
|
||||
// acs参数:gx_code, device_code
|
||||
JSONArray acsArray = new JSONArray();
|
||||
for (int i = 0; i < row.size(); i++) {
|
||||
JSONObject gxObj = row.getJSONObject(i);
|
||||
String gxCode = gxObj.getString("gx_code");
|
||||
String materialCode = gxObj.getString("material_code");
|
||||
String materialSpec = gxObj.getString("material_spec");
|
||||
MdMeMaterialbase materialbase = new MdMeMaterialbase();
|
||||
materialbase.setMaterial_id(gxCode);
|
||||
materialbase.setMaterial_code(gxCode);
|
||||
materialbase.setMaterial_name(materialSpec);
|
||||
materialbase.setMaterial_spec(materialSpec);
|
||||
materialbase.setMaterial_model(materialCode);
|
||||
materialbase.setCreate_time(DateUtil.now());
|
||||
materialbase.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
materialbase.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
meMaterialbaseService.save(materialbase);
|
||||
log.info("保存管芯 - {}", materialbase);
|
||||
// 查找点位最终一次性发给ACS
|
||||
JSONObject acs = new JSONObject();
|
||||
acs.put("product_area", URLEnum.ACS_URL_A1.getProduct_area());
|
||||
acs.put("gx_code", gxCode);
|
||||
acs.put("device_code", allGxPoints.get(i).getPoint_code());
|
||||
acsArray.add(acs);
|
||||
}
|
||||
// todo: 调用ACS
|
||||
log.info("调用ACS管芯入库- {}", acsArray);
|
||||
// 更新点位信息
|
||||
List<SchBasePoint> updatePoint = new ArrayList<>();
|
||||
for (int i = 0; i < row.size(); i++) {
|
||||
JSONObject rowObj = row.getJSONObject(i);
|
||||
SchBasePoint point = allGxPoints.get(i);
|
||||
String gxCode = rowObj.getString("gx_code");
|
||||
String materialCode = rowObj.getString("material_code");
|
||||
String materialSpec = rowObj.getString("material_spec");
|
||||
point.setPoint_status("2");
|
||||
point.setVehicle_code(gxCode);
|
||||
point.setVehicle_type(materialCode);
|
||||
point.setRemark(materialSpec);
|
||||
updatePoint.add(point);
|
||||
log.info("点位 {} 存放条码 {} 规格 {} 管芯", point.getPoint_code(), gxCode, materialSpec);
|
||||
}
|
||||
// 更新数据
|
||||
pointService.updateBatchById(updatePoint);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "管芯入库全部请求成功!");
|
||||
result.put("data", new JSONObject());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int remainingQty() {
|
||||
List<SchBasePoint> allGxPoints = pointService.getPointByConditions("A1", "A1-GXK",
|
||||
"2", "1", null, true);
|
||||
return allGxPoints.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject confirmedOutStorage(JSONObject param) {
|
||||
MDC.put("tag_name", TagNameEnum.GX_OUT.getTag());
|
||||
log.info("手持操作管芯出库 - {}", param);
|
||||
// param: number, material_code, material_spec
|
||||
int number = param.getInteger("number");
|
||||
// 记录在载具类型中
|
||||
String materialCode = param.getString("material_code");
|
||||
String materialSpec = param.getString("material_spec");
|
||||
if (number <= 0) {
|
||||
throw new BadRequestException("数量必须大于0!");
|
||||
}
|
||||
// 判断还有几个同规格的管芯
|
||||
List<SchBasePoint> allPoint = pointService.getPointByConditions("A1", "A1-GXK",
|
||||
"2", "2", materialCode, true);
|
||||
if (allPoint.size() == 0) {
|
||||
throw new BadRequestException("管芯不存在规格为[" + materialSpec + "]的管芯!");
|
||||
}
|
||||
log.info("找到规格:{} 的管芯有 {} 个", materialSpec, allPoint.size());
|
||||
number = Math.min(number, allPoint.size());
|
||||
log.info("输出 {} 个管芯", number);
|
||||
// acs参数:gx_code, device_code
|
||||
JSONArray acsArray = new JSONArray();
|
||||
List<SchBasePoint> updatePoints = new ArrayList<>();
|
||||
for (int i = 0; i < number; i++) {
|
||||
SchBasePoint point = allPoint.get(i);
|
||||
// 查找点位最终一次性发给ACS
|
||||
JSONObject acs = new JSONObject();
|
||||
acs.put("product_area", URLEnum.ACS_URL_A1.getProduct_area());
|
||||
acs.put("gx_code", point.getVehicle_code());
|
||||
acs.put("device_code", point.getDevice_code());
|
||||
acsArray.add(acs);
|
||||
// 点位清空
|
||||
clearPointNotUpdate(point, TaskFinishedTypeEnum.MANUAL_PDA);
|
||||
updatePoints.add(point);
|
||||
}
|
||||
// todo: 调用ACS
|
||||
log.info("调用ACS管芯入库- {}", acsArray);
|
||||
// 批量清除点位
|
||||
pointService.updateBatchById(updatePoints);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "管芯出库全部请求成功!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package org.nl.wms.pda.st.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.lucene.TagNameEnum;
|
||||
import org.nl.wms.pda.st.service.NbjPdaService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.core.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.tasks.nbj.SubRollDownAGVTask;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.nl.wms.util.PointUtils.setUpdateByPC;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class NbjPdaServiceImpl implements NbjPdaService {
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private SubRollDownAGVTask subRollDownAGVTask;
|
||||
@Override
|
||||
public JSONObject changeLiftStatus(JSONObject param) {
|
||||
MDC.put("tag_name", TagNameEnum.SWITCH_STATUS_OF_LIFT.getTag());
|
||||
log.info("货梯切换状态 - {}", param);
|
||||
// type: 1: 清空, 2:放空架子, point_code
|
||||
String type = param.getString("type");
|
||||
String pointCode = param.getString("point_code");
|
||||
SchBasePoint liftPoint = pointService.getById(pointCode);
|
||||
liftPoint.setPoint_status(type);
|
||||
PointUtils.setUpdateByType(liftPoint, TaskFinishedTypeEnum.MANUAL_PDA);
|
||||
pointService.updateById(liftPoint);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "货梯状态修改成功!");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getLiftInfos() {
|
||||
List<SchBasePoint> lifts = pointService.getPointByConditions("A1", "A1-LIFT-AREA",
|
||||
null, null, null, false);
|
||||
JSONArray jsonArray = lifts.stream()
|
||||
.map(item -> {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("text", item.getPoint_name());
|
||||
jsonObject.put("value", item.getPoint_code());
|
||||
return jsonObject;
|
||||
})
|
||||
.collect(Collectors.toCollection(JSONArray::new));
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getWeightCacheInfos() {
|
||||
List<SchBasePoint> lifts = pointService.getPointByConditions("A1", "A1-CZZC",
|
||||
null, null, null, false);
|
||||
JSONArray jsonArray = lifts.stream()
|
||||
.map(item -> {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("text", item.getPoint_name());
|
||||
jsonObject.put("value", item.getPoint_code());
|
||||
return jsonObject;
|
||||
})
|
||||
.collect(Collectors.toCollection(JSONArray::new));
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject doSubVolumeDown(JSONObject param) {
|
||||
log.info("手持子卷下线,送到货梯 - {}", param);
|
||||
// point_code, vehicle_code
|
||||
String pointCode = param.getString("point_code");
|
||||
String vehicleCode = param.getString("vehicle_code");
|
||||
// 校验任务
|
||||
List<SchBaseTask> schBaseTasks = taskService.checkHaveTask(pointCode);
|
||||
if (schBaseTasks.size() > 0) {
|
||||
throw new BadRequestException("该点位已经创建过任务!");
|
||||
}
|
||||
SchBasePoint startPoint = pointService.getById(pointCode);
|
||||
startPoint.setPoint_status("2");
|
||||
startPoint.setVehicle_code(vehicleCode);
|
||||
setUpdateByPC(startPoint);
|
||||
pointService.updateById(startPoint);
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("device_code", pointCode);
|
||||
// 纸管编码
|
||||
taskParam.put("vehicle_code", vehicleCode);
|
||||
taskParam.put("config_code", "SubRollDownAGVTask");
|
||||
taskParam.put("create_mode", GeneralDefinition.PDA_CREATION);
|
||||
subRollDownAGVTask.apply(taskParam);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "子卷下线成功!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.nl.wms.pdm.ivt.bcut.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pdm.ivt.bcut.service.IBstIvtCutpointivtService;
|
||||
import org.nl.wms.pdm.ivt.bcut.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.wms.pdm.ivt.bcut.service.dto.BstIvtCutpointivtQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Set;
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-02-26
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/bstIvtCutpointivt")
|
||||
public class BstIvtCutpointivtController {
|
||||
|
||||
@Autowired
|
||||
private IBstIvtCutpointivtService bstIvtCutpointivtService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询分切区缓存点位库存")
|
||||
//@SaCheckPermission("@el.check('bstIvtCutpointivt:list')")
|
||||
public ResponseEntity<Object> query(BstIvtCutpointivtQuery whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(bstIvtCutpointivtService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增分切区缓存点位库存")
|
||||
//@SaCheckPermission("@el.check('bstIvtCutpointivt:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody BstIvtCutpointivt entity){
|
||||
bstIvtCutpointivtService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改分切区缓存点位库存")
|
||||
//@SaCheckPermission("@el.check('bstIvtCutpointivt:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody BstIvtCutpointivt entity){
|
||||
bstIvtCutpointivtService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除分切区缓存点位库存")
|
||||
//@SaCheckPermission("@el.check('bstIvtCutpointivt:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
bstIvtCutpointivtService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 分切缓存点位相关的控制层、服务层、持久层
|
||||
*/
|
||||
package org.nl.wms.pdm.ivt.bcut;
|
||||
@@ -0,0 +1,125 @@
|
||||
package org.nl.wms.pdm.ivt.bcut.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.pdm.ivt.bcut.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.wms.pdm.ivt.bcut.service.dto.BstIvtCutpointivtQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2024-02-26
|
||||
**/
|
||||
public interface IBstIvtCutpointivtService extends IService<BstIvtCutpointivt> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<BstIvtCutpointivt>
|
||||
*/
|
||||
IPage<BstIvtCutpointivt> queryAll(BstIvtCutpointivtQuery whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(BstIvtCutpointivt entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(BstIvtCutpointivt entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 获取类型状态,没任务的点位
|
||||
* @param type 点位类型:1套轴对接位,2分切缓存位,3分切对接位,4套轴异常位
|
||||
* @param pointStatus 点位状态:1空位、2有气涨轴、3有子卷
|
||||
* @param area 区域(0上1下)
|
||||
* @param sort 0:不排序,1:正序, 2:倒序
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String area, String sort);
|
||||
/**
|
||||
* 获取类型状态,没任务的点位,不校验取货完成的任务
|
||||
* @param type 点位类型:1套轴对接位,2分切缓存位,3分切对接位,4套轴异常位
|
||||
* @param pointStatus 点位状态:1空位、2有气涨轴、3有子卷
|
||||
* @param area 区域(0上1下)
|
||||
* @param sort 0:不排序,1:正序, 2:倒序
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByStatusNotCheckPickUpCompleted(String type, String pointStatus, String area, String sort);
|
||||
|
||||
/**
|
||||
* 获取同尺寸的气涨轴
|
||||
* @param type 点位类型:1套轴对接位,2分切缓存位,3分切对接位,4套轴异常位
|
||||
* @param size 气涨轴尺寸
|
||||
* @param generation 代数(4:小,5:大)
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtCutpointivt> getPointByTypeAndShaftSize(String type, String size, String generation);
|
||||
|
||||
/**
|
||||
* 根据桁架对应的点位编码获取点位实体
|
||||
* @param point 桁架点位编码
|
||||
* @param flag 是否需要校验启用
|
||||
* @return 实体
|
||||
*/
|
||||
BstIvtCutpointivt getPintByTrussCode(String point, boolean flag);
|
||||
/**
|
||||
* 根据AGV对应的点位编码获取点位实体
|
||||
* @param point AGV点位编码
|
||||
* @param flag 是否需要校验启用
|
||||
* @return 实体
|
||||
*/
|
||||
BstIvtCutpointivt getPintByAgvCode(String point, boolean flag);
|
||||
|
||||
/**
|
||||
* 获取类型1状态3,没任务的点位
|
||||
* @param location 区域:0上1下
|
||||
* @return
|
||||
*/
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByLocationAreaAndStatus(String location);
|
||||
|
||||
/**
|
||||
* 获取一半的点位
|
||||
* @param type 点位类型:1套轴对接位,2分切缓存位,3分切对接位,4套轴异常位
|
||||
* @param pointStatus 点位状态:1空位、2有气涨轴、3有子卷
|
||||
* @param location 区域:0上1下
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtCutpointivt> getAllHalfPlacePoints(String type, String pointStatus, String location);
|
||||
|
||||
/**
|
||||
* 获取分切暂存下拉框
|
||||
* @param pointType /
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtCutpointivt> getPintByAgvCodesByPointType(String pointType);
|
||||
|
||||
/**
|
||||
* 获取准备好的气胀轴,套好纸管
|
||||
* @param resourceName 设备号
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtCutpointivt> getReallyQzzSameDevice(String resourceName);
|
||||
|
||||
/**
|
||||
* 根据区域、类型校验
|
||||
* @param area 区域
|
||||
* @param types 类型
|
||||
* @return /
|
||||
*/
|
||||
List<BstIvtCutpointivt> getPintByAgvCodesByPointTypeAndArea(String area, List<String> types);
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package org.nl.wms.pdm.ivt.bcut.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description 添加'@Builder'注解最好不好添加'@NoArgsConstructor'
|
||||
* @author lyd
|
||||
* @date 2024-02-26
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("bst_ivt_cutpointivt")
|
||||
public class BstIvtCutpointivt implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "ivt_id", type = IdType.NONE)
|
||||
/** 库存记录标识 */
|
||||
private String ivt_id;
|
||||
|
||||
/** AGV点位编码 */
|
||||
private String point_code;
|
||||
|
||||
/** AGV点位名称 */
|
||||
private String point_name;
|
||||
|
||||
/** 桁架点位编码1 */
|
||||
private String truss_point_code1;
|
||||
|
||||
/** 桁架点位编码2 */
|
||||
private String truss_point_code2;
|
||||
|
||||
/** 气胀轴编码1 */
|
||||
private String qzz_no1;
|
||||
|
||||
/** 气胀轴编码2 */
|
||||
private String qzz_no2;
|
||||
|
||||
/** 点位类型 */
|
||||
private String point_type;
|
||||
|
||||
/** 生产区域 */
|
||||
private String product_area;
|
||||
|
||||
/** 位置 */
|
||||
private String point_location;
|
||||
|
||||
/** 顺序号 */
|
||||
private BigDecimal sort_seq;
|
||||
|
||||
/** 是否启用 */
|
||||
private String is_used;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 创建人 */
|
||||
private String create_id;
|
||||
|
||||
/** 创建人姓名 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改人 */
|
||||
private String update_optid;
|
||||
|
||||
/** 修改人姓名 */
|
||||
private String update_optname;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
|
||||
/** 规划 */
|
||||
private String plan;
|
||||
|
||||
private String point_status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String qzz_generation;
|
||||
@TableField(exist = false)
|
||||
private String qzz_size;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.nl.wms.pdm.ivt.bcut.service.dao.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.pdm.ivt.bcut.service.dao.BstIvtCutpointivt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-02-26
|
||||
**/
|
||||
public interface BstIvtCutpointivtMapper extends BaseMapper<BstIvtCutpointivt> {
|
||||
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String area, String sort);
|
||||
|
||||
List<BstIvtCutpointivt> getPointByTypeAndShaftSize(String type, String size, String generation);
|
||||
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByLocationAreaAndStatus(String location);
|
||||
|
||||
List<BstIvtCutpointivt> getAllHalfPlacePoints(String type, String pointStatus, String location);
|
||||
|
||||
List<BstIvtCutpointivt> getReallyQzzSameDevice(String resourceName);
|
||||
|
||||
List<BstIvtCutpointivt> getAreaNotTaskPointByStatusNotCheckPickUpCompleted(String type, String pointStatus, String area, String sort);
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.pdm.ivt.bcut.service.dao.mapper.BstIvtCutpointivtMapper">
|
||||
|
||||
<select id="getAreaNotTaskPointByStatus"
|
||||
resultType="org.nl.wms.pdm.ivt.bcut.service.dao.BstIvtCutpointivt">
|
||||
SELECT bic.*
|
||||
FROM bst_ivt_cutpointivt bic
|
||||
WHERE bic.point_type = #{type}
|
||||
AND bic.is_used = '1'
|
||||
AND bic.point_status = #{pointStatus}
|
||||
AND bic.point_location = #{area}
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ <= ]]> '071' AND t.task_status <![CDATA[ <> ]]> '07'
|
||||
AND (t.point_code1 = bic.point_code OR t.point_code2 = bic.point_code
|
||||
OR t.point_code1 = bic.truss_point_code1 oR t.point_code2 = bic.truss_point_code1
|
||||
OR t.point_code1 = bic.truss_point_code2 oR t.point_code2 = bic.truss_point_code2)
|
||||
)
|
||||
<if test="sort == '1'">
|
||||
ORDER BY bic.sort_seq ASC
|
||||
</if>
|
||||
<if test="sort == '2'">
|
||||
ORDER BY bic.sort_seq DESC
|
||||
</if>
|
||||
|
||||
</select>
|
||||
<select id="getPointByTypeAndShaftSize"
|
||||
resultType="org.nl.wms.pdm.ivt.bcut.service.dao.BstIvtCutpointivt">
|
||||
SELECT bc.*
|
||||
FROM `bst_ivt_cutpointivt` bc
|
||||
LEFT JOIN pdm_bi_slittingproductionplan pp ON pp.qzzno = bc.qzz_no1
|
||||
OR pp.qzzno = bc.qzz_no2
|
||||
WHERE bc.point_type = #{type}
|
||||
AND IFNULL(pp.qzzno,'') <![CDATA[ <> ]]> ''
|
||||
AND pp.qzz_size = #{size}
|
||||
<if test="size == '3'">
|
||||
AND pp.qzz_generation = #{generation}
|
||||
</if>
|
||||
AND bc.is_used = '1'
|
||||
AND bc.point_status = '3'
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ < ]]> '07'
|
||||
AND (t.point_code1 = bc.truss_point_code1 OR t.point_code1 = bc.truss_point_code2))
|
||||
</select>
|
||||
<select id="getAreaNotTaskPointByLocationAreaAndStatus"
|
||||
resultType="org.nl.wms.pdm.ivt.bcut.service.dao.BstIvtCutpointivt">
|
||||
SELECT DISTINCT bic.*, p.qzz_generation, p.qzz_size
|
||||
FROM bst_ivt_cutpointivt bic
|
||||
LEFT JOIN pdm_bi_slittingproductionplan p ON ((p.qzzno = bic.qzz_no1 AND IFNULL(bic.qzz_no1,'') != '')
|
||||
OR (p.qzzno = bic.qzz_no2 AND IFNULL(bic.qzz_no2,'') != ''))
|
||||
WHERE bic.point_type = '1'
|
||||
AND bic.is_used = '1'
|
||||
AND bic.point_status = '3'
|
||||
AND bic.point_location = #{location}
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ < ]]> '07'
|
||||
AND (t.point_code1 = bic.point_code OR t.point_code2 = bic.point_code
|
||||
OR t.point_code1 = bic.truss_point_code1 oR t.point_code2 = bic.truss_point_code1
|
||||
OR t.point_code1 = bic.truss_point_code2 oR t.point_code2 = bic.truss_point_code2)
|
||||
)
|
||||
</select>
|
||||
<select id="getAllHalfPlacePoints"
|
||||
resultType="org.nl.wms.pdm.ivt.bcut.service.dao.BstIvtCutpointivt">
|
||||
SELECT
|
||||
bic.*
|
||||
FROM
|
||||
bst_ivt_cutpointivt bic
|
||||
WHERE
|
||||
bic.point_type = '1'
|
||||
AND bic.is_used = '1'
|
||||
AND bic.point_status = '2'
|
||||
AND bic.point_location = '0'
|
||||
AND (LENGTH(bic.qzz_no1) = 0 OR LENGTH(bic.qzz_no2) = 0)
|
||||
AND (LENGTH(bic.qzz_no1) <![CDATA[ > ]]> 0 OR LENGTH(bic.qzz_no2) <![CDATA[ > ]]> 0)
|
||||
AND 0 = (
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
sch_base_task t
|
||||
WHERE
|
||||
t.task_status <![CDATA[ < ]]> '07'
|
||||
AND (
|
||||
t.point_code1 = bic.point_code
|
||||
OR t.point_code2 = bic.point_code
|
||||
OR t.point_code1 = bic.truss_point_code1
|
||||
OR t.point_code2 = bic.truss_point_code1
|
||||
OR t.point_code1 = bic.truss_point_code2
|
||||
OR t.point_code2 = bic.truss_point_code2
|
||||
)
|
||||
)
|
||||
</select>
|
||||
<select id="getCachePointSame" resultType="org.nl.wms.pdm.ivt.bcut.service.dao.BstIvtCutpointivt">
|
||||
SELECT bc.*
|
||||
FROM bst_ivt_cutpointivt bc
|
||||
LEFT JOIN pdm_bi_slittingproductionplan p ON p.qzzno = bc.qzz_no1 OR p.qzzno = bc.qzz_no2
|
||||
WHERE bc.point_type = '1' AND bc.point_status = '2' AND (IFNULL(bc.qzz_no1,'') <![CDATA[ <> ]]> '' OR IFNULL(bc.qzz_no2,'') <![CDATA[ <> ]]> ''
|
||||
) AND (IFNULL(bc.qzz_no1,'') = '' OR IFNULL(bc.qzz_no2,'') = '')
|
||||
AND p.resource_name = #{resource_name}
|
||||
AND (p.restruct_container_name = #{parent_container_name} OR p.parent_container_name = #{parent_container_name})
|
||||
AND p.split_group = #{split_group}
|
||||
</select>
|
||||
<select id="getReallyQzzSameDevice"
|
||||
resultType="org.nl.wms.pdm.ivt.bcut.service.dao.BstIvtCutpointivt">
|
||||
SELECT bc.*
|
||||
FROM bst_ivt_cutpointivt bc
|
||||
LEFT JOIN pdm_bi_slittingproductionplan p ON p.qzzno = bc.qzz_no1 OR p.qzzno = bc.qzz_no2
|
||||
WHERE bc.point_type IN ('1', '3') AND bc.point_status = '2'
|
||||
AND (IFNULL(bc.qzz_no1,'') <![CDATA[ <> ]]> '' OR IFNULL(bc.qzz_no2,'') <![CDATA[ <> ]]> '')
|
||||
AND p.resource_name = #{resource_name} AND IFNULL(p.qzzno, '') <![CDATA[ <> ]]> ''
|
||||
|
||||
</select>
|
||||
<select id="getAreaNotTaskPointByStatusNotCheckPickUpCompleted"
|
||||
resultType="org.nl.wms.pdm.ivt.bcut.service.dao.BstIvtCutpointivt">
|
||||
SELECT bic.*
|
||||
FROM bst_ivt_cutpointivt bic
|
||||
WHERE bic.point_type = #{type}
|
||||
AND bic.is_used = '1'
|
||||
AND bic.point_status = #{pointStatus}
|
||||
AND bic.point_location = #{area}
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.task_status <![CDATA[ < ]]> '07'
|
||||
AND (t.point_code1 = bic.point_code OR t.point_code2 = bic.point_code
|
||||
OR t.point_code1 = bic.truss_point_code1 oR t.point_code2 = bic.truss_point_code1
|
||||
OR t.point_code1 = bic.truss_point_code2 oR t.point_code2 = bic.truss_point_code2)
|
||||
)
|
||||
<if test="sort == '1'">
|
||||
ORDER BY bic.sort_seq ASC
|
||||
</if>
|
||||
<if test="sort == '2'">
|
||||
ORDER BY bic.sort_seq DESC
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,81 @@
|
||||
package org.nl.wms.pdm.ivt.bcut.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2024-02-26
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
public class BstIvtCutpointivtDto implements Serializable {
|
||||
|
||||
/** 库存记录标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long ivt_id;
|
||||
|
||||
/** AGV点位编码 */
|
||||
private String point_code;
|
||||
|
||||
/** AGV点位名称 */
|
||||
private String point_name;
|
||||
|
||||
/** 桁架点位编码1 */
|
||||
private String truss_point_code1;
|
||||
|
||||
/** 桁架点位编码2 */
|
||||
private String truss_point_code2;
|
||||
|
||||
/** 气胀轴编码1 */
|
||||
private String qzz_no1;
|
||||
|
||||
/** 气胀轴编码2 */
|
||||
private String qzz_no2;
|
||||
|
||||
/** 点位类型 */
|
||||
private String point_type;
|
||||
|
||||
/** 生产区域 */
|
||||
private String product_area;
|
||||
|
||||
/** 位置 */
|
||||
private String point_location;
|
||||
|
||||
/** 顺序号 */
|
||||
private BigDecimal sort_seq;
|
||||
|
||||
/** 是否启用 */
|
||||
private String is_used;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 创建人 */
|
||||
private Long create_id;
|
||||
|
||||
/** 创建人姓名 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改人 */
|
||||
private Long update_optid;
|
||||
|
||||
/** 修改人姓名 */
|
||||
private String update_optname;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
|
||||
/** 规划 */
|
||||
private String plan;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.wms.pdm.ivt.bcut.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-02-26
|
||||
**/
|
||||
@Data
|
||||
public class BstIvtCutpointivtQuery implements Serializable {
|
||||
private String point_type;
|
||||
private String point_code;
|
||||
private String product_area;
|
||||
private String is_used;
|
||||
private String point_location;
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package org.nl.wms.pdm.ivt.bcut.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
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.pdm.ivt.bcut.service.IBstIvtCutpointivtService;
|
||||
import org.nl.wms.pdm.ivt.bcut.service.dao.BstIvtCutpointivt;
|
||||
import org.nl.wms.pdm.ivt.bcut.service.dao.mapper.BstIvtCutpointivtMapper;
|
||||
import org.nl.wms.pdm.ivt.bcut.service.dto.BstIvtCutpointivtQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2024-02-26
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BstIvtCutpointivtServiceImpl extends ServiceImpl<BstIvtCutpointivtMapper, BstIvtCutpointivt> implements IBstIvtCutpointivtService {
|
||||
|
||||
@Autowired
|
||||
private BstIvtCutpointivtMapper bstIvtCutpointivtMapper;
|
||||
|
||||
@Override
|
||||
public IPage<BstIvtCutpointivt> queryAll(BstIvtCutpointivtQuery whereJson, PageQuery page){
|
||||
LambdaQueryWrapper<BstIvtCutpointivt> lam = new LambdaQueryWrapper<>();
|
||||
lam.eq(ObjectUtil.isNotEmpty(whereJson.getPoint_code()), BstIvtCutpointivt::getPoint_code, whereJson.getPoint_code())
|
||||
.eq(ObjectUtil.isNotEmpty(whereJson.getPoint_type()), BstIvtCutpointivt::getPoint_type, whereJson.getPoint_type())
|
||||
.eq(ObjectUtil.isNotEmpty(whereJson.getProduct_area()), BstIvtCutpointivt::getProduct_area, whereJson.getProduct_area())
|
||||
.eq(ObjectUtil.isNotEmpty(whereJson.getIs_used()), BstIvtCutpointivt::getIs_used, whereJson.getIs_used())
|
||||
.eq(ObjectUtil.isNotEmpty(whereJson.getPoint_location()), BstIvtCutpointivt::getPoint_location, whereJson.getPoint_location());
|
||||
IPage<BstIvtCutpointivt> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
bstIvtCutpointivtMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(BstIvtCutpointivt entity) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
entity.setIvt_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setCreate_id(currentUserId);
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
entity.setUpdate_optid(currentUserId);
|
||||
entity.setUpdate_optname(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
bstIvtCutpointivtMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(BstIvtCutpointivt entity) {
|
||||
BstIvtCutpointivt dto = bstIvtCutpointivtMapper.selectById(entity.getIvt_id());
|
||||
if (dto == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_optid(currentUserId);
|
||||
entity.setUpdate_optname(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
|
||||
bstIvtCutpointivtMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
bstIvtCutpointivtMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtCutpointivt> getAreaNotTaskPointByStatus(String type, String pointStatus, String area, String sort) {
|
||||
return bstIvtCutpointivtMapper.getAreaNotTaskPointByStatus(type, pointStatus, area, sort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtCutpointivt> getAreaNotTaskPointByStatusNotCheckPickUpCompleted(String type, String pointStatus, String area, String sort) {
|
||||
return bstIvtCutpointivtMapper.getAreaNotTaskPointByStatusNotCheckPickUpCompleted(type, pointStatus, area, sort);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtCutpointivt> getPointByTypeAndShaftSize(String type, String size, String generation) {
|
||||
return bstIvtCutpointivtMapper.getPointByTypeAndShaftSize(type, size, generation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BstIvtCutpointivt getPintByTrussCode(String point, boolean flag) {
|
||||
LambdaQueryWrapper<BstIvtCutpointivt> lam = new QueryWrapper<BstIvtCutpointivt>().lambda();
|
||||
lam.eq(flag, BstIvtCutpointivt::getIs_used, "1")
|
||||
.and(blam -> blam.eq(BstIvtCutpointivt::getTruss_point_code1, point).or()
|
||||
.eq(BstIvtCutpointivt::getTruss_point_code2, point));
|
||||
return bstIvtCutpointivtMapper.selectOne(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BstIvtCutpointivt getPintByAgvCode(String point, boolean flag) {
|
||||
LambdaQueryWrapper<BstIvtCutpointivt> lam = new QueryWrapper<BstIvtCutpointivt>().lambda();
|
||||
lam.eq(flag, BstIvtCutpointivt::getIs_used, "1").eq(BstIvtCutpointivt::getPoint_code, point);
|
||||
return bstIvtCutpointivtMapper.selectOne(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtCutpointivt> getAreaNotTaskPointByLocationAreaAndStatus(String location) {
|
||||
return bstIvtCutpointivtMapper.getAreaNotTaskPointByLocationAreaAndStatus(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtCutpointivt> getAllHalfPlacePoints(String type, String pointStatus, String location) {
|
||||
return bstIvtCutpointivtMapper.getAllHalfPlacePoints(type, pointStatus, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtCutpointivt> getPintByAgvCodesByPointType(String pointType) {
|
||||
return bstIvtCutpointivtMapper.selectList(new LambdaQueryWrapper<BstIvtCutpointivt>()
|
||||
.eq(BstIvtCutpointivt::getPoint_type, pointType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtCutpointivt> getReallyQzzSameDevice(String resourceName) {
|
||||
return bstIvtCutpointivtMapper.getReallyQzzSameDevice(resourceName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BstIvtCutpointivt> getPintByAgvCodesByPointTypeAndArea(String area, List<String> types) {
|
||||
return bstIvtCutpointivtMapper.selectList(new LambdaQueryWrapper<BstIvtCutpointivt>()
|
||||
.eq(BstIvtCutpointivt::getProduct_area, area)
|
||||
.in(BstIvtCutpointivt::getPoint_type, types));
|
||||
}
|
||||
}
|
||||
@@ -83,10 +83,11 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
* @param region 区域
|
||||
* @param pointType 点位类型
|
||||
* @param pointStatus 点位状态
|
||||
* @param vehicleType 载具类型
|
||||
* @param flag 是否校验启用状态
|
||||
* @return /
|
||||
*/
|
||||
List<SchBasePoint> getPointByConditions(String area, String region, String pointType, String pointStatus, @NotNull boolean flag);
|
||||
List<SchBasePoint> getPointByConditions(String area, String region, String pointType, String pointStatus, String vehicleType, @NotNull boolean flag);
|
||||
|
||||
/**
|
||||
* 获取烘箱可用的对接位
|
||||
|
||||
@@ -145,6 +145,7 @@ public class SchBasePoint implements Serializable {
|
||||
|
||||
@TableField(exist = false)
|
||||
private String record_id;
|
||||
private String material_id;
|
||||
|
||||
private String device_code;
|
||||
|
||||
|
||||
@@ -215,12 +215,13 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchBasePoint> getPointByConditions(String area, String region, String pointType, String pointStatus, boolean flag) {
|
||||
public List<SchBasePoint> getPointByConditions(String area, String region, String pointType, String pointStatus, String vehicleType, boolean flag) {
|
||||
LambdaQueryWrapper<SchBasePoint> lam = new QueryWrapper<SchBasePoint>().lambda();
|
||||
lam.eq(ObjectUtil.isNotEmpty(area), SchBasePoint::getProduct_area, area)
|
||||
.eq(ObjectUtil.isNotEmpty(region), SchBasePoint::getRegion_code, region)
|
||||
.eq(ObjectUtil.isNotEmpty(pointType), SchBasePoint::getPoint_type, pointType)
|
||||
.eq(ObjectUtil.isNotEmpty(pointStatus), SchBasePoint::getPoint_status, pointStatus)
|
||||
.eq(ObjectUtil.isNotEmpty(vehicleType), SchBasePoint::getVehicle_type, vehicleType)
|
||||
.eq(flag, SchBasePoint::getIs_used, true);
|
||||
return pointMapper.selectList(lam);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.util.URLEnum;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -32,6 +33,12 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
public class AcsUtil {
|
||||
/**
|
||||
* 对数组进行拆分独自下发
|
||||
* @param api 请求路径
|
||||
* @param list 数据数组
|
||||
* @return acs响应
|
||||
*/
|
||||
public static JSONObject notifyAcs(String api, JSONArray list) {
|
||||
log.info("下发ACS参数----------------------------------------+" + api + ",---" + list.toString());
|
||||
//判断是否连接ACS系统
|
||||
@@ -182,4 +189,71 @@ public class AcsUtil {
|
||||
}
|
||||
return resultForAcs;
|
||||
}
|
||||
/**
|
||||
* 数组一次性下发
|
||||
* @param api 请求路径
|
||||
* @param list 数据数组
|
||||
* @return acs响应
|
||||
*/
|
||||
public static JSONObject notifyAcs4(String api, JSONArray list) {
|
||||
log.info("下发ACS参数----------------------------------------+" + api + ",---" + list.toString());
|
||||
//判断是否连接ACS系统
|
||||
String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_connect_acs").getValue();
|
||||
JSONObject result = new JSONObject();
|
||||
if (StrUtil.equals("0", isConnect)) {
|
||||
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "下发成功,但未连接ACS!");
|
||||
result.put("data", new JSONObject());
|
||||
return result;
|
||||
}
|
||||
JSONObject jo = list.getJSONObject(0);
|
||||
String product_area = jo.getString("product_area");
|
||||
|
||||
if (jo.containsKey("class_type") && jo.getString("class_type").contains("0105")) {
|
||||
product_area = "LK";
|
||||
}
|
||||
if (StrUtil.isEmpty(product_area)) {
|
||||
throw new BadRequestException("区域不能为空!下发信息:" + jo.toString());
|
||||
}
|
||||
|
||||
String acs_url = URLEnum.find(product_area);
|
||||
if (StrUtil.isEmpty(acs_url)) {
|
||||
log.info(product_area);
|
||||
throw new BadRequestException("未查询到区域对应的acs地址!");
|
||||
}
|
||||
|
||||
String url = acs_url + api;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(list))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
log.info("ACS相应参数----------------------------------------+" + api + ",---" + result.toString());
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//ConnectException: Connection refused: connect
|
||||
//网络不通
|
||||
result.put("status", HttpStatus.BAD_REQUEST);
|
||||
result.put("message", "网络不通,操作失败!");
|
||||
result.put("data", new JSONObject());
|
||||
}
|
||||
//acs抛异常这里
|
||||
if (!StrUtil.equals(result.getString("status"), "200")) {
|
||||
throw new BadRequestException(result.getString("message"));
|
||||
} else {
|
||||
//如果向ACS下发任务,变更任务状态为下发
|
||||
if ("api/wms/task".equals(api)) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JSONObject task_jo = list.getJSONObject(i);
|
||||
ISchBaseTaskService bean = SpringContextHolder.getBean(ISchBaseTaskService.class);
|
||||
bean.update(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.set(SchBaseTask::getTask_status, TaskStatus.ISSUE.getCode())
|
||||
.eq(SchBaseTask::getTask_id, task_jo.getString("ext_task_id")));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.wms.sch.task_manage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 内包间处理服务层
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
public interface NbjOperationService {
|
||||
/**
|
||||
* 管芯库满入空出的异常处理
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject tubeExceptionHandling(JSONObject param);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.nl.wms.sch.task_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.lucene.TagNameEnum;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task_manage.core.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.service.NbjOperationService;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.wms.util.PointUtils.clearPoint;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class NbjOperationServiceImpl implements NbjOperationService {
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject tubeExceptionHandling(JSONObject param) {
|
||||
MDC.put("tag_name", TagNameEnum.ERROR_GX_IN_OUT.getTag());
|
||||
log.info("ACS请求满入/空出异常处理 - {}", param);
|
||||
// type: 1满入,2空出、device_code: 异常点位
|
||||
String type = param.getString("type");
|
||||
String deviceCode = param.getString("device_code");
|
||||
Assert.notBlank(type, "类型不能为空!");
|
||||
Assert.notBlank(deviceCode, "点位不能为空!");
|
||||
SchBasePoint exceptionPoint = pointService.getById(deviceCode);
|
||||
List<SchBasePoint> allGxPoints;
|
||||
if ("1".equals(type)) {
|
||||
// 满入: 把点位禁用,重新分配点位
|
||||
exceptionPoint.setIs_used(false);
|
||||
exceptionPoint.setUpdate_time(DateUtil.now());
|
||||
allGxPoints = pointService.getPointByConditions("A1", "A1-GXK",
|
||||
"2", "1", null, true);
|
||||
log.info("满入禁用点位");
|
||||
pointService.updateById(exceptionPoint);
|
||||
} else {
|
||||
// 空出: 根据点位的载具类型查找相同位置
|
||||
String vehicleType = exceptionPoint.getVehicle_type();
|
||||
allGxPoints = pointService.getPointByConditions("A1", "A1-GXK",
|
||||
"2", "2", vehicleType, true);
|
||||
}
|
||||
if (allGxPoints.size() == 0) {
|
||||
throw new BadRequestException("重新分配货位失败!");
|
||||
}
|
||||
SchBasePoint point = allGxPoints.get(0);
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("device_code", point.getPoint_code());
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "满入空出异常处理请求成功!");
|
||||
result.put("data", data);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.nl.wms.sch.task_manage.tasks.nbj;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.TaskStatus;
|
||||
import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.core.enums.TaskFinishedTypeEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.wms.util.TaskUtils.*;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 管芯入库任务
|
||||
* @Date: 2024/8/13
|
||||
*/
|
||||
@Deprecated
|
||||
@Slf4j
|
||||
@Component(value = "GxInStorageTask")
|
||||
public class GxInStorageTask extends AbstractTask {
|
||||
private final String THIS_CLASS = GxInStorageTask.class.getName();
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Override
|
||||
public void create() throws BadRequestException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createCompletion(SchBaseTask task) {
|
||||
// 找管芯库中没有任务的空位。
|
||||
List<SchBasePoint> allGxPoints = pointService.getHotNotTaskPoint("A1", "A1-GXK",
|
||||
"2", "1");
|
||||
// todo: 此处抛异常可能会全部回滚,需要按实际情况调整
|
||||
if (allGxPoints.size() == 0) {
|
||||
throw new BadRequestException("管芯库已经没有空位存放管芯!");
|
||||
}
|
||||
SchBasePoint point = allGxPoints.get(0);
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
// 保存任务参数
|
||||
task.setHandle_class(THIS_CLASS);
|
||||
task.setTask_status(TaskStatus.START_AND_POINT.getCode());
|
||||
setUpdateByPC(task);
|
||||
taskService.save(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
checkTaskOptionStatus(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
checkTaskOptionStatus(taskObj);
|
||||
// 取消
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package org.nl.wms.sch.task_manage.tasks.nbj;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.TaskStatus;
|
||||
import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.core.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.wms.util.TaskUtils.checkTaskOptionStatus;
|
||||
import static org.nl.wms.util.TaskUtils.setUpdateByPC;
|
||||
import static org.nl.wms.util.PointUtils.clearPoint;
|
||||
import static org.nl.wms.util.PointUtils.setUpdateByType;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 子卷下线agv任务
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
@Slf4j
|
||||
@Component(value = "SubRollDownAGVTask")
|
||||
public class SubRollDownAGVTask extends AbstractTask {
|
||||
private final String THIS_CLASS = SubRollDownAGVTask.class.getName();
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Override
|
||||
public void create() throws BadRequestException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createCompletion(SchBaseTask task) {
|
||||
// 查找空位没任务的货梯
|
||||
List<SchBasePoint> lifts = pointService.getAllBusinessNotTaskPoint("A1", "A1-LIFT-AREA",
|
||||
"1", "1", null);
|
||||
if (lifts.size() == 0) {
|
||||
throw new BadRequestException("暂无可用的货梯!");
|
||||
}
|
||||
SchBasePoint liftPoint = lifts.get(0);
|
||||
task.setPoint_code2(liftPoint.getPoint_code());
|
||||
// 创建任务
|
||||
task.setHandle_class(THIS_CLASS);
|
||||
task.setTask_status(TaskStatus.START_AND_POINT.getCode());
|
||||
setUpdateByPC(task);
|
||||
taskService.save(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
checkTaskOptionStatus(taskObj);
|
||||
// 起点清空(没有取货完成的业务),终点赋值
|
||||
String startPointCode = taskObj.getPoint_code1();
|
||||
String endPointCode = taskObj.getPoint_code2();
|
||||
SchBasePoint startPoint = pointService.getById(startPointCode);
|
||||
SchBasePoint endPoint = pointService.getById(endPointCode);
|
||||
clearPoint(startPoint, taskFinishedType);
|
||||
endPoint.setPoint_status("2");
|
||||
endPoint.setVehicle_code(taskObj.getVehicle_code());
|
||||
setUpdateByType(endPoint, taskFinishedType);
|
||||
pointService.updateById(endPoint);
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
checkTaskOptionStatus(taskObj);
|
||||
// 取消
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,8 @@ public class RawCallRollTrussTask extends AbstractTask {
|
||||
throw new BadRequestException("找不到同规格的收卷辊!");
|
||||
}
|
||||
// 终点为出口,不校验是否占用
|
||||
List<SchBasePoint> endPoints = pointService.getPointByConditions("A1", "A1-SJGK", "2", null, true);
|
||||
List<SchBasePoint> endPoints = pointService.getPointByConditions("A1", "A1-SJGK",
|
||||
"2", null, null, true);
|
||||
if (endPoints.size() == 0) {
|
||||
throw new BadRequestException("收卷辊出口查询失败!");
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class SlitterSendRollAGVTask extends AbstractTask {
|
||||
// 查找终点:获取收卷辊入口
|
||||
// 终点为入口,不校验是否占用
|
||||
List<SchBasePoint> endPoints = pointService.getPointByConditions("A1",
|
||||
"A1-SJGK", "1", null, true);
|
||||
"A1-SJGK", "1", null, null, true);
|
||||
if (endPoints.size() == 0) {
|
||||
throw new BadRequestException("收卷辊出口查询失败!");
|
||||
}
|
||||
|
||||
@@ -66,7 +66,8 @@ public class SlitterUpAGVTask extends AbstractTask {
|
||||
task.setPoint_code2(cutPoint.getFull_point_code());
|
||||
} else {
|
||||
// 收卷辊的入库不做校验
|
||||
List<SchBasePoint> sjgPoints = pointService.getPointByConditions("A1", "A1-SJGK", "1", null, false);
|
||||
List<SchBasePoint> sjgPoints = pointService.getPointByConditions("A1", "A1-SJGK",
|
||||
"1", null, null, false);
|
||||
if (sjgPoints.size() == 0) {
|
||||
throw new BadRequestException("收卷辊库找不到入口!");
|
||||
}
|
||||
|
||||
@@ -52,7 +52,8 @@ public class SlitterUpTrussTask extends AbstractTask {
|
||||
JSONObject requestObj = JSONObject.parseObject(requestParam);
|
||||
String pointCode = requestObj.getString("zc_point");
|
||||
// 终点为出口,不校验是否占用
|
||||
List<SchBasePoint> endPoints = pointService.getPointByConditions("A1", "A1-HXZC", "1", null, true);
|
||||
List<SchBasePoint> endPoints = pointService.getPointByConditions("A1", "A1-HXZC",
|
||||
"1", null, null, true);
|
||||
if (endPoints.size() == 0) {
|
||||
throw new BadRequestException("烘箱出口查询失败!");
|
||||
}
|
||||
|
||||
@@ -58,10 +58,30 @@ public class PointUtils {
|
||||
point.setIng_task_code("");
|
||||
point.setSource_id("");
|
||||
point.setVehicle_qty(0);
|
||||
point.setMaterial_code("");
|
||||
point.setUpdate_time(DateUtil.now());
|
||||
setUpdateByType(point, taskFinishedType);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
/**
|
||||
* 清空点位(不会在此工具进行update)
|
||||
* 会直接更新数据,使用时候需要在update
|
||||
* @param point
|
||||
*/
|
||||
public static void clearPointNotUpdate(SchBasePoint point, TaskFinishedTypeEnum taskFinishedType) {
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
return; // 空直接退出
|
||||
}
|
||||
point.setPoint_status(PointStatusEnum.EMPTY_POINT.getCode());
|
||||
point.setVehicle_type("");
|
||||
point.setVehicle_code("");
|
||||
point.setIng_task_code("");
|
||||
point.setSource_id("");
|
||||
point.setVehicle_qty(0);
|
||||
point.setMaterial_code("");
|
||||
point.setUpdate_time(DateUtil.now());
|
||||
setUpdateByType(point, taskFinishedType);
|
||||
}
|
||||
/**
|
||||
* 烘箱清空点位
|
||||
* 会直接更新数据,使用时候不需要在update
|
||||
@@ -130,6 +150,11 @@ public class PointUtils {
|
||||
pointObj.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
/**
|
||||
* 赋值点位修改信息,只做赋值不做更新!!!
|
||||
* @param pointObj 点位
|
||||
* @param taskFinishedType 操作类型
|
||||
*/
|
||||
public static void setUpdateByType(SchBasePoint pointObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
if (taskFinishedType.equals(TaskFinishedTypeEnum.AUTO_ACS)) {
|
||||
setUpdateByAcs(pointObj);
|
||||
|
||||
Reference in New Issue
Block a user