diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java index 1238cd392..06600840d 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java @@ -1421,6 +1421,7 @@ public class MesToLmsServiceImpl implements MesToLmsService { } @Override + @Transactional(rollbackFor = Exception.class) public JSONObject sendAuditResult(JSONObject param) { log.info("sendAuditResult接口输入参数为:-------------------" + param.toString()); @@ -1467,6 +1468,7 @@ public class MesToLmsServiceImpl implements MesToLmsService { } @Override + @Transactional(rollbackFor = Exception.class) public JSONObject sendProcessInfo(JSONObject param) { log.info("sendProcessInfo输入参数为:-------------------" + param.toString()); @@ -1506,7 +1508,7 @@ public class MesToLmsServiceImpl implements MesToLmsService { if (StrUtil.isEmpty(up_scroll)) { //取满放满 form.put("point_code1", jsonCoolIvt.getString("full_point_code")); - form.put("point_code2", device_jo.getString("up_point_code")); + form.put("point_code2", device_jo.getString("up_point_code")+"_M"); form.put("task_type", "010702"); form.put("material_code", containerName); form.put("vehicle_code", jsonCoolIvt.getString("full_vehicle_code")); @@ -1514,8 +1516,8 @@ public class MesToLmsServiceImpl implements MesToLmsService { } else { //取满取空放满放空 form.put("point_code1", jsonCoolIvt.getString("full_point_code")); - form.put("point_code2", device_jo.getString("up_point_code")); - form.put("point_code3", device_jo.getString("up_point_code")); + form.put("point_code2", device_jo.getString("up_point_code")+"_K"); + form.put("point_code3", device_jo.getString("up_point_code")+"_M"); //判断对应空轴点位是否为空,为空用当前点位,不为空查询其他点位 if (jsonCoolIvt.getString("empty_point_status").equals("01")) { form.put("point_code4", jsonCoolIvt.getString("empty_point_code")); @@ -1541,7 +1543,7 @@ public class MesToLmsServiceImpl implements MesToLmsService { map.put("flag", "1"); map.put("product_area", device_jo.getString("product_area")); JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0); - form.put("point_code1", device_jo.getString("up_point_code")); + form.put("point_code1", device_jo.getString("up_point_code")+"_M"); //寻找可用的冷却区满轴点位 form.put("point_code2", jsonIvt.getString("full_point_code")); form.put("task_type", "010704"); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/RawFoilController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/RawFoilController.java index 207c72920..a3f7d0c47 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/RawFoilController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/RawFoilController.java @@ -56,6 +56,13 @@ public class RawFoilController { return new ResponseEntity<>(rawFoilService.needEmptyAxis(whereJson), HttpStatus.OK); } + @PostMapping("/needEmptyAxisTest") + @Log("呼叫") + + public ResponseEntity needEmptyAxisTest(@RequestBody JSONObject whereJson) { + return new ResponseEntity<>(rawFoilService.needEmptyAxisTest(whereJson), HttpStatus.OK); + } + @PostMapping("/needEmptyVehicle") @Log("呼叫空轴") diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/SurfaceController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/SurfaceController.java new file mode 100644 index 000000000..9656ee3e0 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/SurfaceController.java @@ -0,0 +1,39 @@ +package org.nl.wms.pda.mps.rest; + +import com.alibaba.fastjson.JSONObject; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.modules.logging.annotation.Log; +import org.nl.wms.pda.mps.service.SerfaceService; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor + +@RequestMapping("api/pda/surface") +@Slf4j +public class SurfaceController { + + private final SerfaceService serfaceService; + + + @PostMapping("/operate") + @Log("表处上料、退料") + public ResponseEntity operate(@RequestBody JSONObject whereJson) { + serfaceService.operate(whereJson); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("/confirm") + @Log("允许进入") + public ResponseEntity confirm(@RequestBody JSONObject whereJson) { + serfaceService.confirm(whereJson); + return new ResponseEntity<>(HttpStatus.OK); + } + +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/RawFoilService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/RawFoilService.java index fd5cbb9eb..de5bff4ff 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/RawFoilService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/RawFoilService.java @@ -36,6 +36,14 @@ public interface RawFoilService { */ JSONObject needEmptyAxis(JSONObject whereJson); + /** + * 呼叫 + * + * @param whereJson / + * @return JSONObject + */ + JSONObject needEmptyAxisTest(JSONObject whereJson); + /** * 呼叫空卷轴 * diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/SerfaceService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/SerfaceService.java new file mode 100644 index 000000000..1693e34f2 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/SerfaceService.java @@ -0,0 +1,25 @@ +package org.nl.wms.pda.mps.service; + +import com.alibaba.fastjson.JSONObject; +import org.nl.modules.wql.core.content.HttpContext; + +public interface SerfaceService { + + /** + * 套轴确认 + * + * @param whereJson / + * @return JSONObject + */ + void operate(JSONObject whereJson); + + + /** + * 允许进入 + * + * @param whereJson / + * @return JSONObject + */ + void confirm(JSONObject whereJson); + +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java index 0cded8bf0..52f315a7b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java @@ -67,8 +67,6 @@ public class BakingServiceImpl implements BakingService { WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表 - String temperature_lose = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("temperature_lose").getValue(); - //获取人员对应的区域 UserAreaServiceImpl userAreaService = new UserAreaServiceImpl(); String in_area_id = userAreaService.getInArea(); @@ -87,6 +85,9 @@ public class BakingServiceImpl implements BakingService { 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)) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java index 4d10abea9..eb0b6fbad 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java @@ -145,29 +145,6 @@ public class RawFoilServiceImpl implements RawFoilService { WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 WQLObject sbTab = WQLObject.getWQLObject("ST_IVT_SbPointIvt"); // 生箔点位库存表 - // 插入生箔工序工单表 - JSONObject json = new JSONObject(); - json.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId()); - json.put("container_name", whereJson.getString("container_name")); - json.put("resource_name", whereJson.getString("device_code")); - json.put("mfg_order_name", "test"); - json.put("product_name", "test"); - json.put("description", "test"); - json.put("theory_height", 2000.00); - json.put("eqp_velocity", 20.00); - json.put("up_coiler_date", DateUtil.now()); - json.put("is_reload_send", 0); - json.put("order_type", 1); // ? - json.put("product_area", "B2"); - json.put("realstart_time", DateUtil.now()); - json.put("status", "01"); - json.put("is_delete", "0"); - json.put("agvno", "0"); - json.put("productin_qty", 0); - json.put("create_id", "1"); - json.put("create_name", "管理员"); - json.put("create_time", DateUtil.now()); - rawTab.insert(json); JSONObject raw_jo = whereJson.getJSONObject("raw_jo"); JSONObject jsonRaw = rawTab.query("workorder_id = '" + raw_jo.getString("workorder_id") + "'").uniqueResult(0); @@ -226,6 +203,88 @@ public class RawFoilServiceImpl implements RawFoilService { return jo; } + @Override + @Transactional(rollbackFor = Exception.class) + public JSONObject needEmptyAxisTest(JSONObject whereJson) { + + WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 + WQLObject sbTab = WQLObject.getWQLObject("ST_IVT_SbPointIvt"); // 生箔点位库存表 + JSONObject device_jo = sbTab.query("point_code = '"+whereJson.getString("point_code")+"'").uniqueResult(0); + // 插入生箔工序工单表 + JSONObject json = new JSONObject(); + json.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId()); + json.put("container_name", whereJson.getString("container_name")); + json.put("resource_name", device_jo.getString("ext_code")); + json.put("mfg_order_name", "test"); + json.put("product_name", "741011000000361"); + json.put("description", "铜箔|双面光|原箔|6微米|1350"); + json.put("theory_height", 2000.00); + json.put("eqp_velocity", 20.00); + json.put("up_coiler_date", DateUtil.now()); + json.put("is_reload_send", 0); + json.put("order_type", device_jo.getString("device_type")); + json.put("product_area", "B2"); + json.put("realstart_time", DateUtil.now()); + json.put("status", "01"); + json.put("is_delete", "0"); + json.put("agvno", "0"); + json.put("productin_qty", 0); + json.put("create_id", "1"); + json.put("create_name", "管理员"); + json.put("create_time", DateUtil.now()); + rawTab.insert(json); + + JSONObject jsonSb = sbTab.query("point_code = '" + whereJson.getString("device_code") + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonSb)) { + throw new BadRequestException("点位:" + whereJson.getString("device_code") + "生箔设备不存在"); + } + + if (StrUtil.equals("0", jsonSb.getString("is_used"))) { + throw new BadRequestException("当前生箔机:" + jsonSb.getString("ext_code") + "未启用!"); + } + + String start_pint_code = ""; + String point_code4 = ""; + // 2.根据就近原则查对应空卷抽 + JSONObject map = new JSONObject(); + map.put("flag", "1"); + map.put("product_area", jsonSb.getString("product_area")); + map.put("point_location", jsonSb.getString("point_location")); + JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0); + // 3.如果没找到则继续找下一节点 + if (ObjectUtil.isEmpty(jsonIvt)) { + /*String point_location = jsonSb.getString("point_location"); + if (StrUtil.equals(point_location, "0")) map.put("point_location", "1"); + if (StrUtil.equals(point_location, "1")) map.put("point_location", "0"); + JSONObject jsonIvt_tow = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);*/ + throw new BadRequestException("未查询到有空轴且母卷位置为空的点位!"); + } else { + start_pint_code = jsonIvt.getString("empty_point_code"); + point_code4 = jsonIvt.getString("full_point_code"); + } + + // 起点和终点确定 生成任务 + JSONObject param = new JSONObject(); + param.put("point_code1", start_pint_code); + param.put("point_code2", jsonSb.getString("point_code") + "_K"); + param.put("point_code3", jsonSb.getString("point_code") + "_M"); + param.put("point_code4", point_code4); + param.put("task_type", "010101"); + param.put("material_code", whereJson.getString("container_name")); + param.put("product_area", jsonSb.getString("product_area")); + + CallEmpReelTask callEmpReelTask = new CallEmpReelTask(); + callEmpReelTask.createTask(param); + + // 更新工单状态 + json.put("status", "02"); + rawTab.update(json); + + JSONObject jo = new JSONObject(); + jo.put("message", "操作成功!"); + return jo; + } + @Override @Transactional(rollbackFor = Exception.class) public JSONObject needEmptyVehicle(JSONObject whereJson) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/SerfaceServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/SerfaceServiceImpl.java new file mode 100644 index 000000000..2a4952450 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/SerfaceServiceImpl.java @@ -0,0 +1,73 @@ +package org.nl.wms.pda.mps.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.modules.common.exception.BadRequestException; +import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.modules.wql.util.SpringContextHolder; +import org.nl.wms.ext.acs.service.WmsToAcsService; +import org.nl.wms.ext.mes.service.MesToLmsService; +import org.nl.wms.pda.mps.service.SerfaceService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@RequiredArgsConstructor +@Slf4j +public class SerfaceServiceImpl implements SerfaceService { + + private final MesToLmsService mesToLmsService; + + @Override + @Transactional(rollbackFor = Exception.class) + public void operate(JSONObject whereJson) { + String option = whereJson.getString("option"); + String container_name = whereJson.getString("container_name"); + String device_code = whereJson.getString("point_code"); + + JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + container_name + "'").uniqueResult(0); + if (raw_jo.getString("order_type").equals("2")){ + throw new BadRequestException("当前工单为锂电工单,不允许表处!"); + } + JSONObject device_jo = WQLObject.getWQLObject("st_ivt_stpointivt").query("point_code = '" + device_code + "'").uniqueResult(0); + JSONObject param = new JSONObject(); + param.put("ContainerName", container_name); + param.put("ResourceName", device_jo.getString("ext_code")); + param.put("Type", option); + MesToLmsService bean = SpringContextHolder.getBean(MesToLmsService.class); + JSONObject jsonObject = bean.sendProcessInfo(param); + if (jsonObject.getString("RTYPE").equals("E")){ + throw new BadRequestException(jsonObject.getString("RTMSG")); + } + } + + @Override + public void confirm(JSONObject whereJson) { + String point_code = whereJson.getString("point_code"); + //查询该点位对应的任务 + JSONObject task_jo = WQLObject.getWQLObject("sch_base_task").query("(point_code1 like '%"+point_code+"%' + OR point_code2 like '%"+point_code+"%' AND is_delete = '0'").uniqueResult(0); + if (ObjectUtil.isEmpty(task_jo)){ + throw new BadRequestException("未查询到该点位对应的任务!"); + } + + //下发ACS,执行允许进入 + JSONArray paramArr = new JSONArray(); + JSONObject param = new JSONObject(); + param.put("device_code", point_code); + param.put("task_code", task_jo.getString("task_code")); + param.put("product_area", task_jo.getString("product_area")); + param.put("option", "1"); + paramArr.add(param); + + WmsToAcsService bean = SpringContextHolder.getBean(WmsToAcsService.class); + JSONObject result = bean.updateTask(paramArr); + + if (!StrUtil.equals(result.getString("status"), "200")) { + throw new BadRequestException("操作失败:" + result.getString("message ")); + } + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_RAWFOIL_01.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_RAWFOIL_01.wql index fad9c41c9..3841abf7f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_RAWFOIL_01.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_RAWFOIL_01.wql @@ -51,7 +51,7 @@ FROM ST_IVT_CoolPointIvt ivt WHERE - ivt.empty_point_status = '01' + ivt.empty_point_status = '02' AND ivt.full_point_status = '01' AND diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls index b1725fa7e..f8e138248 100644 Binary files a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls and b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls differ diff --git a/lms/nladmin-ui/src/views/b_lms/pdm/ivt/stpointivt/index.vue b/lms/nladmin-ui/src/views/b_lms/pdm/ivt/stpointivt/index.vue index f80b92e7e..901edbe2a 100644 --- a/lms/nladmin-ui/src/views/b_lms/pdm/ivt/stpointivt/index.vue +++ b/lms/nladmin-ui/src/views/b_lms/pdm/ivt/stpointivt/index.vue @@ -59,9 +59,6 @@ - - - - +