fix:一期光电上报无货优化、MES新加接口、AGV放行提示优化

This commit is contained in:
zhouz
2024-08-12 14:15:35 +08:00
parent e164cdc0e3
commit aa70b786ce
5 changed files with 188 additions and 2 deletions

View File

@@ -1592,8 +1592,16 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
log.info("shipDeviceUpdate请求参数---------------------------------------------" + whereJson.toString() + ",ACS上报无货且此时LMS该点位没有任何任务");
JSONObject result = new JSONObject();
result.put("status", HttpStatus.OK.value());
result.put("message", "反馈成功!");
result.put("message", "反馈成功,ACS上报无货且此时LMS该点位没有任何任务");
return result;
}else {
String vehicleCode2 = left_jo.getString("vehicle_code2");
if (!deliver_jo.getString("vehicle_code").equals(vehicleCode2)) {
JSONObject result = new JSONObject();
result.put("status", HttpStatus.OK.value());
result.put("message", "反馈成功,ACS上报无货但当前点位载具和任务载具号不一致");
return result;
}
}
} else {
//如果为分切输送线上料位,判断该点位是否存在未完成的任务类型为分切输送出的或载具横移任务
@@ -1604,6 +1612,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
result.put("status", HttpStatus.OK.value());
result.put("message", "反馈成功!");
return result;
}else {
String vehicleCode2 = right_jo.getString("vehicle_code2");
if (!deliver_jo.getString("vehicle_code").equals(vehicleCode2)) {
JSONObject result = new JSONObject();
result.put("status", HttpStatus.OK.value());
result.put("message", "反馈成功,ACS上报无货但当前点位载具和任务载具号不一致");
return result;
}
}
}
deliver_jo.put("point_status", "01");

View File

@@ -139,4 +139,11 @@ public class LmsToMesController {
public ResponseEntity<Object> momBoxPackageSubmit(@RequestBody JSONObject jo) {
return new ResponseEntity<>(lmsToMesService.momBoxPackageSubmit(jo), HttpStatus.OK);
}
@PostMapping("/GetInspectionResult")
@Log("LMS获取MES称重后子卷信息")
@SaIgnore
public ResponseEntity<Object> GetInspectionResult(@RequestBody JSONObject jo) {
return new ResponseEntity<>(lmsToMesService.getInspectionResult(jo), HttpStatus.OK);
}
}

View File

@@ -182,4 +182,6 @@ public interface LmsToMesService {
JSONObject momGetPackingInfo(JSONObject jo);
JSONObject momBoxPackageSubmit(JSONObject jo);
JSONObject getInspectionResult(JSONObject jo);
}

View File

@@ -1,19 +1,24 @@
package org.nl.wms.ext.mes.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.nl.b_lms.pdm.info.dao.PdmBiContainerinfo;
import org.nl.b_lms.pdm.info.service.IPdmBiContainerinfoService;
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
@@ -953,4 +958,160 @@ public class LmsToMesServiceImpl implements LmsToMesService {
return result;
}
public JSONObject getInspectionResult(JSONObject param) {
log.info("getInspectionResult接口输出参数为-------------------" + param.toString());
String container_name = param.getString("container_name");
if (StrUtil.isEmpty(container_name)) {
throw new BadRequestException("传入的子卷号不能为空!");
}
JSONObject result = new JSONObject();
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
String api = "CamstarApi/GetInspectionResult";
url = url + api;
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
param.put("UserName", UserName);
param.put("Password", Password);
param.put("FromContainer", container_name);
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
.execute().body();
result = JSONObject.parseObject(resultMsg);
IpdmBiSubpackagerelationService subpackagerelationService = SpringContextHolder.getBean(IpdmBiSubpackagerelationService.class);
JSONObject container_info = result.getJSONObject("RTDAT");
System.out.println(container_info.toString());
if (ObjectUtil.isNotEmpty(container_info)) {
//子卷号
String ContainerName = container_info.getString("ContainerName");
//SAP批次
String SAPLotNumber = container_info.getString("SAPLotNumber");
//销售订单及行号
String SaleOrderName = container_info.getString("SaleOrderName");
//客户编号
String CustomerName = container_info.getString("CustomerName");
//客户名称
String CustomerDescription = container_info.getString("CustomerDescription");
//计划幅宽
String WidthPlan = container_info.getString("WidthPlan");
//计划厚度
String ThicknessPlan = container_info.getString("ThicknessPlan");
//产品幅宽
String Width = container_info.getString("Width");
//产品厚度
String Thickness = container_info.getString("Thickness");
//单位面积质量
String MassPerUnitArea = container_info.getString("MassPerUnitArea");
//净重
String NetWeight = container_info.getString("NetWeight");
//长度
String Length = container_info.getString("Length");
//制造完成日期
String DateOfProduction = container_info.getString("DateOfProduction");
//计划外分切的子卷
String isUnPlanProduction = container_info.getString("isUnPlanProduction");
//子卷的物性值1
String UnPlanProductProperty1 = container_info.getString("UnPlanProductProperty1");
//子卷的物性值2
String UnPlanProductProperty2 = container_info.getString("UnPlanProductProperty2");
//子卷的物性值3
String UnPlanProductProperty3 = container_info.getString("UnPlanProductProperty3");
//客户需求抗拉下限
String SOTensileStrengthLowerLimit = container_info.getString("SOTensileStrengthLowerLimit");
//内控标准抗拉下限
String ETTensileStrengthLowerLimit = container_info.getString("ETTensileStrengthLowerLimit");
//生产实际抗拉值
String TensileStrength = container_info.getString("TensileStrength");
//包装类型
String ReWorkName = container_info.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";
}
}
IPdmBiContainerinfoService containerinfoService = SpringContextHolder.getBean(IPdmBiContainerinfoService.class);
PdmBiContainerinfo one = containerinfoService.getOne(new LambdaQueryWrapper<PdmBiContainerinfo>().eq(PdmBiContainerinfo::getContainer_name, ContainerName));
if (ObjectUtil.isEmpty(one)) {
PdmBiContainerinfo containerinfo = PdmBiContainerinfo.builder()
.workorder_id(IdUtil.getSnowflake(1, 1).nextId())
.container_name(ContainerName)
.sap_pcsn(SAPLotNumber)
.sale_order_name(SaleOrderName)
.customer_name(CustomerName)
.customer_description(CustomerDescription)
.width(Width)
.thickness(Thickness)
.mass_per_unit_area(MassPerUnitArea)
.net_weight(NetWeight)
.length(Length)
.date_of_production(DateOfProduction)
.is_un_plan_production(isUnPlanProduction)
.un_plan_product_property1(UnPlanProductProperty1)
.un_plan_product_property2(UnPlanProductProperty2)
.un_plan_product_property3(UnPlanProductProperty3)
.demand_limit(SOTensileStrengthLowerLimit)
.standard_limit(ETTensileStrengthLowerLimit)
.actual_value(TensileStrength)
.create_id(SecurityUtils.getCurrentUserId())
.create_name(SecurityUtils.getCurrentNickName())
.create_time(DateUtil.now())
.width_standard(WidthPlan)
.sub_type(sub_type)
.thickness_request(ThicknessPlan).build();
containerinfoService.save(containerinfo);
} else {
one.setSap_pcsn(SAPLotNumber);
one.setSale_order_name(SaleOrderName);
one.setCustomer_name(CustomerName);
one.setCustomer_description(CustomerDescription);
one.setWidth(Width);
one.setThickness(Thickness);
one.setMass_per_unit_area(MassPerUnitArea);
one.setNet_weight(NetWeight);
one.setLength(Length);
one.setDate_of_production(DateOfProduction);
one.setIs_un_plan_production(isUnPlanProduction);
one.setUn_plan_product_property1(UnPlanProductProperty1);
one.setUn_plan_product_property2(UnPlanProductProperty2);
one.setUn_plan_product_property3(UnPlanProductProperty3);
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);
}
}
log.info("getInspectionResult接口输出参数为-------------------" + result.toString());
String RTYPE = result.getString("RTYPE");
if ("E".equals(RTYPE)) {
throw new BadRequestException(result.getString("RTMSG"));
}
} catch (Exception e) {
throw new BadRequestException("MES提示错误" + e.getMessage());
}
return result;
}
}

View File

@@ -580,7 +580,7 @@ public class FeedingServiceImpl implements FeedingService {
//查询该母卷号对应的任务
JSONObject task_jo = WQLObject.getWQLObject("SCH_BASE_Task").query("(point_code2 = '" + point_code + "' OR point_code1 = '" + point_code + "') and task_status <> '07' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(task_jo)) {
throw new BadRequestException("输入设备点位编码不能为空");
throw new BadRequestException("未查询到点位[" + point_code + "]对应的任务");
}
//下发ACS执行取满放空的AGV动作
JSONArray paramArr = new JSONArray();