rev:代码评审优化

This commit is contained in:
2025-06-30 09:21:57 +08:00
parent acd07ff4c6
commit 9deeae6efc
23 changed files with 835 additions and 254 deletions

View File

@@ -5,6 +5,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.pdm.bi.slittingproductionplan.service.dto.PdmBiSlittingproductionplanDto;
import org.nl.common.domain.query.PageQuery;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.pdm.rawfoilworkorder.service.dao.RawfoilWorkOrder;
@@ -25,6 +26,13 @@ public class SlittingproductionplanController {
private final IPdmBiSlittingproductionplanService biSlittingproductionplanService;
@GetMapping("/getSlittingproductionplanDtl")
@Log("查询同一组明细计划")
//@SaCheckPermission("@el.check('slittingproductionplan:list')")
public ResponseEntity<Object> getSlittingproductionplanDtl(PdmBiSlittingproductionplanDto dto) {
return new ResponseEntity<>(biSlittingproductionplanService.getSlittingproductionplanDtl(dto), HttpStatus.OK);
}
@GetMapping
@Log("查询分切计划")
@@ -107,9 +115,16 @@ public class SlittingproductionplanController {
}
@PostMapping("/print")
@Log("打印")
@Log("打印卷标")
public ResponseEntity<Object> print( @RequestBody List<PdmBiSlittingproductionplan> list){
biSlittingproductionplanService.print(list);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PostMapping("/print1")
@Log("打印管标")
public ResponseEntity<Object> print1( @RequestBody List<PdmBiSlittingproductionplan> list){
biSlittingproductionplanService.print1(list);
return new ResponseEntity<>(HttpStatus.CREATED);
}
}

View File

@@ -2,6 +2,7 @@ package org.nl.b_lms.pdm.bi.slittingproductionplan.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dto.PdmBiSlittingproductionplanDto;
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.SlitterPlanDistinctDto;
import org.nl.common.domain.query.PageQuery;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -189,4 +190,8 @@ public interface IPdmBiSlittingproductionplanService extends IService<PdmBiSlitt
void compelFinish(JSONObject whereJson);
void print(List<PdmBiSlittingproductionplan> list);
List<PdmBiSlittingproductionplan> getSlittingproductionplanDtl(PdmBiSlittingproductionplanDto dto);
void print1(List<PdmBiSlittingproductionplan> list);
}

View File

@@ -161,7 +161,7 @@ public class PdmBiSlittingproductionplanServiceImpl extends ServiceImpl<PdmBiSli
dto.setMfg_order_name("FQ" + TaskUtils.getDateTime("yyMMddHHmmss") + CodeUtil.getNewCode("SBGD_CODE"));
dto.setIs_call("0");
dto.setStart_time(DateUtil.now());
dto.setSale_order_name(IdUtil.getSnowflake(1, 1).nextId() + "");
dto.setSale_order_name(rows.get(i).getString("sale_order_name"));
dto.setStatus("01");
dto.setIs_delete("0");
dto.setIs_paper_ok("0");
@@ -522,5 +522,36 @@ public class PdmBiSlittingproductionplanServiceImpl extends ServiceImpl<PdmBiSli
}
}
}
@Override
public void print1(List<PdmBiSlittingproductionplan> list) {
JSONObject print_info = WQLObject.getWQLObject("pdm_bi_printinfo").query("print_name = 'tube_tag'").uniqueResult(0);
for (int i = 0; i < list.size(); i++) {
PdmBiSlittingproductionplan pdmBiSlittingproductionplan = list.get(i);
JSONObject print_jo = new JSONObject();
print_jo.put("container_name", pdmBiSlittingproductionplan.getContainer_name());
if ("1".equals(pdmBiSlittingproductionplan.getPaper_tube_or_frp())) {
print_jo.put("paper_tube_or_frp", pdmBiSlittingproductionplan.getPaper_tube_model());
} else {
print_jo.put("paper_tube_or_frp", pdmBiSlittingproductionplan.getFRP_model());
}
print_jo.put("print_type", print_info.getString("print_id"));
new PrintServiceImpl().tube_print(print_jo);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
@Override
public List<PdmBiSlittingproductionplan> getSlittingproductionplanDtl(PdmBiSlittingproductionplanDto dto) {
List<PdmBiSlittingproductionplan> list = pdmBiSlittingproductionplanMapper.selectList(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().eq(PdmBiSlittingproductionplan::getParent_container_name, dto.getParent_container_name())
.eq(PdmBiSlittingproductionplan::getSplit_group, dto.getSplit_group()));
return list;
}
}

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;
@@ -52,7 +53,7 @@ public class BakingController {
@PostMapping("/queryHotPoints")
@Log("烘烤区域母卷详情")
@SaIgnore
public ResponseEntity<Object> queryHotPoints(@RequestBody JSONObject whereJson) {
HttpContext ctx = new HttpContext("11");
ctx.setPage((String) (whereJson.get("page")));
@@ -67,4 +68,11 @@ public class BakingController {
return new ResponseEntity<>(bakingService.inCoolOrOven(whereJson), HttpStatus.OK);
}
@PostMapping("/inHotByPoint")
@Log("定点入烘箱")
public ResponseEntity<Object> inHotByPoint(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(bakingService.inHotByPoint(whereJson), HttpStatus.OK);
}
}

View File

@@ -70,6 +70,13 @@ public class RawFoilController {
return new ResponseEntity<>(rawFoilService.scrollDowm(whereJson), HttpStatus.OK);
}
@PostMapping("/confirmWeight")
@Log("母卷重量维护")
public ResponseEntity<Object> confirmWeight(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(rawFoilService.confirmWeight(whereJson), HttpStatus.OK);
}
@PostMapping("/query")
@Log("查询冷却区生箔情况")

View File

@@ -35,4 +35,6 @@ public interface BakingService {
JSONObject inCoolOrOven(JSONObject whereJson);
JSONObject queryHotPoints(JSONObject whereJson, HttpContext ctx);
JSONObject inHotByPoint(JSONObject whereJson);
}

View File

@@ -56,4 +56,6 @@ public interface RawFoilService {
JSONObject scrollDowm(JSONObject whereJson);
JSONObject query(JSONObject whereJson, HttpContext ctx);
JSONObject confirmWeight(JSONObject whereJson);
}

View File

@@ -20,6 +20,7 @@ import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.core.content.HttpContext;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.system.service.param.ISysParamService;
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;
@@ -47,6 +48,8 @@ public class BakingServiceImpl implements BakingService {
@Autowired
private RedisUtils redisUtils;
@Autowired
private ISysParamService paramService;
@Autowired
private CoolPointIvtMapper coolPointIvtMapper;
@Autowired
private RawfoilWorkOrderMapper rawfoilWorkOrderMapper;
@@ -114,10 +117,12 @@ public class BakingServiceImpl implements BakingService {
throw new BadRequestException("未查询到母卷号:" + container_name + "对应的生箔机台编号!");
}
if (StrUtil.equals("1", sb_jo.getString("mes_used")) && !"1".equals(raw_jo.getString("is_baking"))) {
throw new BadRequestException("该母卷在MES上未进行决策入烘箱不允许进行入烘箱操作");
String mes_used = paramService.findByCode("mes_used").getValue();
if (StrUtil.equals("1", mes_used)) {
if (!"1".equals(raw_jo.getString("is_baking"))) {
throw new BadRequestException("该母卷在MES上未进行决策入烘箱不允许进行入烘箱操作");
}
}
if (ObjectUtil.isEmpty(container_name)) {
throw new BadRequestException("母卷号不能为空");
}
@@ -134,7 +139,7 @@ public class BakingServiceImpl implements BakingService {
/*
* 根据点位判断是 冷却区入烘箱还是烘箱对接位入烘箱
*/
JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "' AND point_type = '4'").uniqueResult(0);
JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "' AND point_type = '5'").uniqueResult(0);
String point_type = "1";
// 冷却点
@@ -242,25 +247,29 @@ public class BakingServiceImpl implements BakingService {
//只找入箱点位
map.put("point_type", "4");
String point_code2 = "";
JSONObject point_code2_jo = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
if (ObjectUtil.isEmpty(point_code2_jo)) {
throw new BadRequestException("未查询到可用的点位类型为入箱的烘箱对接位!");
if (ObjectUtil.isNotEmpty(point_code2_jo)) {
point_code2 = point_code2_jo.getString("point_code");
}
String point_code3 = "";
JSONObject jsonHotIvt = getJsonObject(product_area, point_code2_jo, temperature);
if (ObjectUtil.isEmpty(jsonHotIvt)) {
throw new BadRequestException("烘烤区没有合适温度的空位!");
if (ObjectUtil.isNotEmpty(jsonHotIvt)) {
point_code3 = jsonHotIvt.getString("point_code");
}
// 3.创建冷却区 --> 烘烤区任务
JSONObject param = new JSONObject();
param.put("type", "1"); // 1- 冷却区入烘箱 2- 暂存位入烘箱
param.put("point_code1", point_code1);
param.put("point_code2", point_code2_jo.getString("point_code"));
param.put("point_code3", jsonHotIvt.getString("point_code"));
param.put("point_code2", point_code2);
param.put("point_code3", point_code3);
param.put("material_code", container_name);
param.put("product_area", product_area);
param.put("request_param", NumberUtil.mul(Double.parseDouble(hours), 60));
param.put("temperature", temperature);
param.put("param", map);
// 创建冷却区 --> 暂存位的任务
InHotTask inHotTask = new InHotTask();
@@ -316,7 +325,7 @@ public class BakingServiceImpl implements BakingService {
jsonCool.put("confirm_time", DateUtil.now());
coolTab.insert(jsonCool);
} else {
throw new BadRequestException("请扫描正确的冷却区点位或对接点位!");
throw new BadRequestException("请扫描正确的冷却区点位或烘箱对接点位!");
}
} else if (StrUtil.equals(option, "2")) {
// 出箱
@@ -445,6 +454,283 @@ public class BakingServiceImpl implements BakingService {
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject inHotByPoint(JSONObject whereJson) {
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位表
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
WQLObject coolIvtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区点位库存表
WQLObject hosIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); // 烤箱区点位库存表
WQLObject hosReMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烤箱区出入主表
WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
//获取人员对应的区域
UserAreaServiceImpl userAreaService = new UserAreaServiceImpl();
String in_area_id = userAreaService.getInArea();
// 入箱
String container_name = whereJson.getString("container_name"); // 母卷号
String temperature = whereJson.getString("temperature"); // 温度
String hours = whereJson.getString("hours"); // 时间
String point_code1 = whereJson.getString("point_code"); // 起点
String point_code3 = whereJson.getString("next_point_code");//终点
if (ObjectUtil.isEmpty(container_name)) {
throw new BadRequestException("母卷号不能为空");
}
if (ObjectUtil.isEmpty(temperature)) {
throw new BadRequestException("温度不能为空");
}
if (ObjectUtil.isEmpty(hours)) {
throw new BadRequestException("时间不能为空");
}
if (ObjectUtil.isEmpty(point_code1)) {
throw new BadRequestException("起点不能为空");
}
if (ObjectUtil.isEmpty(point_code3)) {
throw new BadRequestException("终点不能为空");
}
//查询该点位是否存在未完成的任务
JSONObject task1 = isSingleTask(point_code1);
if (task1 != null) {
throw new BadRequestException("当前点位" + point_code1 + "存在正在执行的任务" + task1.getString("task_code"));
}
JSONObject task2 = isSingleTask(point_code3);
if (task2 != null) {
throw new BadRequestException("当前点位" + point_code3 + "存在正在执行的任务" + task2.getString("task_code"));
}
//校验该设备是否启用且母卷MES是否请求烘烤
//查询该母卷号、设备号对应的生箔工单
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + container_name + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到对应的生箔工单!");
}
if (raw_jo.getString("order_type").equals("1")) {
throw new BadRequestException("当前工单为标箔工单,不允许烘烤!");
}
String resource_name = raw_jo.getString("resource_name");
JSONObject sb_jo = WQLObject.getWQLObject("st_ivt_sbpointivt").query("ext_code ='" + resource_name + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sb_jo)) {
throw new BadRequestException("未查询到母卷号:" + container_name + "对应的生箔机台编号!");
}
String mes_used = paramService.findByCode("mes_used").getValue();
if (StrUtil.equals("1", mes_used)) {
if (!"1".equals(raw_jo.getString("is_baking"))) {
throw new BadRequestException("该母卷在MES上未进行决策入烘箱不允许进行入烘箱操作");
}
}
/*
* 根据点位判断是 冷却区入烘箱还是烘箱对接位入烘箱
*/
JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "' AND point_type = '5'").uniqueResult(0);
String point_type = "1";
// 冷却点
JSONObject jsonCoolIvt = coolIvtTab.query("full_point_code = '" + point_code1 + "' and is_used = '1' AND point_type = '" + point_type + "'").uniqueResult(0);
// CoolPointIvt coolPointIvt = coolPointIvtMapper.selectOne(new LambdaQueryWrapper<CoolPointIvt>()
// .eq(ObjectUtil.isNotEmpty(point_code1), CoolPointIvt::getPoint_code, point_code1));
if (ObjectUtil.isNotEmpty(jsonPointZc)) {
if (!in_area_id.contains(jsonPointZc.getString("product_area"))) {
throw new BadRequestException("当前登录人员暂无【" + jsonPointZc.getString("product_area") + "】操作权限");
}
/*
* 暂存区入烘箱
*/
JSONObject jsonHotIvt = hosIvtTab.query("point_code = '" + point_code3 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotIvt)) {
throw new BadRequestException("烘烤区域无此点位!");
}
if (!jsonPointZc.getString("point_location").equals(jsonHotIvt.getString("point_location"))) {
throw new BadRequestException("暂存位和烘烤区域点位位置不一致!请选择点位位置一致的烘箱位置或者暂存位");
}
boolean exists = redisUtils.hHasKey(point_code3, "temperature");
String point_temperature = "";
if (exists) {
point_temperature = (String) redisUtils.hget(point_code3, "temperature");
} else {
throw new BadRequestException("获取不到redis中" + point_code3 + "的温度");
}
if (ObjectUtil.isEmpty(point_temperature)) {
if (!point_temperature.equals(temperature)) {
throw new BadRequestException("请先调节指定烘箱的温度到" + temperature + ",再重新操作!");
}
}
// 2.创建暂存位 --> 烘烤区任务
JSONObject param = new JSONObject();
param.put("type", "2"); // 1- 冷却区入烘箱 2- 暂存位入烘箱
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"));
param.put("request_param", NumberUtil.mul(Double.parseDouble(hours), 60));
InHotTask inHotTask = new InHotTask();
String task_id = inHotTask.createTask(param);
// 3.插入主表
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);
JSONObject hotParam = new JSONObject();
hotParam.put("container_name", container_name);
hotParam.put("workorder_id", jsonRaw.getString("workorder_id"));
hotParam.put("material_id", jsonMater.getString("material_id"));
hotParam.put("qty", jsonRaw.get("productin_qty"));
hotParam.put("io_type", "0");
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", jsonHotIvt.getString("point_code"));
hotParam.put("temperature", temperature);
hotParam.put("oven_time", hours);
this.createHotIoMst(hotParam);
} else if (ObjectUtil.isNotEmpty(jsonCoolIvt)) {
/*
* 冷却区入烘箱
*/
// hint:
// 1.根据烘箱点位此母卷的点位找到对应的暂存区
JSONObject jsonHotIvt = hosIvtTab.query("point_code = '" + point_code3 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotIvt)) {
throw new BadRequestException("烘烤区域无此点位!");
}
boolean exists = redisUtils.hHasKey(point_code3, "temperature");
String point_temperature = "";
if (exists) {
point_temperature = (String) redisUtils.hget(point_code3, "temperature");
} else {
throw new BadRequestException("获取不到redis中" + point_code3 + "的温度");
}
if (ObjectUtil.isEmpty(point_temperature)) {
if (!point_temperature.equals(temperature)) {
throw new BadRequestException("请先调节指定烘箱的温度到" + temperature + ",再重新操作!");
}
}
String product_area = jsonHotIvt.getString("product_area"); // 生产区域
String point_location = jsonHotIvt.getString("point_location"); // 位置
String reging_id = "";
if (!in_area_id.contains(product_area)) {
throw new BadRequestException("当前登录人员暂无【" + 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 "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", point_location);
//只找入箱点位
map.put("point_type", "4");
JSONObject point_code2_jo = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
if (ObjectUtil.isEmpty(point_code2_jo)) {
throw new BadRequestException("未查询到可用的点位类型为入箱的冷却位对接位!");
}
// 3.创建冷却区 --> 烘烤区任务
JSONObject param = new JSONObject();
param.put("type", "1"); // 1- 冷却区入烘箱 2- 暂存位入烘箱
param.put("point_code1", point_code1);
param.put("point_code2", point_code2_jo.getString("point_code"));
param.put("point_code3", point_code3);
param.put("material_code", container_name);
param.put("product_area", product_area);
param.put("request_param", NumberUtil.mul(Double.parseDouble(hours), 60));
param.put("temperature", temperature);
param.put("param", map);
// 创建冷却区 --> 暂存位的任务
InHotTask inHotTask = new InHotTask();
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("workorder_id", jsonRaw.getString("workorder_id"));
hotParam.put("material_id", jsonMater.getString("material_id"));
hotParam.put("qty", jsonRaw.get("productin_qty"));
hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id"));
hotParam.put("task_id", task_id);
hotParam.put("io_type", "0");
hotParam.put("start_point_code", point_code1);
hotParam.put("end_point_code", jsonHotIvt.getString("point_code"));
hotParam.put("temperature", temperature);
hotParam.put("oven_time", hours);
this.createHotIoMst(hotParam);
// 生成冷却区出入表
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", jsonMater.getString("material_id"));
jsonCool.put("pcsn", container_name);
jsonCool.put("bill_status", "50");
jsonCool.put("qty", jsonRaw.get("productin_qty"));
jsonCool.put("task_id", task_id);
jsonCool.put("qty_unit_id", jsonMater.getString("base_unit_id"));
jsonCool.put("start_point_code", point_code1);
jsonCool.put("end_point_code", jsonHotIvt.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());
coolTab.insert(jsonCool);
} else {
throw new BadRequestException("请扫描正确的冷却区点位或烘箱对接点位!");
}
JSONObject result = new JSONObject();
result.put("message", "操作成功!");
return result;
}
public JSONObject getJsonObject(String product_area, JSONObject point_code2_jo, String temperature) {
if (ObjectUtil.isEmpty(point_code2_jo)) {
throw new BadRequestException("烘箱对接没有可用位置!");
@@ -510,8 +796,11 @@ public class BakingServiceImpl implements BakingService {
throw new BadRequestException("未查询到母卷号:" + container_name + "对应的生箔机台编号!");
}
if (StrUtil.equals("1", sb_jo.getString("mes_used")) && !"1".equals(raw_jo.getString("is_instor"))) {
throw new BadRequestException("该母卷在MES上未进行决策入半成品库不允许进行入冷却操作");
String mes_used = paramService.findByCode("mes_used").getValue();
if (StrUtil.equals("1", mes_used)) {
if (!"1".equals(raw_jo.getString("is_instor"))) {
throw new BadRequestException("该母卷在MES上未进行决策入半成品库不允许进行入冷却操作");
}
}
// 1.获取此暂存位的生产区域和上下位置
@@ -776,8 +1065,11 @@ public class BakingServiceImpl implements BakingService {
throw new BadRequestException("未查询到母卷号:" + container_name + "对应的生箔机台编号!");
}
if (StrUtil.equals("1", sb_jo.getString("mes_used")) && !"1".equals(raw_jo.getString("is_baking"))) {
throw new BadRequestException("该母卷在MES上未进行决策入烘箱不允许进行入烘箱操作");
String mes_used = paramService.findByCode("mes_used").getValue();
if (StrUtil.equals("1", mes_used)) {
if (!"1".equals(raw_jo.getString("is_baking"))) {
throw new BadRequestException("该母卷在MES上未进行决策入烘箱不允许进行入烘箱操作");
}
}
if (ObjectUtil.isEmpty(container_name)) {
@@ -861,7 +1153,7 @@ public class BakingServiceImpl implements BakingService {
hotParam.put("oven_time", hours);
this.createHotIoMst(hotParam);
} else {
throw new BadRequestException("扫描点位类型为出箱的烘箱对接位!");
throw new BadRequestException("选择点位类型为出箱的烘箱对接位上的母卷");
}
} else if (StrUtil.equals(option, "1")) {
// 入冷却
@@ -888,8 +1180,11 @@ public class BakingServiceImpl implements BakingService {
throw new BadRequestException("未查询到母卷号:" + container_name + "对应的生箔机台编号!");
}
if (StrUtil.equals("1", sb_jo.getString("mes_used")) && !"1".equals(raw_jo.getString("is_instor"))) {
throw new BadRequestException("该母卷在MES上未进行决策入半成品库不允许进行入冷却操作");
String mes_used = paramService.findByCode("mes_used").getValue();
if (StrUtil.equals("1", mes_used)) {
if (!"1".equals(raw_jo.getString("is_instor"))) {
throw new BadRequestException("该母卷在MES上未进行决策入半成品库不允许进行入冷却操作");
}
}
// 1.获取此暂存位的生产区域和上下位置
@@ -993,16 +1288,30 @@ public class BakingServiceImpl implements BakingService {
}
JSONObject json = WQL.getWO("ST_IVT_HOTPOINTIVT").addParamMap(map).pageQuery(ctx, "container_name");
JSONArray rows = json.getJSONArray("content");
JSONArray new_rows = new JSONArray();
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
String temperature = (String) redisUtils.hget(row.getString("point_code"), "temperature");
String last_time = (String) redisUtils.hget(row.getString("point_code"), "last_time");
row.put("temperature", temperature);
row.put("last_time", last_time);
new_rows.add(row);
JSONObject jo = new JSONObject();
jo.put("data", rows);
jo.put("size", json.getString("totalElements"));
jo.put("message", "查询成功!");
return jo;
}
public JSONObject isSingleTask(String point_code) {
JSONObject task1 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code1 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
JSONObject task2 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code2 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
JSONObject task3 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code3 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
JSONObject task4 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code4 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(task1)) {
return task1;
} else if (ObjectUtil.isNotEmpty(task2)) {
return task2;
} else if (ObjectUtil.isNotEmpty(task3)) {
return task3;
} else if (ObjectUtil.isNotEmpty(task4)) {
return task4;
}
json.put("content", new_rows);
return json;
return null;
}
}

View File

@@ -101,19 +101,17 @@ public class FeedingServiceImpl implements FeedingService {
@Transactional(rollbackFor = Exception.class)
@Override
public JSONObject handleConfirm(JSONObject form) {
String point_code = form.getString("point_code");
String next_point_code = form.getString("next_point_code");
String container_name = form.getString("container_name");
if (StrUtil.isEmpty(point_code)) {
throw new BadRequestException("输入的起点不能为空!");
JSONObject json = form.getJSONObject("raw_jo");
String next_point_code = json.getString("point_code");
String container_name = json.getString("container_name");
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("point_code = '" + next_point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo)) {
throw new BadRequestException("找不到分切机:" + next_point_code + "的点位!");
}
JSONObject cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0);
JSONObject cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("container_name = '" + container_name + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cool_jo)) {
cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("point_code = '" + point_code + "'").uniqueResult(0);
}
if (ObjectUtil.isEmpty(cool_jo)) {
throw new BadRequestException("请输入或者扫描冷却区满轴位的点位做为起点!");
throw new BadRequestException("找不到母卷号:" + container_name + "的冷却区满轴位的点位!");
} else {
//获取人员对应的区域
UserAreaServiceImpl userAreaService = new UserAreaServiceImpl();
@@ -122,6 +120,7 @@ public class FeedingServiceImpl implements FeedingService {
throw new BadRequestException("当前登录人员暂无【" + cool_jo.getString("product_area") + "】操作权限");
}
}
String point_code = cool_jo.getString("point_code");
if (!StrUtil.equals(cool_jo.getString("full_point_status"), "02")) {
throw new BadRequestException("该点位上不存在母卷!");
@@ -132,8 +131,6 @@ public class FeedingServiceImpl implements FeedingService {
JSONObject result = new JSONObject();
result.put("message", "操作成功!");
JSONObject jo = new JSONObject();
//查询该分切机对应的点位
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + next_point_code + "'").uniqueResult(0);
if (StrUtil.isNotEmpty(cut_jo.getString("container_name")) || "02".equals(cut_jo.getString("full_point_status"))) {
throw new BadRequestException("该分切机对应的上料位存在母卷,不能下发搬运任务!");

View File

@@ -152,6 +152,7 @@ public class RawFoilServiceImpl implements RawFoilService {
JSONObject map = new JSONObject();
map.put("point_code", whereJson.getString("point_code"));
map.put("container_name", whereJson.getString("container_name"));
map.put("product_area", whereJson.getString("product_area"));
// //获取人员对应的区域
// UserAreaServiceImpl userAreaService = new UserAreaServiceImpl();
// String in_area_id = userAreaService.getInArea();
@@ -320,6 +321,24 @@ public class RawFoilServiceImpl implements RawFoilService {
return jo;
}
@Override
public JSONObject confirmWeight(JSONObject whereJson) {
BigDecimal weight = whereJson.getBigDecimal("weight");
String container_name = whereJson.getString("container_name");
if (ObjectUtil.isEmpty(weight)){
throw new BadRequestException("请输入称重值!");
}
if (ObjectUtil.isEmpty(container_name)){
throw new BadRequestException("请输入母卷号!");
}
RawfoilWorkOrder rawfoilWorkOrder = rawfoilWorkOrderMapper.selectOne(new LambdaQueryWrapper<RawfoilWorkOrder>().eq(RawfoilWorkOrder::getContainer_name, container_name));
rawfoilWorkOrder.setProductin_qty(weight);
rawfoilWorkOrderMapper.updateById(rawfoilWorkOrder);
JSONObject jo = new JSONObject();
jo.put("message", "操作成功!");
return jo;
}
private void handleType1And3(JSONObject raw_jo, JSONObject param, String type) {
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("生箔工单不能为空!");
@@ -361,18 +380,19 @@ public class RawFoilServiceImpl implements RawFoilService {
CoolPointIvt jsonIvt;
//如果没找到则继续找下一节点
if (CollectionUtil.isEmpty(coolPointIvtList)) {
adjustPointLocation(map, stIvtSbpointivt);
coolPointIvtList = coolPointIvtMapper.queryCoolPointIvt(map);
if (CollectionUtil.isEmpty(coolPointIvtList)) {
throw new BadRequestException("未查询到合适的点位");
}
jsonIvt = coolPointIvtList.get(0);
if ("1".equals(type)) {
start_pint_code = jsonIvt.getEmpty_point_code();
point_code4 = jsonIvt.getFull_point_code();
} else {
next_pint_code = jsonIvt.getFull_point_code();
}
// adjustPointLocation(map, stIvtSbpointivt);
// coolPointIvtList = coolPointIvtMapper.queryCoolPointIvt(map);
// if (CollectionUtil.isEmpty(coolPointIvtList)) {
// throw new BadRequestException("未查询到合适的点位");
// }
// jsonIvt = coolPointIvtList.get(0);
// if ("1".equals(type)) {
// start_pint_code = jsonIvt.getEmpty_point_code();
// point_code4 = jsonIvt.getFull_point_code();
// } else {
// next_pint_code = jsonIvt.getFull_point_code();
// }
throw new BadRequestException("未查询到合适的冷却区点位");
} else {
jsonIvt = coolPointIvtList.get(0);
@@ -426,13 +446,14 @@ public class RawFoilServiceImpl implements RawFoilService {
//如果没找到则继续找下一节点
CoolPointIvt jsonIvt;
if (ObjectUtil.isEmpty(coolPointIvtList)) {
adjustPointLocation(map, stIvtSbpointivt);
coolPointIvtList = coolPointIvtMapper.queryCoolPointIvt(map);
if (CollectionUtil.isEmpty(coolPointIvtList)) {
throw new BadRequestException("未查询到合适的点位");
}
jsonIvt = coolPointIvtList.get(0);
start_pint_code = jsonIvt.getEmpty_point_code();
// adjustPointLocation(map, stIvtSbpointivt);
// coolPointIvtList = coolPointIvtMapper.queryCoolPointIvt(map);
// if (CollectionUtil.isEmpty(coolPointIvtList)) {
// throw new BadRequestException("未查询到合适的点位");
// }
// jsonIvt = coolPointIvtList.get(0);
// start_pint_code = jsonIvt.getEmpty_point_code();
throw new BadRequestException("未查询到合适的冷却区点位");
} else {
jsonIvt = coolPointIvtList.get(0);
start_pint_code = jsonIvt.getEmpty_point_code();
@@ -477,13 +498,14 @@ public class RawFoilServiceImpl implements RawFoilService {
CoolPointIvt jsonIvt;
//如果没找到则继续找下一节点
if (CollectionUtil.isEmpty(coolPointIvtList)) {
adjustPointLocation(map, stIvtSbpointivt);
coolPointIvtList = coolPointIvtMapper.queryCoolPointIvt(map);
if (CollectionUtil.isEmpty(coolPointIvtList)) {
throw new BadRequestException("未查询到合适的点位");
}
jsonIvt = coolPointIvtList.get(0);
next_pint_code = jsonIvt.getEmpty_point_code();
// adjustPointLocation(map, stIvtSbpointivt);
// coolPointIvtList = coolPointIvtMapper.queryCoolPointIvt(map);
// if (CollectionUtil.isEmpty(coolPointIvtList)) {
// throw new BadRequestException("未查询到合适的点位");
// }
// jsonIvt = coolPointIvtList.get(0);
// next_pint_code = jsonIvt.getEmpty_point_code();
throw new BadRequestException("未查询到合适的冷却区点位");
} else {
jsonIvt = coolPointIvtList.get(0);
next_pint_code = jsonIvt.getEmpty_point_code();

View File

@@ -65,6 +65,13 @@ public interface PrintService {
*/
public JSONObject subVolume_print(JSONObject whereJson);
/**
* 管标打印
* @param whereJson
* @return
*/
public JSONObject tube_print(JSONObject whereJson);
/**
* 获取单据类型
*

View File

@@ -624,6 +624,52 @@ public class PrintServiceImpl implements PrintService {
return jo;
}
@Override
public JSONObject tube_print(JSONObject whereJson) {
JSONObject jo = new JSONObject();
String container_name = jo.getString("container_name");
String paper_tube_or_frp = jo.getString("paper_tube_or_frp");
WQLObject printTab = WQLObject.getWQLObject("pdm_bi_printinfo");
// 生成txt文件
JSONObject jsonPrint = printTab.query("print_id = '" + whereJson.getString("print_type") + "'").uniqueResult(0);
//10.1.3.21/LMSPrinter/
String time = String.valueOf(DateUtil.current());
String filePath = jsonPrint.getString("print_route") +time+"外包标签.txt";
FileWriter fw = null;
try {
File file = new File(filePath);
if (!file.exists()) {
file.createNewFile();
}
fw = new FileWriter(filePath);
OutputStreamWriter write = new OutputStreamWriter(new FileOutputStream(file), "utf-8");
BufferedWriter bw = new BufferedWriter(write);
bw.write("container_name,paper_tube_or_frp\n");
bw.write(container_name + ","
+ paper_tube_or_frp + "\n"
);
bw.close();
jo.put("message", "打印成功!");
log.info(DateUtil.now()+"打印成功!");
} catch (Exception e) {
jo.put("message", "打印失败!" + e.getMessage());
log.info(DateUtil.now()+"1打印失败");
} finally {
try {
if(fw != null){
fw.close();
}
} catch (Exception e) {
jo.put("message", "打印失败!" + e.getMessage());
log.info(DateUtil.now()+"2打印失败");
}
}
return jo;
}
@Override
public JSONObject printType(JSONObject whereJson) {
JSONArray rows = WQL.getWO("PDA_ST_01").addParam("flag", "6").process().getResultJSONArray(0);

View File

@@ -58,6 +58,7 @@ public class CoolPointIvtServiceImpl extends ServiceImpl<CoolPointIvtMapper, Coo
wrapper.eq(ObjectUtil.isNotEmpty(whereJson.get("point_location")), CoolPointIvt::getPoint_location, whereJson.get("point_location"));
wrapper.eq(ObjectUtil.isNotEmpty(whereJson.get("is_used")), CoolPointIvt::getIs_used, whereJson.get("is_used"));
// wrapper.eq(ObjectUtil.isNotEmpty(whereJson.get("in_area_id")), CoolPointIvt::getProduct_area, whereJson.get("in_area_id"));
wrapper.like(ObjectUtil.isNotEmpty(whereJson.get("product_area")), CoolPointIvt::getProduct_area, whereJson.get("product_area"));
wrapper.ge(ObjectUtil.isNotEmpty(whereJson.get("begin_time")), CoolPointIvt::getInstorage_time, whereJson.get("begin_time"));
wrapper.le(ObjectUtil.isNotEmpty(whereJson.get("end_time")), CoolPointIvt::getInstorage_time, whereJson.get("end_time"));
IPage<CoolPointIvt> pages = new Page<>(page.getOffset() + 1, page.getPageSize());

View File

@@ -52,7 +52,7 @@ import java.util.Map;
@Service
@RequiredArgsConstructor
@Slf4j
public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMapper,RawfoilWorkOrder> implements RawfoilWorkOrderService {
public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMapper, RawfoilWorkOrder> implements RawfoilWorkOrderService {
// @Autowired
// IUserAreaPermissionService userAreaPermissionService;
@@ -75,10 +75,10 @@ public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMap
RawfoilWorkOrderDto rawfoilWorkOrderDto = new RawfoilWorkOrderDto();
rawfoilWorkOrderDto.setProduct_area(MapUtil.getStr(whereJson, "product_area"));
rawfoilWorkOrderDto.setResource_name(MapUtil.getStr(whereJson, "resource_name"));
rawfoilWorkOrderDto.setStatus(MapUtil.getStr(whereJson,"status"));
rawfoilWorkOrderDto.setContainer_name(MapUtil.getStr(whereJson,"container_name"));
rawfoilWorkOrderDto.setBegin_time(MapUtil.getStr(whereJson,"begin_time"));
rawfoilWorkOrderDto.setEnd_time(MapUtil.getStr(whereJson,"end_time"));
rawfoilWorkOrderDto.setStatus(MapUtil.getStr(whereJson, "status"));
rawfoilWorkOrderDto.setContainer_name(MapUtil.getStr(whereJson, "container_name"));
rawfoilWorkOrderDto.setBegin_time(MapUtil.getStr(whereJson, "begin_time"));
rawfoilWorkOrderDto.setEnd_time(MapUtil.getStr(whereJson, "end_time"));
//获取人员对应的区域
// List<String> in_area_id = userAreaPermissionService.getCurrentUserAreas(SecurityUtils.getCurrentUserId());
//获取人员对应的区域
@@ -88,7 +88,7 @@ public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMap
// rawfoilWorkOrderDto.setProduct_area(in_area_id);
// }
IPage<RawfoilWorkOrderDto> pages = new Page<>(page.getPage() + 1, page.getSize());
IPage<RawfoilWorkOrderDto> rawfoilWorkOrderList = rawfoilWorkOrderMapper.queryAllPage(rawfoilWorkOrderDto,pages);
IPage<RawfoilWorkOrderDto> rawfoilWorkOrderList = rawfoilWorkOrderMapper.queryAllPage(rawfoilWorkOrderDto, pages);
JSONObject jsonObject = new JSONObject();
jsonObject.put("totalElements", rawfoilWorkOrderList.getTotal());
jsonObject.put("content", rawfoilWorkOrderList.getRecords());
@@ -110,7 +110,7 @@ public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMap
public void create(RawfoilWorkOrder dto) {
String container_name = dto.getContainer_name();
RawfoilWorkOrder rawfoilWorkOrder = rawfoilWorkOrderMapper.selectOne(new QueryWrapper<RawfoilWorkOrder>()
.eq("container_name",container_name));
.eq("container_name", container_name));
if (ObjectUtil.isNotEmpty(rawfoilWorkOrder)) {
throw new BadRequestException("母卷号已存在");
}
@@ -120,7 +120,7 @@ public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMap
String now = DateUtil.now();
StIvtSbpointivt stIvtSbpointivt = stIvtSbpointivtMapper.selectOne(new QueryWrapper<StIvtSbpointivt>()
.eq("ext_code",dto.getResource_name()));
.eq("ext_code", dto.getResource_name()));
if (ObjectUtil.isEmpty(stIvtSbpointivt)) {
throw new BadRequestException("点位设备不存在");
}
@@ -138,7 +138,6 @@ public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMap
}
dto.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextId());
dto.setCreate_id(currentUserId);
dto.setCreate_name(nickName);
@@ -146,8 +145,8 @@ public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMap
dto.setUpdate_optname(nickName);
dto.setUpdate_time(now);
dto.setCreate_time(now);
dto.setPscn("N" + TaskUtils.getDateTime("yyMMdd")+ CodeUtil.getNewCode("SAP_CODE"));
dto.setMfg_order_name("SB"+TaskUtils.getDateTime("yyMMddHHmmss")+ CodeUtil.getNewCode("SBGD_CODE"));
dto.setPscn("N" + TaskUtils.getDateTime("yyMMdd") + CodeUtil.getNewCode("SAP_CODE"));
dto.setMfg_order_name("SB" + TaskUtils.getDateTime("yyMMddHHmmss") + CodeUtil.getNewCode("SBGD_CODE"));
dto.setOrder_type("2");
dto.setAgvno("0");
dto.setIs_delete("0");
@@ -155,7 +154,7 @@ public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMap
dto.setProduct_area(stIvtSbpointivt.getProduct_area());
dto.setPoint_code(stIvtSbpointivt.getPoint_code());
dto.setStatus("00");
if (ObjectUtil.isEmpty(dto.getProductin_qty())){
if (ObjectUtil.isEmpty(dto.getProductin_qty())) {
dto.setProductin_qty(BigDecimal.valueOf(0));
}
@@ -209,7 +208,7 @@ public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMap
public JSONObject start(JSONObject whereJson) {
RawfoilWorkOrder rawfoilWorkOrder = rawfoilWorkOrderMapper.selectOne(new LambdaQueryWrapper<RawfoilWorkOrder>()
.eq(ObjectUtil.isNotEmpty(whereJson.getString("workorder_id")), RawfoilWorkOrder::getWorkorder_id, whereJson.getString("workorder_id")));
if (rawfoilWorkOrder== null) {
if (rawfoilWorkOrder == null) {
throw new BadRequestException("查询不到该工单!");
}
if (!StrUtil.equals(rawfoilWorkOrder.getStatus(), "00")) {
@@ -228,14 +227,9 @@ public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMap
if (ObjectUtil.isNotEmpty(task_jo)) {
throw new BadRequestException("该生箔工单存在未完成的任务,请先完成任务!");
}
if (StrUtil.equals("01", sbPointIvt.getFull_point_status()) && StrUtil.equals("02", sbPointIvt.getEmpty_point_status())) {
rawfoilWorkOrder.setStatus("30");
rawfoilWorkOrder.setFinish_type("02");
rawfoilWorkOrder.setUpdate_time(DateUtil.now());
rawfoilWorkOrderMapper.updateById(rawfoilWorkOrder);
} else {
throw new BadRequestException("当前生箔机:" + sbPointIvt.getExt_code() + "不为满轴位为空且空轴位有轴的状态!,请先维护生箔机点位状态再来操作");
}
rawfoilWorkOrder.setStatus("30");
rawfoilWorkOrder.setUpdate_time(DateUtil.now());
rawfoilWorkOrderMapper.updateById(rawfoilWorkOrder);
JSONObject jo = new JSONObject();
@@ -253,9 +247,9 @@ public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMap
String container_name = whereJson.getString("container_name");
SchBaseTask schBaseTask = schBaseTaskMapper.selectOne(new LambdaQueryWrapper<>(SchBaseTask.class)
.eq(SchBaseTask::getMaterial_code,container_name)
.eq(SchBaseTask::getMaterial_code, container_name)
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
.eq(SchBaseTask::getIs_delete,"0"));
.eq(SchBaseTask::getIs_delete, "0"));
if (ObjectUtil.isNotEmpty(schBaseTask)) {
throw new BadRequestException("该生箔工单存在未完成的任务,请先完成任务!");
}
@@ -284,7 +278,7 @@ public class RawfoilWorkOrderServiceImpl extends ServiceImpl<RawfoilWorkOrderMap
public void print(List<RawfoilWorkOrder> list) {
JSONObject print_info = WQLObject.getWQLObject("pdm_bi_printinfo").query("print_name = 'parentvolume_tag'").uniqueResult(0);
for(int i=0;i<list.size();i++){
for (int i = 0; i < list.size(); i++) {
RawfoilWorkOrder rawfoilWorkOrder = list.get(i);
JSONObject print_jo = new JSONObject();

View File

@@ -141,26 +141,30 @@
IF 输入.flag = "3"
PAGEQUERY
SELECT
hot.*
der.origin
der.roll_status
b.*,
CASE der.roll_status
WHEN '0' THEN '未烘烤'
WHEN '1' THEN '待质检'
WHEN '2' THEN '正在烘烤'
WHEN '3' THEN '质检合格'
WHEN '4' THEN '需复烤'
ELSE ''
END AS roll_status
FROM
PDM_BI_RawFoilWorkOrder der
LEFT JOIN st_ivt_hotpointivt hot ON hot.container_name = der.container_name
LEFT JOIN sch_base_point a ON a.material_code = der.container_name
LEFT JOIN (SELECT point_code,material_code as container_name,product_area FROM `sch_base_point` UNION SELECT point_code,container_name,product_area from st_ivt_hotpointivt) b ON b.container_name = der.container_name
WHERE
der.is_delete = '0'
AND hot.is_delete = '0'
AND hot.product_area in 输入.in_area_id
AND b.container_name != ''
AND b.product_area in 输入.in_area_id
OPTION 输入.point_code <> ""
hot.point_code = 输入.point_code
or a.point_code = 输入.point_code
b.point_code = 输入.point_code
ENDOPTION
OPTION 输入.product_area <> ""
product_area = 输入.product_area
b.product_area = 输入.product_area
ENDOPTION
OPTION 输入.container_name <> ""
container_name >= 输入.container_name
b.container_name >= 输入.container_name
ENDOPTION
ENDSELECT
ENDPAGEQUERY

View File

@@ -0,0 +1,120 @@
package org.nl.wms.sch.manage;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
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.common.utils.RedisUtils;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.sch.tasks.InHotTask;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Slf4j
@Component
public class AutoInHotTask {
private final String THIS_CLASS = AutoInHotTask.class.getName();
@Autowired
private RedisUtils redisUtils;
@Autowired
private IschBaseTaskService taskService;
@Autowired
private RedissonClient redissonClient;
@SneakyThrows
public void run() {
log.info("定时入烘箱....");
RLock lock = redissonClient.getLock(THIS_CLASS);
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try {
if (tryLock) {
List<SchBaseTask> tasks = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_type, "010201")
.eq(SchBaseTask::getIs_delete, "0")
.eq(SchBaseTask::getTask_status, TaskStatusEnum.SURE_START.getCode()));
for (SchBaseTask task : tasks) {
handleUnTask(task);
}
} else {
log.info("定时入烘箱任务被锁住。");
}
} finally {
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
}
@Transactional(rollbackFor = Exception.class)
public void handleUnTask(SchBaseTask task) {
JSONObject form = JSONObject.parseObject(task.getRemark());
String point_code1 = form.getString("point_code1");
WQLObject coolIvtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区点位库存表
WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst");
JSONObject jsonCoolIvt = coolIvtTab.query("full_point_code = '" + point_code1 + "' and is_used = '1' AND point_type = '" + "1" + "'").uniqueResult(0);
String product_area = jsonCoolIvt.getString("product_area");
String temperature = form.getString("temperature");
JSONObject map = JSONObject.parseObject(form.getString("param"));
JSONObject point_code2_jo = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
if (ObjectUtil.isEmpty(point_code2_jo) || ObjectUtil.isEmpty(point_code2_jo.getString("point_code"))) {
log.info("冷却区满轴位:{} 没找到烘箱对接位!", task.getPoint_code1());
return;
}
JSONObject jsonHotIvt = getJsonObject(product_area, point_code2_jo, temperature);
if (ObjectUtil.isEmpty(jsonHotIvt) || ObjectUtil.isEmpty(jsonHotIvt.getString("point_code"))) {
log.info("冷却区满轴位:{} 没找到合适的烘箱!", task.getPoint_code1());
return;
}
JSONObject jsonHotMst = hotMstTab.query("task_id = '" + task.getTask_id() + "'").uniqueResult(0);
jsonHotMst.put("end_point_code", jsonHotIvt.getString("point_code"));
hotMstTab.update(jsonHotMst);
task.setTask_status(TaskStatusEnum.START_AND_POINT.getCode());
task.setPoint_code2(point_code2_jo.getString("point_code"));
task.setPoint_code3(jsonHotIvt.getString("point_code"));
task.setRemark("-");
task.setUpdate_time(DateUtil.now());
taskService.updateById(task);
new InHotTask().immediateNotifyAcs(task.getTask_id());
}
public JSONObject getJsonObject(String product_area, JSONObject point_code2_jo, String temperature) {
if (ObjectUtil.isEmpty(point_code2_jo)) {
throw new BadRequestException("烘箱对接没有可用位置!");
}
JSONObject jsonMap = new JSONObject();
jsonMap.put("flag", "1");
jsonMap.put("product_area", product_area);
jsonMap.put("point_location", point_code2_jo.getString("point_location"));
JSONArray hot_rows = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().getResultJSONArray(0);
JSONObject jsonHotIvt = new JSONObject();
for (int i = 0; i < hot_rows.size(); i++) {
JSONObject hot_row = hot_rows.getJSONObject(i);
String point_code = hot_row.getString("point_code");
boolean exists = redisUtils.hHasKey(point_code, "temperature");
String point_temperature = "";
if (exists) {
point_temperature = (String) redisUtils.hget(point_code, "temperature");
}
if (ObjectUtil.isNotEmpty(point_temperature)) {
if (point_temperature.equals(temperature)) {
jsonHotIvt = hot_row;
break;
}
}
}
return jsonHotIvt;
}
}

View File

@@ -120,10 +120,10 @@ public class InCoolIvtTask extends AbstractAcsTask {
String requestParam = jsonTask.getString("request_param");
if ("1".equals(requestParam)) {
raw_jo.put("origin", "2");
raw_jo.put("roll_status", "2");
raw_jo.put("roll_status", "4");
}else if ("2".equals(requestParam)){
raw_jo.put("origin", "2");
raw_jo.put("roll_status", "1");
raw_jo.put("roll_status", "3");
}
pdm_bi_rawfoilworkorder.update(raw_jo);

View File

@@ -212,6 +212,7 @@ public class InHotTask extends AbstractAcsTask {
//将该母卷的入烘箱标识改为0
HashMap<String, String> map = new HashMap<>();
map.put("is_baking", "0");
map.put("roll_status", "2");//母卷状态改为正在烘烤
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + jsonHotMst.getString("container_name") + "'");
log.info("母卷:" + jsonHotMst.getString("container_name") + "对应的入烘箱任务完成请求烘烤标识改为0");
}
@@ -245,17 +246,33 @@ public class InHotTask extends AbstractAcsTask {
if (cutConveyorTask.isSingleTask(point_code1)) {
throw new BadRequestException("点位:" + point_code1 + "存在未完成的任务!");
}
if (cutConveyorTask.isSingleTask(point_code3)) {
throw new BadRequestException("点位:" + point_code3 + "存在未完成的任务!");
if (StrUtil.isNotEmpty(point_code2)) {
if (cutConveyorTask.isSingleTask(point_code2)) {
throw new BadRequestException("点位:" + point_code2 + "存在未完成的任务!");
}
}
if (StrUtil.isNotEmpty(point_code3)) {
if (cutConveyorTask.isSingleTask(point_code3)) {
throw new BadRequestException("点位:" + point_code3 + "存在未完成的任务!");
}
}
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", "010201");
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
if (StrUtil.isNotEmpty(point_code2) && StrUtil.isNotEmpty(point_code3)) {
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
json.put("task_status", TaskStatusEnum.SURE_START.getCode());
json.put("remark", form);
json.put("point_code2", form.getString("point_code2"));
json.put("point_code3", form.getString("point_code3"));
} else {
json.put("remark", form);
json.put("point_code2", "");
json.put("point_code3", "");
json.put("task_status", TaskStatusEnum.SURE_START.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("request_param", form.getString("request_param"));
json.put("sort_seq", "1");
@@ -274,7 +291,9 @@ public class InHotTask extends AbstractAcsTask {
json.put("acs_task_type", "8");
tab.insert(json);
task_id = json.getString("task_id");
if ("04".equals(json.getString("task_status"))) {
immediateNotifyAcs(task_id);
}
//更新对应点位库存为已裹膜
JSONObject cool_ivt = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + form.getString("point_code1") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cool_ivt)) {
@@ -320,8 +339,8 @@ public class InHotTask extends AbstractAcsTask {
json.put("acs_task_type", "6");
tab.insert(json);
task_id = json.getString("task_id");
immediateNotifyAcs(task_id);
}
immediateNotifyAcs(task_id);
return task_id;
}

View File

@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@Service
@@ -138,6 +139,9 @@ public class OutHotTask extends AbstractAcsTask {
if (!update_ivt2.getString("container_name").equals(update_ivt.getString("container_name"))) {
log.info("出烘箱WQL更新不成功");
}
HashMap<String, String> map = new HashMap<>();
map.put("roll_status","1");//母卷状态改为待质检
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + jsonHotMst.getString("container_name") + "'");
// 将出烘箱信息发送给mes
// JSONObject param = new JSONObject();