代码更新
This commit is contained in:
@@ -177,9 +177,17 @@ public class BakingServiceImpl implements BakingService {
|
||||
String task_id = inHotTask.createTask(param);
|
||||
|
||||
// 4.插入烘箱区出入主表 和 明细表
|
||||
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 hotParam = new JSONObject();
|
||||
hotParam.put("container_name", container_name);
|
||||
hotParam.put("task_id", task_id);
|
||||
hotParam.put("workorder_id", jsonRaw.getString("workorder_id"));
|
||||
hotParam.put("material_id", jsonMater.get("material_id"));
|
||||
hotParam.put("qty", jsonMater.get("productin_qty"));
|
||||
hotParam.put("qty_unit_id", jsonMater.get("base_unit_id"));
|
||||
// 创建主表
|
||||
String iostorinv_id = this.createHotIoMst(hotParam);
|
||||
// 创建明细
|
||||
@@ -194,10 +202,6 @@ public class BakingServiceImpl implements BakingService {
|
||||
Long 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"));
|
||||
@@ -285,6 +289,7 @@ public class BakingServiceImpl implements BakingService {
|
||||
hotParam.put("iostorinv_id", jsonHotReMst.getString("iostorinv_id"));
|
||||
hotParam.put("start_point_code", point_code1);
|
||||
hotParam.put("next_point_code", point_code2);
|
||||
hotParam.put("temperature", jsonHotIvt.getString("temperature"));
|
||||
this.createHotDtl(hotParam);
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
@@ -389,18 +394,16 @@ public class BakingServiceImpl implements BakingService {
|
||||
* 创建烘箱区出入主表
|
||||
*/
|
||||
WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烘箱区出入主表
|
||||
WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区点位库存表
|
||||
|
||||
JSONObject jsonCoolIvt = coolTab.query("container_name = '" + param.getString("container_name") + "'").uniqueResult(0);
|
||||
|
||||
JSONObject jsonHotMst = new JSONObject();
|
||||
jsonHotMst.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonHotMst.put("bill_code", CodeUtil.getNewCode("HOT_BILL_CODE"));
|
||||
jsonHotMst.put("container_name", param.getString("container_name"));
|
||||
jsonHotMst.put("workorder_id", jsonCoolIvt.getString("workorder_id"));
|
||||
jsonHotMst.put("qty", jsonCoolIvt.getString("ivt_qty"));
|
||||
jsonHotMst.put("workorder_id", param.getString("workorder_id"));
|
||||
jsonHotMst.put("material_id", param.get("material_id"));
|
||||
jsonHotMst.put("qty", param.getString("qty"));
|
||||
jsonHotMst.put("bill_status", "10");
|
||||
jsonHotMst.put("qty_unit_id", "1");
|
||||
jsonHotMst.put("qty_unit_id", param.getString("qty_unit_id"));
|
||||
jsonHotMst.put("create_mode", "03");
|
||||
jsonHotMst.put("task_id", param.getString("task_id"));
|
||||
jsonHotMst.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
@@ -140,6 +141,16 @@ public class InCoolIvtTask extends AbstractAcsTask {
|
||||
JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
jsonHotDtl.put("dtl_status", "50");
|
||||
hotDtlTab.update(jsonHotDtl);
|
||||
|
||||
// 将入冷却信息发送给mes
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("iContainerName", jsonTask.getString("material_code"));
|
||||
param.put("iArrivalTime", DateUtil.now());
|
||||
param.put("iWarehouse", 2);
|
||||
param.put("UserName", "");
|
||||
param.put("PassWord", "");
|
||||
|
||||
JSONObject result = new LmsToMesServiceImpl().momRollSemiFGInboundComplete(param);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
@@ -72,10 +73,14 @@ public class InHotTask extends AbstractAcsTask {
|
||||
// 判断此条明细是否是冷却区 -> 烘箱,是则删除主表
|
||||
if (ObjectUtil.isNotEmpty(jsonTask.getString("point_code3"))) {
|
||||
|
||||
// 删除烘箱主表
|
||||
JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonHotDtl)) throw new BadRequestException("明细单据不存在");
|
||||
|
||||
hotMstTab.delete("iostorinv_id = '"+jsonHotDtl.getString("iostorinv_id")+"'");
|
||||
|
||||
// 删除冷却出入表
|
||||
coolIoTab.delete("task_id = '"+task_id+"'");
|
||||
}
|
||||
|
||||
// 取消删除任务
|
||||
@@ -100,6 +105,13 @@ public class InHotTask extends AbstractAcsTask {
|
||||
JSONObject jsonHotMst = hotMstTab.query("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
jsonHotMst.put("bill_status", "40");
|
||||
hotMstTab.update(jsonHotMst);
|
||||
|
||||
// 如果是冷却区入烘箱则更新 冷却区出入表状态
|
||||
if (ObjectUtil.isNotEmpty(jsonTask.getString("point_code3"))) {
|
||||
JSONObject jsonCoolIo = coolIoTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
jsonCoolIo.put("bill_status", "40");
|
||||
coolIoTab.update(jsonCoolIo);
|
||||
}
|
||||
}
|
||||
|
||||
if(StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
@@ -124,6 +136,7 @@ public class InHotTask extends AbstractAcsTask {
|
||||
// 更新主表: 什么时候更新主表
|
||||
JSONObject jsonHotMst = hotMstTab.query("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
|
||||
String hot_point_code = "";
|
||||
// 判断此任务是否有三个点位
|
||||
if (ObjectUtil.isEmpty(jsonTask.getString("point_code3"))) {
|
||||
/*
|
||||
@@ -146,6 +159,8 @@ public class InHotTask extends AbstractAcsTask {
|
||||
jsonPoint.put("point_status", "1");
|
||||
jsonPoint.put("material_code", "");
|
||||
pointTab.update(jsonPoint);
|
||||
|
||||
hot_point_code = jsonHotIvt.getString("point_code");
|
||||
} else {
|
||||
/*
|
||||
* 冷却区入烘箱任务
|
||||
@@ -183,8 +198,21 @@ public class InHotTask extends AbstractAcsTask {
|
||||
jsonHotIvt.put("update_optname", currentUsername);
|
||||
jsonHotIvt.put("update_time", DateUtil.now());
|
||||
hotIvtTab.update(jsonHotIvt);
|
||||
|
||||
hot_point_code = jsonHotIvt.getString("point_code");
|
||||
}
|
||||
|
||||
// 将入烘箱信息发送给mes
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("iContainerName", jsonHotMst.getString("container_name"));
|
||||
param.put("iResourceName", hot_point_code);
|
||||
param.put("iMoveInDate", DateUtil. now());
|
||||
param.put("iPlanBakingTemperature", jsonHotDtl.getDoubleValue("temperature"));
|
||||
param.put("iPlanBakingTimer", jsonHotDtl.getDoubleValue("oven_time"));
|
||||
param.put("UserName", "");
|
||||
param.put("PassWord", "");
|
||||
|
||||
JSONObject result = new LmsToMesServiceImpl().momRollBakeInBound(param);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -11,6 +12,7 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
@@ -18,6 +20,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@@ -97,20 +100,26 @@ 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);
|
||||
|
||||
// 更新明细表
|
||||
JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
Date date1 = DateUtil.parse(jsonHotIvt.getString("instorage_time"));
|
||||
Date date2 = DateUtil.parse(DateUtil.now());
|
||||
long betweenDay = DateUtil.between(date1, date2, DateUnit.MINUTE);
|
||||
|
||||
jsonHotDtl.put("dtl_status", "50");
|
||||
jsonHotDtl.put("confirm_optid", currentUserId);
|
||||
jsonHotDtl.put("confirm_optname", currentUsername);
|
||||
jsonHotDtl.put("confirm_time", DateUtil.now());
|
||||
jsonHotDtl.put("oven_time", Double.valueOf(betweenDay));
|
||||
hotDtlTab.update(jsonHotDtl);
|
||||
|
||||
// 更新主表: 什么时候更新主表
|
||||
JSONObject jsonHotMst = hotMstTab.query("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
|
||||
// 更新暂存区点位状态
|
||||
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").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"));
|
||||
@@ -126,6 +135,18 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
jsonHotIvt.put("update_optname", currentUsername);
|
||||
jsonHotIvt.put("update_time", DateUtil.now());
|
||||
hotIvtTab.update(jsonHotIvt);
|
||||
|
||||
// 将出烘箱信息发送给mes
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("iContainerName", jsonHotMst.getString("container_name"));
|
||||
param.put("iResourceName", jsonHotIvt.getString("point_code"));
|
||||
param.put("iMoveOutDate", DateUtil. now());
|
||||
param.put("iabxActualBakingTemperature", jsonHotDtl.getDoubleValue("temperature"));
|
||||
param.put("iabxActualBakingTimer", jsonHotDtl.getDoubleValue("oven_time"));
|
||||
param.put("UserName", "");
|
||||
param.put("PassWord", "");
|
||||
|
||||
JSONObject result = new LmsToMesServiceImpl().momRollBakeOutBound(param);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user