This commit is contained in:
2022-12-09 13:19:17 +08:00
parent fd0030270f
commit 27d5e5fafe
19 changed files with 491 additions and 536 deletions

View File

@@ -58,4 +58,13 @@ public class AcsToWmsController {
public ResponseEntity<Object> againApply(@RequestBody String task_id) { public ResponseEntity<Object> againApply(@RequestBody String task_id) {
return new ResponseEntity<>(acsToWmsService.againApply(task_id), HttpStatus.OK); return new ResponseEntity<>(acsToWmsService.againApply(task_id), HttpStatus.OK);
} }
@PostMapping("/deviceApply")
@Log("申请贴标、捆扎")
@ApiOperation("申请贴标、捆扎")
public ResponseEntity<Object> deviceApply(@RequestBody JSONObject jo) {
return new ResponseEntity<>(acsToWmsService.deviceApply(jo), HttpStatus.OK);
}
} }

View File

@@ -51,4 +51,13 @@ public interface AcsToWmsService {
*/ */
JSONObject apply(JSONObject whereJson); JSONObject apply(JSONObject whereJson);
/**
* ACS客户端--->LMS服务端
* 申请贴标、捆扎
*
* @param whereJson 条件
* @return JSONObject
*/
JSONObject deviceApply(JSONObject whereJson);
} }

View File

@@ -2,15 +2,19 @@ package org.nl.wms.ext.acs.service.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.ext.acs.service.AcsToWmsService; import org.nl.wms.ext.acs.service.AcsToWmsService;
import org.nl.wms.log.LokiLog; import org.nl.wms.log.LokiLog;
import org.nl.wms.log.LokiLogType; import org.nl.wms.log.LokiLogType;
import org.nl.wms.pda.st.service.PrintService;
import org.nl.wms.sch.manage.TaskStatusEnum; import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.service.TaskService; import org.nl.wms.sch.service.TaskService;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@@ -25,8 +29,10 @@ import java.util.Map;
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
public class AcsToWmsServiceImpl implements AcsToWmsService { public class AcsToWmsServiceImpl implements AcsToWmsService {
private final TaskService taskService; private final TaskService taskService;
private final PrintService printService;
/** /**
* task_id任务标识 * task_id任务标识
* task_code任务编码 * task_code任务编码
@@ -185,4 +191,60 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return null; return null;
} }
@Override
public JSONObject deviceApply(JSONObject whereJson) {
String vehicle_code = whereJson.getString("vehicle_code");
String type = whereJson.getString("type");
if (StrUtil.isEmpty(vehicle_code)){
throw new BadRequestException("木箱码不能为空!");
}
if (StrUtil.isEmpty(type)){
throw new BadRequestException("任务类型不能为空!");
}
JSONObject result = new JSONObject();
JSONObject sub_jo = WQLObject.getWQLObject("").query("package_box_sn = '"+vehicle_code+"'").uniqueResult(0);
if (ObjectUtil.isEmpty(sub_jo)){
throw new BadRequestException("未查询到该木箱对应的包装关系!");
}
if (type.equals("1")){
//贴标申请
String print_type = sub_jo.getString("print_type");
if (StrUtil.isEmpty(print_type)){
throw new BadRequestException("请指定一台打印机进行打印!");
}
String print_code = "";
switch (print_type){
case "1":
print_code = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("print_device1").getValue();
break;
case "2":
print_code = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("print_device2").getValue();
break;
default:
throw new BadRequestException("未查询到对应打印机!");
}
JSONObject print_info = WQLObject.getWQLObject("pdm_bi_printinfo").query("print_name = '"+print_code+"'").uniqueResult(0);
JSONObject print_jo = new JSONObject();
print_jo.put("box_no",vehicle_code);
print_jo.put("print_type",print_info.getString("print_id"));
printService.customerPrint(print_jo);
}else if (type.equals("2")){
//捆扎申请
String box_length = sub_jo.getString("box_length");
String box_width = sub_jo.getString("box_width");
String box_high = sub_jo.getString("box_high");
result.put("box_length",box_length);
result.put("box_width",box_width);
result.put("box_high",box_high);
}else {
throw new BadRequestException("请输入正确的任务类型!");
}
return result;
}
} }

View File

@@ -7,7 +7,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.modules.logging.annotation.Log; import org.nl.modules.logging.annotation.Log;
import org.nl.wms.pda.mps.service.BakingService; import org.nl.wms.pda.mps.service.BakingService;
import org.nl.wms.pda.mps.service.RawFoilService; import org.nl.wms.pda.mps.service.HandleBakingService;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@@ -17,24 +17,24 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@Api(tags = "烘烤工序") @Api(tags = "人工烘烤")
@RequestMapping("api/pda/baking") @RequestMapping("api/pda/handleBaking")
@Slf4j @Slf4j
public class BakingController { public class HandleBakingController {
private final BakingService bakingService; private final HandleBakingService handleBakingService;
@PostMapping("/ovenInAndOut") @PostMapping("/ovenInAndOut")
@Log("烘箱出入") @Log("手工烘箱出入")
@ApiOperation("烘箱出入") @ApiOperation("手工烘箱出入")
public ResponseEntity<Object> queryRawFoil(@RequestBody JSONObject whereJson) { public ResponseEntity<Object> queryRawFoil(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(bakingService.ovenInAndOut(whereJson),HttpStatus.OK); return new ResponseEntity<>(handleBakingService.ovenInAndOut(whereJson),HttpStatus.OK);
} }
@PostMapping("/inCoolIvt") @PostMapping("/checkConfirm")
@Log("入冷却") @Log("库存变更")
@ApiOperation("入冷却") @ApiOperation("库存变更")
public ResponseEntity<Object> inCoolIvt(@RequestBody JSONObject whereJson) { public ResponseEntity<Object> checkConfirm(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(bakingService.inCoolIvt(whereJson),HttpStatus.OK); return new ResponseEntity<>(handleBakingService.checkConfirm(whereJson),HttpStatus.OK);
} }
} }

View File

@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.modules.logging.annotation.Log; import org.nl.modules.logging.annotation.Log;
import org.nl.modules.wql.core.content.HttpContext;
import org.nl.wms.pda.mps.service.RawFoilService; import org.nl.wms.pda.mps.service.RawFoilService;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@@ -34,14 +35,20 @@ public class RawFoilController {
@Log("查询生箔生产进度") @Log("查询生箔生产进度")
@ApiOperation("查询生箔生产进度") @ApiOperation("查询生箔生产进度")
public ResponseEntity<Object> queryRawFoil(@RequestBody JSONObject whereJson) { public ResponseEntity<Object> queryRawFoil(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(rawFoilService.queryRawFoil(whereJson), HttpStatus.OK); HttpContext ctx = new HttpContext("11");
ctx.setPage((String) (whereJson.get("page")));
ctx.setRows((String) (whereJson.get("size")));
return new ResponseEntity<>(rawFoilService.queryRawFoil(whereJson, ctx), HttpStatus.OK);
} }
@PostMapping("/queryRawFoilList") @PostMapping("/queryRawFoilList")
@Log("查询生箔工单") @Log("查询生箔工单")
@ApiOperation("查询生箔工单") @ApiOperation("查询生箔工单")
public ResponseEntity<Object> queryRawFoilList(@RequestBody JSONObject whereJson) { public ResponseEntity<Object> queryRawFoilList(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(rawFoilService.queryRawFoilList(whereJson), HttpStatus.OK); HttpContext ctx = new HttpContext("11");
ctx.setPage((String) (whereJson.get("page")));
ctx.setRows((String) (whereJson.get("size")));
return new ResponseEntity<>(rawFoilService.queryRawFoilList(whereJson, ctx), HttpStatus.OK);
} }
@PostMapping("/needEmptyAxis") @PostMapping("/needEmptyAxis")
@@ -55,8 +62,7 @@ public class RawFoilController {
@Log("确认下卷") @Log("确认下卷")
@ApiOperation("确认下卷") @ApiOperation("确认下卷")
public ResponseEntity<Object> confirmBlanking(@RequestBody JSONObject whereJson) { public ResponseEntity<Object> confirmBlanking(@RequestBody JSONObject whereJson) {
rawFoilService.confirmBlanking(whereJson); return new ResponseEntity<>(rawFoilService.confirmBlanking(whereJson), HttpStatus.OK);
return new ResponseEntity<>(HttpStatus.OK);
} }
@PostMapping("/finishBlanking") @PostMapping("/finishBlanking")

View File

@@ -2,7 +2,7 @@ package org.nl.wms.pda.mps.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
public interface BakingService { public interface HandleBakingService {
/** /**
* 烘箱出入 * 烘箱出入
@@ -12,11 +12,11 @@ public interface BakingService {
JSONObject ovenInAndOut(JSONObject whereJson); JSONObject ovenInAndOut(JSONObject whereJson);
/** /**
* 入冷却 * 检测确认
* @param whereJson / * @param whereJson /
* @return JSONObject * @return JSONObject
*/ */
JSONObject inCoolIvt(JSONObject whereJson); JSONObject checkConfirm(JSONObject whereJson);
} }

View File

@@ -2,6 +2,7 @@ package org.nl.wms.pda.mps.service;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.nl.modules.wql.core.content.HttpContext;
public interface RawFoilService { public interface RawFoilService {
@@ -16,14 +17,14 @@ public interface RawFoilService {
* @param whereJson / * @param whereJson /
* @return JSONObject * @return JSONObject
*/ */
JSONObject queryRawFoil(JSONObject whereJson); JSONObject queryRawFoil(JSONObject whereJson, HttpContext ctx);
/** /**
* 查询生箔工单 * 查询生箔工单
* @param whereJson / * @param whereJson /
* @return JSONObject * @return JSONObject
*/ */
JSONObject queryRawFoilList(JSONObject whereJson); JSONObject queryRawFoilList(JSONObject whereJson, HttpContext ctx);
/** /**
* 呼叫空卷轴 * 呼叫空卷轴
@@ -37,7 +38,7 @@ public interface RawFoilService {
* @param whereJson / * @param whereJson /
* @return JSONObject * @return JSONObject
*/ */
void confirmBlanking(JSONObject whereJson); JSONObject confirmBlanking(JSONObject whereJson);
/** /**
* 下卷完成 * 下卷完成

View File

@@ -70,7 +70,7 @@ public class BakingServiceImpl implements BakingService {
if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("点位不能为空"); if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("点位不能为空");
/* /*
* 根据点位判断是 冷却入烘箱还是暂存区入烘箱 * 根据点位判断是 冷却入烘箱还是暂存区入烘箱
*/ */
JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0); JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonPointZc)) { if (ObjectUtil.isNotEmpty(jsonPointZc)) {
@@ -94,19 +94,22 @@ public class BakingServiceImpl implements BakingService {
InHotTask inHotTask = new InHotTask(); InHotTask inHotTask = new InHotTask();
String task_id = inHotTask.createTask(param); String task_id = inHotTask.createTask(param);
// 3.插入明细明细 // 3.插入主表
JSONObject jsonHotReMst = hosReMstTab.query("container_name = '" + container_name + "' and bill_status <> '50' and is_delete = '0'").uniqueResult(0); JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotReMst)) throw new BadRequestException("烘箱区出入主表不存在"); JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
JSONObject hotParam = new JSONObject(); JSONObject hotParam = new JSONObject();
hotParam.put("container_name", container_name); 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("task_id", task_id);
hotParam.put("iostorinv_id", jsonHotReMst.getString("iostorinv_id"));
hotParam.put("start_point_code", point_code1); hotParam.put("start_point_code", point_code1);
hotParam.put("next_point_code", jsonHotIvt.getString("point_code")); hotParam.put("next_point_code", jsonHotIvt.getString("point_code"));
hotParam.put("temperature", temperature); hotParam.put("temperature", temperature);
hotParam.put("oven_time", hours); hotParam.put("oven_time", hours);
this.createHotDtl(hotParam); this.createHotIoMst(hotParam);
} else { } else {
/* /*
* 冷却区入烘箱 * 冷却区入烘箱
@@ -187,27 +190,24 @@ public class BakingServiceImpl implements BakingService {
InHotTask inHotTask = new InHotTask(); InHotTask inHotTask = new InHotTask();
String task_id = inHotTask.createTask(param); String task_id = inHotTask.createTask(param);
// 4.插入烘箱区出入主表 和 明细表 // 4.插入烘箱区出入主表
JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0); 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 jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("物料不存在"); if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("物料不存在");
JSONObject hotParam = new JSONObject(); JSONObject hotParam = new JSONObject();
hotParam.put("container_name", container_name); hotParam.put("container_name", container_name);
hotParam.put("task_id", task_id);
hotParam.put("workorder_id", jsonRaw.getString("workorder_id")); hotParam.put("workorder_id", jsonRaw.getString("workorder_id"));
hotParam.put("material_id", jsonMater.get("material_id")); hotParam.put("material_id", jsonMater.getString("material_id"));
hotParam.put("qty", jsonMater.get("productin_qty")); hotParam.put("qty", jsonRaw.get("productin_qty"));
hotParam.put("qty_unit_id", jsonMater.get("base_unit_id")); hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id"));
// 创建主表 hotParam.put("task_id", task_id);
String iostorinv_id = this.createHotIoMst(hotParam); hotParam.put("start_point_code", point_code1);
// 创建明细
hotParam.put("iostorinv_id", iostorinv_id);
hotParam.put("start_point_code", point_code2);
hotParam.put("next_point_code", jsonHotIvt.getString("point_code")); hotParam.put("next_point_code", jsonHotIvt.getString("point_code"));
hotParam.put("temperature", temperature); hotParam.put("temperature", temperature);
hotParam.put("oven_time", hours); hotParam.put("oven_time", hours);
this.createHotDtl(hotParam); this.createHotIoMst(hotParam);
// 生成冷却区出入表 // 生成冷却区出入表
Long currentUserId = 2L; Long currentUserId = 2L;
@@ -416,13 +416,21 @@ public class BakingServiceImpl implements BakingService {
jsonHotMst.put("workorder_id", param.getString("workorder_id")); jsonHotMst.put("workorder_id", param.getString("workorder_id"));
jsonHotMst.put("material_id", param.get("material_id")); jsonHotMst.put("material_id", param.get("material_id"));
jsonHotMst.put("qty", param.getString("qty")); jsonHotMst.put("qty", param.getString("qty"));
jsonHotMst.put("bill_status", "10"); jsonHotMst.put("bill_status", "50");
jsonHotMst.put("qty_unit_id", param.getString("qty_unit_id")); jsonHotMst.put("qty_unit_id", param.getString("qty_unit_id"));
jsonHotMst.put("start_point_code", param.getString("start_point_code"));
jsonHotMst.put("end_point_code", param.getString("end_point_code"));
jsonHotMst.put("create_mode", "03"); jsonHotMst.put("create_mode", "03");
jsonHotMst.put("task_id", param.getString("task_id")); jsonHotMst.put("task_id", param.getString("task_id"));
jsonHotMst.put("task_type", param.getString("task_type"));
jsonHotMst.put("temperature", param.getString("temperature"));
jsonHotMst.put("oven_time", param.getString("oven_time"));
jsonHotMst.put("create_id", 2); jsonHotMst.put("create_id", 2);
jsonHotMst.put("create_name", "mes用户"); jsonHotMst.put("create_name", "mes用户");
jsonHotMst.put("create_time", DateUtil.now()); jsonHotMst.put("create_time", DateUtil.now());
jsonHotMst.put("confirm_optid", 2);
jsonHotMst.put("confirm_optname", "mes用户");
jsonHotMst.put("confirm_time", DateUtil.now());
hotMstTab.insert(jsonHotMst); hotMstTab.insert(jsonHotMst);
return jsonHotMst.getString("iostorinv_id"); return jsonHotMst.getString("iostorinv_id");
@@ -436,8 +444,8 @@ public class BakingServiceImpl implements BakingService {
WQLObject hotDtlTab = WQLObject.getWQLObject("ST_IVT_HotRegionIODtl"); // 烘箱区出入明细表 WQLObject hotDtlTab = WQLObject.getWQLObject("ST_IVT_HotRegionIODtl"); // 烘箱区出入明细表
JSONObject jsonHotDtl = new JSONObject(); JSONObject jsonHotDtl = new JSONObject();
jsonHotDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId()); jsonHotDtl.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
jsonHotDtl.put("iostorinv_id", param.getString("iostorinv_id")); jsonHotDtl.put("bill_code", "");
jsonHotDtl.put("start_point_code", param.getString("start_point_code")); jsonHotDtl.put("start_point_code", param.getString("start_point_code"));
jsonHotDtl.put("next_point_code", param.getString("next_point_code")); jsonHotDtl.put("next_point_code", param.getString("next_point_code"));
jsonHotDtl.put("temperature", param.getString("temperature")); jsonHotDtl.put("temperature", param.getString("temperature"));

View File

@@ -9,12 +9,12 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException; 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.system.util.CodeUtil;
import org.nl.modules.wql.WQL; import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.pda.mps.eum.RegionTypeEnum; import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.pda.mps.service.BakingService; import org.nl.wms.pda.mps.service.BakingService;
import org.nl.wms.pda.mps.service.HandleBakingService;
import org.nl.wms.sch.tasks.InCoolIvtTask; import org.nl.wms.sch.tasks.InCoolIvtTask;
import org.nl.wms.sch.tasks.InHotTask; import org.nl.wms.sch.tasks.InHotTask;
import org.nl.wms.sch.tasks.OutHotTask; import org.nl.wms.sch.tasks.OutHotTask;
@@ -24,7 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
public class BakingServiceImpl implements BakingService { public class HandleBakingServiceImpl implements HandleBakingService {
/* /*
* 业务流程: * 业务流程:
@@ -56,254 +56,155 @@ public class BakingServiceImpl implements BakingService {
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表 WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
// 入箱
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 next_point_code = whereJson.getString("next_point_code"); // 终点
Long currentUserId = 2L;
String currentUsername = "默认用户";
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("物料不存在");
if (StrUtil.equals(option, "1")) { if (StrUtil.equals(option, "1")) {
// 入箱
String container_name = whereJson.getString("container_name"); // 母卷号
String temperature = whereJson.getString("temperature"); // 温度
String hours = whereJson.getString("hours"); // 时间
String point_code1 = whereJson.getString("point_code"); // 点位
if (ObjectUtil.isEmpty(container_name)) throw new BadRequestException("母卷号不能为空"); if (ObjectUtil.isEmpty(container_name)) throw new BadRequestException("母卷号不能为空");
if (ObjectUtil.isEmpty(temperature)) throw new BadRequestException("温度不能为空"); if (ObjectUtil.isEmpty(temperature)) throw new BadRequestException("温度不能为空");
if (ObjectUtil.isEmpty(hours)) throw new BadRequestException("时间不能为空"); if (ObjectUtil.isEmpty(hours)) throw new BadRequestException("时间不能为空");
if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("不能为空"); if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("点不能为空");
if (ObjectUtil.isEmpty(next_point_code)) throw new BadRequestException("终点不能为空");
/* //插入冷却区出入库单表
* 根据点位判断是 冷却区入烘箱还是暂存区入烘箱 // 生成冷却区出入表
*/ JSONObject jsonCool = new JSONObject();
JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0); jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
if (ObjectUtil.isNotEmpty(jsonPointZc)) { 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);
// 1.查询烘箱对应的空位 jsonCool.put("bill_status", "50");
JSONObject jsonMap = new JSONObject(); jsonCool.put("qty_unit_id", jsonMater.getString("base_unit_id"));
jsonMap.put("flag", "1"); jsonCool.put("start_point_code", point_code1);
jsonMap.put("product_area",jsonPointZc.getString("product_area")); jsonCool.put("end_point_code", next_point_code);
jsonMap.put("temperature",temperature); jsonCool.put("create_mode", "03");
jsonMap.put("point_location",jsonPointZc.getString("point_location")); jsonCool.put("create_id", currentUserId);
JSONObject jsonHotIvt = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().uniqueResult(0); jsonCool.put("create_name", currentUsername);
if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有对应空位"); jsonCool.put("create_time", DateUtil.now());
// 2.创建暂存位 --> 烘烤区任务 jsonCool.put("update_optid", currentUserId);
JSONObject param = new JSONObject(); jsonCool.put("update_optname", currentUsername);
param.put("type", "2"); // 1- 冷却区入烘箱 2- 暂存位入烘箱 jsonCool.put("update_time", DateUtil.now());
param.put("point_code1", point_code1); jsonCool.put("confirm_optid", currentUserId);
param.put("point_code2", jsonHotIvt.getString("point_code")); jsonCool.put("confirm_optname", currentUsername);
jsonCool.put("confirm_time", DateUtil.now());
coolTab.insert(jsonCool);
InHotTask inHotTask = new InHotTask(); // 更新冷却区库存状态
String task_id = inHotTask.createTask(param); JSONObject jsonCoolIvt = coolIvtTab.query("full_point_code = '" + point_code1 + "'").uniqueResult(0);
// 3.插入主表 jsonCoolIvt.put("full_point_status", "01");
JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0); jsonCoolIvt.put("container_name", "");
JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); jsonCoolIvt.put("workorder_id", "");
jsonCoolIvt.put("ivt_qty", "0");
JSONObject hotParam = new JSONObject(); jsonCoolIvt.put("instorage_time", "");
hotParam.put("container_name", container_name); jsonCoolIvt.put("update_optid", currentUserId);
hotParam.put("workorder_id", jsonRaw.getString("workorder_id")); jsonCoolIvt.put("update_optname", currentUsername);
hotParam.put("material_id", jsonMater.getString("material_id")); jsonCoolIvt.put("update_time", DateUtil.now());
hotParam.put("qty", jsonRaw.get("productin_qty")); coolIvtTab.update(jsonCoolIvt);
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("next_point_code", jsonHotIvt.getString("point_code"));
hotParam.put("temperature", temperature);
hotParam.put("oven_time", hours);
this.createHotIoMst(hotParam);
} else {
/*
* 冷却区入烘箱
*/
// 1.根据冷却区此母卷的点位找到对应的暂存区、找到空位
// JSONObject jsonCoolIvt = coolIvtTab.query("container_name ='" + container_name + "' and is_used = '1' and full_point_status = '02' and cool_ivt_status = '01'").uniqueResult(0);
JSONObject jsonCoolIvt = coolIvtTab.query("full_point_code = '" + point_code1 + "'and container_name = '" + container_name + "' and is_used = '1' and full_point_status = '02' and cool_ivt_status = '01'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonCoolIvt)) throw new BadRequestException("点位不存在或母卷不存在");
String product_area = jsonCoolIvt.getString("product_area"); // 生产区域
String point_location = jsonCoolIvt.getString("point_location"); // 位置
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;
}
JSONObject map = new JSONObject();
map.put("flag", "1");
map.put("reging_id", reging_id);
map.put("point_location", point_location);
JSONArray pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().getResultJSONArray(0);
if (ObjectUtil.isEmpty(pointArr)) {
if (StrUtil.equals(point_location, "0")) map.put("point_location", "1");
if (StrUtil.equals(point_location, "1")) map.put("point_location", "0");
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("没有空暂存位");
// 查询烘箱对应的空位
JSONObject jsonMap = new JSONObject();
jsonMap.put("flag", "1");
jsonMap.put("product_area",product_area);
jsonMap.put("temperature",temperature);
jsonMap.put("point_location",map.getString("point_location"));
JSONObject jsonHotIvt = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotIvt)) 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);
param.put("point_code3", jsonHotIvt.getString("point_code"));
// 创建冷却区 --> 暂存位的任务
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("start_point_code", point_code1);
hotParam.put("next_point_code", jsonHotIvt.getString("point_code"));
hotParam.put("temperature", temperature);
hotParam.put("oven_time", hours);
this.createHotIoMst(hotParam);
// 生成冷却区出入表 //生成烘箱出入
Long currentUserId = 2L;
String currentUsername = "mes用户";
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", "10");
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 if (StrUtil.equals(option, "2")) {
// 出箱
String point_code1 = whereJson.getString("point_code");
if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("出箱点位不能为空");
JSONObject jsonHotIvt = hosIvtTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("点位不存在");
// 1.查询暂存位有没有空位
String product_area = jsonHotIvt.getString("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;
}
JSONObject map = new JSONObject();
map.put("flag", "1");
map.put("reging_id", reging_id);
map.put("point_location", jsonHotIvt.getString("point_location"));
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"));
OutHotTask outHotTask = new OutHotTask();
String task_id = outHotTask.createTask(param);
// 4.插入烘箱区出入明细表
JSONObject jsonHotReMst = hosReMstTab.query("container_name = '" + jsonHotIvt.getString("container_name") + "' and bill_status <> '50' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotReMst)) throw new BadRequestException("烘箱区出入主表不存在");
// 创建明细
JSONObject hotParam = new JSONObject(); JSONObject hotParam = new JSONObject();
hotParam.put("task_id", task_id); hotParam.put("container_name", container_name);
hotParam.put("iostorinv_id", jsonHotReMst.getString("iostorinv_id")); hotParam.put("io_type", "0");
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("start_point_code", point_code1); hotParam.put("start_point_code", point_code1);
hotParam.put("next_point_code", point_code2); hotParam.put("next_point_code", next_point_code);
hotParam.put("temperature", jsonHotIvt.getString("temperature")); hotParam.put("temperature", temperature);
this.createHotDtl(hotParam); hotParam.put("oven_time", hours);
this.createHotIoMst(hotParam);
// 更新烘箱区库存状态
JSONObject jsonHotIvt = hosIvtTab.query("point_code = '" + next_point_code + "'").uniqueResult(0);
jsonHotIvt.put("point_status", "02");
jsonHotIvt.put("container_name", container_name);
jsonHotIvt.put("workorder_id", jsonRaw.getString("workorder_id"));
jsonHotIvt.put("ivt_qty", jsonRaw.getString("productin_qty"));
jsonHotIvt.put("instorage_time", DateUtil.now());
jsonHotIvt.put("update_optid", currentUserId);
jsonHotIvt.put("update_optname", currentUsername);
jsonHotIvt.put("update_time", DateUtil.now());
hosIvtTab.update(jsonHotIvt);
} else if (StrUtil.equals(option, "2")) {
//插入烘箱出入库记录表
JSONObject hotParam = new JSONObject();
hotParam.put("container_name", container_name);
hotParam.put("io_type", "1");
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("start_point_code", point_code1);
hotParam.put("next_point_code", next_point_code);
hotParam.put("temperature", temperature);
hotParam.put("oven_time", hours);
this.createHotIoMst(hotParam);
//维护烘箱库存信息
JSONObject jsonHotIvt = hosIvtTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
// 更新烘箱区库存状态
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());
hosIvtTab.update(jsonHotIvt);
//生成冷却区入库记录
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_unit_id", jsonMater.get("base_unit_id"));
jsonCool.put("start_point_code", point_code1);
jsonCool.put("end_point_code", next_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 jsonIvt = coolIvtTab.query("full_point_code ='" + next_point_code + "'").uniqueResult(0);
jsonIvt.put("full_point_status", "02");
jsonIvt.put("cool_ivt_status", "03");
jsonIvt.put("instorage_time", DateUtil.now());
jsonIvt.put("container_name", jsonRaw.getString("container_name"));
jsonIvt.put("workorder_id", jsonRaw.getString("workorder_id"));
jsonIvt.put("ivt_qty", jsonRaw.getString("productin_qty"));
coolIvtTab.update(jsonIvt);
} }
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("message", "操作成功!"); result.put("message", "操作成功!");
@@ -312,90 +213,24 @@ public class BakingServiceImpl implements BakingService {
@Override @Override
@Transactional @Transactional
public JSONObject inCoolIvt(JSONObject whereJson) { public JSONObject checkConfirm(JSONObject whereJson) {
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位点 String point_code = whereJson.getString("point_code");
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表 String container_name = whereJson.getString("container_name");
WQLObject hotMstTab = 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"); // 物料表
if (StrUtil.isEmpty(point_code)){
String point_code1 = whereJson.getString("point_code"); // 暂存位:起点 throw new BadRequestException("点位不能为空!");
String container_name = whereJson.getString("container_name"); // 母卷号 }
if (StrUtil.isEmpty(container_name)){
if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("点位不能为空"); throw new BadRequestException("母卷不能为空");
if (ObjectUtil.isEmpty(container_name)) throw new BadRequestException("母卷号不能为空");
// 1.获取此暂存位的生产区域和上下位置
JSONObject jsonPoint = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonPoint)) throw new BadRequestException("点位不存在");
// 2.找冷却区空货位
JSONObject map = new JSONObject();
map.put("flag", "2");
map.put("product_area", jsonPoint.getString("product_area"));
map.put("point_location", jsonPoint.getString("point_location"));
JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
// 如果为空
if (ObjectUtil.isEmpty(jsonCooIvt)) {
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 cool_ivt = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '"+point_code+"'").uniqueResult(0);
JSONObject param = new JSONObject(); String on_container_name = cool_ivt.getString("on_container_name");
param.put("point_code1", point_code1); if (!on_container_name.equals(container_name)){
param.put("point_code2", jsonCooIvt.getString("full_point_code")); throw new BadRequestException("点位上子卷不符!");
param.put("container_name", container_name); }
cool_ivt.put("cool_ivt_status","04");
InCoolIvtTask inCoolIvtTask = new InCoolIvtTask();
String task_id = inCoolIvtTask.createTask(param);
// 4.插入明细
JSONObject jsonHotMst = hotMstTab.query("container_name = '" + container_name + "' and is_delete = '0' and bill_status <> '50'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotMst)) throw new BadRequestException("烘烤区出入主表不存在");
JSONObject hotParam = new JSONObject();
hotParam.put("task_id", task_id);
hotParam.put("iostorinv_id", jsonHotMst.getString("iostorinv_id"));
hotParam.put("start_point_code", point_code1);
hotParam.put("next_point_code", jsonCooIvt.getString("full_point_code"));
this.createHotDtl(hotParam);
// 生成冷却区出入表
Long currentUserId = 2L;
String currentUsername = "mes用户";
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_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(); JSONObject result = new JSONObject();
result.put("message", "操作成功!"); result.put("message", "操作成功!");

View File

@@ -37,8 +37,8 @@ public class OutServiceImpl implements OutService {
} }
JSONArray rows = WQL.getWO("PDA_02").addParamMap(map).process().getResultJSONArray(0); JSONArray rows = WQL.getWO("PDA_02").addParamMap(map).process().getResultJSONArray(0);
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("data",rows); jo.put("data", rows);
jo.put("message","查询成功!"); jo.put("message", "查询成功!");
return jo; return jo;
} }
@@ -52,7 +52,7 @@ public class OutServiceImpl implements OutService {
JSONArray rows = whereJson.getJSONArray("cut_rows"); JSONArray rows = whereJson.getJSONArray("cut_rows");
if (rows.size()>2){ if (rows.size() > 2) {
throw new BadRequestException("最多选择两个子卷进行操作!"); throw new BadRequestException("最多选择两个子卷进行操作!");
} }
@@ -65,30 +65,30 @@ public class OutServiceImpl implements OutService {
//对子卷任务进行校验 //对子卷任务进行校验
for (int i = 0; i < rows.size(); i++) { for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i); JSONObject row = rows.getJSONObject(i);
if (StrUtil.isEmpty(split_group)){ if (StrUtil.isEmpty(split_group)) {
split_group = row.getString("split_group"); split_group = row.getString("split_group");
resource_name = row.getString("resource_name"); resource_name = row.getString("resource_name");
order_type = row.getString("order_type"); order_type = row.getString("order_type");
if (order_type.equals("1")){ if (order_type.equals("1")) {
parent_container_name = row.getString("parent_container_name"); parent_container_name = row.getString("parent_container_name");
}else { } else {
restruct_container_name = row.getString("restruct_container_name"); restruct_container_name = row.getString("restruct_container_name");
package_box_sn = row.getString("package_box_sn"); package_box_sn = row.getString("package_box_sn");
} }
}else { } else {
if (!split_group.equals(row.getString("split_group"))){ if (!split_group.equals(row.getString("split_group"))) {
throw new BadRequestException("两个子卷的分切组必须相同!"); throw new BadRequestException("两个子卷的分切组必须相同!");
} }
if (!resource_name.equals(row.getString("resource_name"))){ if (!resource_name.equals(row.getString("resource_name"))) {
throw new BadRequestException("两个子卷的机台编号必须相同!"); throw new BadRequestException("两个子卷的机台编号必须相同!");
} }
if (order_type.equals("1")){ if (order_type.equals("1")) {
if (!parent_container_name.equals(row.getString("parent_container_name"))){ if (!parent_container_name.equals(row.getString("parent_container_name"))) {
throw new BadRequestException("两个子卷的母卷号必须相同!"); throw new BadRequestException("两个子卷的母卷号必须相同!");
} }
}else { } else {
if (!restruct_container_name.equals(row.getString("restruct_container_name")) || !package_box_sn.equals(row.getString("package_box_sn"))){ if (!restruct_container_name.equals(row.getString("restruct_container_name")) || !package_box_sn.equals(row.getString("package_box_sn"))) {
throw new BadRequestException("两个子卷的改制子卷必须相同!"); throw new BadRequestException("两个子卷的改制子卷必须相同!");
} }
} }
@@ -96,20 +96,20 @@ public class OutServiceImpl implements OutService {
} }
//查询该点位对应的机台编号 //查询该点位对应的机台编号
JSONObject cut_ivt = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("up_point_code ='"+point_code+"' OR down_point_code ='"+point_code+"'").uniqueResult(0); JSONObject cut_ivt = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("up_point_code ='" + point_code + "' OR down_point_code ='" + point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_ivt)){ if (ObjectUtil.isEmpty(cut_ivt)) {
throw new BadRequestException("未查询到对应的分切机!"); throw new BadRequestException("未查询到对应的分切机!");
} }
String cut_qzzno = rows.getJSONObject(0).getString("qzzno"); String cut_qzzno = rows.getJSONObject(0).getString("qzzno");
//判断是否末次下卷 //判断是否末次下卷
if (is_last.equals("1")){ if (is_last.equals("1")) {
//查询该分切机邻近位置的空载具的输送线点位 //查询该分切机邻近位置的空载具的输送线点位
JSONObject empty_vehicle = WQL.getWO("PDA_02") JSONObject empty_vehicle = WQL.getWO("PDA_02")
.addParam("sort_seq", cut_ivt.getString("sort_seq")) .addParam("sort_seq", cut_ivt.getString("sort_seq"))
.addParam("sql_str", " ORDER BY abs("+cut_ivt.getString("sort_seq")+"-sort_seq),point_code") .addParam("sql_str", " ORDER BY abs(" + cut_ivt.getString("sort_seq") + "-sort_seq),point_code")
.addParam("product_area", cut_ivt.getString("product_area")) .addParam("product_area", cut_ivt.getString("product_area"))
.addParam("point_location", cut_ivt.getString("point_location")) .addParam("point_location", cut_ivt.getString("point_location"))
.addParam("flag", "3").process().uniqueResult(0); .addParam("flag", "3").process().uniqueResult(0);
@@ -118,78 +118,78 @@ public class OutServiceImpl implements OutService {
} }
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("point_code1",point_code); jo.put("point_code1", point_code);
jo.put("point_code2",empty_vehicle.getString("point_code")); jo.put("point_code2", empty_vehicle.getString("point_code"));
jo.put("vehicle_code",cut_qzzno); jo.put("vehicle_code", cut_qzzno);
jo.put("task_type","010404"); jo.put("task_type", "010404");
cutTrussTask.createTask(jo); cutTrussTask.createTask(jo);
}else { } else {
String ext_code = cut_ivt.getString("ext_code"); String ext_code = cut_ivt.getString("ext_code");
//查询该机台编号已经配送完成,套轴完成但是未完成的分切计划 //查询该机台编号已经配送完成,套轴完成但是未完成的分切计划
JSONObject slitting = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("resource_name = '"+ext_code+"' AND is_child_tz_ok = '1' AND is_child_ps_ok = '1' AND status = '03'").uniqueResult(0); JSONObject slitting = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("resource_name = '" + ext_code + "' AND is_child_tz_ok = '1' AND is_child_ps_ok = '1' AND status = '03'").uniqueResult(0);
if (ObjectUtil.isEmpty(slitting)){ if (ObjectUtil.isEmpty(slitting)) {
throw new BadRequestException("该分切机没有对应完成配送完成的气涨轴!"); throw new BadRequestException("该分切机没有对应完成配送完成的气涨轴!");
} }
String qzzno = slitting.getString("qzzno"); String qzzno = slitting.getString("qzzno");
//查询该气涨轴所在输送线位置 //查询该气涨轴所在输送线位置
JSONObject delivery_point = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt").query("qzzno = '"+qzzno+"' AND point_status = '03'").uniqueResult(0); JSONObject delivery_point = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt").query("qzzno = '" + qzzno + "' AND point_status = '03'").uniqueResult(0);
if (ObjectUtil.isEmpty(delivery_point)){ if (ObjectUtil.isEmpty(delivery_point)) {
throw new BadRequestException("未查询到对应的输送线点位!"); throw new BadRequestException("未查询到对应的输送线点位!");
} }
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("point_code1",delivery_point.getString("point_code")); jo.put("point_code1", point_code);
jo.put("point_code2",point_code); jo.put("point_code2", delivery_point.getString("point_code"));
jo.put("point_code3",point_code); jo.put("point_code3", delivery_point.getString("point_code"));
jo.put("point_code4",delivery_point.getString("point_code")); jo.put("point_code4", point_code);
jo.put("vehicle_code",delivery_point.getString("qzzno")); jo.put("vehicle_code", delivery_point.getString("qzzno"));
jo.put("vehicle_code2",cut_qzzno); jo.put("vehicle_code2", cut_qzzno);
jo.put("task_type","010403"); jo.put("task_type", "010403");
cutTrussTask.createTask(jo); cutTrussTask.createTask(jo);
} }
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("message","操作成功!"); result.put("message", "操作成功!");
return result; return result;
} }
@Override @Override
public JSONObject conveyPointQuery(JSONObject whereJson) { public JSONObject conveyPointQuery(JSONObject whereJson) {
String product_area = whereJson.getString("product_area"); String product_area = whereJson.getString("product_area");
HashMap<String,String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
map.put("flag","10"); map.put("flag", "10");
if (StrUtil.isNotEmpty(product_area)){ if (StrUtil.isNotEmpty(product_area)) {
map.put("product_area",product_area); map.put("product_area", product_area);
} }
JSONArray deliver_rows = WQL.getWO("PDA_02").addParam("product_area",product_area).addParam("flag","").process().getResultJSONArray(0); JSONArray deliver_rows = WQL.getWO("PDA_02").addParam("product_area", product_area).addParam("flag", "").process().getResultJSONArray(0);
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("data",deliver_rows); jo.put("data", deliver_rows);
jo.put("message","查询成功!"); jo.put("message", "查询成功!");
return jo; return jo;
} }
@Override @Override
public JSONObject conveyConfirm(JSONObject whereJson) { public JSONObject conveyConfirm(JSONObject whereJson) {
String point_code = whereJson.getString("point_code"); String point_code = whereJson.getString("point_code");
if (StrUtil.isEmpty(point_code)){ if (StrUtil.isEmpty(point_code)) {
throw new BadRequestException("起点不能为空!"); throw new BadRequestException("起点不能为空!");
} }
//如果查询到给ACS下发一个输送线任务 //如果查询到给ACS下发一个输送线任务
JSONObject form = new JSONObject(); JSONObject form = new JSONObject();
form.put("point_code1",point_code); form.put("point_code1", point_code);
form.put("point_code2","SS01"); form.put("point_code2", "SS01");
form.put("task_type","010401"); form.put("task_type", "010401");
CutConveyorTask cutConveyorTask = new CutConveyorTask(); CutConveyorTask cutConveyorTask = new CutConveyorTask();
cutConveyorTask.createTask(form); cutConveyorTask.createTask(form);
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("message","查询成功!"); jo.put("message", "查询成功!");
return jo; return jo;
} }

View File

@@ -15,6 +15,7 @@ import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL; import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.core.content.HttpContext;
import org.nl.wms.ext.acs.service.AcsToWmsService; import org.nl.wms.ext.acs.service.AcsToWmsService;
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl; import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
import org.nl.wms.pda.mps.service.RawFoilService; import org.nl.wms.pda.mps.service.RawFoilService;
@@ -44,7 +45,7 @@ public class RawFoilServiceImpl implements RawFoilService {
} }
@Override @Override
public JSONObject queryRawFoil(JSONObject whereJson) { public JSONObject queryRawFoil(JSONObject whereJson, HttpContext ctx) {
String point_code = whereJson.getString("point_code"); String point_code = whereJson.getString("point_code");
String container_name = whereJson.getString("container_name"); String container_name = whereJson.getString("container_name");
String product_area = whereJson.getString("product_area"); String product_area = whereJson.getString("product_area");
@@ -61,10 +62,11 @@ public class RawFoilServiceImpl implements RawFoilService {
map.put("product_area", "A1"); map.put("product_area", "A1");
}*/ }*/
JSONArray arr = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().getResultJSONArray(0); JSONObject arr = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).pageQuery(ctx,"container_name");
for (int i = 0; i < arr.size(); i++) { JSONArray rows = arr.getJSONArray("content");
for (int i = 0; i < rows.size(); i++) {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
JSONObject jsonObject = arr.getJSONObject(i); JSONObject jsonObject = rows.getJSONObject(i);
String theory_height = jsonObject.getString("theory_height"); String theory_height = jsonObject.getString("theory_height");
String eqp_velocity = jsonObject.getString("eqp_velocity"); String eqp_velocity = jsonObject.getString("eqp_velocity");
@@ -84,9 +86,9 @@ public class RawFoilServiceImpl implements RawFoilService {
if (betweenDay > 0) { if (betweenDay > 0) {
json.put("color_type", "1"); json.put("color_type", "1");
}else if(betweenDay <= 0 && betweenDay >= -30) { } else if (betweenDay <= 0 && betweenDay >= -30) {
json.put("color_type", "2"); json.put("color_type", "2");
}else { } else {
json.put("color_type", "0"); json.put("color_type", "0");
} }
@@ -102,20 +104,22 @@ public class RawFoilServiceImpl implements RawFoilService {
} }
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("data", resultArr); jo.put("data", resultArr);
jo.put("size",arr.getString("totalElements"));
jo.put("message", "查询成功!"); jo.put("message", "查询成功!");
return jo; return jo;
} }
@Override @Override
public JSONObject queryRawFoilList(JSONObject whereJson) { public JSONObject queryRawFoilList(JSONObject whereJson, HttpContext ctx) {
JSONObject map = new JSONObject(); JSONObject map = new JSONObject();
map.put("flag", "5"); map.put("flag", "5");
map.put("point_code", whereJson.getString("point_code")); map.put("point_code", whereJson.getString("point_code"));
map.put("container_name", whereJson.getString("container_name")); map.put("container_name", whereJson.getString("container_name"));
JSONArray resultJSONArray = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().getResultJSONArray(0); JSONObject resultJSONArray = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).pageQuery(ctx,"container_name");
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("data", resultJSONArray); jo.put("data", resultJSONArray.getJSONArray("content"));
jo.put("size",resultJSONArray.getString("totalElements"));
jo.put("message", "查询成功!"); jo.put("message", "查询成功!");
return jo; return jo;
} }
@@ -124,10 +128,7 @@ public class RawFoilServiceImpl implements RawFoilService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public JSONObject needEmptyAxis(JSONObject whereJson) { public JSONObject needEmptyAxis(JSONObject whereJson) {
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表
WQLObject regionTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料信息表
WQLObject sbTab = WQLObject.getWQLObject("ST_IVT_SbPointIvt"); // 生箔点位库存表 WQLObject sbTab = WQLObject.getWQLObject("ST_IVT_SbPointIvt"); // 生箔点位库存表
@@ -139,6 +140,7 @@ public class RawFoilServiceImpl implements RawFoilService {
if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("生箔点位不存在"); if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("生箔点位不存在");
String start_pint_code = ""; String start_pint_code = "";
String point_code4 = "";
// 2.根据就近原则查对应空卷抽 // 2.根据就近原则查对应空卷抽
JSONObject map = new JSONObject(); JSONObject map = new JSONObject();
map.put("flag", "1"); map.put("flag", "1");
@@ -147,43 +149,16 @@ public class RawFoilServiceImpl implements RawFoilService {
JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0); JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);
// 3.如果没找到则继续找下一节点 // 3.如果没找到则继续找下一节点
if (ObjectUtil.isEmpty(jsonIvt)) { if (ObjectUtil.isEmpty(jsonIvt)) {
String point_location = jsonSb.getString("point_location"); /*String point_location = jsonSb.getString("point_location");
if (StrUtil.equals(point_location, "0")) map.put("point_location", "1"); if (StrUtil.equals(point_location, "0")) map.put("point_location", "1");
if (StrUtil.equals(point_location, "1")) map.put("point_location", "0"); if (StrUtil.equals(point_location, "1")) map.put("point_location", "0");
JSONObject jsonIvt_tow = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0); JSONObject jsonIvt_tow = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);*/
throw new BadRequestException("未查询到可用点位");
if (ObjectUtil.isEmpty(jsonIvt_tow)) throw new BadRequestException("没有空卷轴");
start_pint_code = jsonIvt_tow.getString("empty_point_code");
} else { } else {
start_pint_code = jsonIvt.getString("empty_point_code"); start_pint_code = jsonIvt.getString("empty_point_code");
point_code4 = jsonIvt.getString("full_point_code");
} }
//查询满轴存放点位
// 2.根据就近原则查对应空卷抽
String point_code4= "";
JSONObject map4 = new JSONObject();
map4.put("flag", "2");
map4.put("product_area", jsonSb.getString("product_area"));
map4.put("point_location", jsonSb.getString("point_location"));
JSONObject jsonIvt4 = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map4).process().uniqueResult(0);
// 3.如果没找到则继续找下一节点
if (ObjectUtil.isEmpty(jsonIvt4)) {
String point_location = jsonSb.getString("point_location");
if (StrUtil.equals(point_location, "0")) {
map4.put("point_location", "1");
}
if (StrUtil.equals(point_location, "1")) {
map4.put("point_location", "0");
}
JSONObject jsonIvt_tow = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map4).process().uniqueResult(0);
if (ObjectUtil.isEmpty(jsonIvt_tow)) {
throw new BadRequestException("没有空位");
}
point_code4 = jsonIvt_tow.getString("full_point_code");
} else {
point_code4 = jsonIvt4.getString("full_point_code");
}
// 起点和终点确定 生成任务 // 起点和终点确定 生成任务
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("point_code1", start_pint_code); param.put("point_code1", start_pint_code);
@@ -194,34 +169,7 @@ public class RawFoilServiceImpl implements RawFoilService {
param.put("material_code", jsonRaw.getString("container_name")); param.put("material_code", jsonRaw.getString("container_name"));
CallEmpReelTask callEmpReelTask = new CallEmpReelTask(); CallEmpReelTask callEmpReelTask = new CallEmpReelTask();
String task_id = callEmpReelTask.createTask(param); callEmpReelTask.createTask(param);
// 插入入库单
Long currentUserId = SecurityUtils.getCurrentUserId();
String currentUsername = SecurityUtils.getCurrentUsername();
JSONObject jsonMater = materTab.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", "1");
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", "10");
jsonRegion.put("start_point_code", jsonSb.getString("point_code"));
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());
regionTab.insert(jsonRegion);
// 更新工单状态 // 更新工单状态
jsonRaw.put("status", "02"); jsonRaw.put("status", "02");
@@ -233,7 +181,7 @@ public class RawFoilServiceImpl implements RawFoilService {
} }
@Override @Override
public void confirmBlanking(JSONObject whereJson) { public JSONObject confirmBlanking(JSONObject whereJson) {
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单 WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单
WQLObject sbTab = WQLObject.getWQLObject("st_ivt_sbpointivt"); // 生箔点位库存表 WQLObject sbTab = WQLObject.getWQLObject("st_ivt_sbpointivt"); // 生箔点位库存表
@@ -244,7 +192,7 @@ public class RawFoilServiceImpl implements RawFoilService {
//查询该母卷号对应的任务 //查询该母卷号对应的任务
String container_name = whereJson.getString("container_name"); String container_name = whereJson.getString("container_name");
JSONObject task_jo = WQLObject.getWQLObject("SCH_BASE_Task").query("material_code = '"+container_name+"' and task_status <> '07'").uniqueResult(0); JSONObject task_jo = WQLObject.getWQLObject("SCH_BASE_Task").query("material_code = '" + container_name + "' and task_status <> '07'").uniqueResult(0);
// 查询生箔点位库存表 // 查询生箔点位库存表
JSONObject jsonSb = sbTab.query("ext_code = '" + jsonRaw.getString("resource_name") + "'and is_used = '1'").uniqueResult(0); JSONObject jsonSb = sbTab.query("ext_code = '" + jsonRaw.getString("resource_name") + "'and is_used = '1'").uniqueResult(0);
@@ -261,12 +209,16 @@ public class RawFoilServiceImpl implements RawFoilService {
JSONObject result = wmsToAcsService.updateTask(paramArr); JSONObject result = wmsToAcsService.updateTask(paramArr);
if (!StrUtil.equals(result.getString("status"), "200")) { if (!StrUtil.equals(result.getString("status"), "200")) {
throw new BadRequestException("操作失败:"+result.getString("message ")); throw new BadRequestException("操作失败:" + result.getString("message "));
} }
// 更新工单状态为确认下卷 // 更新工单状态为确认下卷
jsonRaw.put("status","03"); jsonRaw.put("status", "03");
rawTab.update(jsonRaw); rawTab.update(jsonRaw);
JSONObject jo = new JSONObject();
jo.put("message", "操作成功!");
return jo;
} }
@Override @Override

View File

@@ -51,6 +51,8 @@
ST_IVT_CoolPointIvt ivt ST_IVT_CoolPointIvt ivt
WHERE WHERE
ivt.empty_point_status = '02' ivt.empty_point_status = '02'
AND
ivt.full_point_status = '01'
AND NOT EXISTS ( AND NOT EXISTS (
SELECT SELECT
@@ -126,7 +128,7 @@
ENDIF ENDIF
IF 输入.flag = "4" IF 输入.flag = "4"
QUERY PAGEQUERY
SELECT SELECT
der.* der.*
FROM FROM
@@ -148,11 +150,11 @@
ENDOPTION ENDOPTION
ENDSELECT ENDSELECT
ENDQUERY ENDPAGEQUERY
ENDIF ENDIF
IF 输入.flag = "5" IF 输入.flag = "5"
QUERY PAGEQUERY
SELECT SELECT
( (
CASE CASE
@@ -176,7 +178,6 @@
der.product_area AS product_area, der.product_area AS product_area,
der.update_time AS update_time, der.update_time AS update_time,
ivt.point_location, ivt.point_location,
ivt.product_area,
der.workorder_id der.workorder_id
FROM FROM
PDM_BI_RawFoilWorkOrder der PDM_BI_RawFoilWorkOrder der
@@ -194,7 +195,7 @@
ENDOPTION ENDOPTION
ENDSELECT ENDSELECT
ENDQUERY ENDPAGEQUERY
ENDIF ENDIF

View File

@@ -47,4 +47,11 @@ public class CoolInController {
return new ResponseEntity<>(coolInService.confirmInstor(whereJson),HttpStatus.OK); return new ResponseEntity<>(coolInService.confirmInstor(whereJson),HttpStatus.OK);
} }
@PostMapping("/statusList")
@Log("状态下拉框")
@ApiOperation("状态下拉框")
public ResponseEntity<Object> statusList(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(coolInService.statusList(whereJson),HttpStatus.OK);
}
} }

View File

@@ -25,4 +25,11 @@ public interface CoolInService {
* @return JSONObject / * @return JSONObject /
*/ */
JSONObject confirmInstor(JSONObject whereJson); JSONObject confirmInstor(JSONObject whereJson);
/**
* 状态下拉框
* @param whereJson /
* @return JSONObject /
*/
JSONObject statusList(JSONObject whereJson);
} }

View File

@@ -62,9 +62,14 @@ public class CoolInServiceImpl implements CoolInService {
String is_bake = whereJson.getString("is_bake"); // 是否烘烤完成 String is_bake = whereJson.getString("is_bake"); // 是否烘烤完成
// 查询终点在冷却区是否存在 // 查询终点在冷却区是否存在
JSONObject jsonCoolIvt = coolIvtTab.query("point_code = '" + point_code + "' and full_point_status = '01' and is_used = '1'").uniqueResult(0); JSONObject jsonCoolIvt = coolIvtTab.query("point_code = '" + point_code + "' and full_point_status = '01' and empty_point_status = '01' and is_used = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonCoolIvt)) throw new BadRequestException("此点位不存在或被占用"+point_code); if (ObjectUtil.isEmpty(jsonCoolIvt)) throw new BadRequestException("此点位不存在或被占用"+point_code);
//查询该点位是否存在任务
JSONObject task_jo = WQLObject.getWQLObject("").query("(point_code1 like '%"+jsonCoolIvt.getString("point_code")+"%' OR point_code2 like '%"+jsonCoolIvt.getString("point_code")+"%') AND is_delete = '0' AND task_status < '07'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(task_jo)){
throw new BadRequestException("该点位存在未完成的任务,不允许绑定!");
}
/* // 插入冷却区出入库单据 /* // 插入冷却区出入库单据
JSONObject jsonCool = new JSONObject(); JSONObject jsonCool = new JSONObject();
jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1,1).nextId()); jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1,1).nextId());
@@ -90,12 +95,17 @@ public class CoolInServiceImpl implements CoolInService {
JSONObject json = coolIvtTab.query("container_name = '" + raw_jo.getString("container_name") + "'").uniqueResult(0); JSONObject json = coolIvtTab.query("container_name = '" + raw_jo.getString("container_name") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) throw new BadRequestException("此母卷库存已存在"); if (ObjectUtil.isNotEmpty(json)) throw new BadRequestException("此母卷库存已存在");
//查询对应母卷信息
JSONObject mom_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '"+raw_jo.getString("container_name")+"'").uniqueResult(0);
if (ObjectUtil.isEmpty(mom_jo)){
throw new BadRequestException("未查询到该母卷对应工单!");
}
// 更新冷却区库存 // 更新冷却区库存
jsonCoolIvt.put("full_point_status", "02"); jsonCoolIvt.put("full_point_status", "02");
if (StrUtil.equals(is_bake, "0")) jsonCoolIvt.put("cool_ivt_status", "01"); jsonCoolIvt.put("cool_ivt_status", is_bake);
if (StrUtil.equals(is_bake, "1")) jsonCoolIvt.put("cool_ivt_status", "03");
jsonCoolIvt.put("container_name", raw_jo.getString("container_name")); jsonCoolIvt.put("container_name", raw_jo.getString("container_name"));
jsonCoolIvt.put("workorder_id", raw_jo.getString("workorder_id")); jsonCoolIvt.put("workorder_id", raw_jo.getString("workorder_id"));
jsonCoolIvt.put("ivt_qty", raw_jo.getString("productin_qty"));
jsonCoolIvt.put("instorage_time", DateUtil.now()); jsonCoolIvt.put("instorage_time", DateUtil.now());
jsonCoolIvt.put("update_optid", currentUserId); jsonCoolIvt.put("update_optid", currentUserId);
jsonCoolIvt.put("create_name", currentUsername); jsonCoolIvt.put("create_name", currentUsername);
@@ -106,4 +116,13 @@ public class CoolInServiceImpl implements CoolInService {
result.put("message", "入库成功!"); result.put("message", "入库成功!");
return result; return result;
} }
@Override
public JSONObject statusList(JSONObject whereJson) {
JSONArray rows = WQL.getWO("PDA_COOLIN").addParam("flag","2").process().getResultJSONArray(0);
JSONObject jo = new JSONObject();
jo.put("data", rows);
jo.put("message", "查询成功!");
return jo;
}
} }

View File

@@ -79,3 +79,17 @@
ENDSELECT ENDSELECT
ENDPAGEQUERY ENDPAGEQUERY
ENDIF ENDIF
IF 输入.flag = "2"
QUERY
SELECT
label AS text,
value
FROM
sys_dict_detail
WHERE
dict_id = '115'
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -73,7 +73,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
taskTab.delete("task_id = '" + task_id + "'"); taskTab.delete("task_id = '" + task_id + "'");
// 删除冷却区出入单据 // 删除冷却区出入单据
coolTab.delete("task_id = '"+task_id+"'"); // coolTab.delete("task_id = '"+task_id+"'");
// 更新生箔工单状态为开始、清除称重信息 // 更新生箔工单状态为开始、清除称重信息
JSONObject jsonRaw = rawTab.query("container_name ='" + jsonTask.getString("material_code") + "' AND status <> '09' AND is_delete = '0'").uniqueResult(0); JSONObject jsonRaw = rawTab.query("container_name ='" + jsonTask.getString("material_code") + "' AND status <> '09' AND is_delete = '0'").uniqueResult(0);
@@ -88,10 +88,10 @@ public class CallEmpReelTask extends AbstractAcsTask {
jsonTask.put("update_time", DateUtil.now()); jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask); taskTab.update(jsonTask);
// 更新冷却区出入表 状态为执行中 /*// 更新冷却区出入表 状态为执行中
JSONObject jsonCool = coolTab.query("task_id = '" + task_id + "'").uniqueResult(0); JSONObject jsonCool = coolTab.query("task_id = '" + task_id + "'").uniqueResult(0);
jsonCool.put("bill_status", "40"); jsonCool.put("bill_status", "40");
coolTab.update(jsonCool); coolTab.update(jsonCool);*/
// 更新生箔工单称重信息 // 更新生箔工单称重信息
String weight = taskObj.getString("weight"); String weight = taskObj.getString("weight");
@@ -169,15 +169,32 @@ public class CallEmpReelTask extends AbstractAcsTask {
ivtTab.update(jsonIvt2); ivtTab.update(jsonIvt2);
} }
// 更新冷却区出入表 // 插入入库单
JSONObject jsonCool = coolTab.query("task_id = '" + task_id + "'").uniqueResult(0); Long currentUserId = SecurityUtils.getCurrentUserId();
if (ObjectUtil.isNotEmpty(jsonCool)) { String currentUsername = SecurityUtils.getCurrentUsername();
jsonCool.put("bill_status", "50");
jsonCool.put("confirm_optid", SecurityUtils.getCurrentUserId()); JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
jsonCool.put("confirm_optname", SecurityUtils.getCurrentUsername()); if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("产品不存在");
jsonCool.put("confirm_time", DateUtil.now());
coolTab.update(jsonCool); 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", "1");
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());
coolTab.insert(jsonRegion);
} }
} }

View File

@@ -70,7 +70,7 @@ public class InHotTask extends AbstractAcsTask {
String task_id = taskObj.getString("task_id"); String task_id = taskObj.getString("task_id");
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
if (StrUtil.equals(status,"0")) { if (StrUtil.equals(status, "0")) {
// 判断此条明细是否是冷却区 -> 烘箱,是则删除主表 // 判断此条明细是否是冷却区 -> 烘箱,是则删除主表
if (ObjectUtil.isNotEmpty(jsonTask.getString("point_code3"))) { if (ObjectUtil.isNotEmpty(jsonTask.getString("point_code3"))) {
@@ -78,18 +78,18 @@ public class InHotTask extends AbstractAcsTask {
JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0); JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotDtl)) throw new BadRequestException("明细单据不存在"); if (ObjectUtil.isEmpty(jsonHotDtl)) throw new BadRequestException("明细单据不存在");
hotMstTab.delete("iostorinv_id = '"+jsonHotDtl.getString("iostorinv_id")+"'"); hotMstTab.delete("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'");
// 删除冷却出入表 // 删除冷却出入表
coolIoTab.delete("task_id = '"+task_id+"'"); coolIoTab.delete("task_id = '" + task_id + "'");
} }
// 取消删除任务 // 取消删除任务
taskTab.delete("task_id = '"+task_id+"'"); taskTab.delete("task_id = '" + task_id + "'");
// 删除烘箱明细 // 删除烘箱明细
hotDtlTab.delete("task_id = '"+task_id+"'"); hotDtlTab.delete("task_id = '" + task_id + "'");
} }
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) { if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
// 更新任务状态为执行中 // 更新任务状态为执行中
@@ -115,12 +115,12 @@ public class InHotTask extends AbstractAcsTask {
} }
} }
if(StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) { if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
Long currentUserId = SecurityUtils.getCurrentUserId(); Long currentUserId = SecurityUtils.getCurrentUserId();
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
// 更改任务状态为完成 // 更改任务状态为完成
jsonTask.put("task_status",TaskStatusEnum.FINISHED.getCode()); jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
jsonTask.put("update_optid", currentUserId); jsonTask.put("update_optid", currentUserId);
jsonTask.put("update_optname", currentUsername); jsonTask.put("update_optname", currentUsername);
jsonTask.put("update_time", DateUtil.now()); jsonTask.put("update_time", DateUtil.now());
@@ -146,10 +146,10 @@ public class InHotTask extends AbstractAcsTask {
// 更新烘箱区库存状态 // 更新烘箱区库存状态
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0); JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
jsonHotIvt.put("point_status", "02"); jsonHotIvt.put("point_status", "02");
jsonHotIvt.put("container_name",jsonHotMst.getString("container_name")); jsonHotIvt.put("container_name", jsonHotMst.getString("container_name"));
jsonHotIvt.put("workorder_id",jsonHotMst.getString("workorder_id") ); jsonHotIvt.put("workorder_id", jsonHotMst.getString("workorder_id"));
jsonHotIvt.put("ivt_qty",jsonHotMst.getString("qty") ); jsonHotIvt.put("ivt_qty", jsonHotMst.getString("qty"));
jsonHotIvt.put("instorage_time",DateUtil.now() ); jsonHotIvt.put("instorage_time", DateUtil.now());
jsonHotIvt.put("update_optid", currentUserId); jsonHotIvt.put("update_optid", currentUserId);
jsonHotIvt.put("update_optname", currentUsername); jsonHotIvt.put("update_optname", currentUsername);
jsonHotIvt.put("update_time", DateUtil.now()); jsonHotIvt.put("update_time", DateUtil.now());
@@ -191,10 +191,10 @@ public class InHotTask extends AbstractAcsTask {
// 更新烘箱区库存状态 // 更新烘箱区库存状态
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code3") + "'").uniqueResult(0); JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code3") + "'").uniqueResult(0);
jsonHotIvt.put("point_status", "02"); jsonHotIvt.put("point_status", "02");
jsonHotIvt.put("container_name",container_name ); jsonHotIvt.put("container_name", container_name);
jsonHotIvt.put("workorder_id",workorder_id ); jsonHotIvt.put("workorder_id", workorder_id);
jsonHotIvt.put("ivt_qty",ivt_qty ); jsonHotIvt.put("ivt_qty", ivt_qty);
jsonHotIvt.put("instorage_time",DateUtil.now() ); jsonHotIvt.put("instorage_time", DateUtil.now());
jsonHotIvt.put("update_optid", currentUserId); jsonHotIvt.put("update_optid", currentUserId);
jsonHotIvt.put("update_optname", currentUsername); jsonHotIvt.put("update_optname", currentUsername);
jsonHotIvt.put("update_time", DateUtil.now()); jsonHotIvt.put("update_time", DateUtil.now());
@@ -209,7 +209,7 @@ public class InHotTask extends AbstractAcsTask {
String passWord = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_PASSWORD").getValue(); String passWord = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
param.put("iContainerName", jsonHotMst.getString("container_name")); param.put("iContainerName", jsonHotMst.getString("container_name"));
param.put("iResourceName", hot_point_code); param.put("iResourceName", hot_point_code);
param.put("iMoveInDate", DateUtil. now()); param.put("iMoveInDate", DateUtil.now());
param.put("iPlanBakingTemperature", jsonHotDtl.getDoubleValue("temperature")); param.put("iPlanBakingTemperature", jsonHotDtl.getDoubleValue("temperature"));
param.put("iPlanBakingTimer", jsonHotDtl.getDoubleValue("oven_time")); param.put("iPlanBakingTimer", jsonHotDtl.getDoubleValue("oven_time"));
param.put("UserName", userName); param.put("UserName", userName);
@@ -244,17 +244,17 @@ public class InHotTask extends AbstractAcsTask {
String point_code1 = form.getString("point_code1"); String point_code1 = form.getString("point_code1");
String point_code2 = form.getString("point_code2"); String point_code2 = form.getString("point_code2");
String point_code3 = form.getString("point_code3"); String point_code3 = form.getString("point_code3");
if (cutConveyorTask.isSingleTask(point_code1)){ if (cutConveyorTask.isSingleTask(point_code1)) {
throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!"); throw new BadRequestException("点位:" + point_code1 + "存在未完成的任务!");
} }
if (cutConveyorTask.isSingleTask(point_code2)){ if (cutConveyorTask.isSingleTask(point_code2)) {
throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!"); throw new BadRequestException("点位:" + point_code2 + "存在未完成的任务!");
} }
if (cutConveyorTask.isSingleTask(point_code3)){ if (cutConveyorTask.isSingleTask(point_code3)) {
throw new BadRequestException("点位:"+point_code3+"存在未完成的任务!"); throw new BadRequestException("点位:" + point_code3 + "存在未完成的任务!");
} }
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("task_id",IdUtil.getSnowflake(1,1).nextId()); json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_code", CodeUtil.getNewCode("TASK_CODE")); json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
json.put("task_type", "010201"); json.put("task_type", "010201");
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode()); json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
@@ -266,25 +266,34 @@ public class InHotTask extends AbstractAcsTask {
json.put("create_id", currentUserId); json.put("create_id", currentUserId);
json.put("create_name", currentUsername); json.put("create_name", currentUsername);
json.put("create_time", DateUtil.now()); json.put("create_time", DateUtil.now());
json.put("priority","1" ); json.put("priority", "1");
json.put("acs_task_type","1" ); json.put("acs_task_type", "1");
tab.insert(json); tab.insert(json);
task_id = json.getString("task_id"); task_id = json.getString("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)) {
throw new BadRequestException("未查询到对应的冷却区点位!");
}
cool_ivt.put("cool_ivt_status", "02");
WQLObject.getWQLObject("st_ivt_coolpointivt").update(cool_ivt);
} }
if (StrUtil.equals(form.getString("type"), "2")) { if (StrUtil.equals(form.getString("type"), "2")) {
String point_code1 = form.getString("point_code1"); String point_code1 = form.getString("point_code1");
String point_code2 = form.getString("point_code2"); String point_code2 = form.getString("point_code2");
if (cutConveyorTask.isSingleTask(point_code1)){ if (cutConveyorTask.isSingleTask(point_code1)) {
throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!"); throw new BadRequestException("点位:" + point_code1 + "存在未完成的任务!");
} }
if (cutConveyorTask.isSingleTask(point_code2)){ if (cutConveyorTask.isSingleTask(point_code2)) {
throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!"); throw new BadRequestException("点位:" + point_code2 + "存在未完成的任务!");
} }
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("task_id",IdUtil.getSnowflake(1,1).nextId()); json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_code", CodeUtil.getNewCode("TASK_CODE")); json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
json.put("task_type", "010203"); json.put("task_type", "010203");
json.put("task_status", "01"); json.put("task_status", "01");
@@ -295,8 +304,8 @@ public class InHotTask extends AbstractAcsTask {
json.put("create_id", currentUserId); json.put("create_id", currentUserId);
json.put("create_name", currentUsername); json.put("create_name", currentUsername);
json.put("create_time", DateUtil.now()); json.put("create_time", DateUtil.now());
json.put("priority","1" ); json.put("priority", "1");
json.put("acs_task_type","1" ); json.put("acs_task_type", "1");
tab.insert(json); tab.insert(json);
task_id = json.getString("task_id"); task_id = json.getString("task_id");
} }
@@ -311,7 +320,6 @@ public class InHotTask extends AbstractAcsTask {
} }
@Override @Override
public void cancel(String task_id) { public void cancel(String task_id) {