fix:MES相关接口修改

This commit is contained in:
zhouz
2024-08-01 16:11:10 +08:00
parent 2cc00c2c06
commit 02c50e60af
11 changed files with 92 additions and 8 deletions

View File

@@ -1,6 +1,16 @@
package org.nl.b_lms.pdm.info.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import org.nl.b_lms.pdm.info.service.IPdmBiContainerinfoService;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.ext.mes.service.MesToLmsService;
import org.springframework.beans.factory.annotation.Autowired;
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;
@@ -14,7 +24,18 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2024-07-19
*/
@RestController
@RequestMapping("/pdm-bi-containerinfo")
@RequestMapping("/api/containerinfo")
public class PdmBiContainerinfoController {
@Autowired
private IPdmBiContainerinfoService containerinfoService;
@PostMapping("/sendSubInfo")
@Log("子卷下料信息MES传递给LMS")
@SaIgnore
public ResponseEntity<Object> sendSubInfo(@RequestBody String jo) {
containerinfoService.createSubInfoByContainer(jo);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -7,5 +7,6 @@
from pdm_bi_orderbominfo info
left join pdm_bi_slittingproductionplan plan ON plan.mfg_order_name = info.mfgOrder
where plan.container_name = #{container_name}
AND plan.is_delete = '0'
</select>
</mapper>

View File

@@ -59,6 +59,7 @@ public class PdmBiContainerinfoServiceImpl extends ServiceImpl<PdmBiContainerinf
quality_guaran_period = "180天";
}
//插入包装关系
PdmBiSubpackagerelation subpackagerelation = subpackagerelationService.getOne(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getContainer_name, container_name));
if (ObjectUtil.isEmpty(subpackagerelation)) {
subpackagerelation = new PdmBiSubpackagerelation();
@@ -95,10 +96,12 @@ public class PdmBiContainerinfoServiceImpl extends ServiceImpl<PdmBiContainerinf
subpackagerelation.setCreate_id(Long.parseLong(SecurityUtils.getCurrentUserId()));
subpackagerelation.setActual_value(containerinfo.getActual_value());
subpackagerelation.setExt_code("BC01");
subpackagerelation.setSub_type(containerinfo.getSub_type());
subpackagerelation.setJoint_type(slittingproductionplan.getJoint_type());
subpackagerelation.setMaterial_type(slittingproductionplan.getMaterial_type());
subpackagerelationService.save(subpackagerelation);
} else {
//更新入包装关系
subpackagerelation.setSale_order_name(containerinfo.getSale_order_name());
subpackagerelation.setCustomer_name(containerinfo.getCustomer_name());
subpackagerelation.setCustomer_description(containerinfo.getCustomer_description());
@@ -117,6 +120,7 @@ public class PdmBiContainerinfoServiceImpl extends ServiceImpl<PdmBiContainerinf
subpackagerelation.setUn_plan_product_property2(containerinfo.getUn_plan_product_property2());
subpackagerelation.setUn_plan_product_property3(containerinfo.getUn_plan_product_property3());
subpackagerelation.setSap_pcsn(containerinfo.getSap_pcsn());
subpackagerelation.setSub_type(containerinfo.getSub_type());
subpackagerelation.setWidth_standard(containerinfo.getWidth_standard());
subpackagerelation.setThickness_request(containerinfo.getThickness_request());
subpackagerelation.setDemand_limit(containerinfo.getDemand_limit());

View File

@@ -119,7 +119,7 @@ public class AutoSendZxToDjw {
}
//获取与该木箱号匹配的子卷号
String containerName = relationList.get(0).getContainer_name();
log.info(THIS_CLASS+"-装箱区->装箱对接位任务开始执行扫描。");
log.info(THIS_CLASS + "-装箱区->装箱对接位任务开始执行扫描。");
RLock lock = redissonClient.getLock(containerName);
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try {
@@ -228,6 +228,9 @@ public class AutoSendZxToDjw {
UpdateWrapper<PdmBiSubpackagerelation> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("box_weight", totalWeight);
updateWrapper.set("status", "0");
updateWrapper.set("box_length", bstIvtBoxinfo.getBox_length());
updateWrapper.set("box_width", bstIvtBoxinfo.getBox_width());
updateWrapper.set("box_high", bstIvtBoxinfo.getBox_high());
updateWrapper.eq("container_name", packagerelationList.get(0).getContainer_name());
pdmBiSubpackagerelationMapper.update(null, updateWrapper);
//推送MES

View File

@@ -0,0 +1,17 @@
package org.nl.modules.logging.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author Zheng Jie
* @date 2018-11-24
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface InterfaceLog {
String value() default "";
}

View File

@@ -49,7 +49,7 @@ public class WhiteListLogAspect {
private AntPathMatcher pathMatcher = new AntPathMatcher();
@Pointcut("execution(* org.nl.wms.ext..*Service.*(..))")
@Pointcut("execution(* org.nl.wms.ext..*Service.*(..)) || @annotation(org.nl.modules.logging.annotation.InterfaceLog)")
public void logPointcut() {
// 该方法无方法体,主要为了让同类中其他方法使用此切入点
}

View File

@@ -540,6 +540,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
String Attribute3 = param.getString("Attribute3"); // 上下轴
String Attribute4 = param.getString("Attribute4"); // 位置左右
String Attribute5 = param.getString("Attribute5"); // 是否套轴
String Attribute6 = param.getString("Attribute6"); // 是否套轴
WQLObject tab = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan");
@@ -697,6 +698,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
json.put("is_paper_ok", "2");
}
json.put("sale_order_name", Attribute2);
json.put("material_type", Attribute6);
json.put("start_time", DateUtil.now());
json.put("status", "01");
json.put("qzz_generation", qzz_generation);
@@ -1047,7 +1049,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
}
if (plan.getString("container_name").startsWith("B")) {
//如果属于二期的子卷出战调用二期的方法
cut_jo.put("device_code", cut_jo.getString("point_code"));
cut_jo.put("device_code", cut_jo.getString("ext_code"));
slitterService.downRolls(cut_jo);
} else {
{
@@ -1839,6 +1841,9 @@ public class MesToLmsServiceImpl implements MesToLmsService {
BstIvtPackageinfoivt containerInfo =
bstIvtPackageinfoivtList.stream().filter(r -> r.getContainer_name().equals(containerName)).collect(Collectors.toList()).get(0);
JSONObject toDjqTask = new JSONObject();
if (ObjectUtil.isEmpty(containerInfo)) {
throw new BadRequestException("当前子卷号【" + containerName + "】,不在待检区或管制区!");
}
toDjqTask.put("vehicle_code", containerName);
//0 管制区 1待检区
if ("0".equals(TargetHouse)) {
@@ -1850,6 +1855,10 @@ public class MesToLmsServiceImpl implements MesToLmsService {
toDjqTask.put("point_code1", containerInfo.getPoint_code());
toDjqTask.put("point_code2", djqList.get(0).getPoint_code());
djqTask.createTask(toDjqTask);
} else {
if (ObjectUtil.isEmpty(containerInfo)) {
throw new BadRequestException("待检区没有可用的空位!");
}
}
}
@@ -1862,6 +1871,10 @@ public class MesToLmsServiceImpl implements MesToLmsService {
toDjqTask.put("point_code1", containerInfo.getPoint_code());
toDjqTask.put("point_code2", gzqList.get(0).getPoint_code());
gzqTask.createTask(toDjqTask);
} else {
if (ObjectUtil.isEmpty(containerInfo)) {
throw new BadRequestException("管制区没有可用的空位!");
}
}
}
@@ -2179,6 +2192,20 @@ public class MesToLmsServiceImpl implements MesToLmsService {
String ETTensileStrengthLowerLimit = param.getString("ETTensileStrengthLowerLimit");
//生产实际抗拉值
String TensileStrength = param.getString("TensileStrength");
//包装类型
String ReWorkName = param.getString("ReWorkName");
String sub_type = "";
if (ObjectUtil.isEmpty(ReWorkName)) {
sub_type = "0";
}else {
if ("Recheck".equals(ReWorkName)) {
sub_type = "1";
}
if ("ReCut".equals(ReWorkName)) {
sub_type = "2";
}
}
try {
IPdmBiContainerinfoService containerinfoService = SpringContextHolder.getBean(IPdmBiContainerinfoService.class);
@@ -2208,6 +2235,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
.create_name(SecurityUtils.getCurrentNickName())
.create_time(DateUtil.now())
.width_standard(WidthPlan)
.sub_type(sub_type)
.thickness_request(ThicknessPlan).build();
containerinfoService.save(containerinfo);
} else {
@@ -2228,12 +2256,11 @@ public class MesToLmsServiceImpl implements MesToLmsService {
one.setDemand_limit(SOTensileStrengthLowerLimit);
one.setStandard_limit(ETTensileStrengthLowerLimit);
one.setActual_value(TensileStrength);
one.setSub_type(sub_type);
one.setWidth_standard(WidthPlan);
one.setThickness_request(ThicknessPlan);
containerinfoService.updateById(one);
}
IPdmBiContainerinfoService biContainerinfoService = SpringContextHolder.getBean(IPdmBiContainerinfoService.class);
biContainerinfoService.createSubInfoByContainer(ContainerName);
// 返回成功
result.put("RTYPE", "S");

View File

@@ -62,7 +62,6 @@ public class FeedingController {
@PostMapping("/AGVPass")
@Log("AGV放行")
public ResponseEntity<Object> AGVPass(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(feedingService.AGVPass(whereJson), HttpStatus.OK);
}

View File

@@ -14,7 +14,9 @@ import org.nl.common.utils.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.core.content.HttpContext;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
import org.nl.wms.ext.mes.service.LmsToMesService;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
@@ -589,7 +591,7 @@ public class FeedingServiceImpl implements FeedingService {
param.put("option", "1");
paramArr.add(param);
WmsToAcsServiceImpl wmsToAcsService = new WmsToAcsServiceImpl();
WmsToAcsService wmsToAcsService = SpringContextHolder.getBean(WmsToAcsService.class);
JSONObject result = wmsToAcsService.updateTask(paramArr);
if (!StrUtil.equals(result.getString("status"), "200")) {

View File

@@ -6,12 +6,14 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.logging.annotation.InterfaceLog;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.tasks.URLEnum;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import java.util.HashMap;
@@ -19,8 +21,16 @@ import java.util.HashMap;
* ACS连接工具类:
*/
@Slf4j
@Component
public class AcsUtil {
public static JSONObject notifyAcs(String api, JSONArray list) {
AcsUtil bean = SpringContextHolder.getBean(AcsUtil.class);
JSONObject jsonObject = bean.notifyAcs3(api, list);
return jsonObject;
}
@InterfaceLog
public JSONObject notifyAcs3(String api, JSONArray list) {
log.info("下发ACS参数----------------------------------------+" + api + ",---" + list.toString());
//判断是否连接ACS系统
String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_connect_acs").getValue();