fix: 调试中出现的问题

This commit is contained in:
2025-03-09 18:02:15 +08:00
parent a7d2c0288f
commit f8081c4949
30 changed files with 1072 additions and 146 deletions

View File

@@ -3,6 +3,8 @@ package org.nl.b_lms.sch.point.dao.mapper;
import org.nl.b_lms.sch.point.dao.StIvtShaftivt;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* {@code @Description:} 内包间点位库存表(StIvtShaftivt)数据持久层
* {@code @Author:} gbx
@@ -12,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface StIvtShaftivtMapper extends BaseMapper<StIvtShaftivt> {
List<StIvtShaftivt> getCachePointNoTask(String productArea);
}

View File

@@ -0,0 +1,10 @@
<?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.b_lms.sch.point.dao.mapper.StIvtShaftivtMapper">
<select id="getCachePointNoTask" resultType="org.nl.b_lms.sch.point.dao.StIvtShaftivt">
SELECT * FROM st_ivt_shaftivt s
WHERE s.point_type = '11' AND s.have_qzz = '0' AND s.is_used = '1' AND s.product_area = #{productArea}
AND 0 = (SELECT COUNT(*) FROM sch_base_task t WHERE t.point_code2 = s.point_code AND t.task_status <![CDATA[ < ]]> '07' AND t.is_delete = '0')
</select>
</mapper>

View File

@@ -3,6 +3,7 @@ package org.nl.b_lms.sch.point.service;
import org.nl.b_lms.sch.point.dao.StIvtShaftivt;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -52,6 +53,12 @@ public interface IstIvtShaftivtService extends IService<StIvtShaftivt> {
void deleteAll(Set<String> ids);
/**
* 获取该区域可用的子卷暂存架
* @param productArea
* @return
*/
List<StIvtShaftivt> getCachePointNoTask(String productArea);
}

View File

@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import org.nl.common.domain.query.PageQuery;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -81,6 +82,11 @@ public class StIvtShaftivtServiceImpl extends ServiceImpl<StIvtShaftivtMapper, S
stIvtShaftivtMapper.deleteBatchIds(ids);
}
@Override
public List<StIvtShaftivt> getCachePointNoTask(String productArea) {
return stIvtShaftivtMapper.getCachePointNoTask(productArea);
}
/**
* 获取实体基础信息

View File

@@ -145,4 +145,9 @@ public class WmsToAcsController {
public ResponseEntity<Object> querydeviceOne(@RequestBody JSONObject jo) {
return new ResponseEntity<>(wmsToAcsService.queryBoxWeigh(jo), HttpStatus.OK);
}
@PostMapping("/queryRGVStatus")
@Log(value = "查询RGV状态", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
public ResponseEntity<Object> queryRGVStatus(@RequestBody JSONObject jo) {
return new ResponseEntity<>(wmsToAcsService.queryRGVStatus(jo), HttpStatus.OK);
}
}

View File

@@ -94,7 +94,7 @@ public interface AcsToWmsService {
JSONObject sendCBZInfo(JSONObject whereJson);
/**
* 2、反馈尺寸3、申请放货4、申请取货6、套轴申请7、套轴完成8、拔轴完成9、反馈重量
* 2、反馈尺寸3、申请放货4、申请取货6、套轴申请7、套轴完成8、拔轴完成9、反馈重量10、扫码异常放货到人工RGV
* @param whereJson
* @return
*/

View File

@@ -153,4 +153,11 @@ public interface WmsToAcsService {
* @return JSONObject
*/
JSONObject queryBoxWeigh(JSONObject jo);
/**
* 查询RGV状态
* @param jo
* @return
*/
JSONObject queryRGVStatus(JSONObject jo);
}

View File

@@ -23,7 +23,9 @@ import org.nl.b_lms.pda.service.ProductOutTwoService;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
import org.nl.b_lms.sch.point.dao.StIvtCutpointivt;
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
import org.nl.b_lms.sch.point.service.IstIvtCutpointivtService;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
import org.nl.b_lms.sch.tasks.TwoBoxExcepTask;
@@ -40,6 +42,7 @@ import org.nl.common.enums.NoticeTypeEnum;
import org.nl.common.enums.PackageInfoIvtEnum;
import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.MapOf;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
@@ -162,6 +165,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Autowired
private ProductOutTwoService productOutTwoService;
private final IstIvtCutpointivtService cutpointivtService;
/**
* task_id任务标识
@@ -1092,9 +1097,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public JSONObject sendGetGoalStruct(JSONObject whereJson) {
log.info("sendGetGoalStruct请求参数为--------------------------" + whereJson.toString());
//type:2、反馈尺寸3、申请放货4、申请取货6、套轴申请7、套轴完成8、拔轴完成9、反馈重量
//type:2、反馈尺寸3、申请放货4、申请取货6、套轴申请7、套轴完成8、拔轴完成9、反馈重量10、扫码异常放货到人工RGV
String type = whereJson.getString("type");
String device_code = whereJson.getString("device_code");
WQLObject ivt_shaftivt = WQLObject.getWQLObject("st_ivt_shaftivt");
JSONObject result = new JSONObject();
//桁架任务 (气胀轴任务)
@@ -1113,6 +1119,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} else {
product_area = task_jo.getString("product_area");
}
boolean openTzArea = RenUtils.isOpenTzArea(product_area);
boolean openTempArea = RenUtils.isOpenTempArea(product_area);
// hint: 不在设置公共位置
String public_area = product_area;
// if (product_area.equals("A1") || product_area.equals("A2")) {
@@ -1179,9 +1187,32 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
JSONObject jo = new JSONObject();
jo.put("task_type", "010604");
jo.put("point_code1", cbz_jo.getString("point_code"));
JSONObject fhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '7' AND product_area = '" + product_area + "'").uniqueResult(0);
JSONObject fhd_jo;
// 判断是不是3寸的
if (openTzArea && "3".equals(cbz_size) && openTempArea) {
//查询可用的空点位
fhd_jo = WQL.getWO("QAUTO_QUERY").addParam("flag", "6001")
.addParam("need_size", cbz_size)
.addParam("need_generation", cbz_generation)
.addParam("product_area", product_area)
.process().uniqueResult(0);
} else {
// A1_FHD_01
fhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '7' AND product_area = '" + product_area + "'").uniqueResult(0);
}
jo.put("point_code2", fhd_jo.getString("point_code"));
JSONObject qhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '6' AND product_area = '" + product_area + "'").uniqueResult(0);
JSONObject qhd_jo;
if ("3".equals(zg_size) && openTempArea && openTzArea) {
// 判断是不是3寸的
//查询可用的空点位
qhd_jo = WQL.getWO("QAUTO_QUERY").addParam("flag", "6002")
.addParam("need_size", zg_size)
.addParam("need_generation", zg_generation)
.addParam("product_area", product_area)
.process().uniqueResult(0);
} else {
qhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '6' AND product_area = '" + product_area + "'").uniqueResult(0);
}
jo.put("point_code3", qhd_jo.getString("point_code"));
jo.put("point_code4", cbz_jo.getString("point_code"));
jo.put("product_area", product_area);
@@ -1297,6 +1328,31 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
result.put("message", "反馈成功!");
return result;
} else {
JSONObject jo = new JSONObject();
jo.put("task_type", "010606");
JSONObject tggw_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("product_area = '" + product_area + "' AND point_type = '4'").uniqueResult(0);
jo.put("task_id", IdUtil.getSnowflake(1,1).nextIdStr());
jo.put("task_code", IdUtil.getSnowflake(1,1).nextIdStr());
jo.put("point_code1", tggw_jo.getString("point_code"));
jo.put("point_code2", in_jo.getString("point_code"));
jo.put("product_area", product_area);
jo.put("vehicle_code", task_resq.getString("container_name1"));
jo.put("task_status", TaskStatusEnum.SURE_START.getCode());
jo.put("material_code", task_resq.getString("container_name1"));
JSONObject request_param = new JSONObject();
request_param.put("temp", "2");
request_param.put("need_size", cbz_size);
request_param.put("need_generation", cbz_generation);
request_param.put("need_location", point_location);
request_param.put("container_name1", task_resq.getString("container_name1"));
request_param.put("container_name2", task_resq.getString("container_name2"));
jo.put("request_param", request_param.toString());
jo.put("handle_class", PaperTrussTask.class.getName());
jo.put("create_time", DateUtil.now());
jo.put("priority", "1");
jo.put("acs_task_type", "9");
jo.put("response_param", "1");
WQLObject.getWQLObject("SCH_BASE_Task").insert(jo);
noticeService.createNotice("套轴气胀轴缓存架空位不足", "套轴气胀轴缓存架空位不足"
, NoticeTypeEnum.WARN.getCode());
result.put("status", HttpStatus.OK.value());
@@ -1354,9 +1410,15 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
//更新任务
if ("010603".equals(task_jo.getString("task_type")) || "010604".equals(task_jo.getString("task_type"))) {
if(!task_jo.getString("point_code2").contains("FHD")) {
return result;
}
task_jo.put("point_code2", struct_jo.getString("point_code"));
}
if ("010606".equals(task_jo.getString("task_type"))) {
if(!task_jo.getString("point_code1").contains("FHD")) {
return result;
}
task_jo.put("point_code1", struct_jo.getString("point_code"));
}
@@ -1409,21 +1471,54 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
//todo:创建桁架任务搬运一个符合的气涨轴
JSONObject jo = new JSONObject();
jo.put("task_type", "010602");
JSONObject qhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '6' AND product_area = '" + public_area + "'").uniqueResult(0);
JSONObject qhd_jo = null;
String flag = "1";
// 判断是不是3寸的
if (openTzArea && "3".equals(need_size) && openTempArea) {
//查询可用的空点位
qhd_jo = WQL.getWO("QAUTO_QUERY").addParam("flag", "6002")
.addParam("need_size", need_size)
.addParam("need_generation", need_generation)
.addParam("product_area", product_area)
.process().uniqueResult(0);
jo.put("truss_type", "1");
flag = "1";
} else {
qhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '6' AND product_area = '" + public_area + "'").uniqueResult(0);
jo.put("truss_type", "8");
flag = "2";
}
jo.put("point_code1", qhd_jo.getString("point_code"));
jo.put("point_code2", cbz_jo.getString("point_code"));
jo.put("truss_type", "8");
jo.put("vehicle_code", tggw_jo.getString("container_name1") + "-qzz");
jo.put("product_area", product_area);
JSONObject tas_param = new JSONObject();
tas_param.put("need_size", tggw_jo.getString("qzz_size"));
tas_param.put("need_generation", tggw_jo.getString("qzz_generation"));
tas_param.put("flag", flag);
jo.put("request_param", tas_param.toString());
paperTrussTask.createTask(jo);
}
}
}
}
// 扫码异常放货到人工RGV
if ("10".equals(type)) {
if (ObjectUtil.isEmpty(task_jo)) {
throw new BadRequestException("桁架任务不能为空!");
}
JSONObject rgv_jo = ivt_shaftivt.query("point_code = '" + device_code + "'").uniqueResult(0);
int have_qzz = rgv_jo.getIntValue("have_qzz");
rgv_jo.put("have_qzz", have_qzz + 1);
ivt_shaftivt.update(rgv_jo);
task_jo.put("point_code2", device_code);
task_jo.put("remark", "桁架异常自动到人工RGV");
task_jo.put("update_time", DateUtil.now());
task_jo.put("update_optid", SecurityUtils.getCurrentUserId());
task_jo.put("update_optname", SecurityUtils.getCurrentNickName());
task_jo.put("task_status", TaskStatusEnum.FINISHED.getCode());
WQLObject.getWQLObject("sch_base_task").update(task_jo);
}
WQLObject.getWQLObject("sch_base_task").update(task_jo);
result.put("status", HttpStatus.OK.value());
result.put("device_code", struct_jo.getString("point_code"));
@@ -1472,12 +1567,24 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
JSONObject jo = new JSONObject();
jo.put("task_type", "010603");
jo.put("point_code1", cbz_jo.getString("point_code"));
// A1_FHD_01
JSONObject fhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '7' AND product_area = '" + product_area + "'").uniqueResult(0);
JSONObject fhd_jo = null;
// 判断是不是3寸的
if (RenUtils.isOpenTzArea(product_area) && "3".equals(cbz_size) && RenUtils.isOpenTempArea(product_area)) {
//查询可用的空点位
fhd_jo = WQL.getWO("QAUTO_QUERY").addParam("flag", "6001")
.addParam("need_size", cbz_size)
.addParam("need_generation", cbz_generation)
.addParam("product_area", product_area)
.process().uniqueResult(0);
jo.put("truss_type", "1");
} else {
// A1_FHD_01
fhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '7' AND product_area = '" + product_area + "'").uniqueResult(0);
jo.put("truss_type", "8");
}
jo.put("point_code2", fhd_jo.getString("point_code"));
jo.put("product_area", product_area);
jo.put("vehicle_code", DateUtil.format(DateUtil.date(), "HHmm") + "qzz");
jo.put("truss_type", "8");
JSONObject request_param = new JSONObject();
request_param.put("have_size", cbz_size);
request_param.put("have_generation", cbz_generation);
@@ -1536,15 +1643,19 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String product_area = task_jo.getString("product_area");
//判断对应的内包间区域是否启用
JSONObject pack_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '9' AND product_area = '" + product_area + "'").uniqueResult(0);
if (task_jo.getString("task_type").equals("010401") && pack_jo.getString("is_used").equals("1")) {
if ((task_jo.getString("task_type").equals("010401") || task_jo.getString("task_type").equals("010409")) && pack_jo.getString("is_used").equals("1")) {
String vehicle_code = task_jo.getString("vehicle_code2");
// 托盘属性
JSONObject vehicle_jo = WQLObject.getWQLObject("md_pb_vehiclearea").query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
// 托盘所对应的区域位置
String point_location = vehicle_jo.getString("point_location");
// in点位置
JSONObject in_jo = WQLObject.getWQLObject("sch_base_point").query("product_area = '" + product_area + "' AND point_type = '6'").uniqueResult(0);
//查询呼叫时间最早的分切计划
// 1套管工位有轴切计划的位置符合
// 2010606 的半条任务通过任务material_code字段判断分切计划对应的设备的位置是否符合。也就是直接到达分切IN点的半条任务
JSONObject plan_jo = WQL.getWO("PDA_02").addParam("flag", "23").addParam("point_location", point_location)
.addParam("product_area", product_area).process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(plan_jo)) {
//将载具号维护到IN口
in_jo.put("vehicle_code", vehicle_code);
@@ -1604,14 +1715,15 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
/**
* 判断等待
* @param product_area
* @param vehicle_jo
* @param product_area 区域A1-4
* @param vehicle_jo 载具对象
* @return
*/
private boolean judgeWait(String product_area, JSONObject vehicle_jo) {
boolean need_wait = false;
// 纸管库的任务
JSONArray task_rows = WQL.getWO("QAUTO_QUERY").addParam("flag", "8").addParam("product_area", product_area).process().getResultJSONArray(0);
//取当前
//取当前(托盘的区域)
String point_location = vehicle_jo.getString("point_location");
String task_num = "";
if ("0".equals(point_location)) {
@@ -1639,6 +1751,20 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
}
// 判断当前托盘区域位置与当前即将套轴的位置是否一致,一致则等待
if (RenUtils.isOpenTempArea(product_area) && !need_wait) {
JSONObject tggw_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '4' AND product_area = '" + product_area + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(tggw_jo.getString("container_name1"))) {
return need_wait;
}
PdmBiSlittingproductionplan plan = slittingproductionplanService.getByContainerName(tggw_jo.getString("tube_code1"));
// 查询设备
StIvtCutpointivt device = cutpointivtService.getPintByExtCode(plan.getResource_name(), false);
if (device.getPoint_location().equals(point_location)) {
need_wait = true;
}
}
return need_wait;
}
@@ -1651,6 +1777,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
throw new BadRequestException("输入的设备号不能为空!");
}
// hint: 上报的时候任务不在导致上报失败
//查询该设备对应的输送线点位
JSONObject deliver_jo = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("point_code = '" + device_code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(deliver_jo)) {
@@ -1658,7 +1785,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
//判断该点位是否存在未完成的任务
if (Integer.valueOf(String.valueOf(dtl_type)) % 2 != 0) {
//如果为分切输送线上料位,判断该点位是否存在未完成的任务类型为分切输送出的任务
JSONArray left_arr = WQLObject.getWQLObject("sch_base_task").query("task_type = '010401' AND point_code1 = '" + device_code + "' AND is_delete = '0' AND task_status < '07'").getResultJSONArray(0);
JSONArray left_arr = WQLObject.getWQLObject("sch_base_task").query("point_code1 = '" + device_code + "' AND (task_type = '010401' OR task_type = '010409') AND is_delete = '0' AND task_status < '07'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(left_arr)) {
log.info("shipDeviceUpdate请求参数---------------------------------------------" + whereJson.toString() + ",ACS上报无货且此时LMS该点位没有任何任务");
JSONObject result = new JSONObject();

View File

@@ -517,4 +517,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
return result;
}
@Override
public JSONObject queryRGVStatus(JSONObject jo) {
String api = "api/wms/queryRGVStatus";
JSONArray arr = new JSONArray();
arr.add(jo);
return AcsUtil.notifyAcs(api, arr);
}
}

View File

@@ -1,5 +1,6 @@
package org.nl.wms.pda.mps.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -55,5 +56,11 @@ public class InController {
public ResponseEntity<Object> conveyConfirm(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(inService.conveyConfirm(whereJson), HttpStatus.OK);
}
@PostMapping("/cutUpShaft")
@Log("分切上轴")
@SaIgnore
public ResponseEntity<Object> cutUpShaft(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(inService.cutUpShaft(whereJson), HttpStatus.OK);
}
}

View File

@@ -1,5 +1,6 @@
package org.nl.wms.pda.mps.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -51,13 +52,33 @@ public class PaperTubeController {
@PostMapping("/shaftGoBack")
@Log("气胀轴回库")
@SaIgnore
public ResponseEntity<Object> shaftGoBack(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(paperTubeService.shaftGoBack(whereJson), HttpStatus.OK);
}
@PostMapping("/callPaperShaft")
@Log("一期新呼叫送轴")
@SaIgnore
public ResponseEntity<Object> callPaperShaft(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(paperTubeService.callPaperShaft(whereJson), HttpStatus.OK);
}
@PostMapping("/callNeedShaft")
@Log("一期呼叫空轴(气胀轴库->人工RGV")
@SaIgnore
public ResponseEntity<Object> callNeedShaft(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(paperTubeService.callNeedShaft(whereJson), HttpStatus.OK);
}
@PostMapping("/labourShaftBack")
@Log("一期人工送轴人工RGV->分切车间)")
@SaIgnore
public ResponseEntity<Object> labourShaftBack(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(paperTubeService.labourShaftBack(whereJson), HttpStatus.OK);
}
@PostMapping("/remainShaftBack")
@Log("一期余轴退回(分切车间->人工RGV/气胀轴库)")
@SaIgnore
public ResponseEntity<Object> remainShaftBack(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(paperTubeService.remainShaftBack(whereJson), HttpStatus.OK);
}
}

View File

@@ -44,4 +44,10 @@ public interface InService {
*/
JSONObject conveyConfirm(JSONObject whereJson);
/**
* 分切上轴
* @param whereJson
* @return
*/
JSONObject cutUpShaft(JSONObject whereJson);
}

View File

@@ -50,4 +50,25 @@ public interface PaperTubeService {
* @return
*/
JSONObject callPaperShaft(JSONObject param);
/**
* 人工送轴
* @param whereJson
* @return
*/
JSONObject labourShaftBack(JSONObject whereJson);
/**
* 呼叫空轴
* @param param
* @return
*/
JSONObject callNeedShaft(JSONObject param);
/**
* 剩余轴退回
* @param param
* @return
*/
JSONObject remainShaftBack(JSONObject param);
}

View File

@@ -6,11 +6,16 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl;
import org.nl.wms.pda.mps.service.InService;
import org.nl.wms.pdm.ivt.deliverycache.service.IDeliverycachepointivtService;
import org.nl.wms.pdm.ivt.deliverycache.service.dao.Deliverycachepointivt;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.tasks.CutConveyorTask;
import org.nl.wms.sch.tasks.CutTrussTask;
@@ -19,6 +24,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service
@RequiredArgsConstructor
@@ -26,6 +34,8 @@ import java.util.HashMap;
public class InServiceImpl implements InService {
private final CutTrussTask cutTrussTask;
private final IDeliverycachepointivtService deliverycachepointivtService;
private final IschBaseTaskService taskService;
@Override
public JSONObject queryMaterialInfo(JSONObject whereJson) {
@@ -161,4 +171,72 @@ public class InServiceImpl implements InService {
jo.put("message", "操作成功!");
return jo;
}
@Override
public JSONObject cutUpShaft(JSONObject param) {
// param: area, device_code, point_code, left_spec, right_spec
String area = param.getString("area");
String device_code = param.getString("device_code");
String point_code = param.getString("point_code");
String left_spec = param.getString("left_spec");
String right_spec = param.getString("right_spec");
List<String> specs = Stream.of(left_spec, right_spec).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
//查询该点位对应的机台编号
JSONObject cut_ivt = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("up_point_code ='" + point_code + "' OR down_point_code ='" + point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_ivt)) {
throw new BadRequestException("未查询到对应的分切机!");
}
if (!StrUtil.equals(device_code, cut_ivt.getString("ext_code"))) {
throw new BadRequestException("请选择和分切计划相同的设备点位进行上空轴!");
}
// todo: 判断是否存在任务
List<SchBaseTask> tasks = taskService.checkHaveTask(point_code);
if (tasks.size() > 0) {
throw new BadRequestException("该点位已经创建过任务");
}
// 获取管芯的点位
// 套好纸管的空轴点位
Deliverycachepointivt dec = null;
if (specs.size() > 0) {
// hint: 虚拟分切计划不动,直到搬运成功后清除点位时删除(*
if (specs.size() == 1) {
String tubeCode = specs.get(0);
// 找单根单管
List<Deliverycachepointivt> deliverycachepointivts = deliverycachepointivtService.getOneConformShaft(
tubeCode,
cut_ivt.getString("product_area"),
cut_ivt.getString("point_location"));
if (deliverycachepointivts.size() > 0) {
dec = deliverycachepointivts.get(0);
}
} else {
// 找单根双管
List<Deliverycachepointivt> deliverycachepointivts = deliverycachepointivtService.getMoreConformShaft(
left_spec,
right_spec,
cut_ivt.getString("product_area"),
cut_ivt.getString("point_location"));
if (deliverycachepointivts.size() > 0) {
dec = deliverycachepointivts.get(0);
}
}
}
if (dec == null) {
throw new BadRequestException("不存在相应管芯的点位!");
}
JSONObject jo = new JSONObject();
jo.put("point_code1", dec.getPoint_code());
jo.put("point_code2", point_code);
jo.put("vehicle_code", dec.getQzzno());
jo.put("product_area", area);
jo.put("task_type", "010405");
cutTrussTask.createTask(jo);
JSONObject result = new JSONObject();
result.put("message", "操作成功!");
return result;
}
}

View File

@@ -222,8 +222,8 @@ public class OutServiceImpl implements OutService {
// 子卷出站、空轴进站的任务
jo.put("point_code1", dec.getPoint_code());
jo.put("point_code2", point_code);
jo.put("point_code3", cachePoint.getPoint_code());
jo.put("point_code4", point_code);
jo.put("point_code3", point_code);
jo.put("point_code4", cachePoint.getPoint_code());
jo.put("vehicle_code2", cut_qzzno);
jo.put("vehicle_code", dec.getQzzno());
jo.put("task_type", "010403");
@@ -267,8 +267,8 @@ public class OutServiceImpl implements OutService {
// 子卷出站、空轴进站的任务
jo.put("point_code1", dec.getPoint_code());
jo.put("point_code2", point_code);
jo.put("point_code3", empty_vehicle.getString("point_code"));
jo.put("point_code4", point_code);
jo.put("point_code3", point_code);
jo.put("point_code4", empty_vehicle.getString("point_code"));
jo.put("vehicle_code", dec.getQzzno());
jo.put("vehicle_code2", cut_qzzno);
jo.put("task_type", "010403");
@@ -282,7 +282,7 @@ public class OutServiceImpl implements OutService {
// jo.put("point_code2", "");
if (isOpen) {
if (ObjectUtil.isNotEmpty(dec)) {
jo.put("point_code3", "");
jo.put("point_code4", "");
}
} else {
jo.put("point_code2", "");
@@ -332,11 +332,11 @@ public class OutServiceImpl implements OutService {
throw new BadRequestException("请求失败,中转架与靠近分切机的输送线移栽台均没空载具位置,如果远离分切机有位置,则先手动横移!");
}
} else {
jo.put("point_code3", empty_vehicle.getString("point_code"));
jo.put("point_code4", empty_vehicle.getString("point_code"));
}
jo.put("point_code1", delivery_point.getString("point_code"));
jo.put("point_code2", point_code);
jo.put("point_code4", point_code);
jo.put("point_code3", point_code);
jo.put("vehicle_code", delivery_point.getString("qzzno"));
jo.put("vehicle_code2", cut_qzzno);
jo.put("product_area", cut_ivt.getString("product_area"));
@@ -367,56 +367,6 @@ public class OutServiceImpl implements OutService {
return result;
}
public boolean doCheckUpShaft(String order_type, JSONObject cut_ivt, String parent_container_name, String restruct_container_name,
String resource_name, String split_group, String point_code) {
// 这里还需要多加一步判断,有没有下一趟分切计划,需要在缓存架找到对应的管芯。
List<PdmBiSlittingproductionplan> allPlans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
.eq(order_type.equals("1"), PdmBiSlittingproductionplan::getParent_container_name, parent_container_name)
.eq(order_type.equals("2"), PdmBiSlittingproductionplan::getRestruct_container_name, restruct_container_name)
.eq(PdmBiSlittingproductionplan::getResource_name, resource_name)
.ne(PdmBiSlittingproductionplan::getSplit_group, split_group));
if (allPlans.size() > 0) {
List<PdmBiSlittingproductionplan> nextPlan = null;
// 判断当前是分切机的什么位置(上/下)
if (cut_ivt.getString("up_point_code").equals(point_code)) {
// 上轴
nextPlan = allPlans.stream().filter(p -> "1".equals(p.getUp_or_down())).collect(Collectors.toList());
} else {
// 下轴
nextPlan = allPlans.stream().filter(p -> "2".equals(p.getUp_or_down())).collect(Collectors.toList());
}
if (nextPlan.size() > 0) {
if (nextPlan.size() == 1) {
PdmBiSlittingproductionplan onePlan = nextPlan.get(0);
// 找单根单管
List<Deliverycachepointivt> deliverycachepointivts = deliverycachepointivtService.getOneConformShaft(
onePlan.getPaper_tube_or_FRP().equals("1") ? onePlan.getPaper_tube_material() : onePlan.getFRP_material(),
cut_ivt.getString("product_area"),
cut_ivt.getString("point_location"));
if (deliverycachepointivts.size() > 0) {
Deliverycachepointivt dec = deliverycachepointivts.get(0);
}
} else {
PdmBiSlittingproductionplan onePlan = nextPlan.get(0);
PdmBiSlittingproductionplan twoPlan = nextPlan.get(1);
// 找单根双管
List<Deliverycachepointivt> deliverycachepointivts = deliverycachepointivtService.getMoreConformShaft(
onePlan.getPaper_tube_or_FRP().equals("1") ? onePlan.getPaper_tube_material() : onePlan.getFRP_material(),
twoPlan.getPaper_tube_or_FRP().equals("1") ? twoPlan.getPaper_tube_material() : twoPlan.getFRP_material(),
cut_ivt.getString("product_area"),
cut_ivt.getString("point_location"));
if (deliverycachepointivts.size() > 0) {
Deliverycachepointivt dec = deliverycachepointivts.get(0);
}
}
}
}
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject disuseConfirm(JSONObject whereJson) {

View File

@@ -20,16 +20,25 @@ import org.nl.common.utils.TaskUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.pda.mps.service.PaperTubeService;
import org.nl.wms.pdm.ivt.deliverycache.service.IDeliverycachepointivtService;
import org.nl.wms.pdm.ivt.deliverycache.service.dao.Deliverycachepointivt;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.tasks.CutConveyorTask;
import org.nl.wms.sch.tasks.CutTrussTask;
import org.nl.wms.sch.tasks.PaperTrussTask;
import org.nl.wms.sch.tasks.renovation.util.RenUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@@ -41,6 +50,9 @@ public class PaperTubeServiceImpl implements PaperTubeService {
private final IschBaseTaskService taskService;
private final IstIvtCutpointivtService cutpointivtService;
private final IPdmBiSlittingproductionplanService pdmBiSlittingproductionplanService;
private final CutConveyorTask cutConveyorTask;
private final CutTrussTask cutTrussTask;
private final IDeliverycachepointivtService deliverycachepointivtService;
@Override
public JSONObject queryDeviceList(JSONObject whereJson) {
@@ -165,20 +177,42 @@ public class PaperTubeServiceImpl implements PaperTubeService {
if (tasks.size() > 0) {
throw new BadRequestException(startPoint + "任务已存在!");
}
// A1_FHD_01
JSONObject fhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '7' AND product_area = '" + area + "'").uniqueResult(0);
// 判断是否有空位
JSONObject jo = new JSONObject();
JSONObject fhd_jo;
// 判断是不是3寸的
if (RenUtils.isOpenTzArea(area) && "3".equals(qzzSize) && RenUtils.isOpenTempArea(area)) {
//查询可用的空点位
fhd_jo = WQL.getWO("QAUTO_QUERY").addParam("flag", "6001")
.addParam("need_size", qzzSize)
.addParam("need_generation", qzzGeneration)
.addParam("product_area", area)
.process().uniqueResult(0);
jo.put("truss_type", "1");
} else {
// A1_FHD_01
fhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '7' AND product_area = '" + area + "'").uniqueResult(0);
jo.put("truss_type", "8");
}
jo.put("task_type", "010603");
jo.put("point_code1", startPoint);
jo.put("point_code2", fhd_jo.getString("point_code"));
jo.put("product_area", area);
jo.put("vehicle_code", DateUtil.format(DateUtil.date(), "HHmm") + "qzz");
jo.put("truss_type", "8");
JSONObject request_param = new JSONObject();
request_param.put("have_size", qzzSize);
request_param.put("have_generation", qzzGeneration);
jo.put("request_param", request_param.toString());
paperTrussTask.createTask(jo);
// 通知RGV进去
JSONArray action_rows = new JSONArray();
JSONObject action_jo = new JSONObject();
action_jo.put("device_code", area + "_RG_RGV");
action_jo.put("code", "to_command");
action_jo.put("product_area", area);
action_jo.put("value", "1");
action_rows.add(action_jo);
wmsToAcsService.action(action_rows);
JSONObject result = new JSONObject();
result.put("message", "操作成功!");
return result;
@@ -191,6 +225,26 @@ public class PaperTubeServiceImpl implements PaperTubeService {
// 纸制筒管|纸管|3英寸|12|650
// 玻璃纤维及其制品|FRP管|6英寸|15-20|1700|阶梯
// 玻璃纤维及其制品|FRP管|6英寸|15|1700|高强
// param: area, device_code, up_left_size_k,up_right_size_k, up_left_size_v,up_right_size_v
// location, qzz_size, qzz_generation
// 虚拟设备A1_XNFQ_01
String area = param.getString("area");
if (!area.startsWith("A")) {
throw new BadRequestException("该功能只对一期有用!");
}
doInsertPlan(param);
JSONObject res = new JSONObject();
res.put("status", HttpStatus.HTTP_OK);
res.put("message", "呼叫送轴成功!");
return res;
}
/**
* 插入分切计划(提取方法)
* @param param
* @return
*/
public JSONObject doInsertPlan(JSONObject param) {
// param: area, device_code, up_left_size_k,up_right_size_k, up_left_size_v,up_right_size_v
// location, qzz_size, qzz_generation
// 虚拟设备A1_XNFQ_01
@@ -199,6 +253,17 @@ public class PaperTubeServiceImpl implements PaperTubeService {
throw new BadRequestException("该功能只对一期有用!");
}
String location = param.getString("location");
String qzz_size = param.getString("qzz_size");
Integer number = param.getInteger("qqz_num");
// 判断还有没有位置(没有就不给创建)
List<Deliverycachepointivt> canUsePoint = deliverycachepointivtService.list(new LambdaQueryWrapper<Deliverycachepointivt>()
.eq(Deliverycachepointivt::getProduct_area, area)
.eq(Deliverycachepointivt::getPoint_location, location)
.eq(Deliverycachepointivt::getIs_used, "1")
.like(Deliverycachepointivt::getCan_size, qzz_size));
if (canUsePoint.size() < number) {
throw new BadRequestException("该半区该尺寸类型的位置剩余【" + canUsePoint.size() + "】个");
}
String qzz_generation = param.getString("qzz_generation");
StIvtCutpointivt xnDevice = cutpointivtService.getOne(new LambdaQueryWrapper<StIvtCutpointivt>()
.eq(StIvtCutpointivt::getPoint_location, location)
@@ -211,7 +276,6 @@ public class PaperTubeServiceImpl implements PaperTubeService {
}
// mes的设备号
String deviceCode = xnDevice.getExt_code();
Integer number = param.getInteger("qqz_num");
// 当前轴需要的管芯名称 ...
String upLeftSizeK = param.getString("up_left_size_k");
String upRightSizeK = param.getString("up_right_size_k");
@@ -305,10 +369,248 @@ public class PaperTubeServiceImpl implements PaperTubeService {
pdmBiSlittingproductionplanService.saveBatch(plans);
JSONObject res = new JSONObject();
res.put("status", HttpStatus.HTTP_OK);
res.put("plans", plans);
res.put("message", "呼叫送轴成功!");
return res;
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject labourShaftBack(JSONObject param) {
// param: area, device_code, up_left_size_k,up_right_size_k, up_left_size_v,up_right_size_v
// location, qzz_size, qzz_generation
String area = param.getString("area");
String deviceCode = area + "_RG_RGV";
List<SchBaseTask> tasks = taskService.checkHaveTask(deviceCode);
if (tasks.size() > 0) {
throw new BadRequestException("该人工RGV存在未完成的任务");
}
// 呼叫空托盘
param.put("qqz_num", "1");
if (!area.startsWith("A")) {
throw new BadRequestException("该功能只对一期有用!");
}
// 通知RGV进去
JSONArray action_rows = new JSONArray();
JSONObject action_jo = new JSONObject();
action_jo.put("device_code", deviceCode);
action_jo.put("code", "to_command");
action_jo.put("product_area", area);
action_jo.put("value", "1");
action_rows.add(action_jo);
JSONObject action = wmsToAcsService.action(action_rows);
if (!action.getString("status").equals("200")) {
throw new BadRequestException("该区域人工RGV异常");
}
String location = param.getString("location");
String qzz_generation = param.getString("qzz_generation");
// 插入分切计划
JSONObject planObj = doInsertPlan(param);
JSONArray plansArray = planObj.getJSONArray("plans");
List<PdmBiSlittingproductionplan> plans = plansArray.toJavaList(PdmBiSlittingproductionplan.class);
// 呼叫空盘
doCallEmptyVehicle(area, location);
// 创建半条任务,等待空盘横移后触发。
doCreateTask(area, location, qzz_generation, plans);
JSONObject res = new JSONObject();
res.put("status", HttpStatus.HTTP_OK);
res.put("plans", plans);
res.put("message", "呼叫送轴成功!");
return res;
}
@Override
public JSONObject callNeedShaft(JSONObject param) {
// param: areaqzz_size, qzz_generation
String product_area = param.getString("area");
String need_size = param.getString("qzz_size");
String qzzGeneration = param.getString("qzz_generation");
String endPoint = product_area + "_RG_RGV";
if (!product_area.startsWith("A")) {
throw new BadRequestException("此功能用于一期区域!");
}
List<SchBaseTask> tasks = taskService.checkHaveTask(endPoint);
if (tasks.size() > 0) {
throw new BadRequestException("该人工RGV存在未完成的任务");
}
JSONObject jo = new JSONObject();
jo.put("task_type", "010602");
JSONObject qhd_jo;
String flag;
// 判断是不是3寸的
if (RenUtils.isOpenTzArea(product_area) && "3".equals(need_size) && RenUtils.isOpenTempArea(product_area)) {
//查询可用的空点位
qhd_jo = WQL.getWO("QAUTO_QUERY").addParam("flag", "6002")
.addParam("need_size", need_size)
.addParam("need_generation", qzzGeneration)
.addParam("product_area", product_area)
.process().uniqueResult(0);
jo.put("truss_type", "1");
flag = "1";
} else {
qhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '6' AND product_area = '" + product_area + "'").uniqueResult(0);
jo.put("truss_type", "8");
flag = "2";
}
jo.put("point_code1", qhd_jo.getString("point_code"));
jo.put("point_code2", endPoint);
jo.put("vehicle_code", "XN-qzz");
jo.put("product_area", product_area);
JSONObject tas_param = new JSONObject();
tas_param.put("need_size", need_size);
tas_param.put("need_generation", qzzGeneration);
tas_param.put("flag", flag);
jo.put("request_param", tas_param.toString());
// 通知RGV进去
JSONArray action_rows = new JSONArray();
JSONObject action_jo = new JSONObject();
action_jo.put("device_code", endPoint);
action_jo.put("code", "to_command");
action_jo.put("product_area", product_area);
action_jo.put("value", "1");
action_rows.add(action_jo);
JSONObject action = wmsToAcsService.action(action_rows);
if (!action.getString("status").equals("200")) {
throw new BadRequestException("该区域人工RGV异常");
}
paperTrussTask.createTask(jo);
JSONObject res = new JSONObject();
res.put("status", HttpStatus.HTTP_OK);
res.put("message", "呼叫空轴成功!");
return res;
}
@Override
public JSONObject remainShaftBack(JSONObject param) {
// param : point_code、flag、qzz_size、qzz_generation
String pointCode = param.getString("point_code");
String flag = param.getString("flag");
String qzzSize = param.getString("qzz_size");
String qzzGeneration = param.getString("qzz_generation");
BigDecimal sortSeq;
String area;
String location;
List<SchBaseTask> tasks = taskService.checkHaveTask(pointCode);
if (tasks.size() > 0) {
throw new BadRequestException("当前位置有未完成的任务!");
}
// 创建桁架任务,到内测输送线,新的任务类型
Deliverycachepointivt deliverCachePoint = deliverycachepointivtService.getOneByPointCode(pointCode, true);
if (ObjectUtil.isNotEmpty(deliverCachePoint)) {
if (!deliverCachePoint.getPoint_status().equals("03")) {
throw new BadRequestException("该点位在系统中不是气胀轴!");
}
sortSeq = deliverCachePoint.getSort_seq();
area = deliverCachePoint.getProduct_area();
location = deliverCachePoint.getPoint_location();
// throw new BadRequestException("缓存架点位不存在或者被禁用!");
} else {
StIvtCutpointivt cutDevice = cutpointivtService.getPintByUpOrDownCode(pointCode, true);
if (ObjectUtil.isEmpty(cutDevice)) {
throw new BadRequestException("分切机设备不存在或被禁用!");
}
sortSeq = cutDevice.getSort_seq();
area = cutDevice.getProduct_area();
location = cutDevice.getPoint_location();
}
// 查找空盘位
JSONObject empty_vehicle = WQL.getWO("PDA_02")
.addParam("sort_seq", sortSeq)
.addParam("sql_str", " ORDER BY abs(" + sortSeq + "-sort_seq),point_code")
.addParam("product_area", area)
.addParam("point_location", location)
.addParam("flag", "3001").process().uniqueResult(0);
if (ObjectUtil.isEmpty(empty_vehicle)) {
throw new BadRequestException("没有可用的托盘,等待托盘空闲或者对向横移完毕");
}
// 创建任务
JSONObject jo = new JSONObject();
jo.put("point_code1", pointCode);
jo.put("point_code2", empty_vehicle.getString("point_code"));
jo.put("vehicle_code",empty_vehicle.getString("vehicle_code"));
jo.put("product_area", area);
jo.put("flag", flag);
jo.put("qzz_size", qzzSize);
jo.put("qzz_generation", qzzGeneration);
jo.put("task_type", "010409");
cutTrussTask.createTask(jo);
JSONObject res = new JSONObject();
res.put("status", HttpStatus.HTTP_OK);
res.put("message", "退回呼叫成功!");
return res;
}
public void doCreateTask(String area, String location, String qzz_generation, List<PdmBiSlittingproductionplan> plans) {
PdmBiSlittingproductionplan demoPlan = plans.get(0);
// 获取管芯
PdmBiSlittingproductionplan leftPlan = plans.stream().filter(p -> p.getLeft_or_right().equals("1")).findFirst().orElse(null);
PdmBiSlittingproductionplan rightPlan = plans.stream().filter(p -> p.getLeft_or_right().equals("2")).findFirst().orElse(null);
JSONObject in_jo = WQLObject.getWQLObject("sch_base_point").query("product_area = '" + area + "' AND point_type = '6'").uniqueResult(0);
// 获取点位
JSONObject jo = new JSONObject();
jo.put("task_type", "010606");
jo.put("task_id", IdUtil.getSnowflake(1,1).nextIdStr());
jo.put("task_code", IdUtil.getSnowflake(1,1).nextIdStr());
jo.put("point_code1", area + "_RG_RGV");
jo.put("point_code2", in_jo.getString("point_code"));
jo.put("product_area", area);
jo.put("vehicle_code", leftPlan.getContainer_name());
jo.put("material_code", leftPlan.getContainer_name());
jo.put("task_status", TaskStatusEnum.SURE_START.getCode());
JSONObject request_param = new JSONObject();
request_param.put("temp", "2");
request_param.put("need_size", demoPlan.getQzz_size());
request_param.put("need_generation", qzz_generation);
request_param.put("need_location", location);
request_param.put("container_name1", ObjectUtil.isNotEmpty(leftPlan) ? leftPlan.getContainer_name() : "");
request_param.put("container_name2", ObjectUtil.isNotEmpty(rightPlan) ? rightPlan.getContainer_name() : "");
jo.put("request_param", request_param.toString());
jo.put("handle_class", PaperTrussTask.class.getName());
jo.put("create_time", DateUtil.now());
jo.put("priority", "1");
jo.put("acs_task_type", "9");
jo.put("response_param", "1");
WQLObject.getWQLObject("SCH_BASE_Task").insert(jo);
}
public void doCallEmptyVehicle(String area, String location) {
JSONObject empty_vehicle = WQL.getWO("PDA_02")
.addParam("sql_str", " ORDER BY point_code")
.addParam("product_area", area)
.addParam("point_location", location)
.addParam("flag", "302").process().uniqueResult(0);
// 创建输送线任务规则:(内测保持空载具、外侧先出的逻辑)
JSONObject form = new JSONObject();
if (ObjectUtil.isEmpty(empty_vehicle)) {
// todo: 如果还有需要空载具,但是此时这个区域已经没有位置了,创建半条任务,等待载具送达时候,触发。
if (RenUtils.isOpenTzArea(area)) {
JSONObject tips = new JSONObject();
tips.put("product_area", area);
tips.put("point_location", location);
form.put("point_code1", "");
form.put("vehicle_code2", "");
form.put("task_status", TaskStatusEnum.SURE_END.getCode());
form.put("tips", tips);
} else {
return ;
}
} else {
form.put("point_code1", empty_vehicle.getString("point_code"));
form.put("vehicle_code2", empty_vehicle.getString("vehicle_code"));
if (StrUtil.isEmpty(empty_vehicle.getString("vehicle_code"))) {
throw new BadRequestException("点位:" + empty_vehicle.getString("point_code") + "载具号为空!");
}
}
//查询该区域点位类型为出口的点位
JSONObject ss_jo = WQLObject.getWQLObject("sch_base_point").query("product_area = '" + area + "' AND point_type = '7'").uniqueResult(0);
form.put("point_code2", ss_jo.getString("point_code"));
form.put("task_type", "010401");
form.put("product_area", area);
cutConveyorTask.createTask(form);
}
@Override
public JSONObject queryPaperMaterial(JSONObject whereJson) {
String material_code = whereJson.getString("material_code");

View File

@@ -102,6 +102,7 @@ public class ShippingServiceImpl implements ShippingService {
@Transactional(rollbackFor = Exception.class)
public JSONObject confirm(JSONObject whereJson) {
// todo: 输送线配送套好轴的气胀轴到分切车间(分切机对面的移栽台位置-这里需要注意,任务完成之后需要创建桁架任务挪到空轴取轴位)
JSONObject jo = new JSONObject();
// 分切计划
JSONArray rows = whereJson.getJSONArray("cut_rows");
// 载具号
@@ -181,37 +182,41 @@ public class ShippingServiceImpl implements ShippingService {
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("ext_code = '" + resource_name + "'").uniqueResult(0);
String product_area = cut_jo.getString("product_area");
String point_location = cut_jo.getString("point_location");
boolean openTzArea = RenUtils.isOpenTzArea(product_area);
//判断该气涨轴对应的分切计划是否呼叫,如果没有呼叫不允许配送
//判断该接口是否需要卡MES是否呼叫
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'callNextAssAndMomRoll'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(back_jo) && "1".equals(back_jo.getString("is_back"))) {
String product_areas = back_jo.getString("product_area");
if (StrUtil.isNotEmpty(product_areas) && product_areas.contains(product_area)) {
for (int i = 0; i < plan.size(); i++) {
JSONObject plan_jos = plan.getJSONObject(i);
String is_call = plan_jos.getString("is_call");
if (StrUtil.equals("0", is_call)) {
throw new BadRequestException("子卷号为:" + plan_jos.getString("container_name") + "的分切计划未呼叫,不允许进行配送!");
if (openTzArea) {
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'callNextAssAndMomRoll'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(back_jo) && "1".equals(back_jo.getString("is_back"))) {
String product_areas = back_jo.getString("product_area");
if (StrUtil.isNotEmpty(product_areas) && product_areas.contains(product_area)) {
for (int i = 0; i < plan.size(); i++) {
JSONObject plan_jos = plan.getJSONObject(i);
String is_call = plan_jos.getString("is_call");
if (StrUtil.equals("0", is_call)) {
throw new BadRequestException("子卷号为:" + plan_jos.getString("container_name") + "的分切计划未呼叫,不允许进行配送!");
}
}
}
}
}
//判断当前输送线上是否超过最大负荷任务数量组3组
JSONArray cut_rows = WQL.getWO("PDA_02")
.addParam("flag", "13")
.addParam("qzzno", qzzno)
.addParam("product_area", product_area)
.addParam("point_location", point_location)
.process().getResultJSONArray(0);
// todo: 输送线最大负荷需要重新定义-需要能够配置
if (cut_rows.size() > 3) {
if ("0".equals(point_location)) {
throw new BadRequestException("已超过上半段输送线最大负荷任务数,请等下一子卷送出再进行配送,并将该空载具送回!");
}
if ("1".equals(point_location)) {
throw new BadRequestException("已超过下半段输送线最大负荷任务数,请等下一子卷送出再进行配送,并将该空载具送回!");
if (!openTzArea) {
//判断当前输送线上是否超过最大负荷任务数量组3组
JSONArray cut_rows = WQL.getWO("PDA_02")
.addParam("flag", "13")
.addParam("qzzno", qzzno)
.addParam("product_area", product_area)
.addParam("point_location", point_location)
.process().getResultJSONArray(0);
// todo: 输送线最大负荷需要重新定义-需要能够配置
if (cut_rows.size() > 3) {
if ("0".equals(point_location)) {
throw new BadRequestException("已超过上半段输送线最大负荷任务数,请等下一子卷送出再进行配送,并将该空载具送回!");
}
if ("1".equals(point_location)) {
throw new BadRequestException("已超过下半段输送线最大负荷任务数,请等下一子卷送出再进行配送,并将该空载具送回!");
}
}
}
@@ -225,7 +230,8 @@ public class ShippingServiceImpl implements ShippingService {
//查询离该分切计划包含机台最近的一个空点位
// hint: 只能在外侧point_type=01
JSONObject empty_point;
if (RenUtils.isOpenTzArea(product_area)) {
if (openTzArea) {
// todo: 校验无任务
empty_point = WQL.getWO("PDA_02")
.addParam("sql_str", " ORDER BY abs(" + plan_jo.getString("sort_seq") + "-sort_seq),point_code")
.addParam("product_area", plan_jo.getString("product_area"))
@@ -287,7 +293,7 @@ public class ShippingServiceImpl implements ShippingService {
}
// hint: 改造后的右边一定存放的是空载具
if (Integer.valueOf(String.valueOf(dtl_type)) % 2 == 0 && !RenUtils.isOpenTzArea(product_area)) {
if (Integer.valueOf(String.valueOf(dtl_type)) % 2 == 0 && !openTzArea) {
//如果是右边(外侧)的任务,判断左边是否存在空载具且没任务,如果存在则把左边的空载具送出
JSONObject left_point = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("point_location = '" + empty_point.getString("point_location") + "' AND product_area = '" + empty_point.getString("product_area") + "' AND sort_seq = '" + empty_point.getString("sort_seq") + "' order by point_code").uniqueResult(0);
JSONObject task_jo = WQLObject.getWQLObject("sch_base_task").query("(point_code1 = '" + left_point.getString("point_code") + "' OR point_code2 = '" + left_point.getString("point_code") + "') AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
@@ -307,8 +313,6 @@ public class ShippingServiceImpl implements ShippingService {
cutConveyorTask.createTask(form2);
}
}
JSONObject jo = new JSONObject();
jo.put("message", "操作成功!");
return jo;
}

View File

@@ -155,6 +155,45 @@
ENDQUERY
ENDIF
IF 输入.flag = "3001"
QUERY
SELECT
ivt.*
FROM
st_ivt_deliverypointivt ivt
INNER JOIN (
SELECT
*
FROM
( SELECT RIGHT ( point_code, 1 ) AS goal_code, point_code FROM st_ivt_deliverypointivt ) a
WHERE
MOD ( goal_code, 2 ) = 1
) b ON b.point_code = ivt.point_code
WHERE
point_status = '02'
AND ivt.is_used = '1'
AND 0 = (
SELECT
COUNT(*)
FROM
sch_base_task
WHERE
( point_code1 = ivt.point_code OR point_code2 = ivt.point_code )
AND task_status < '07'
AND is_delete = '0'
)
OPTION 输入.product_area <> ""
ivt.product_area = 输入.product_area
ENDOPTION
OPTION 输入.product_area <> ""
ivt.point_location = 输入.point_location
ENDOPTION
输入.sql_str
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "302"
QUERY
SELECT
@@ -164,6 +203,7 @@
WHERE
point_status = '02'
AND ivt.is_used = '1'
AND ivt.point_type = '02'
AND NOT EXISTS (
SELECT
*
@@ -951,6 +991,7 @@
ivt.product_area = 输入.product_area
AND cut.point_location = 输入.point_location
AND plan.is_delete = '0'
AND ivt.point_type = '2'
AND have_qzz > 0 UNION
SELECT
task.task_code AS start_code,

View File

@@ -99,5 +99,11 @@
FROM pdm_bi_slittingproductionplan p3
WHERE p3.qzzno = de.qzzno
) = 2;
AND 0 = (
SELECT COUNT(*)
FROM sch_base_task t
WHERE t.task_status <![CDATA[ < ]]> '07' AND t.is_delete = '0' AND (
t.point_code1 = de.point_code OR t.point_code2 = de.point_code
)
</select>
</mapper>

View File

@@ -96,7 +96,7 @@ public class DeliverycachepointivtServiceImpl extends ServiceImpl<Deliverycachep
public Deliverycachepointivt getOneByPointCode(String code, boolean flag) {
LambdaQueryWrapper<Deliverycachepointivt> lam = new LambdaQueryWrapper<>();
lam.eq(Deliverycachepointivt::getPoint_code, code)
.eq(flag, Deliverycachepointivt::getIs_used, flag);
.eq(flag, Deliverycachepointivt::getIs_used, "1");
return getOne(lam);
}

View File

@@ -77,7 +77,7 @@ public class AcsUtil {
log.info("下发ACS任务失败原因是----------------------------------------+"+ msg);
}
//acs抛异常这里
if (!StrUtil.equals(result.getString("status"), "200")) {
if (StrUtil.equals(result.getString("status"), "400")) {
log.info("下发acs任务失败原因是----------------------------------------+"+ result.getString("message"));
throw new BadRequestException(result.getString("message"));
} else {

View File

@@ -140,12 +140,13 @@ public class AutoCallEmptyVehicle {
JSONArray in_task = WQL.getWO("QAUTO_QUERY").addParam("flag", "5").addParam("point_location", point_location).addParam("product_area", product_area).process().getResultJSONArray(0);
donw_num -= in_task.size();
log.info("此时需要呼叫托盘的数量:{}", donw_num);
//如果需要空载具数量大于0进行呼叫载具
if (donw_num > 0) {
for (int i = 0; i < donw_num; i++) {
// 这里最多就6个位置
JSONObject empty_vehicle = WQL.getWO("PDA_02")
.addParam("sql_str", " ORDER BY point_type, point_code")
.addParam("sql_str", " ORDER BY point_code")
.addParam("product_area", product_area)
.addParam("point_location", point_location)
.addParam("flag", "302").process().uniqueResult(0);
@@ -153,7 +154,7 @@ public class AutoCallEmptyVehicle {
// 创建输送线任务规则:(内测保持空载具、外侧先出的逻辑)
JSONObject form = new JSONObject();
if (ObjectUtil.isEmpty(empty_vehicle)) {
// todo: 如果还有需要空载具,但是此时这个区域已经没有位置了,创建半条任务,等待载具送达时候,触发。
// todo: 如果还有需要空载具,但是此时这个区域已经没有位置了,创建半条任务,等待载具送达时候(横移完毕),触发。
if (RenUtils.isOpenTzArea(product_area)) {
JSONObject tips = new JSONObject();
tips.put("product_area", product_area);
@@ -459,18 +460,36 @@ public class AutoCallEmptyVehicle {
JSONObject jo = new JSONObject();
jo.put("task_type", "010606");
jo.put("truss_type", "8");
// jo.put("truss_type", "8");
jo.put("task_status", TaskStatusEnum.SURE_START.getCode());
// 气胀轴-取货点point_type=6
JSONObject qhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '6' AND product_area = '" + product_area + "'").uniqueResult(0);
JSONObject qhd_jo;
String flag = "1";
// 判断是不是3寸的
if ("3".equals(need_size) && RenUtils.isOpenTempArea(product_area) && RenUtils.isOpenTzArea(product_area)) {
//查询可用的空点位
qhd_jo = WQL.getWO("QAUTO_QUERY").addParam("flag", "6002")
.addParam("need_size", need_size)
.addParam("need_generation", need_generation)
.addParam("product_area", product_area)
.process().uniqueResult(0);
jo.put("truss_type", "1");
flag = "1";
} else {
qhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '6' AND product_area = '" + product_area + "'").uniqueResult(0);
jo.put("truss_type", "8");
flag = "2";
}
// JSONObject qhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '6' AND product_area = '" + product_area + "'").uniqueResult(0);
jo.put("point_code1", qhd_jo.getString("point_code"));
// todo: 如果in点没空载具呢
// todo: 如果in点没空载具呢 再此已经呼叫过空载具,如果载具回流,需要在某处进行判断
JSONObject in_jo = WQLObject.getWQLObject("sch_base_point").query("product_area = '" + product_area + "' AND point_type = '6'").uniqueResult(0);
jo.put("point_code2", in_jo.getString("point_code"));
// 构建请求参数
JSONObject request_param = new JSONObject();
request_param.put("need_size", need_size);
request_param.put("need_generation", need_generation);
request_param.put("flag", flag);
JSONArray cut_rows = new JSONArray();
String qzzno = "";
if (same_flag) {

View File

@@ -0,0 +1,75 @@
package org.nl.wms.sch.manage;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.nl.b_lms.sch.point.dao.StIvtShaftivt;
import org.nl.b_lms.sch.point.service.IstIvtShaftivtService;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.sch.tasks.PaperTrussTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 成品卷到拔轴机
* @Author: lyd
* @Date: 2025/2/26
*/
@Slf4j
@Component
public class AutoSendOutShaft {
@Autowired
private IschBaseTaskService taskService;
@Autowired
private WmsToAcsService wmsToAcsService;
@Autowired
private IstIvtShaftivtService shaftivtService;
public void run() {
List<StIvtShaftivt> list = shaftivtService.list(new LambdaQueryWrapper<StIvtShaftivt>()
.eq(StIvtShaftivt::getPoint_type, "11")
.eq(StIvtShaftivt::getHave_qzz, "1")
.eq(StIvtShaftivt::getIs_used, "1"));
for (StIvtShaftivt stIvtShaftivt : list) {
JSONObject rgv_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '5' AND product_area = '" + stIvtShaftivt.getProduct_area() + "'").uniqueResult(0);
// 查询ACS是否有可用的RGV
JSONObject queryRgvParam = new JSONObject();
queryRgvParam.put("device_code", rgv_jo.getString("point_code"));
queryRgvParam.put("product_area", rgv_jo.getString("product_area"));
JSONObject canUseRgv = wmsToAcsService.queryRGVStatus(queryRgvParam);
String rgvResStatus = canUseRgv.getString("status");
boolean canUse = true;
if (rgvResStatus.equals("200")) {
int qty = canUseRgv.getInteger("qty");
IschBaseTaskService taskService = SpringContextHolder.getBean(IschBaseTaskService.class);
int taskNum = taskService.count(new LambdaQueryWrapper<SchBaseTask>()
.eq(SchBaseTask::getPoint_code2, rgv_jo.getString("point_code"))
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
.eq(SchBaseTask::getIs_delete, "0"));
canUse = qty > taskNum;
}
if (canUse) {
// 创建任务到RGV
JSONObject jo = new JSONObject();
jo.put("task_type", "010605");
jo.put("point_code1", stIvtShaftivt.getPoint_code());
jo.put("point_code2", rgv_jo.getString("point_code"));
jo.put("truss_type", "6");
jo.put("vehicle_code", stIvtShaftivt.getContainer_name1());
jo.put("product_area", stIvtShaftivt.getProduct_area());
JSONObject request_param = new JSONObject();
request_param.put("have_generation", stIvtShaftivt.getQzz_generation());
jo.put("request_param", request_param.toString());
// 成品卷下线拔轴 - 取货完成动作做完后ACS请求LMS尺寸。
PaperTrussTask paperTrussTask = SpringContextHolder.getBean(PaperTrussTask.class);
paperTrussTask.createTask(jo);
}
}
}
}

View File

@@ -7,10 +7,15 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.impl.PdmBiSlittingproductionplanServiceImpl;
import org.nl.b_lms.sch.point.dao.StIvtShaftivt;
import org.nl.b_lms.sch.point.service.IstIvtShaftivtService;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
import org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
@@ -88,6 +93,7 @@ public class CutConveyorTask extends AbstractAcsTask {
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt");
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
ReNbjService reNbjService = SpringContextHolder.getBean(ReNbjService.class);
WmsToAcsService wmsToAcsService = SpringContextHolder.getBean(WmsToAcsService.class);
PdmBiSlittingproductionplanServiceImpl planService = SpringContextHolder.getBean(PdmBiSlittingproductionplanServiceImpl.class);
String task_id = taskObj.getString("task_id");
@@ -223,22 +229,68 @@ public class CutConveyorTask extends AbstractAcsTask {
JSONObject jo = new JSONObject();
jo.put("task_type", "010605");
jo.put("point_code1", jsonTask.getString("point_code2"));
jo.put("truss_type", "6");
if (RenUtils.isOpenTzArea(out_jo.getString("product_area"))) {
// hint: 超过1400需要送到新增的人工处理RGV上。
List<String> list = JSON.parseArray(jsonTask.getString("request_param"), String.class);
List<PdmBiSlittingproductionplan> plans = planService.getByContainerNames(list);
PdmBiSlittingproductionplan demoPlan = plans.get(0);
Integer paperLength = Integer.valueOf(SlitterTaskUtil.getPaperLength(demoPlan));
if (paperLength >= 1400) {
JSONObject rgv_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '10' AND product_area = '" + jsonTask.getString("product_area") + "'").uniqueResult(0);
// hint: 超过1400 或者 饵料 需要送到新增的人工处理RGV上。
JSONObject rgv_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '10' AND product_area = '" + jsonTask.getString("product_area") + "'").uniqueResult(0);
if (out_jo.getString("vehicle_code").contains("废箔")) {
jo.put("point_code2", rgv_jo.getString("point_code"));
} else {
List<String> list = JSON.parseArray(jsonTask.getString("request_param"), String.class);
List<PdmBiSlittingproductionplan> plans = planService.getByContainerNames(list);
PdmBiSlittingproductionplan demoPlan = plans.get(0);
Integer paperLength = Integer.valueOf(SlitterTaskUtil.getPaperLength(demoPlan));
if (paperLength >= 1400) {
jo.put("point_code2", rgv_jo.getString("point_code"));
}
}
jo.put("truss_type", "1");
}
if (ObjectUtil.isEmpty(jo.getString("point_code2"))) {
JSONObject rgv_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '5' AND product_area = '" + jsonTask.getString("product_area") + "'").uniqueResult(0);
// 查询ACS是否有可用的RGV
JSONObject queryRgvParam = new JSONObject();
queryRgvParam.put("device_code", rgv_jo.getString("point_code"));
queryRgvParam.put("product_area", rgv_jo.getString("product_area"));
JSONObject canUseRgv = wmsToAcsService.queryRGVStatus(queryRgvParam);
String rgvResStatus = canUseRgv.getString("status");
boolean canUse = true;
if (rgvResStatus.equals("200")) {
int qty = canUseRgv.getInteger("qty");
IschBaseTaskService taskService = SpringContextHolder.getBean(IschBaseTaskService.class);
int taskNum = taskService.count(new LambdaQueryWrapper<SchBaseTask>()
.eq(SchBaseTask::getPoint_code2, rgv_jo.getString("point_code"))
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
.eq(SchBaseTask::getIs_delete, "0"));
canUse = qty > taskNum;
}
if (!rgvResStatus.equals("200") || !canUse) {
log.warn("RGV不可用或者不够用送到暂存架{}", canUseRgv.getString("message"));
// hint: 创建到子卷暂存架
IstIvtShaftivtService shaftivtService = SpringContextHolder.getBean(IstIvtShaftivtService.class);
List<StIvtShaftivt> caches = shaftivtService.getCachePointNoTask(rgv_jo.getString("product_area"));
if (caches.size() > 0) {
StIvtShaftivt shaftivt = caches.get(0);
// 创建任务
JSONObject pa = new JSONObject();
pa.put("task_type", "010610");
pa.put("point_code1", jsonTask.getString("point_code2"));
pa.put("point_code2", shaftivt.getPoint_code());
pa.put("truss_type", "1");
pa.put("vehicle_code", jsonTask.getString("vehicle_code"));
pa.put("product_area", jsonTask.getString("product_area"));
JSONObject request_param = new JSONObject();
request_param.put("have_generation", qzz_generation);
pa.put("request_param", request_param.toString());
PaperTrussTask paperTrussTask = SpringContextHolder.getBean(PaperTrussTask.class);
paperTrussTask.createTask(pa);
return;
}
}
// 如果没找到或者暂存也没位置,那就卡在桁架任务上
jo.put("point_code2", rgv_jo.getString("point_code"));
jo.put("truss_type", "6");
}
jo.put("truss_type", "6");
jo.put("vehicle_code", jsonTask.getString("vehicle_code"));
jo.put("product_area", jsonTask.getString("product_area"));
JSONObject request_param = new JSONObject();
@@ -251,7 +303,6 @@ public class CutConveyorTask extends AbstractAcsTask {
//给输送线OUT点下发acition1让载具进行横移
// hint: 横移后由ACS请求横移完毕将载具号设置到IN点
String device_code = jsonTask.getString("point_code2");
WmsToAcsService wmsToAcsService = SpringContextHolder.getBean(WmsToAcsService.class);
JSONArray action_rows = new JSONArray();
JSONObject action_jo = new JSONObject();
action_jo.put("device_code", device_code);
@@ -284,11 +335,12 @@ public class CutConveyorTask extends AbstractAcsTask {
if (RenUtils.isOpenTzArea(jsonIvt.getString("product_area"))) {
// 任务完成需要创建桁架任务到空轴取轴位!
reNbjService.sendShaftToCache(taskObj);
return;
if (jsonIvt.getString("point_status").equals("03")) {
log.info("任务完成需要创建桁架任务到空轴取轴位");
reNbjService.sendShaftToCache(jsonTask);
return;
}
}
// todo: 分切计划考虑放到桁架任务结束
//更新对应气涨轴的分切计划表为配送完成
HashMap map = new HashMap();
@@ -446,6 +498,55 @@ public class CutConveyorTask extends AbstractAcsTask {
}
}
}
// 退轴
if ("010409".equals(jsonTask.getString("task_type"))) {
String product_area = jsonTask.getString("product_area");
JSONObject requestParam = JSONObject.parseObject(jsonTask.getString("request_param"));
String flag = requestParam.getString("flag");
String qzzSize = requestParam.getString("qzz_size");
String qzzGeneration = requestParam.getString("qzz_generation");
//判断内包间是否启用
JSONObject package_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query(
"point_type = '9' AND product_area = '" + jsonTask.getString("product_area") + "'")
.uniqueResult(0);
if (package_jo.getString("is_used").equals("1")) {
PaperTrussTask paperTrussTask = SpringContextHolder.getBean(PaperTrussTask.class);
JSONObject jo = new JSONObject();
jo.put("task_type", "010603");
jo.put("point_code1", jsonTask.getString("point_code2"));
if ("1".equals(flag)) {
// 空轴
JSONObject fhd_jo;
// 判断是不是3寸的
if (RenUtils.isOpenTzArea(product_area) && "3".equals(qzzSize) && RenUtils.isOpenTempArea(product_area)) {
//查询可用的空点位
fhd_jo = WQL.getWO("QAUTO_QUERY").addParam("flag", "6001")
.addParam("need_size", qzzSize)
.addParam("need_generation", qzzGeneration)
.addParam("product_area", product_area)
.process().uniqueResult(0);
jo.put("truss_type", "1");
} else {
// A1_FHD_01
fhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '7' AND product_area = '" + product_area + "'").uniqueResult(0);
jo.put("truss_type", "8");
}
jo.put("point_code2", fhd_jo.getString("point_code"));
} else {
// hint: 管轴 需要送到新增的人工处理RGV上。
JSONObject rgv_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '10' AND product_area = '" + jsonTask.getString("product_area") + "'").uniqueResult(0);
jo.put("point_code2", rgv_jo.getString("point_code"));
jo.put("truss_type", "1");
}
jo.put("product_area", product_area);
jo.put("vehicle_code", DateUtil.format(DateUtil.date(), "HHmm") + "qzz");
JSONObject request_param = new JSONObject();
request_param.put("have_size", qzzSize);
request_param.put("have_generation", qzzGeneration);
jo.put("request_param", request_param.toString());
paperTrussTask.createTask(jo);
}
}
}
}
@@ -497,6 +598,9 @@ public class CutConveyorTask extends AbstractAcsTask {
if (ObjectUtil.isNotEmpty(form.get("tips"))) {
json.put("request_param", form.getJSONObject("tips").toJSONString());
}
if (ObjectUtil.isNotEmpty(form.get("flag"))) {
json.put("request_param", form.getJSONObject("flag").toJSONString());
}
//根据类型获取对应的任务优先级
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", json.getString("task_type")).process().uniqueResult(0);
if (ObjectUtil.isEmpty(priority_jo)) {

View File

@@ -252,7 +252,7 @@ public class CutTrussTask extends AbstractAcsTask {
delivery_cache_point.put("point_status", "01");
cacheTab.update(delivery_cache_point);
// 终点设置值
String deliveryCode = jsonTask.getString("point_code3");
String deliveryCode = jsonTask.getString("point_code4");
JSONObject delivery_point = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt")
.query("point_code = '" + deliveryCode + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(delivery_point)) {
@@ -391,6 +391,10 @@ public class CutTrussTask extends AbstractAcsTask {
for (int i = 0; i < plan_jo.size(); i++) {
JSONObject plan_row = plan_jo.getJSONObject(i);
if (plan_row.getString("container_name").contains("虚拟")) {
WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").delete(plan_row);
continue;
}
plan_row.put("status", "05");
plan_row.put("end_time", DateUtil.now());
WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").update(plan_row);
@@ -486,25 +490,25 @@ public class CutTrussTask extends AbstractAcsTask {
jsonTask.getString("vehicle_code") + "' AND is_child_tz_ok = '1' AND is_child_ps_ok = '0' " +
"AND is_delete ='0' AND status = '02'");
LmsToMesService lmsToMesService = SpringContextHolder.getBean(LmsToMesService.class);
// 调用MES配送完成接口
// LmsToMesService lmsToMesService = SpringContextHolder.getBean(LmsToMesService.class);
// // 调用MES配送完成接口
JSONArray rows = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan")
.query("qzzno = '" + jsonTask.getString("vehicle_code") +
"' AND is_child_tz_ok = '1' AND is_child_ps_ok = '1' AND is_delete ='0' AND status = '03'")
.getResultJSONArray(0);
JSONObject demoPlan = rows.getJSONObject(0);
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
String ContainerName = row.getString("container_name");
JSONObject jo = new JSONObject();
jo.put("ContainerName", ContainerName);
//判断该接口是否需要回传
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query(
"interface_name = 'airSwellWithPaperTubeAssArrival'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(back_jo) && "1".equals(back_jo.getString("is_back"))) {
lmsToMesService.airSwellWithPaperTubeAssArrival(row);
}
}
// for (int i = 0; i < rows.size(); i++) {
// JSONObject row = rows.getJSONObject(i);
// String ContainerName = row.getString("container_name");
// JSONObject jo = new JSONObject();
// jo.put("ContainerName", ContainerName);
// //判断该接口是否需要回传
// JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query(
// "interface_name = 'airSwellWithPaperTubeAssArrival'").uniqueResult(0);
// if (ObjectUtil.isNotEmpty(back_jo) && "1".equals(back_jo.getString("is_back"))) {
// lmsToMesService.airSwellWithPaperTubeAssArrival(row);
// }
// }
String point_code1 = jsonTask.getString("point_code1");
// 起点清空
JSONObject jsonIvt = ivtTab.query("point_code ='" + point_code1 + "'").uniqueResult(0);
@@ -551,7 +555,7 @@ public class CutTrussTask extends AbstractAcsTask {
needTask.setVehicle_code2(jsonTask.getString("vehicle_code2"));
needTask.setUpdate_time(DateUtil.now());
taskService.updateById(needTask);
this.immediateNotifyAcs(null);
cutConveyorTask.immediateNotifyAcs(null);
return;
}
// 否则查看是否横移
@@ -619,6 +623,48 @@ public class CutTrussTask extends AbstractAcsTask {
form.put("product_area", delivery_point.getString("product_area"));
cutConveyorTask.createTask(form);
}
// 气胀轴推回
if ("010409".equals(jsonTask.getString("task_type"))) {
JSONObject requestParam = JSONObject.parseObject(jsonTask.getString("request_param"));
if (ObjectUtil.isEmpty(requestParam)) {
throw new BadRequestException("该任务请求参数为空!");
}
JSONObject flag = new JSONObject();
flag.put("flag", requestParam.getString("flag"));
flag.put("qzz_size", requestParam.getString("qzz_size"));
flag.put("qzz_generation", requestParam.getString("qzz_generation"));
// 终点设置值
JSONObject delivery_point = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt").query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
delivery_point.put("qzzno", jsonTask.getString("vehicle_code"));
delivery_point.put("point_status", "03");
WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt").update(delivery_point);
// 起点清空
IDeliverycachepointivtService bean = SpringContextHolder.getBean(IDeliverycachepointivtService.class);
Deliverycachepointivt startPoint = bean.getOneByPointCode(jsonTask.getString("point_code1"), false);
if (ObjectUtil.isNotEmpty(startPoint)) {
LambdaUpdateWrapper<Deliverycachepointivt> lam = new LambdaUpdateWrapper<>();
lam.set(Deliverycachepointivt::getQzzno, null)
.set(Deliverycachepointivt::getPoint_status, "01")
.set(Deliverycachepointivt::getUpdate_optid, SecurityUtils.getCurrentUserId())
.set(Deliverycachepointivt::getUpdate_optname, SecurityUtils.getCurrentNickName())
.set(Deliverycachepointivt::getUpdate_time, DateUtil.now())
.eq(Deliverycachepointivt::getPoint_code, startPoint.getPoint_code());
bean.update(lam);
}
//生成一个输送线出库任务(将轴送到内包间)
JSONObject form = new JSONObject();
form.put("point_code1", jsonTask.getString("point_code2"));
JSONObject out_jo = WQLObject.getWQLObject("sch_base_point").query("product_area = '" + jsonTask.getString("product_area") + "' AND point_type = '7'").uniqueResult(0);
form.put("point_code2", out_jo.getString("point_code"));
if (StrUtil.isEmpty(delivery_point.getString("vehicle_code"))) {
throw new BadRequestException("点位:" + delivery_point.getString("point_code") + "载具号为空!");
}
form.put("vehicle_code2", delivery_point.getString("vehicle_code"));
form.put("flag", flag);
form.put("task_type", "010409");
form.put("product_area", delivery_point.getString("product_area"));
cutConveyorTask.createTask(form);
}
}
}
@@ -656,6 +702,7 @@ public class CutTrussTask extends AbstractAcsTask {
json.put("point_code4", form.getString("point_code4"));
json.put("product_area", form.getString("product_area"));
json.put("handle_class", THIS_CLASS);
json.put("request_param", JSONObject.toJSONString(form));
json.put("create_id", currentUserId);
json.put("create_name", currentUsername);
json.put("create_time", DateUtil.now());

View File

@@ -6,8 +6,11 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.b_lms.sch.point.dao.StIvtShaftivt;
import org.nl.b_lms.sch.point.service.IstIvtShaftivtService;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.core.bean.WQLObject;
@@ -16,6 +19,7 @@ import org.nl.wms.pda.mps.service.ShippingService;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.tasks.renovation.util.RenUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -107,6 +111,23 @@ public class PaperTrussTask extends AbstractAcsTask {
goal_point.put("qzz_generation", qzz_generation);
goal_point.put("have_qzz", "1");
ivt_shaftivt.update(goal_point);
String flag = request_param.getString("flag");
if (ObjectUtil.isNotEmpty(flag) && "1".equals(flag)) {
JSONObject qzz3_point = ivt_shaftivt.query("point_code = '" + task_jo.getString("point_code1") + "'").uniqueResult(0);
qzz3_point.put("have_qzz", "0");
ivt_shaftivt.update(qzz3_point);
}
}
//空轴放货货任务
if ("010603".equals(task_type)) {
String point_code = task_jo.getString("point_code2");
JSONObject goal_point = ivt_shaftivt.query("point_code = '" + point_code + "'").uniqueResult(0);
JSONObject request_param = task_jo.getJSONObject("request_param");
String qzz_size = request_param.getString("have_size");
if ("3".equals(qzz_size) && RenUtils.isOpenTempArea(taskObj.getString("product_area"))) {
goal_point.put("have_qzz", "1");
ivt_shaftivt.update(goal_point);
}
}
//空轴换货任务
if ("010604".equals(task_type)) {
@@ -134,14 +155,18 @@ public class PaperTrussTask extends AbstractAcsTask {
if ("010606".equals(task_type)) {
String point_code = task_jo.getString("point_code1");
JSONObject goal_point = ivt_shaftivt.query("point_code = '" + point_code + "'").uniqueResult(0);
JSONObject request_param_jo = task_jo.getJSONObject("request_param");
if ("2".equals(goal_point.getString("point_type"))) {
goal_point.put("qzz_size", "");
goal_point.put("qzz_generation", "");
goal_point.put("have_qzz", "0");
ivt_shaftivt.update(goal_point);
}
if (ObjectUtil.isNotEmpty(request_param_jo.getString("flag")) && "1".equals(request_param_jo.getString("flag"))) {
goal_point.put("have_qzz", "0");
ivt_shaftivt.update(goal_point);
}
//桁架任务完成后创建输送线配送任务
JSONObject request_param_jo = task_jo.getJSONObject("request_param");
String container_name1 = request_param_jo.getString("container_name1");
// 根据子卷号获取对应的分切计划,最多就两条记录
JSONArray cut_rows = new JSONArray();
@@ -187,6 +212,17 @@ public class PaperTrussTask extends AbstractAcsTask {
ivt_shaftivt.update(goal_point2);
}
}
// 放到暂存架子存放
if ("010610".equals(task_type)) {
String pointCode2 = taskObj.getString("point_code2");
JSONObject requestParam = taskObj.getJSONObject("request_param");
IstIvtShaftivtService shaftivtService = SpringContextHolder.getBean(IstIvtShaftivtService.class);
StIvtShaftivt one = shaftivtService.getOne(new LambdaQueryWrapper<StIvtShaftivt>().eq(StIvtShaftivt::getPoint_code, pointCode2));
one.setHave_qzz("1");
one.setQzz_generation(requestParam.getString("have_generation"));
one.setContainer_name1(taskObj.getString("vehicle_code"));
shaftivtService.updateById(one);
}
}
map.put("update_optid", currentUserId);
map.put("update_optname", nickName);

View File

@@ -10,12 +10,14 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.tasks.renovation.util.RenUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -137,15 +139,34 @@ public class PaperTubeTask extends AbstractAcsTask {
if (product_area.equals("A3") || product_area.equals("A4")) {
public_area = "A3";
}*/
JSONObject qhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '6' AND product_area = '" + product_area + "'").uniqueResult(0);
JSONObject qhd_jo = null;
String flag = "1";
if ("3".equals(need_size) && RenUtils.isOpenTempArea(product_area)) {
// 判断是不是3寸的
if (RenUtils.isOpenTzArea(product_area)) {
//查询可用的空点位
qhd_jo = WQL.getWO("QAUTO_QUERY").addParam("flag", "6002")
.addParam("need_size", need_size)
.addParam("need_generation", need_generation)
.addParam("product_area", product_area)
.process().uniqueResult(0);
jo.put("truss_type", "1");
flag = "1";
}
} else {
qhd_jo = WQLObject.getWQLObject("st_ivt_shaftivt").query("point_type = '6' AND product_area = '" + product_area + "'").uniqueResult(0);
jo.put("truss_type", "8");
flag = "2";
}
jo.put("point_code1", qhd_jo.getString("point_code"));
jo.put("point_code2", cbz_jo.getString("point_code"));
jo.put("truss_type", "8");
jo.put("vehicle_code", req_param.getString("container_name1") + "-qzz");
jo.put("product_area", product_area);
JSONObject request_param = new JSONObject();
request_param.put("need_size", need_size);
request_param.put("need_generation", need_generation);
request_param.put("flag", flag);
jo.put("request_param", request_param.toString());
paperTrussTask.createTask(jo);
} else {
@@ -172,6 +193,7 @@ public class PaperTubeTask extends AbstractAcsTask {
//更新出库口的库存信息
out_jo.put("qzz_size", need_size);
out_jo.put("qzz_generation", need_generation);
out_jo.put("have_qzz", "1");
WQLObject.getWQLObject("st_ivt_shaftivt").update(out_jo);
}

View File

@@ -48,7 +48,7 @@ public class ReNbjServiceImpl implements ReNbjService {
// "status", "03"
List<PdmBiSlittingproductionplan> plans = planService.getByQzzNoByStatus(qzzno, "02");
if (plans.size() == 0) {
return;
throw new BadRequestException("计划未找到!");
}
PdmBiSlittingproductionplan demoPlan = plans.get(0);
JSONObject cut_ivt = cutTab.query("ext_code = '" + demoPlan.getResource_name() + "'").uniqueResult(0);

View File

@@ -30,4 +30,19 @@ public class RenUtils {
List<String> list = Arrays.asList(openOneTzArea.getValue().split("[,]"));
return list.contains(area);
}
/**
* 判断该区域是否为定义开放3寸临时摆放的区域
* @param area
* @return
*/
public static boolean isOpenTempArea(String area) {
SysParamServiceImpl bean = SpringContextHolder.getBean(SysParamServiceImpl.class);
Param openOneTzArea = bean.findByCode("open_one_temp_area");
if (ObjectUtil.isEmpty(openOneTzArea)) {
throw new BadRequestException("请配置[open_one_temp_area]参数");
}
List<String> list = Arrays.asList(openOneTzArea.getValue().split("[,]"));
return list.contains(area);
}
}

View File

@@ -94,7 +94,6 @@
split_group
ORDER BY
call_time
LIMIT 4
ENDSELECT
ENDQUERY
ENDIF
@@ -263,7 +262,7 @@
AND ivt.qzz_size = 输入.need_size
AND ivt.qzz_generation = 输入.need_generation
AND ivt.product_area = 输入.product_area
AND 0 = (SELECT COUNT(*) FROM sch_base_task t WHERE t.point_code2 = ivt.point_code AND t.task_status < '07' AND t.is_delete = '0')
AND 0 = (SELECT COUNT(*) FROM sch_base_task t WHERE t.task_status < '07' AND (t.point_code2 = ivt.point_code OR t.point_code1 = ivt.point_code) AND t.is_delete = '0')
ORDER BY
sort_seq DESC
ENDSELECT