fix:B1生箔、烘箱、分切上料流程修改

This commit is contained in:
zhouz
2024-07-08 09:18:42 +08:00
parent 5ac116d1f0
commit d62c155d92
14 changed files with 706 additions and 390 deletions

View File

@@ -304,7 +304,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
/*
* 查询mes木箱信息插入木箱信息表
*/
//lmsToMesService.momGetPackingInfo(whereJson);
lmsToMesService.momGetPackingInfo(whereJson);
//查询对应的木箱信息

View File

@@ -102,8 +102,8 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl
}
@Override
@CachePenetrationProtect
@Cached(name="paramCache-",key = "#code", expire = 3600, cacheType = CacheType.REMOTE)
/*@CachePenetrationProtect
@Cached(name="paramCache-",key = "#code", expire = 3600, cacheType = CacheType.REMOTE)*/
public Param findByCode(String code) {
QueryWrapper<Param> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("code", code);

View File

@@ -939,7 +939,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
//如果入站的分切计划气涨轴为空,则虚拟一个气a涨轴编号
//如果入站的分切计划气涨轴为空,则虚拟一个气涨轴编号
if (StrUtil.isEmpty(plan_jo.getString("qzzno"))) {
if (i == 0 || i == 2) {
plan_jo.put("qzzno", "XN-" + plan_jo.getString("resource_name") + "A");

View File

@@ -27,8 +27,8 @@ public enum RegionTypeEnum {
TWO_FH01("24", "二期发货区", "1759453285649092608"),
TWO_OUT01("25", "二期出库区", "1760141408548818944"),
TWO_BZC01("26", "二期主存区", "1748219897940414464"),
B2_HKZC("26", "B2烘烤暂存区", "1766012860535803904");
B1_HKZC("27", "B1烘烤暂存区", "1809497203715215360"),
B2_HKZC("28", "B2烘烤暂存区", "1766012860535803904");
private String name;
private String code;

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -21,6 +22,7 @@ import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl;
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.pda.mps.service.BakingService;
import org.nl.wms.pda.mps.service.HandleBakingService;
import org.nl.wms.sch.tasks.CutConveyorTask;
import org.nl.wms.sch.tasks.InCoolIvtTask;
import org.nl.wms.sch.tasks.InHotTask;
@@ -115,7 +117,12 @@ public class BakingServiceImpl implements BakingService {
* 根据点位判断是 冷却区入烘箱还是暂存区入烘箱
*/
JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonPointZc)) {
JSONObject cool_jo = coolIvtTab.query("full_point_code = '" + point_code1 + "' AND point_type = '3'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonPointZc) || ObjectUtil.isNotEmpty(cool_jo)) {
if (ObjectUtil.isEmpty(jsonPointZc)) {
jsonPointZc = cool_jo;
}
if (!in_area_id.contains(jsonPointZc.getString("product_area"))) {
throw new BadRequestException("当前登录人员暂无【" + jsonPointZc.getString("product_area") + "】操作权限");
}
@@ -148,7 +155,11 @@ public class BakingServiceImpl implements BakingService {
// 2.创建暂存位 --> 烘烤区任务
JSONObject param = new JSONObject();
param.put("type", "2"); // 1- 冷却区入烘箱 2- 暂存位入烘箱
param.put("point_code1", point_code1);
if (ObjectUtil.isNotEmpty(cool_jo)) {
param.put("point_code1", cool_jo.getString("point_code"));
}else {
param.put("point_code1", point_code1);
}
param.put("point_code2", jsonHotIvt.getString("point_code"));
param.put("material_code", container_name);
param.put("product_area", jsonPointZc.getString("product_area"));
@@ -340,99 +351,119 @@ public class BakingServiceImpl implements BakingService {
}
// 1.查询暂存位有没有空位
String product_area = jsonHotIvt.getString("product_area");
if (!in_area_id.contains(product_area)) {
throw new BadRequestException("当前登录人员暂无【" + product_area + "】操作权限");
}
String reging_id = "";
switch (product_area) {
case "A1":
reging_id = RegionTypeEnum.A_HKZC.getId();
break;
case "A2":
reging_id = RegionTypeEnum.B_HKZC.getId();
break;
case "A3":
reging_id = RegionTypeEnum.C_HKZC.getId();
break;
case "A4":
reging_id = RegionTypeEnum.D_HKZC.getId();
break;
case "B2":
reging_id = RegionTypeEnum.B2_HKZC.getId();
break;
default:
break;
}
JSONObject map = new JSONObject();
map.put("flag", "1");
map.put("reging_id", reging_id);
map.put("point_location", jsonHotIvt.getString("point_location"));
//只找出箱点位
map.put("point_type", "5");
JSONArray pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().getResultJSONArray(0);
if (ObjectUtil.isEmpty(pointArr)) {
throw new BadRequestException("没有无货且没有任务的点位类型为出箱的烘箱对接位!");
}
//判断区域是否属于B1B1的出烘箱流程出到对应的半成品区
if ("B1".equals(product_area)) {
//查询当前点位为空且没有任务的桁架内缓存点
JSONObject cache_param = new JSONObject();
cache_param.put("flag", "4");
cache_param.put("point_location", jsonHotIvt.getString("point_location"));
cache_param.put("product_area", jsonHotIvt.getString("product_area"));
JSONObject cache_jo = WQL.getWO("PDA_COOLIN").addParamMap(cache_param).process().uniqueResult(0);
// 2.判断暂存位是否有任务:找到无任务的暂存位
String point_code2 = "";
for (int i = 0; i < pointArr.size(); i++) {
JSONObject jsonPoint = pointArr.getJSONObject(i);
String point_code = jsonPoint.getString("point_code");
JSONObject json_point_code1 = taskTab.query("point_code1 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0);
JSONObject json_point_code2 = taskTab.query("point_code2 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0);
JSONObject json_point_code3 = taskTab.query("point_code3 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0);
JSONObject json_point_code4 = taskTab.query("point_code4 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(json_point_code1) && ObjectUtil.isEmpty(json_point_code2) && ObjectUtil.isEmpty(json_point_code3) && ObjectUtil.isEmpty(json_point_code4)) {
point_code2 = point_code;
break;
}
}
if (ObjectUtil.isEmpty(point_code2)) {
throw new BadRequestException("没有无货且没有任务的点位类型为出箱的烘箱对接位!");
}
JSONObject jsonRaw = rawTab.query("container_name = '" + jsonHotIvt.getString("container_name") + "' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonRaw)) {
throw new BadRequestException("未查询到母卷号:" + jsonHotIvt.getString("container_name") + "对应的生箔工单!");
}
JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
throw new BadRequestException("物料基础信息中无此物料!");
}
// 3.创建任务
JSONObject param = new JSONObject();
param.put("point_code1", point_code1);
param.put("point_code2", point_code2);
param.put("material_code", jsonHotIvt.getString("container_name"));
param.put("product_area", jsonHotIvt.getString("product_area"));
OutHotTask outHotTask = new OutHotTask();
String task_id = outHotTask.createTask(param);
//查询该母卷对应最近的一条入烘箱记录
JSONObject last_hot_mst = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst").query("container_name = '" + jsonHotIvt.getString("container_name") + "' AND io_type = '0' order by confirm_time desc").uniqueResult(0);
JSONObject hotParam = new JSONObject();
hotParam.put("container_name", jsonRaw.getString("container_name"));
hotParam.put("workorder_id", jsonRaw.getString("workorder_id"));
hotParam.put("material_id", jsonMater.getString("material_id"));
hotParam.put("qty", jsonRaw.get("qty"));
hotParam.put("io_type", "1");
hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id"));
hotParam.put("task_id", task_id);
hotParam.put("start_point_code", point_code1);
hotParam.put("end_point_code", point_code2);
String point_temperature = (String) redisUtils.hget(point_code1, "temperature");
hotParam.put("temperature", point_temperature);
if (ObjectUtil.isEmpty(last_hot_mst)) {
hotParam.put("oven_time", "480");
// 3.创建任务
JSONObject param = new JSONObject();
param.put("point_code1", point_code1);
param.put("point_code2", cache_jo.getString("point_code"));
param.put("material_code", jsonHotIvt.getString("container_name"));
param.put("product_area", jsonHotIvt.getString("product_area"));
OutHotTask outHotTask = new OutHotTask();
outHotTask.createTask(param);
} else {
hotParam.put("oven_time", last_hot_mst.getString("oven_time"));
if (!in_area_id.contains(product_area)) {
throw new BadRequestException("当前登录人员暂无【" + product_area + "】操作权限");
}
String reging_id = "";
switch (product_area) {
case "A1":
reging_id = RegionTypeEnum.A_HKZC.getId();
break;
case "A2":
reging_id = RegionTypeEnum.B_HKZC.getId();
break;
case "A3":
reging_id = RegionTypeEnum.C_HKZC.getId();
break;
case "A4":
reging_id = RegionTypeEnum.D_HKZC.getId();
break;
case "B2":
reging_id = RegionTypeEnum.B2_HKZC.getId();
break;
default:
break;
}
JSONObject map = new JSONObject();
map.put("flag", "1");
map.put("reging_id", reging_id);
map.put("point_location", jsonHotIvt.getString("point_location"));
//只找出箱点位
map.put("point_type", "5");
JSONArray pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().getResultJSONArray(0);
if (ObjectUtil.isEmpty(pointArr)) {
throw new BadRequestException("没有无货且没有任务的点位类型为出箱的烘箱对接位!");
}
// 2.判断暂存位是否有任务:找到无任务的暂存位
String point_code2 = "";
for (int i = 0; i < pointArr.size(); i++) {
JSONObject jsonPoint = pointArr.getJSONObject(i);
String point_code = jsonPoint.getString("point_code");
JSONObject json_point_code1 = taskTab.query("point_code1 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0);
JSONObject json_point_code2 = taskTab.query("point_code2 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0);
JSONObject json_point_code3 = taskTab.query("point_code3 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0);
JSONObject json_point_code4 = taskTab.query("point_code4 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(json_point_code1) && ObjectUtil.isEmpty(json_point_code2) && ObjectUtil.isEmpty(json_point_code3) && ObjectUtil.isEmpty(json_point_code4)) {
point_code2 = point_code;
break;
}
}
if (ObjectUtil.isEmpty(point_code2)) {
throw new BadRequestException("没有无货且没有任务的点位类型为出箱的烘箱对接位!");
}
// 3.创建任务
JSONObject param = new JSONObject();
param.put("point_code1", point_code1);
param.put("point_code2", point_code2);
param.put("material_code", jsonHotIvt.getString("container_name"));
param.put("product_area", jsonHotIvt.getString("product_area"));
OutHotTask outHotTask = new OutHotTask();
String task_id = outHotTask.createTask(param);
JSONObject jsonRaw = rawTab.query("container_name = '" + jsonHotIvt.getString("container_name") + "' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonRaw)) {
throw new BadRequestException("未查询到母卷号:" + jsonHotIvt.getString("container_name") + "对应的生箔工单!");
}
JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
throw new BadRequestException("物料基础信息中无此物料!");
}
//查询该母卷对应最近的一条入烘箱记录
JSONObject last_hot_mst = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst").query("container_name = '" + jsonHotIvt.getString("container_name") + "' AND io_type = '0' order by confirm_time desc").uniqueResult(0);
JSONObject hotParam = new JSONObject();
hotParam.put("container_name", jsonRaw.getString("container_name"));
hotParam.put("workorder_id", jsonRaw.getString("workorder_id"));
hotParam.put("material_id", jsonMater.getString("material_id"));
hotParam.put("qty", jsonRaw.get("qty"));
hotParam.put("io_type", "1");
hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id"));
hotParam.put("task_id", task_id);
hotParam.put("start_point_code", point_code1);
hotParam.put("end_point_code", point_code2);
String point_temperature = (String) redisUtils.hget(point_code1, "temperature");
hotParam.put("temperature", point_temperature);
if (ObjectUtil.isEmpty(last_hot_mst)) {
hotParam.put("oven_time", "480");
} else {
hotParam.put("oven_time", last_hot_mst.getString("oven_time"));
}
this.createHotIoMst(hotParam);
}
this.createHotIoMst(hotParam);
}
JSONObject result = new JSONObject();
result.put("message", "操作成功!");
@@ -500,82 +531,87 @@ public class BakingServiceImpl implements BakingService {
throw new BadRequestException("该母卷在MES上未进行决策入半成品库不允许进行入冷却操作");
}
// 1.获取此暂存位的生产区域和上下位置
JSONObject jsonPoint = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonPoint)) {
throw new BadRequestException("请扫描点位类型为出箱的烘箱对接位!");
}
if (!in_area_id.contains(jsonPoint.getString("product_area"))) {
throw new BadRequestException("当前登录人员暂无【" + jsonPoint.getString("product_area") + "】操作权限");
}
// 2.找冷却区空货位
JSONObject map = new JSONObject();
map.put("flag", "2");
map.put("product_area", jsonPoint.getString("product_area"));
if (!jsonPoint.getString("product_area").equals("B2")) {
map.put("point_location", jsonPoint.getString("point_location"));
}
JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
// 如果为空
if (ObjectUtil.isEmpty(jsonCooIvt) && !jsonPoint.getString("product_area").equals("B2")) {
if (StrUtil.equals(jsonPoint.getString("point_location"), "0")) {
map.put("point_location", "1");
if (sb_jo.getString("product_area").equals("B1")) {
HandleBakingService bakingService = SpringContextHolder.getBean(HandleBakingService.class);
bakingService.checkConfirm(whereJson);
} else {
// 1.获取此暂存位的生产区域和上下位置
JSONObject jsonPoint = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonPoint)) {
throw new BadRequestException("请扫描点位类型为出箱的烘箱对接位!");
}
if (StrUtil.equals(jsonPoint.getString("point_location"), "1")) {
map.put("point_location", "0");
if (!in_area_id.contains(jsonPoint.getString("product_area"))) {
throw new BadRequestException("当前登录人员暂无【" + jsonPoint.getString("product_area") + "】操作权限");
}
jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
// 2.找冷却区空货位
JSONObject map = new JSONObject();
map.put("flag", "2");
map.put("product_area", jsonPoint.getString("product_area"));
if (!jsonPoint.getString("product_area").equals("B2")) {
map.put("point_location", jsonPoint.getString("point_location"));
}
JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
// 如果为空
if (ObjectUtil.isEmpty(jsonCooIvt) && !jsonPoint.getString("product_area").equals("B2")) {
if (StrUtil.equals(jsonPoint.getString("point_location"), "0")) {
map.put("point_location", "1");
}
if (StrUtil.equals(jsonPoint.getString("point_location"), "1")) {
map.put("point_location", "0");
}
jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
}
if (ObjectUtil.isEmpty(jsonCooIvt)) {
throw new BadRequestException("冷却区空位不足");
}
// 3.创建任务
JSONObject param = new JSONObject();
param.put("point_code1", point_code1);
param.put("point_code2", jsonCooIvt.getString("full_point_code"));
param.put("container_name", container_name);
param.put("product_area", jsonPoint.getString("product_area"));
InCoolIvtTask inCoolIvtTask = new InCoolIvtTask();
String task_id = inCoolIvtTask.createTask(param);
// 生成冷却区出入表
String currentUserId = SecurityUtils.getCurrentUserId();
String currentUsername = SecurityUtils.getCurrentUsername();
JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0);
JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
throw new BadRequestException("物料基础信息中无此物料!");
}
JSONObject jsonCool = new JSONObject();
jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
jsonCool.put("io_type", "0");
jsonCool.put("material_id", jsonMater.getString("material_id"));
jsonCool.put("pcsn", container_name);
jsonCool.put("bill_status", "10");
jsonCool.put("qty", jsonRaw.get("productin_qty"));
jsonCool.put("qty_unit_id", jsonMater.get("base_unit_id"));
jsonCool.put("task_id", task_id);
jsonCool.put("start_point_code", point_code1);
jsonCool.put("end_point_code", jsonCooIvt.getString("full_point_code"));
jsonCool.put("create_mode", "03");
jsonCool.put("create_id", currentUserId);
jsonCool.put("create_name", currentUsername);
jsonCool.put("create_time", DateUtil.now());
jsonCool.put("update_optid", currentUserId);
jsonCool.put("update_optname", currentUsername);
jsonCool.put("update_time", DateUtil.now());
jsonCool.put("confirm_optid", currentUserId);
jsonCool.put("confirm_optname", currentUsername);
jsonCool.put("confirm_time", DateUtil.now());
coolTab.insert(jsonCool);
}
if (ObjectUtil.isEmpty(jsonCooIvt)) {
throw new BadRequestException("冷却区空位不足");
}
// 3.创建任务
JSONObject param = new JSONObject();
param.put("point_code1", point_code1);
param.put("point_code2", jsonCooIvt.getString("full_point_code"));
param.put("container_name", container_name);
param.put("product_area", jsonPoint.getString("product_area"));
InCoolIvtTask inCoolIvtTask = new InCoolIvtTask();
String task_id = inCoolIvtTask.createTask(param);
// 生成冷却区出入表
String currentUserId = SecurityUtils.getCurrentUserId();
String currentUsername = SecurityUtils.getCurrentUsername();
JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0);
JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
throw new BadRequestException("物料基础信息中无此物料!");
}
JSONObject jsonCool = new JSONObject();
jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
jsonCool.put("io_type", "0");
jsonCool.put("material_id", jsonMater.getString("material_id"));
jsonCool.put("pcsn", container_name);
jsonCool.put("bill_status", "10");
jsonCool.put("qty", jsonRaw.get("productin_qty"));
jsonCool.put("qty_unit_id", jsonMater.get("base_unit_id"));
jsonCool.put("task_id", task_id);
jsonCool.put("start_point_code", point_code1);
jsonCool.put("end_point_code", jsonCooIvt.getString("full_point_code"));
jsonCool.put("create_mode", "03");
jsonCool.put("create_id", currentUserId);
jsonCool.put("create_name", currentUsername);
jsonCool.put("create_time", DateUtil.now());
jsonCool.put("update_optid", currentUserId);
jsonCool.put("update_optname", currentUsername);
jsonCool.put("update_time", DateUtil.now());
jsonCool.put("confirm_optid", currentUserId);
jsonCool.put("confirm_optname", currentUsername);
jsonCool.put("confirm_time", DateUtil.now());
coolTab.insert(jsonCool);
JSONObject result = new JSONObject();
result.put("message", "操作成功!");

View File

@@ -16,9 +16,11 @@ import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.core.content.HttpContext;
import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl;
import org.nl.wms.ext.mes.service.LmsToMesService;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.pda.mps.service.FeedingService;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.tasks.CoolCutTask;
import org.nl.wms.sch.tasks.OutHotTask;
import org.nl.wms.st.inbill.service.CheckOutBillService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -278,87 +280,139 @@ public class FeedingServiceImpl implements FeedingService {
if (!StrUtil.equals(cool_jo.getString("full_point_status"), "02")) {
throw new BadRequestException("该点位上不存在母卷!");
}
JSONObject jo = new JSONObject();
//查询该分切机对应的点位
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + next_point_code + "'").uniqueResult(0);
JSONObject zz_jo = WQLObject.getWQLObject("sch_base_point").query("point_type = '8' AND is_used = '1' AND is_delete = '0' AND point_code = '"+next_point_code+"'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo)) {
//查询中转区的点位
if (ObjectUtil.isEmpty(zz_jo)){
throw new BadRequestException("请扫描或者输入分切区域的满轴点位或表处中转区做为终点!");
}
if (zz_jo.getString("point_status").equals("2")){
throw new BadRequestException("该表处中转区点位上存在母卷,不能下发搬运任务!");
}
jo.put("point_code1", point_code);
jo.put("point_code2", next_point_code);
jo.put("vehicle_code", cool_jo.getString("container_name"));
jo.put("product_area", zz_jo.getString("product_area"));
jo.put("task_type", "010305");
}else {
if (StrUtil.isNotEmpty(cut_jo.getString("container_name")) || "02".equals(cut_jo.getString("full_point_status"))) {
throw new BadRequestException("该分切机对应的上料位存在母卷,不能下发搬运任务!");
if (cool_jo.getString("product_area").equals("B1")) {
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + next_point_code + "'").uniqueResult(0);
JSONObject task_jo = new JSONObject();
task_jo.put("point_code1", cool_jo.getString("point_code"));
String reging_id = "";
//查询出的对接位
switch (cool_jo.getString("product_area")) {
case "A1":
reging_id = RegionTypeEnum.A_HKZC.getId();
break;
case "A2":
reging_id = RegionTypeEnum.B_HKZC.getId();
break;
case "A3":
reging_id = RegionTypeEnum.C_HKZC.getId();
break;
case "A4":
reging_id = RegionTypeEnum.D_HKZC.getId();
break;
case "B1":
reging_id = RegionTypeEnum.B1_HKZC.getId();
break;
case "B2":
reging_id = RegionTypeEnum.B2_HKZC.getId();
break;
default:
break;
}
if (StrUtil.equals("01", cut_jo.getString("empty_point_status"))) {
JSONObject map = new JSONObject();
map.put("flag", "1");
map.put("reging_id", reging_id);
map.put("point_location", cool_jo.getString("point_location"));
//只找出箱点位
map.put("point_type", "5");
JSONObject pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
if (ObjectUtil.isEmpty(pointArr)) {
throw new BadRequestException("没有无货且没有任务的点位类型为出箱的烘箱对接位!");
}
task_jo.put("point_code2", pointArr.getString("point_code"));
//将分切机的点位作为目的点桁架任务完成时自动创建AGV任务
task_jo.put("point_code3", next_point_code);
task_jo.put("vehicle_code", cool_jo.getString("container_name"));
task_jo.put("product_area", cut_jo.getString("product_area"));
task_jo.put("task_type", "010205");
OutHotTask outHotTask = new OutHotTask();
String task_id = outHotTask.createTask(task_jo);
} else {
JSONObject jo = new JSONObject();
//查询该分切机对应的点位
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + next_point_code + "'").uniqueResult(0);
JSONObject zz_jo = WQLObject.getWQLObject("sch_base_point").query("point_type = '8' AND is_used = '1' AND is_delete = '0' AND point_code = '" + next_point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo)) {
//查询中转区的点位
if (ObjectUtil.isEmpty(zz_jo)) {
throw new BadRequestException("请扫描或者输入分切区域的满轴点位或表处中转区做为终点!");
}
if (zz_jo.getString("point_status").equals("2")) {
throw new BadRequestException("该表处中转区点位上存在母卷,不能下发搬运任务!");
}
jo.put("point_code1", point_code);
jo.put("point_code2", next_point_code);
jo.put("vehicle_code", cool_jo.getString("container_name"));
jo.put("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010302");
jo.put("product_area", zz_jo.getString("product_area"));
jo.put("task_type", "010305");
} else {
jo.put("point_code1", point_code);
jo.put("point_code2", next_point_code);
jo.put("point_code3", cut_jo.getString("empty_point_code"));
jo.put("point_code4", cool_jo.getString("empty_point_code"));
jo.put("vehicle_code", cool_jo.getString("container_name"));
jo.put("vehicle_code2", cut_jo.getString("empty_vehicle_code"));
jo.put("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010301");
if (StrUtil.isNotEmpty(cut_jo.getString("container_name")) || "02".equals(cut_jo.getString("full_point_status"))) {
throw new BadRequestException("该分切机对应的上料位存在母卷,不能下发搬运任务!");
}
if (StrUtil.equals("01", cut_jo.getString("empty_point_status"))) {
jo.put("point_code1", point_code);
jo.put("point_code2", next_point_code);
jo.put("vehicle_code", cool_jo.getString("container_name"));
jo.put("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010302");
} else {
jo.put("point_code1", point_code);
jo.put("point_code2", next_point_code);
jo.put("point_code3", cut_jo.getString("empty_point_code"));
jo.put("point_code4", cool_jo.getString("empty_point_code"));
jo.put("vehicle_code", cool_jo.getString("container_name"));
jo.put("vehicle_code2", cut_jo.getString("empty_vehicle_code"));
jo.put("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010301");
}
}
AbstractAcsTask task = new CoolCutTask();
String task_id = task.createTask(jo);
//查询该母卷号对应的生箔信息
JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + cool_jo.getString("container_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到母卷:" + cool_jo.getString("container_name") + ",对应的生箔信息!");
}
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + raw_jo.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(mater_jo)) {
throw new BadRequestException("未查询到物料:" + raw_jo.getString("product_name") + "基础信息!");
}
//生成半成品出库单据
String currentUserId = SecurityUtils.getCurrentUserId();
String currentUsername = SecurityUtils.getCurrentUsername();
JSONObject jsonCool = new JSONObject();
jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
jsonCool.put("io_type", "1");
jsonCool.put("material_id", mater_jo.getString("material_id"));
jsonCool.put("pcsn", cool_jo.getString("container_name"));
jsonCool.put("bill_status", "50");
jsonCool.put("task_id", task_id);
jsonCool.put("qty_unit_id", "1");
jsonCool.put("start_point_code", cool_jo.getString("full_point_code"));
jsonCool.put("end_point_code", ObjectUtil.isNotEmpty(cut_jo) ? cut_jo.getString("full_point_code") : zz_jo.getString("point_code"));
jsonCool.put("create_mode", "03");
jsonCool.put("create_id", currentUserId);
jsonCool.put("create_name", currentUsername);
jsonCool.put("create_time", DateUtil.now());
jsonCool.put("update_optid", currentUserId);
jsonCool.put("update_optname", currentUsername);
jsonCool.put("update_time", DateUtil.now());
jsonCool.put("confirm_optid", currentUserId);
jsonCool.put("confirm_optname", currentUsername);
jsonCool.put("confirm_time", DateUtil.now());
WQLObject.getWQLObject("ST_IVT_CoolRegionIO").insert(jsonCool);
}
//查询该母卷号对应的生箔信息
JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + cool_jo.getString("container_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到母卷:" + cool_jo.getString("container_name") + ",对应的生箔信息!");
}
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + raw_jo.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(mater_jo)) {
throw new BadRequestException("未查询到物料:" + raw_jo.getString("product_name") + "基础信息!");
}
AbstractAcsTask task = new CoolCutTask();
String task_id = task.createTask(jo);
//生成半成品出库单据
String currentUserId = SecurityUtils.getCurrentUserId();
String currentUsername = SecurityUtils.getCurrentUsername();
JSONObject jsonCool = new JSONObject();
jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
jsonCool.put("io_type", "1");
jsonCool.put("material_id", mater_jo.getString("material_id"));
jsonCool.put("pcsn", cool_jo.getString("container_name"));
jsonCool.put("bill_status", "50");
jsonCool.put("task_id", task_id);
jsonCool.put("qty_unit_id", "1");
jsonCool.put("start_point_code", cool_jo.getString("full_point_code"));
jsonCool.put("end_point_code", ObjectUtil.isNotEmpty(cut_jo) ? cut_jo.getString("full_point_code") : zz_jo.getString("point_code"));
jsonCool.put("create_mode", "03");
jsonCool.put("create_id", currentUserId);
jsonCool.put("create_name", currentUsername);
jsonCool.put("create_time", DateUtil.now());
jsonCool.put("update_optid", currentUserId);
jsonCool.put("update_optname", currentUsername);
jsonCool.put("update_time", DateUtil.now());
jsonCool.put("confirm_optid", currentUserId);
jsonCool.put("confirm_optname", currentUsername);
jsonCool.put("confirm_time", DateUtil.now());
WQLObject.getWQLObject("ST_IVT_CoolRegionIO").insert(jsonCool);
JSONObject result = new JSONObject();
result.put("message", "操作成功!");
return result;

View File

@@ -17,6 +17,7 @@ import org.nl.modules.wql.core.content.HttpContext;
import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl;
import org.nl.wms.ext.acs.service.AcsToWmsService;
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.pda.mps.service.RawFoilService;
import org.nl.wms.sch.service.PointService;
import org.nl.wms.sch.tasks.CallEmpReelTask;
@@ -163,37 +164,108 @@ public class RawFoilServiceImpl implements RawFoilService {
String start_pint_code = "";
String point_code4 = "";
// 2.根据就近原则查对应空卷抽
JSONObject map = new JSONObject();
map.put("flag", "1");
map.put("product_area", jsonSb.getString("product_area"));
map.put("point_location", jsonSb.getString("point_location"));
JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);
// 3.如果没找到则继续找下一节点
if (ObjectUtil.isEmpty(jsonIvt)) {
//二期B1、B3的生箔烘箱任务和其他不一致
if (jsonSb.getString("product_area").equals("B1")) {
// 2.根据就近原则查对应空卷轴
JSONObject map = new JSONObject();
map.put("flag", "6");
map.put("product_area", jsonSb.getString("product_area"));
map.put("point_location", jsonSb.getString("point_location"));
JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);
// 3.如果没找到则继续找下一节点
if (ObjectUtil.isEmpty(jsonIvt)) {
String point_location = jsonSb.getString("point_location");
if (StrUtil.equals(point_location, "0")) map.put("point_location", "1");
if (StrUtil.equals(point_location, "1")) map.put("point_location", "0");
jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);
if (ObjectUtil.isEmpty(jsonIvt)) {
throw new BadRequestException("未查询到有空轴的点位!");
}
}
//查询可用的对接位
String reging_id = "";
String product_area = jsonSb.getString("product_area");
switch (product_area) {
case "A1":
reging_id = RegionTypeEnum.A_HKZC.getId();
break;
case "A2":
reging_id = RegionTypeEnum.B_HKZC.getId();
break;
case "A3":
reging_id = RegionTypeEnum.C_HKZC.getId();
break;
case "A4":
reging_id = RegionTypeEnum.D_HKZC.getId();
break;
case "B1":
reging_id = RegionTypeEnum.B1_HKZC.getId();
break;
case "B2":
reging_id = RegionTypeEnum.B2_HKZC.getId();
break;
default:
break;
}
JSONObject cache_map = new JSONObject();
cache_map.put("flag", "1");
cache_map.put("reging_id", reging_id);
cache_map.put("point_location", jsonSb.getString("point_location"));
//只找入箱点位
cache_map.put("point_type", "4");
JSONObject point_code2_jo = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(cache_map).process().uniqueResult(0);
if (ObjectUtil.isEmpty(point_code2_jo)) {
throw new BadRequestException("未查询到可用的点位类型为入箱的烘箱对接位!");
}
// 起点和终点确定 生成任务
JSONObject param = new JSONObject();
param.put("point_code1", jsonIvt.getString("empty_point_code"));
param.put("point_code2", jsonSb.getString("point_code") + "_K");
param.put("point_code3", jsonSb.getString("point_code") + "_M");
param.put("point_code4", point_code2_jo.getString("point_code"));
param.put("task_type", "010104");
param.put("material_code", jsonRaw.getString("container_name"));
param.put("product_area", jsonSb.getString("product_area"));
CallEmpReelTask callEmpReelTask = new CallEmpReelTask();
callEmpReelTask.createTask(param);
} else {
// 2.根据就近原则查对应空卷轴
JSONObject map = new JSONObject();
map.put("flag", "1");
map.put("product_area", jsonSb.getString("product_area"));
map.put("point_location", jsonSb.getString("point_location"));
JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);
// 3.如果没找到则继续找下一节点
if (ObjectUtil.isEmpty(jsonIvt)) {
/*String point_location = jsonSb.getString("point_location");
if (StrUtil.equals(point_location, "0")) map.put("point_location", "1");
if (StrUtil.equals(point_location, "1")) map.put("point_location", "0");
JSONObject jsonIvt_tow = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);*/
throw new BadRequestException("未查询到有空轴且母卷位置为空的点位!");
} else {
start_pint_code = jsonIvt.getString("empty_point_code");
point_code4 = jsonIvt.getString("full_point_code");
throw new BadRequestException("未查询到有空轴且母卷位置为空的点位!");
} else {
start_pint_code = jsonIvt.getString("empty_point_code");
point_code4 = jsonIvt.getString("full_point_code");
}
// 起点和终点确定 生成任务
JSONObject param = new JSONObject();
param.put("point_code1", start_pint_code);
param.put("point_code2", jsonSb.getString("point_code") + "_K");
param.put("point_code3", jsonSb.getString("point_code") + "_M");
param.put("point_code4", point_code4);
param.put("task_type", "010101");
param.put("material_code", jsonRaw.getString("container_name"));
param.put("product_area", jsonSb.getString("product_area"));
CallEmpReelTask callEmpReelTask = new CallEmpReelTask();
callEmpReelTask.createTask(param);
}
// 起点和终点确定 生成任务
JSONObject param = new JSONObject();
param.put("point_code1", start_pint_code);
param.put("point_code2", jsonSb.getString("point_code") + "_K");
param.put("point_code3", jsonSb.getString("point_code") + "_M");
param.put("point_code4", point_code4);
param.put("task_type", "010101");
param.put("material_code", jsonRaw.getString("container_name"));
param.put("product_area", jsonSb.getString("product_area"));
CallEmpReelTask callEmpReelTask = new CallEmpReelTask();
callEmpReelTask.createTask(param);
// 更新工单状态
jsonRaw.put("status", "02");
pdmBiRawfoilworkorderService.update(jsonRaw);
@@ -211,8 +283,8 @@ public class RawFoilServiceImpl implements RawFoilService {
String container_name = whereJson.getString("container_name");
//判断该母卷是否存在工单
JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '"+container_name+"'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(raw_jo)){
JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + container_name + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(raw_jo)) {
throw new BadRequestException("当前母卷存在生箔工单,不允许创建!");
}

View File

@@ -216,7 +216,7 @@ IF 输入.flag = "6"
FROM
ST_IVT_CoolPointIvt ivt
WHERE
ivt.empty_point_status = '01'
ivt.empty_point_status = '02'
AND
ivt.is_used = '1'
AND NOT EXISTS (

View File

@@ -111,3 +111,37 @@
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "4"
QUERY
SELECT
*
FROM
ST_IVT_CoolPointIvt
WHERE
is_used = '1'
AND point_type = '3'
AND full_point_status = '01'
AND empty_point_status = '01'
AND NOT EXISTS (
SELECT
*
FROM
sch_base_task
WHERE
( point_code1 = empty_point_code OR point_code2 = empty_point_code )
AND task_status < '07'
AND is_delete = '0'
)
OPTION 输入.product_area <> ""
product_area = 输入.product_area
ENDOPTION
OPTION 输入.point_location <> ""
point_location = 输入.point_location
ENDOPTION
ORDER BY sort_seq desc
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -2,6 +2,7 @@ package org.nl.wms.sch.tasks;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
@@ -13,6 +14,7 @@ import org.nl.modules.common.exception.BadRequestException;
import org.nl.common.utils.CodeUtil;
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.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
@@ -74,6 +76,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工序工单表
WQLObject sbTab = WQLObject.getWQLObject("st_ivt_sbpointivt"); // 生箔区域点位表
WQLObject point_tab = WQLObject.getWQLObject("sch_base_point"); // 生箔区域点位表
String task_id = taskObj.getString("task_id");
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
@@ -174,63 +177,94 @@ public class CallEmpReelTask extends AbstractAcsTask {
jsonIvt.put("empty_vehicle_code", "");
ivtTab.update(jsonIvt);
// 校验终点是否存在
JSONObject jsonIvt2 = ivtTab.query("full_point_code ='" + point_code4 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonIvt)) {
throw new BadRequestException("终点未找到可用点位:" + point_code2);
//判断任务类型如果为二期B1生箔AGV任务则更新点位表库存
if (jsonTask.getString("task_type").equals("010104")) {
// 校验终点是否存在
JSONObject jsonIvt2 = point_tab.query("point_code ='" + point_code4 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonIvt)) {
throw new BadRequestException("终点未找到可用点位:" + point_code2);
}
// 更新点位库存状态
jsonIvt2.put("point_status", "2");
jsonIvt2.put("material_code", jsonTask.getString("material_code"));
point_tab.update(jsonIvt2);
//创建桁架任务将子卷搬运到桁架下的半成品缓存位
//查询当前点位为空且没有任务的桁架内缓存点
JSONObject cache_param = new JSONObject();
cache_param.put("flag", "4");
cache_param.put("point_location", jsonIvt.getString("point_location"));
cache_param.put("product_area", jsonIvt.getString("product_area"));
JSONObject cache_jo = WQL.getWO("PDA_COOLIN").addParamMap(cache_param).process().uniqueResult(0);
JSONObject param = new JSONObject();
param.put("point_code1", point_code4);
param.put("point_code2", cache_jo.getString("point_code"));
param.put("material_code", jsonTask.getString("material_code"));
param.put("product_area", jsonTask.getString("product_area"));
param.put("type", "3");
InHotTask inHotTask = SpringContextHolder.getBean(InHotTask.class);
inHotTask.createTask(param);
} else {
// 校验终点是否存在
JSONObject jsonIvt2 = ivtTab.query("full_point_code ='" + point_code4 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonIvt)) {
throw new BadRequestException("终点未找到可用点位:" + point_code2);
}
// 更新工单状态为完成
//更新母卷工单状态
HashMap<String, String> map = new HashMap<>();
map.put("status", "09");
map.put("realend_time", DateUtil.now());
map.put("update_optid", currentUserId + "");
map.put("update_optname", currentUsername);
map.put("finish_type", "01");
map.put("update_time", DateUtil.now());
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + jsonTask.getString("material_code") + "'");
// 更新冷却库存状态
jsonIvt2.put("full_point_status", "02");
jsonIvt2.put("instorage_time", DateUtil.now());
jsonIvt2.put("container_name", jsonRaw.getString("container_name"));
jsonIvt2.put("workorder_id", jsonRaw.getString("workorder_id"));
jsonIvt2.put("ivt_qty", jsonRaw.getString("productin_qty"));
jsonIvt2.put("cool_ivt_status", "01");
ivtTab.update(jsonIvt2);
// 插入入库单
JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
throw new BadRequestException("产品不存在");
}
JSONObject jsonRegion = new JSONObject();
jsonRegion.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
jsonRegion.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
jsonRegion.put("io_type", "0");
jsonRegion.put("material_id", jsonMater.getString("material_id"));
jsonRegion.put("pcsn", jsonRaw.getString("container_name"));
jsonRegion.put("vehicle_code", "");
jsonRegion.put("qty", jsonRaw.getString("productin_qty"));
jsonRegion.put("qty_unit_id", jsonMater.get("base_unit_id"));
jsonRegion.put("bill_status", "50");
jsonRegion.put("start_point_code", point_code2);
jsonRegion.put("end_point_code", point_code4);
jsonRegion.put("cust_id", "");
jsonRegion.put("create_mode", "03");
jsonRegion.put("task_id", task_id);
jsonRegion.put("create_id", currentUserId);
jsonRegion.put("create_name", currentUsername);
jsonRegion.put("create_time", DateUtil.now());
jsonRegion.put("update_optid", currentUserId);
jsonRegion.put("update_optname", currentUsername);
jsonRegion.put("update_time", DateUtil.now());
jsonRegion.put("confirm_optid", currentUserId);
jsonRegion.put("confirm_optname", currentUsername);
jsonRegion.put("confirm_time", DateUtil.now());
coolTab.insert(jsonRegion);
}
// 更新工单状态为完成
//更新母卷工单状态
HashMap<String, String> map = new HashMap<>();
map.put("status", "09");
map.put("realend_time", DateUtil.now());
map.put("update_optid", currentUserId + "");
map.put("update_optname", currentUsername);
map.put("finish_type", "01");
map.put("update_time", DateUtil.now());
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + jsonTask.getString("material_code") + "'");
// 更新冷却库存状态
jsonIvt2.put("full_point_status", "02");
jsonIvt2.put("instorage_time", DateUtil.now());
jsonIvt2.put("container_name", jsonRaw.getString("container_name"));
jsonIvt2.put("workorder_id", jsonRaw.getString("workorder_id"));
jsonIvt2.put("ivt_qty", jsonRaw.getString("productin_qty"));
jsonIvt2.put("cool_ivt_status", "01");
ivtTab.update(jsonIvt2);
// 插入入库单
JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
throw new BadRequestException("产品不存在");
}
JSONObject jsonRegion = new JSONObject();
jsonRegion.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
jsonRegion.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
jsonRegion.put("io_type", "0");
jsonRegion.put("material_id", jsonMater.getString("material_id"));
jsonRegion.put("pcsn", jsonRaw.getString("container_name"));
jsonRegion.put("vehicle_code", "");
jsonRegion.put("qty", jsonRaw.getString("productin_qty"));
jsonRegion.put("qty_unit_id", jsonMater.get("base_unit_id"));
jsonRegion.put("bill_status", "50");
jsonRegion.put("start_point_code", point_code2);
jsonRegion.put("end_point_code", point_code4);
jsonRegion.put("cust_id", "");
jsonRegion.put("create_mode", "03");
jsonRegion.put("task_id", task_id);
jsonRegion.put("create_id", currentUserId);
jsonRegion.put("create_name", currentUsername);
jsonRegion.put("create_time", DateUtil.now());
jsonRegion.put("update_optid", currentUserId);
jsonRegion.put("update_optname", currentUsername);
jsonRegion.put("update_time", DateUtil.now());
jsonRegion.put("confirm_optid", currentUserId);
jsonRegion.put("confirm_optname", currentUsername);
jsonRegion.put("confirm_time", DateUtil.now());
coolTab.insert(jsonRegion);
}
}
}
@@ -294,7 +328,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
} else {
json.put("priority", priority_jo.getString("value"));
}
if ("010101".equals(form.getString("task_type"))) {
if ("010101".equals(form.getString("task_type")) || "010104".equals(form.getString("task_type"))) {
json.put("acs_task_type", "1");
} else {
json.put("acs_task_type", "3");

View File

@@ -122,7 +122,7 @@ public class CutConveyorTask extends AbstractAcsTask {
}
//只有输送入的时候才调用MES
if ("010402".equals(jsonTask.getString("task_type"))) {
if ("010402".equals(jsonTask.getString("task_type")) && StrUtil.isNotEmpty(jsonTask.getString("vehicle_code"))) {
//调用MES接口通知MES运输中
LmsToMesService lmsToMesService = SpringContextHolder.getBean(LmsToMesService.class);
JSONArray rows = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("qzzno = '" + jsonTask.getString("vehicle_code") + "' AND is_child_tz_ok = '1' AND is_delete ='0' AND status < '09'").getResultJSONArray(0);

View File

@@ -118,28 +118,48 @@ public class InHotTask extends AbstractAcsTask {
String hot_point_code = "";
// 判断此任务是否有三个点位
if (ObjectUtil.isEmpty(jsonTask.getString("point_code3"))) {
/*
* 暂存区入烘箱任务
*/
// 更新烘箱区库存状态
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
jsonHotIvt.put("point_status", "02");
jsonHotIvt.put("container_name", jsonHotMst.getString("container_name"));
jsonHotIvt.put("workorder_id", jsonHotMst.getString("workorder_id"));
jsonHotIvt.put("ivt_qty", jsonHotMst.getString("qty"));
jsonHotIvt.put("instorage_time", DateUtil.now());
jsonHotIvt.put("update_optid", currentUserId);
jsonHotIvt.put("update_optname", currentUsername);
jsonHotIvt.put("update_time", DateUtil.now());
hotIvtTab.update(jsonHotIvt);
// 更新暂存区点位状态为空位
JSONObject jsonPoint = pointTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
jsonPoint.put("point_status", "1");
jsonPoint.put("material_code", "");
pointTab.update(jsonPoint);
if (jsonTask.getString("task_type").equals("010204")) {
JSONObject cool_jo = coolIvtTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
cool_jo.put("full_point_status", "02");
cool_jo.put("cool_ict_status", "01");
cool_jo.put("container_name", jsonTask.getString("material_code"));
coolIvtTab.update(cool_jo);
return;
} else {
/*
* 暂存区入烘箱任务
*/
// 更新烘箱区库存状态
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
jsonHotIvt.put("point_status", "02");
jsonHotIvt.put("container_name", jsonHotMst.getString("container_name"));
jsonHotIvt.put("workorder_id", jsonHotMst.getString("workorder_id"));
jsonHotIvt.put("ivt_qty", jsonHotMst.getString("qty"));
jsonHotIvt.put("instorage_time", DateUtil.now());
jsonHotIvt.put("update_optid", currentUserId);
jsonHotIvt.put("update_optname", currentUsername);
jsonHotIvt.put("update_time", DateUtil.now());
hotIvtTab.update(jsonHotIvt);
String product_area = jsonHotIvt.getString("product_area");
if (product_area.equals("B1")) {
JSONObject jsonPoint = coolIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
jsonPoint.put("container_name", "");
jsonPoint.put("full_point_status", "01");
pointTab.update(jsonPoint);
}else {
// 更新暂存区点位状态为空位
JSONObject jsonPoint = pointTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
jsonPoint.put("point_status", "1");
jsonPoint.put("material_code", "");
pointTab.update(jsonPoint);
}
hot_point_code = jsonHotIvt.getString("ext_code");
}
hot_point_code = jsonHotIvt.getString("ext_code");
} else {
/*
* 冷却区入烘箱任务
@@ -325,6 +345,38 @@ public class InHotTask extends AbstractAcsTask {
tab.insert(json);
task_id = json.getString("task_id");
}
if (StrUtil.equals(form.getString("type"), "3")) {
{
String point_code1 = form.getString("point_code1");
String point_code2 = form.getString("point_code2");
if (cutConveyorTask.isSingleTask(point_code1)) {
throw new BadRequestException("点位:" + point_code1 + "存在未完成的任务!");
}
if (cutConveyorTask.isSingleTask(point_code2)) {
throw new BadRequestException("点位:" + point_code2 + "存在未完成的任务!");
}
JSONObject json = new JSONObject();
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_type", "010204");
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
json.put("point_code1", form.getString("point_code1"));
json.put("point_code2", form.getString("point_code2"));
json.put("product_area", form.getString("product_area"));
json.put("sort_seq", "1");
json.put("handle_class", THIS_CLASS);
json.put("create_id", currentUserId);
json.put("create_name", currentUsername);
json.put("create_time", DateUtil.now());
json.put("priority", "1");
json.put("acs_task_type", "6");
tab.insert(json);
task_id = json.getString("task_id");
}
}
immediateNotifyAcs(task_id);
return task_id;
}

View File

@@ -100,56 +100,83 @@ public class OutHotTask extends AbstractAcsTask {
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
if (jsonTask.getString("task_type").equals("010205")) {
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + jsonTask.getString("point_code3") + "'").uniqueResult(0);
//创建AGV任务
if (StrUtil.isNotEmpty(cut_jo.getString("container_name")) || "02".equals(cut_jo.getString("full_point_status"))) {
throw new BadRequestException("该分切机对应的上料位存在母卷,不能下发搬运任务!");
}
JSONObject jo = new JSONObject();
if (StrUtil.equals("01", cut_jo.getString("empty_point_status"))) {
jo.put("point_code1", jsonTask.getString("point_code2"));
jo.put("point_code2", cut_jo.getString("full_point_code"));
jo.put("vehicle_code", jsonTask.getString("material_code"));
jo.put("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010302");
} else {
/*jo.put("point_code1", point_code);
jo.put("point_code2", next_point_code);
jo.put("point_code3", cut_jo.getString("empty_point_code"));
jo.put("point_code4", cool_jo.getString("empty_point_code"));
jo.put("vehicle_code", cool_jo.getString("container_name"));
jo.put("vehicle_code2", cut_jo.getString("empty_vehicle_code"));
jo.put("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010301");*/
}
AbstractAcsTask task = new CoolCutTask();
task.createTask(jo);
}else {
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
// 更新主表: 什么时候更新主表
JSONObject jsonHotMst = hotMstTab.query("task_id = '" + task_id + "'").uniqueResult(0);
// 更新主表: 什么时候更新主表
JSONObject jsonHotMst = hotMstTab.query("task_id = '" + task_id + "'").uniqueResult(0);
// 更新暂存区点位状态
JSONObject jsonPoint2 = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
jsonPoint2.put("point_status", "2");
jsonPoint2.put("material_code", jsonHotIvt.getString("container_name"));
pointTab.update(jsonPoint2);
// 更新暂存区点位状态
JSONObject jsonPoint2 = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
jsonPoint2.put("point_status", "2");
jsonPoint2.put("material_code", jsonHotIvt.getString("container_name"));
pointTab.update(jsonPoint2);
// 更新烘箱区库存状态
jsonHotIvt.put("point_status", "01");
jsonHotIvt.put("container_name", "");
jsonHotIvt.put("workorder_id", "");
jsonHotIvt.put("ivt_qty", 0);
jsonHotIvt.put("instorage_time", "");
jsonHotIvt.put("update_optid", currentUserId);
jsonHotIvt.put("update_optname", currentUsername);
jsonHotIvt.put("update_time", DateUtil.now());
// 更新烘箱区库存状态
jsonHotIvt.put("point_status", "01");
jsonHotIvt.put("container_name", "");
jsonHotIvt.put("workorder_id", "");
jsonHotIvt.put("ivt_qty", 0);
jsonHotIvt.put("instorage_time", "");
jsonHotIvt.put("update_optid", currentUserId);
jsonHotIvt.put("update_optname", currentUsername);
jsonHotIvt.put("update_time", DateUtil.now());
log.info("出烘箱wql执行update语句");
hotIvtTab.update(jsonHotIvt);
JSONObject update_ivt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
log.info("更新完后烘箱库存为:-----------------" + update_ivt.toString());
log.info("出烘箱wql执行update语句");
hotIvtTab.update(jsonHotIvt);
JSONObject update_ivt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
log.info("更新完后烘箱库存为:-----------------" + update_ivt.toString());
log.info("出烘箱mybatis执行update语句");
HotMapper hotMapper = SpringContextHolder.getBean(HotMapper.class);
hotMapper.updateHotByObject(jsonHotIvt);
JSONObject update_ivt2 = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
log.info("更新完后烘箱库存为:-----------------" + update_ivt2.toString());
log.info("出烘箱mybatis执行update语句");
HotMapper hotMapper = SpringContextHolder.getBean(HotMapper.class);
hotMapper.updateHotByObject(jsonHotIvt);
JSONObject update_ivt2 = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
log.info("更新完后烘箱库存为:-----------------" + update_ivt2.toString());
if (!update_ivt2.getString("container_name").equals(update_ivt.getString("container_name"))) {
log.info("出烘箱WQL更新不成功");
}
if (!update_ivt2.getString("container_name").equals(update_ivt.getString("container_name"))) {
log.info("出烘箱WQL更新不成功");
}
// 将出烘箱信息发送给mes
JSONObject param = new JSONObject();
param.put("iContainerName", jsonHotMst.getString("container_name"));
param.put("iResourceName", jsonHotIvt.getString("ext_code"));
param.put("iMoveOutDate", DateUtil.now());
param.put("iabxActualBakingTemperature", jsonHotMst.getDoubleValue("temperature"));
param.put("iabxActualBakingTimer", jsonHotMst.getDoubleValue("oven_time"));
// 将出烘箱信息发送给mes
JSONObject param = new JSONObject();
param.put("iContainerName", jsonHotMst.getString("container_name"));
param.put("iResourceName", jsonHotIvt.getString("ext_code"));
param.put("iMoveOutDate", DateUtil.now());
param.put("iabxActualBakingTemperature", jsonHotMst.getDoubleValue("temperature"));
param.put("iabxActualBakingTimer", jsonHotMst.getDoubleValue("oven_time"));
//判断该接口是否需要回传
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'momRollBakeOutBound'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(back_jo) && "1".equals(back_jo.getString("is_back"))) {
String product_area = back_jo.getString("product_area");
if (StrUtil.isNotEmpty(product_area) && product_area.contains(jsonTask.getString("product_area"))) {
new LmsToMesServiceImpl().momRollBakeOutBound(param);
//判断该接口是否需要回传
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'momRollBakeOutBound'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(back_jo) && "1".equals(back_jo.getString("is_back"))) {
String product_area = back_jo.getString("product_area");
if (StrUtil.isNotEmpty(product_area) && product_area.contains(jsonTask.getString("product_area"))) {
new LmsToMesServiceImpl().momRollBakeOutBound(param);
}
}
}
@@ -187,10 +214,16 @@ public class OutHotTask extends AbstractAcsTask {
JSONObject json = new JSONObject();
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_type", "010202");
String task_type = form.getString("task_type");
if (StrUtil.isNotEmpty(task_type)) {
json.put("task_type", task_type);
}else {
json.put("task_type", "010202");
}
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
json.put("point_code1", form.getString("point_code1"));
json.put("point_code2", form.getString("point_code2"));
json.put("point_code3", form.getString("point_code3"));
json.put("product_area", form.getString("product_area"));
json.put("material_code", form.getString("material_code"));
json.put("sort_seq", "1");

View File

@@ -17,6 +17,7 @@ public enum URLEnum {
ACS_URL_A4("A4", () -> SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("ACS_URL_A4").getValue()),
ACS_URL_LK("LK", () -> SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("ACS_URL_LK").getValue()),
ACS_URL_BLK("BLK", () -> SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("ACS_URL_BLK").getValue()),
ACS_URL_B1("B1", () -> SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("ACS_URL_B2").getValue()),
ACS_URL_B2("B2", () -> SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("ACS_URL_B2").getValue());
private final String product_area;