opt: 管芯入库完成

This commit is contained in:
2024-09-02 11:27:02 +08:00
parent 3587a2acc4
commit eafbc65dc1
9 changed files with 173 additions and 90 deletions

View File

@@ -104,7 +104,7 @@ public class WebSocketServer {
/**
* 群发自定义消息
* */
public static void sendInfo(SocketMsg socketMsg, @PathParam("sid") String sid) throws IOException {
public void sendInfo(SocketMsg socketMsg, @PathParam("sid") String sid) throws IOException {
String message = JSONObject.toJSONString(socketMsg);
log.debug("推送消息到"+sid+",推送内容:"+message);
for (WebSocketServer item : webSocketSet) {

View File

@@ -27,6 +27,7 @@ public enum TagNameEnum {
ERROR_GX_IN_OUT("管芯满入空出异常处理"),
AUTO_CALL_EMPTY_BY_CZZC("自动称重暂存位叫空"),
AUTO_IN_HOT("自动创建入烘箱"),
ACS_FEEDBACK_TUBE_COMPLETE("ACS反馈管芯入库完成"),
/**
* 标记符号
*/

View File

@@ -53,7 +53,7 @@ public class AcsToWmsController {
public ResponseEntity<Object> applyOvenGantryTask(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(acsToWmsService.applyOvenGantryTask(whereJson), HttpStatus.OK);
}
@PostMapping("/applyNewPoint")
@PostMapping("/applyPipeCoreRackNewPoint")
@Log(value = "管芯库满入空出申请新点位", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
@SaIgnore
public ResponseEntity<Object> applyNewPoint(@RequestBody JSONObject whereJson) {
@@ -71,6 +71,12 @@ public class AcsToWmsController {
public ResponseEntity<Object> receiveWasteFoilWeight(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(acsToWmsService.receiveWasteFoilWeight(whereJson), HttpStatus.OK);
}
@PostMapping("/feedbackTubeInStorageComplete")
@Log(value = "反馈管芯入库完成", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
@SaIgnore
public ResponseEntity<Object> acsFeedbackTubeInStorageComplete(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(acsToWmsService.acsFeedbackTubeInStorageComplete(whereJson), HttpStatus.OK);
}
@PostMapping("/againApply")
@Log(value = "二次申请任务", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)

View File

@@ -153,4 +153,11 @@ public interface AcsToWmsService {
* @return
*/
JSONObject applyRollUpRollerNewPoint(JSONObject param);
/**
* 反馈入库完成
* @param param /
* @return /
*/
JSONObject acsFeedbackTubeInStorageComplete(JSONObject param);
}

View File

@@ -202,4 +202,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public JSONObject applyRollUpRollerNewPoint(JSONObject param) {
return otherOperationService.takeUpRollExceptionHandling(param);
}
@Override
public JSONObject acsFeedbackTubeInStorageComplete(JSONObject param) {
return otherOperationService.acsFeedbackTubeInStorageComplete(param);
}
}

View File

@@ -18,6 +18,7 @@ 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.constant.GeneralDefinition;
import org.nl.wms.sch.task_manage.tasks.nbj.GxOutStorageTask;
import org.nl.wms.util.TaskUtils;
import org.nl.wms.util.URLEnum;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
@@ -140,50 +141,52 @@ public class GxPdaServiceImpl implements GxPdaService {
public JSONObject confirmedInStorageV2(JSONObject param) {
MDC.put(GeneralDefinition.MDC_KEY, TagNameEnum.GX_IN.getTag());
log.info("手持确认管芯入库 - {}", param);
// 获取管芯库入口
List<SchBasePoint> gxRks = pointService.getPointByConditions("A1", "A1-GXK",
"1", null, null, false);
// 将每一根存到物料表中,并且创建任务
int gxNumber = param.getInteger("gx_number");
String materialCode = param.getString("material_code");
String materialSpec = param.getString("material_spec");
if (gxNumber > 5) {
throw new BadRequestException("一次性最多只能入5个管芯");
}
// 找管芯库中的空位。
List<SchBasePoint> allGxPoints = pointService.getGxPointNotLock();
if (allGxPoints.size() < gxNumber) {
log.warn("管芯库不够存放,只够存放{}个管芯", allGxPoints.size());
}
int actualQuantity = Math.min(gxNumber, allGxPoints.size());
// 更新点位信息
List<SchBasePoint> updatePoint = new ArrayList<>();
for (int i = 0; i < actualQuantity; i++) {
SchBasePoint point = allGxPoints.get(i);
point.setLock_type("2");
point.setVehicle_code(materialCode);
point.setRemark(materialSpec);
updatePoint.add(point);
log.info("点位 {} 存放规格 {} 管芯", point.getPoint_code(), materialSpec);
}
// acs参数gx_code, device_code
JSONArray acsArray = new JSONArray();
JSONObject acs = new JSONObject();
acs.put("product_area", URLEnum.ACS_URL_A1.getProduct_area());
acs.put("device_code", gxRks.get(0).getPoint_code());
acs.put("num", gxNumber);
for (int i = 0; i < actualQuantity; i++) {
// 查找点位最终一次性发给ACS
acs.put("barcode" + (i + 1), materialCode);
acs.put("target" + (i + 1), allGxPoints.get(i).getPoint_code());
acsArray.add(acs);
}
// 调用ACS
log.info("调用ACS管芯入库的参数 - {}", acsArray);
JSONObject jsonObject = wmsToAcsService.toAcsGxInStorage(acsArray);
log.info("调用ACS管芯入库的反馈 - {}", jsonObject);
// 更新数据
pointService.updateBatchById(updatePoint);
TaskUtils.taskLock("inGx", () -> {
// 获取管芯库入口
List<SchBasePoint> gxRks = pointService.getPointByConditions("A1", "A1-GXK",
"1", null, null, true);
// 将每一根存到物料表中,并且创建任务
int gxNumber = param.getInteger("gx_number");
String materialCode = param.getString("material_code");
String materialSpec = param.getString("material_spec");
if (gxNumber > 5) {
throw new BadRequestException("一次性最多只能入5个管芯");
}
// 找管芯库中的空位。
List<SchBasePoint> allGxPoints = pointService.getGxPointNotLock();
if (allGxPoints.size() < gxNumber) {
log.warn("管芯库不够存放,只够存放{}个管芯", allGxPoints.size());
}
int actualQuantity = Math.min(gxNumber, allGxPoints.size());
// 更新点位信息
List<SchBasePoint> updatePoint = new ArrayList<>();
for (int i = 0; i < actualQuantity; i++) {
SchBasePoint point = allGxPoints.get(i);
point.setLock_type("2");
point.setVehicle_code(materialCode);
point.setRemark(materialSpec);
updatePoint.add(point);
log.info("点位 {} 存放规格 {} 管芯", point.getPoint_code(), materialSpec);
}
// acs参数gx_code, device_code
JSONArray acsArray = new JSONArray();
JSONObject acs = new JSONObject();
acs.put("product_area", URLEnum.ACS_URL_A1.getProduct_area());
acs.put("device_code", gxRks.get(0).getPoint_code());
acs.put("num", gxNumber);
for (int i = 0; i < actualQuantity; i++) {
// 查找点位最终一次性发给ACS
acs.put("barcode" + (i + 1), materialCode);
acs.put("target" + (i + 1), allGxPoints.get(i).getPoint_code());
acsArray.add(acs);
}
// 调用ACS
log.info("调用ACS管芯入库的参数 - {}", acsArray);
JSONObject jsonObject = wmsToAcsService.toAcsGxInStorage(acsArray);
log.info("调用ACS管芯入库的反馈 - {}", jsonObject);
// 更新数据
pointService.updateBatchById(updatePoint);
});
JSONObject result = new JSONObject();
result.put("status", HttpStatus.OK.value());
result.put("message", "管芯入库全部请求成功!");
@@ -209,52 +212,54 @@ public class GxPdaServiceImpl implements GxPdaService {
public JSONObject confirmedOutStorage(JSONObject param) {
MDC.put(GeneralDefinition.MDC_KEY, 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.getAllBusinessNotTaskPoint("A1", "A1-GXK",
"3", "2", null, materialCode);
if (allPoint.size() == 0) {
throw new BadRequestException("管芯不存在规格为[" + materialSpec + "]的管芯!");
}
log.info("找到规格:{} 的管芯有 {} 个", materialSpec, allPoint.size());
number = Math.min(number, allPoint.size());
log.info("输出 {} 个管芯", number);
// 获取终点
List<SchBasePoint> endPoints = pointService.getPointByConditions("A1", "A1-GXK",
"2", null, null, true);
if (endPoints.size() == 0) {
throw new BadRequestException("管芯出口未找到!");
}
SchBasePoint endPoint = endPoints.get(0);
List<SchBasePoint> updatePoints = new ArrayList<>();
for (int i = 0; i < number; i++) {
// 由任务完成来清除点位
SchBasePoint point = allPoint.get(i);
// 查找点位发给ACS
JSONObject taskParam = new JSONObject();
taskParam.put("product_area", URLEnum.ACS_URL_A1.getProduct_area());
taskParam.put("point_code1", point.getPoint_code());
taskParam.put("point_code2", endPoint.getPoint_code());
taskParam.put("vehicle_code", point.getVehicle_code());
taskParam.put("vehicle_type", point.getVehicle_type());
taskParam.put("config_code", "GxOutStorageTask");
taskParam.put("create_mode", GeneralDefinition.PDA_CREATION);
String task = gxOutStorageTask.createTask(taskParam);
log.info("任务创建成功 - {}", task);
}
// 批量清除点位
pointService.updateBatchById(updatePoints);
JSONObject result = new JSONObject();
TaskUtils.taskLock("outGx", () -> {
// 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.getAllBusinessNotTaskPoint("A1", "A1-GXK",
"3", "2", null, materialCode);
if (allPoint.size() == 0) {
throw new BadRequestException("管芯不存在规格为[" + materialSpec + "]的管芯!");
}
log.info("找到规格:{} 的管芯有 {} 个", materialSpec, allPoint.size());
number = Math.min(number, allPoint.size());
log.info("输出 {} 个管芯", number);
// 获取终点
List<SchBasePoint> endPoints = pointService.getPointByConditions("A1", "A1-GXK",
"2", null, null, true);
if (endPoints.size() == 0) {
throw new BadRequestException("管芯出口未找到!");
}
SchBasePoint endPoint = endPoints.get(0);
List<SchBasePoint> updatePoints = new ArrayList<>();
for (int i = 0; i < number; i++) {
// 由任务完成来清除点位
SchBasePoint point = allPoint.get(i);
// 查找点位发给ACS
JSONObject taskParam = new JSONObject();
taskParam.put("product_area", URLEnum.ACS_URL_A1.getProduct_area());
taskParam.put("point_code1", point.getPoint_code());
taskParam.put("point_code2", endPoint.getPoint_code());
taskParam.put("vehicle_code", point.getVehicle_code());
taskParam.put("vehicle_type", point.getVehicle_type());
taskParam.put("config_code", "GxOutStorageTask");
taskParam.put("create_mode", GeneralDefinition.PDA_CREATION);
String task = gxOutStorageTask.createTask(taskParam);
log.info("任务创建成功 - {}", task);
}
// 批量清除点位
pointService.updateBatchById(updatePoints);
result.put("message", "管芯出库 " + number + " 个管芯!");
});
result.put("status", HttpStatus.OK.value());
result.put("message", "管芯出库 " + number + " 个管芯!");
return result;
}
}

View File

@@ -21,4 +21,11 @@ public interface OtherOperationService {
* @return /
*/
JSONObject takeUpRollExceptionHandling(JSONObject param);
/**
* ACS反馈管芯入库完成
* @param param /
* @return /
*/
JSONObject acsFeedbackTubeInStorageComplete(JSONObject param);
}

View File

@@ -4,14 +4,19 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
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.system.service.notice.ISysNoticeService;
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.NoticeTypeEnum;
import org.nl.wms.sch.task_manage.core.enums.TaskFinishedTypeEnum;
import org.nl.wms.sch.task_manage.service.NbjOperationService;
import org.nl.wms.util.PointUtils;
@@ -36,6 +41,8 @@ public class NbjOperationServiceImpl implements NbjOperationService {
private ISchBasePointService pointService;
@Autowired
private ISchBaseTaskService taskService;
@Autowired
private ISysNoticeService sysNoticeService;
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject tubeExceptionHandling(JSONObject param) {
@@ -79,6 +86,20 @@ public class NbjOperationServiceImpl implements NbjOperationService {
throw new BadRequestException("重新分配货位失败!");
}
SchBasePoint point = allGxPoints.get(0);
if ("1".equals(type)) {
// 满入重新赋值
LambdaUpdateWrapper<SchBasePoint> lam = new UpdateWrapper<SchBasePoint>().lambda();
lam.set(SchBasePoint::getVehicle_code, exceptionPoint.getVehicle_code())
.set(SchBasePoint::getRemark, exceptionPoint.getRemark())
.set(SchBasePoint::getLock_type, "2")
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
.set(SchBasePoint::getUpdate_time, DateUtil.now())
.eq(SchBasePoint::getPoint_code, point.getPoint_code());
pointService.update(lam);
}
sysNoticeService.createNotice("点位" + deviceCode + "出现" + ("1".equals(type) ? "-满入" : "-空出") + ",请解决",
deviceCode + ("1".equals(type) ? "-满入" : "-空出") + "点位切换", NoticeTypeEnum.NOTIFICATION.getCode());
JSONObject data = new JSONObject();
data.put("device_code", point.getPoint_code());
JSONObject result = new JSONObject();

View File

@@ -5,19 +5,24 @@ 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.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
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.md.wastefoilrecord.service.IWastefoilrecordService;
import org.nl.wms.md.wastefoilrecord.service.dao.Wastefoilrecord;
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.service.OtherOperationService;
import org.nl.wms.util.PointUtils;
import org.nl.wms.util.TaskUtils;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
@@ -131,4 +136,30 @@ public class OtherOperationServiceImpl implements OtherOperationService {
result.put("data", data);
return result;
}
@Override
public JSONObject acsFeedbackTubeInStorageComplete(JSONObject param) {
MDC.put(GeneralDefinition.MDC_KEY, TagNameEnum.ACS_FEEDBACK_TUBE_COMPLETE.getTag());
log.info("ACS反馈管芯入库完成{}", param);
// device_code, barcode
String deviceCode = param.getString("device_code");
String barcode = param.getString("barcode");
SchBasePoint point = pointService.getById(deviceCode);
if (!barcode.equals(point.getVehicle_code())) {
throw new BadRequestException("系统点位记录的载具号[" + point.getVehicle_code() + "]与实际载具号[" + barcode + "]不符合!");
}
LambdaUpdateWrapper<SchBasePoint> lam = new UpdateWrapper<SchBasePoint>().lambda();
lam.set(SchBasePoint::getLock_type, "1")
.set(SchBasePoint::getPoint_status, "2")
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
.set(SchBasePoint::getUpdate_time, DateUtil.now())
.eq(SchBasePoint::getPoint_code, deviceCode);
pointService.update(lam);
log.info("点位[{}]更新成功", deviceCode);
JSONObject result = new JSONObject();
result.put("status", HttpStatus.OK.value());
result.put("message", "反馈管芯入库完成成功!");
return result;
}
}