MDM -SAP CRM 新系统上线 调整内容
This commit is contained in:
@@ -95,7 +95,7 @@ public class PdmBiContainerinfoServiceImpl extends ServiceImpl<PdmBiContainerinf
|
||||
subpackagerelation.setCreate_time(DateUtil.now());
|
||||
subpackagerelation.setCreate_id(Long.parseLong(SecurityUtils.getCurrentUserId()));
|
||||
subpackagerelation.setActual_value(containerinfo.getActual_value());
|
||||
subpackagerelation.setExt_code("BC01");
|
||||
subpackagerelation.setExt_code("F002");
|
||||
subpackagerelation.setNeed_delete("99");
|
||||
subpackagerelation.setSub_type(containerinfo.getSub_type());
|
||||
subpackagerelation.setJoint_type(slittingproductionplan.getJoint_type());
|
||||
|
||||
@@ -813,7 +813,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
sub.setCreate_time(DateUtil.now());
|
||||
sub.setStatus("99");
|
||||
sub.setSap_pcsn("Test");
|
||||
sub.setExt_code("BC01");
|
||||
sub.setExt_code("F002");
|
||||
sub.setBox_group(null);
|
||||
sub.setProduct_name("测试");
|
||||
this.saveOrUpdate(sub);
|
||||
|
||||
@@ -0,0 +1,707 @@
|
||||
package org.nl.b_lms.sch.tasks.slitter.util;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.bst.ivt.papervehicle.service.dao.MdPbPapervehicle;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
|
||||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 分切部分的任务工具类
|
||||
* @Date: 2024/4/12
|
||||
*/
|
||||
@Slf4j
|
||||
public class SlitterTaskUtilBakup0519 {
|
||||
|
||||
/** B1区域 */
|
||||
public final static String B1_AREA_CODE = "B1";
|
||||
/** B2区域 */
|
||||
public final static String B2_AREA_CODE = "B2";
|
||||
/**
|
||||
* 组成纸管信息
|
||||
* @param plan 对应的分切计划数组
|
||||
* @return 组成的纸管信息
|
||||
* <p>纸制筒管|纸管|6英寸|1300 or 纸制筒管|纸管|3英寸|12|650 or 玻璃纤维及其制品|FRP管|6英寸|15-20|1700|阶梯
|
||||
* 长度:1300mm
|
||||
* 外径:6*25.4mm+15*2mm=182.4mm
|
||||
* 内径:6英寸(25.4mm/英寸)
|
||||
* 壁厚:15mm(常规)、特殊12mm
|
||||
* 材质:纸管</p>
|
||||
*/
|
||||
public static String getPaperTubeInformation(PdmBiSlittingproductionplan plan) {
|
||||
// 纸管描述
|
||||
String tubeDescription;
|
||||
if (SlitterConstant.SLITTER_TYPE_PAPER.equals(plan.getPaper_tube_or_FRP())) {
|
||||
tubeDescription = plan.getPaper_tube_description();
|
||||
} else {
|
||||
tubeDescription = plan.getFRP_description();
|
||||
}
|
||||
// 材质
|
||||
return getComposePaperTubeInformation(tubeDescription, plan.getPaper_tube_or_FRP());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组成信息
|
||||
* @param tubeDescription 纸管信息
|
||||
* @param paperOrFrp 材质(1纸管,2FRP管)
|
||||
* @return 长*外径*内径*壁厚*重量*薄壁厚*阶梯长度*材质(1纸管,2FRP管)
|
||||
*/
|
||||
public static String getComposePaperTubeInformation(String tubeDescription, String paperOrFrp) {
|
||||
if (ObjectUtil.isEmpty(tubeDescription)) {
|
||||
return "";
|
||||
}
|
||||
return getComposePaperTubeInformation(tubeDescription) + "*" + paperOrFrp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组成信息
|
||||
* @param tubeDescription 纸管信息
|
||||
* @return 长*外径*内径*壁厚*重量*薄壁厚*阶梯长度
|
||||
*/
|
||||
public static String getComposePaperTubeInformation(String tubeDescription) {
|
||||
if (ObjectUtil.isEmpty(tubeDescription)) {
|
||||
return "";
|
||||
}
|
||||
boolean flag = tubeDescription.contains("阶梯");
|
||||
tubeDescription = tubeDescription.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "");
|
||||
// 解析描述数组
|
||||
String[] tubeArray = tubeDescription.split("\\|");
|
||||
// 定义尺寸与长度
|
||||
double dia = Double.parseDouble(Character.toString(tubeArray[2].charAt(0)));
|
||||
|
||||
// 假设壁厚默认值为15,如果描述数组长度为4,则重新赋值
|
||||
String th = tubeArray.length == 5 ? tubeArray[3] : "15";
|
||||
String th2 = "0";
|
||||
String jtLen = "0";
|
||||
if (tubeArray[3].contains("-")) {
|
||||
th = tubeArray[3].split("-")[1];
|
||||
th2 = tubeArray[3].split("-")[0];
|
||||
}
|
||||
if (flag) {
|
||||
switch (tubeArray[tubeArray.length - 1]) {
|
||||
case "1400":
|
||||
case "1700":
|
||||
jtLen = "75";
|
||||
break;
|
||||
case "1500":
|
||||
case "1600":
|
||||
jtLen = "150";
|
||||
break;
|
||||
default:
|
||||
jtLen = "0";
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 计算外径和内径
|
||||
double externalDiameter = dia * 25.4 + Double.parseDouble(th) * 2;
|
||||
double internalDiameter = dia * 25.4;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// 长*外径*内径*壁厚*重量*材质(1纸管,2FRP管)
|
||||
// 长
|
||||
sb.append(tubeArray[tubeArray.length - 1]);
|
||||
sb.append("*");
|
||||
// 外径
|
||||
sb.append(NumberUtil.round(externalDiameter, 1).doubleValue());
|
||||
sb.append("*");
|
||||
// 内径
|
||||
sb.append(NumberUtil.round(internalDiameter, 1).doubleValue());
|
||||
sb.append("*");
|
||||
// 壁厚
|
||||
sb.append(th);
|
||||
sb.append("*");
|
||||
// 重量
|
||||
sb.append(0);
|
||||
sb.append("*");
|
||||
// 薄壁厚
|
||||
sb.append(th2);
|
||||
sb.append("*");
|
||||
// 阶梯长度
|
||||
sb.append(jtLen);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// System.out.println(getComposePaperTubeInformation("玻璃纤维及其制品|FRP管|6英寸|15|1100", "1"));
|
||||
System.out.println(isNumeric(",3000"));
|
||||
System.out.println(isNumeric("3000"));
|
||||
System.out.println(isNumeric("3000.32"));
|
||||
System.out.println(isNumeric("-3000.32"));
|
||||
boolean b = checkComplete("1", "2", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置所需的套管纸管信息
|
||||
* @param param 任务参数
|
||||
* @param needPlans 所需的分切计划
|
||||
*/
|
||||
public static void putNeedPaperSpec(JSONObject param, List<PdmBiSlittingproductionplan> needPlans) {
|
||||
log.info("正在设置所需的套管纸管信息...");
|
||||
// 纸制筒管|纸管|6英寸|1300 or 纸制筒管|纸管|3英寸|12|650
|
||||
for (PdmBiSlittingproductionplan plan : needPlans) {
|
||||
if (SlitterConstant.SLITTER_SUB_VOLUME_LEFT.equals(plan.getLeft_or_right())) {
|
||||
if (SlitterConstant.SLITTER_TYPE_PAPER.equals(plan.getPaper_tube_or_FRP())) {
|
||||
param.put("left", plan.getPaper_tube_material());
|
||||
param.put("leftSize", plan.getPaper_tube_model().split("\\|")[2].charAt(0));
|
||||
} else {
|
||||
param.put("left", plan.getFRP_material());
|
||||
param.put("leftSize", plan.getFRP_model().split("\\|")[2].charAt(0));
|
||||
}
|
||||
param.put("leftSpec", SlitterTaskUtilBakup0519.getPaperTubeInformation(plan));
|
||||
} else {
|
||||
if (SlitterConstant.SLITTER_TYPE_PAPER.equals(plan.getPaper_tube_or_FRP())) {
|
||||
param.put("right", plan.getPaper_tube_material());
|
||||
param.put("rightSize", plan.getPaper_tube_model().split("\\|")[2].charAt(0));
|
||||
} else {
|
||||
param.put("right", plan.getFRP_material());
|
||||
param.put("rightSize", plan.getFRP_model().split("\\|")[2].charAt(0));
|
||||
}
|
||||
param.put("rightSpec", SlitterTaskUtilBakup0519.getPaperTubeInformation(plan));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前的拔管纸管信息
|
||||
* @param param 任务参数
|
||||
* @param oldPlans 老的分切计划
|
||||
*/
|
||||
public static void putCurrentPaperSpec(JSONObject param, List<PdmBiSlittingproductionplan> oldPlans) {
|
||||
for (PdmBiSlittingproductionplan plan : oldPlans) {
|
||||
if (SlitterConstant.SLITTER_SUB_VOLUME_LEFT.equals(plan.getLeft_or_right())) {
|
||||
if (SlitterConstant.SLITTER_TYPE_PAPER.equals(plan.getPaper_tube_or_FRP())) {
|
||||
param.put("currentLeft", plan.getPaper_tube_material());
|
||||
param.put("currentLeftSize", plan.getPaper_tube_model().split("\\|")[2].charAt(0));
|
||||
} else {
|
||||
param.put("currentLeft", plan.getFRP_material());
|
||||
param.put("currentLeftSize", plan.getFRP_model().split("\\|")[2].charAt(0));
|
||||
}
|
||||
param.put("currentLeftSpec", SlitterTaskUtilBakup0519.getPaperTubeInformation(plan));
|
||||
} else {
|
||||
if (SlitterConstant.SLITTER_TYPE_PAPER.equals(plan.getPaper_tube_or_FRP())) {
|
||||
param.put("currentRight", plan.getPaper_tube_material());
|
||||
param.put("currentRightSize", plan.getPaper_tube_model().split("\\|")[2].charAt(0));
|
||||
} else {
|
||||
param.put("currentRight", plan.getFRP_material());
|
||||
param.put("currentRightSize", plan.getFRP_model().split("\\|")[2].charAt(0));
|
||||
}
|
||||
param.put("currentRightSpec", SlitterTaskUtilBakup0519.getPaperTubeInformation(plan));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备号
|
||||
* @param resourceCode /
|
||||
* @return /
|
||||
*/
|
||||
public static int getNumberByResourceCode(String resourceCode) {
|
||||
if (ObjectUtil.isEmpty(resourceCode)) {
|
||||
throw new BadRequestException("输入的设备号编码不能为空!");
|
||||
}
|
||||
String trimStr = resourceCode.trim();
|
||||
// 提取最后两位作为字符串
|
||||
String lastTwoDigitsString = trimStr.substring(trimStr.length() - 2);
|
||||
// 将整数再转换回字符串以供返回
|
||||
return Integer.parseInt(lastTwoDigitsString);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上下区域
|
||||
* @param num 编码
|
||||
* @param area 区域
|
||||
* @return /
|
||||
*/
|
||||
public static String getPointLocationInCutDevice(int num, String area) {
|
||||
if (area.equals(B1_AREA_CODE)) {
|
||||
if (num >= 1 && num <= 6) {
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
if (area.equals(B2_AREA_CODE)) {
|
||||
if (num >= 1 && num <= 5) {
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
return "1";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询是否包含在内
|
||||
* @param names 数组
|
||||
* @param name 自负床
|
||||
* @return Boolean 是 {@code true} or 否{@code false}
|
||||
*/
|
||||
public static boolean containscode(String[] names, String name) {
|
||||
for (String n : names) {
|
||||
if (name.equals(n)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取name在数组中的索引
|
||||
* @param names 数组
|
||||
* @param name 校验字符
|
||||
* @return 索引
|
||||
*/
|
||||
public static int getIndex(String[] names, String name) {
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (name.equals(names[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
// 如果找不到返回-1
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 业务:备货区送纸管托盘时候,将纸管信息带给任务中的参数
|
||||
* @param paperList 备货区纸管信息
|
||||
* @param param 任务参数json
|
||||
*/
|
||||
public static void doSavePaperInfos(List<MdPbPapervehicle> paperList, JSONObject param) {
|
||||
String[] material_codes = new String[paperList.size()];
|
||||
String[] material_specs = new String[paperList.size()];
|
||||
int[] qtys = new int[paperList.size()];
|
||||
String[] material_codes1 = {null,null,null,null,null};
|
||||
String[] material_specs1 = {null,null,null,null,null};
|
||||
int[] qtys1 = {0,0,0,0,0};
|
||||
for (int i = 0; i < paperList.size(); i++) {
|
||||
MdPbPapervehicle vehicle = paperList.get(i);
|
||||
String materialCode = vehicle.getMaterial_code();
|
||||
int qty = vehicle.getQty().intValue();
|
||||
if (containscode(material_codes, materialCode)) {
|
||||
int index = getIndex(material_codes, materialCode);
|
||||
qtys[index] += qty;
|
||||
} else {
|
||||
material_codes[i] = vehicle.getMaterial_code();
|
||||
String spec = getComposePaperTubeInformation(vehicle.getMaterial_name(), vehicle.getMaterial_code().startsWith("4") ? "1" : "2");
|
||||
material_specs[i] = spec;
|
||||
qtys[i] = qty;
|
||||
}
|
||||
//新规格数据处理
|
||||
int row_num = Integer.parseInt(vehicle.getRow_num());
|
||||
String spec = getComposePaperTubeInformation(vehicle.getMaterial_name(), vehicle.getMaterial_code().startsWith("4") ? "1" : "2");
|
||||
material_codes1[row_num-1] = materialCode;
|
||||
material_specs1[row_num-1] = spec;
|
||||
qtys1[row_num-1] = qty;
|
||||
}
|
||||
// 转成String
|
||||
String[] qtysStr = Arrays.stream(qtys)
|
||||
.mapToObj(String::valueOf)
|
||||
.toArray(String[]::new);
|
||||
// 转成String
|
||||
String[] qtysStr1 = Arrays.stream(qtys1)
|
||||
.mapToObj(String::valueOf)
|
||||
.toArray(String[]::new);
|
||||
param.put("to_material", String.join(",", material_codes));
|
||||
param.put("to_spec", String.join(",", material_specs));
|
||||
param.put("to_qty", String.join(",", qtysStr));
|
||||
|
||||
param.put("to_material1", String.join(",", material_codes1));
|
||||
param.put("to_spec1", String.join(",", material_specs1));
|
||||
param.put("to_qty1", String.join(",", qtysStr1));
|
||||
param.put("device_code", material_specs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 传入JSONArray返回筛选字符串
|
||||
* @param array /
|
||||
* @param name /
|
||||
* @return /
|
||||
*/
|
||||
public static List<String> getAllStringByName(JSONArray array, String name) {
|
||||
List<String> res = new ArrayList<>();
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject jsonObject = array.getJSONObject(i);
|
||||
res.add(jsonObject.getString(name));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过分切计划的上下轴返回对应的气胀轴编码
|
||||
* todo: 是否存在问题?
|
||||
* @param plan 分切机
|
||||
* @return 气胀轴编码或者"-"
|
||||
*/
|
||||
public static String getQzzNoByUpOrDown(PdmBiSlittingproductionplan plan) {
|
||||
if (SlitterConstant.SLITTER_SHAFT_UP.equals(plan.getUp_or_down())) {
|
||||
return plan.getQzzno();
|
||||
} else {
|
||||
return "-";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取纸管长度
|
||||
* @param plan 分切计划
|
||||
* @return /
|
||||
*/
|
||||
public static String getPaperLength(PdmBiSlittingproductionplan plan) {
|
||||
// String s = "玻璃纤维及其制品|FRP管|6英寸|15|1700";
|
||||
String paperStr = "";
|
||||
if (plan.getPaper_tube_or_FRP().equals(SlitterConstant.SLITTER_TYPE_PAPER)) {
|
||||
paperStr = plan.getPaper_tube_model();
|
||||
} else {
|
||||
paperStr = plan.getFRP_model();
|
||||
}
|
||||
String[] split = paperStr.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "").split("\\|");
|
||||
return split[split.length - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取: 长*外径*内径*壁厚*重量*薄壁厚*阶梯长度
|
||||
* @param plan
|
||||
* @return
|
||||
*/
|
||||
public static String getTubeConvertInfo(PdmBiSlittingproductionplan plan) {
|
||||
// String s = "玻璃纤维及其制品|FRP管|6英寸|15|1700";
|
||||
String paperStr = "";
|
||||
if (plan.getPaper_tube_or_FRP().equals(SlitterConstant.SLITTER_TYPE_PAPER)) {
|
||||
paperStr = plan.getPaper_tube_model();
|
||||
} else {
|
||||
paperStr = plan.getFRP_model();
|
||||
}
|
||||
return getComposePaperTubeInformation(paperStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取纸管长度
|
||||
* @param plan 分切计划
|
||||
* @return /
|
||||
*/
|
||||
public static String getPaperLengthByCode(String name) {
|
||||
// String name = "玻璃纤维及其制品|FRP管|6英寸|15|1700";
|
||||
String[] split = name.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "").split("\\|");
|
||||
return split[split.length - 1];
|
||||
}
|
||||
/**
|
||||
* 获取纸管长度
|
||||
* @param plan 分切计划
|
||||
* @return /
|
||||
*/
|
||||
public static Integer getPaperLengthByCodeInt(String name) {
|
||||
// String name = "玻璃纤维及其制品|FRP管|6英寸|15|1700";
|
||||
return Integer.valueOf(getPaperLengthByCode(name));
|
||||
}
|
||||
public static String getPaperSize(PdmBiSlittingproductionplan plan) {
|
||||
// String s = "玻璃纤维及其制品|FRP管|6英寸|15|1700";
|
||||
String paperStr = "";
|
||||
if (plan.getPaper_tube_or_FRP().equals(SlitterConstant.SLITTER_TYPE_PAPER)) {
|
||||
paperStr = plan.getPaper_tube_model();
|
||||
} else {
|
||||
paperStr = plan.getFRP_model();
|
||||
}
|
||||
String[] split = paperStr.replaceAll("\\|[\\u4e00-\\u9fa5]+$", "").split("\\|");
|
||||
return split[2].replaceAll("英寸","");
|
||||
}
|
||||
|
||||
public static Integer getPaperLengthInt(PdmBiSlittingproductionplan plan) {
|
||||
return Integer.valueOf(getPaperLength(plan));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置重量
|
||||
* @param plans 分切计划
|
||||
* @return 0,0,0,0
|
||||
*/
|
||||
public static void setPaperWeightStr(String weightStr, List<PdmBiSlittingproductionplan> plans) {
|
||||
// 1. 校验输入格式
|
||||
String[] parts = weightStr.split(",");
|
||||
if (parts.length != 4) {
|
||||
// 没有数据则不修改
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 遍历四个位置
|
||||
for (int index = 0; index < 4; index++) {
|
||||
// 解析重量值(自动四舍五入到两位小数)
|
||||
String strValue = parts[index];
|
||||
BigDecimal value;
|
||||
try {
|
||||
value = new BigDecimal(strValue).setScale(2, RoundingMode.HALF_UP);
|
||||
} catch (NumberFormatException e) {
|
||||
continue; // 跳过无效数值
|
||||
}
|
||||
|
||||
// 3. 根据索引确定位置规则
|
||||
String expectedUp, expectedLeft;
|
||||
switch (index) {
|
||||
case 0: // 上左
|
||||
expectedUp = "1";
|
||||
expectedLeft = "1";
|
||||
break;
|
||||
case 1: // 上右
|
||||
expectedUp = "1";
|
||||
expectedLeft = "2";
|
||||
break;
|
||||
case 2: // 下左
|
||||
expectedUp = "2";
|
||||
expectedLeft = "1";
|
||||
break;
|
||||
case 3: // 下右
|
||||
expectedUp = "2";
|
||||
expectedLeft = "2";
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("非法索引: " + index);
|
||||
}
|
||||
|
||||
// 4. 在集合中查找匹配项并更新
|
||||
for (PdmBiSlittingproductionplan plan : plans) {
|
||||
if (expectedUp.equals(plan.getUp_or_down()) &&
|
||||
expectedLeft.equals(plan.getLeft_or_right())) {
|
||||
plan.setPaper_weight(value.toString());
|
||||
break; // 找到后跳出循环
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取重量
|
||||
* @param plans 分切计划
|
||||
* @return 0,0,0,0
|
||||
*/
|
||||
public static String getPaperWeightStr(List<PdmBiSlittingproductionplan> plans) {
|
||||
String[] weights = new String[4];
|
||||
Arrays.fill(weights, "0");
|
||||
|
||||
for (PdmBiSlittingproductionplan plan : plans) {
|
||||
// 1. 获取重量并四舍五入
|
||||
String weightStr = plan.getPaper_weight();
|
||||
BigDecimal weight;
|
||||
try {
|
||||
weight = new BigDecimal(weightStr);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
BigDecimal rounded = weight.setScale(2, RoundingMode.HALF_UP);
|
||||
|
||||
// 2. 根据位置确定数组索引
|
||||
String upDown = plan.getUp_or_down();
|
||||
String leftRight = plan.getLeft_or_right();
|
||||
int index = -1;
|
||||
|
||||
if ("1".equals(upDown)) {
|
||||
index = ("1".equals(leftRight)) ? 0 : 1;
|
||||
} else {
|
||||
index = ("1".equals(leftRight)) ? 2 : 3;
|
||||
}
|
||||
|
||||
// 3. 更新对应位置的重量(格式化为两位小数)
|
||||
if (index >= 0 && index < 4) {
|
||||
weights[index] = rounded.toString();
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 拼接结果字符串
|
||||
return String.join(",", weights);
|
||||
}
|
||||
|
||||
/**
|
||||
* 固定输入与输出气胀轴库点位
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static String getQzzkMappedValue(String input) {
|
||||
switch (input) {
|
||||
case "B_QZZK01": return "B_QZZK02";
|
||||
case "B_QZZK02": return "B_QZZK01";
|
||||
case "B_QZZK03": return "B_QZZK04";
|
||||
case "B_QZZK04": return "B_QZZK03";
|
||||
default: throw new BadRequestException("站点输入错误: " + input);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下卷前置校验,判断卷的上下轴属性与实际是否一致 - 校验子卷属性
|
||||
* @param jsonArray 子卷数组
|
||||
* @param plans 计划
|
||||
*/
|
||||
public static void validateConsistency(JSONArray jsonArray, List<PdmBiSlittingproductionplan> plans) {
|
||||
if (plans.size() == 0) {
|
||||
throw new BadRequestException("计划未找到,请确保MES已推送。");
|
||||
}
|
||||
// 1. 将 List<PdmBiSlittingproductionplan> 转为 Map<container_name, up_or_down>
|
||||
Map<String, String> planMap = plans.stream()
|
||||
.collect(Collectors.toMap(
|
||||
p -> p.getContainer_name(),
|
||||
p -> p.getUp_or_down(),
|
||||
// 如果有重复 key,保留第一个(按需调整)
|
||||
(existing, replacement) -> existing
|
||||
));
|
||||
|
||||
// 2. 遍历 JSONArray
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject item = jsonArray.getJSONObject(i);
|
||||
String containerName = item.getString("container_name");
|
||||
String site = item.getString("site");
|
||||
|
||||
// 3. 检查 Plan 中是否存在对应的 container_name
|
||||
if (!planMap.containsKey(containerName)) {
|
||||
throw new BadRequestException("校验失败: container_name " + containerName + " 在计划列表中不存在");
|
||||
}
|
||||
|
||||
// 4. 比较 site 和 up_or_down 是否一致
|
||||
String expectedUpDown = planMap.get(containerName);
|
||||
if (!expectedUpDown.equals(site)) {
|
||||
throw new BadRequestException("校验失败: 子卷号 " + containerName
|
||||
+ " 的上下轴位置"
|
||||
+ "与MES分切计划中的上下轴位置" + expectedUpDown + "不一致!");
|
||||
}
|
||||
}
|
||||
log.info("分切下卷计划位置校验通过!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断管芯行家对接位是否有所需的管芯、并且数量是符合的。
|
||||
* @param tubeCodes
|
||||
* @param needTubes
|
||||
* @param papers
|
||||
* @return
|
||||
*/
|
||||
public static boolean containsAllTubes(List<String> tubeCodes, List<String> needTubes, List<MdPbPapervehicle> papers) {
|
||||
Set<String> tubeSet = new HashSet<>(tubeCodes);
|
||||
for (String tube : needTubes) {
|
||||
if (!tubeSet.contains(tube)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int num = 0;
|
||||
for (String needTube : needTubes) {
|
||||
for (MdPbPapervehicle paper : papers) {
|
||||
if (needTube.equals(paper.getMaterial_code())) {
|
||||
num += paper.getQty().intValue();
|
||||
}
|
||||
}
|
||||
if (num == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组成映射Map
|
||||
* @param tubes
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, Integer> countTubes(List<String> tubes) {
|
||||
if (tubes == null) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
return tubes.stream()
|
||||
.filter(tube -> tube != null)
|
||||
.collect(Collectors.toMap(
|
||||
Function.identity(),
|
||||
value -> 1,
|
||||
Integer::sum
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
public static <T, U> List<U> mapList(Collection<T> from, Function<T, U> func) {
|
||||
if (CollUtil.isEmpty(from)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return from.stream().map(func).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换List<String>
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
public static List<String> objectToList(Object obj) {
|
||||
// 安全转换为List<String>
|
||||
List<String> errorList = new ArrayList<>();
|
||||
if (obj instanceof List) {
|
||||
for (Object item : (List<?>) obj) {
|
||||
if (item instanceof String) {
|
||||
errorList.add((String) item);
|
||||
} else {
|
||||
// 非字符串元素处理(按需调整)
|
||||
errorList.add(item.toString());
|
||||
}
|
||||
}
|
||||
} else if (obj != null) {
|
||||
// 如果存储的不是List(如JSON字符串),需额外处理
|
||||
throw new IllegalStateException("Expected List type from Redis, but got: " + obj.getClass());
|
||||
}
|
||||
return errorList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串是否为数字(整数、小数、负数)
|
||||
*/
|
||||
public static boolean isNumeric(String str) {
|
||||
if (str == null || str.isEmpty() || str.trim().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
String s = str.trim();
|
||||
return s.matches("-?\\d+(\\.\\d+)?");
|
||||
}
|
||||
|
||||
/**
|
||||
* 单根轴的数据判断:根据指定的尺寸类型,校验左侧或右侧电流数据是否完整。
|
||||
* 当 size 为 1 时,只需一侧数据完整即返回 true;
|
||||
* 当 size 为 2 时,要求左右两侧数据均完整才返回 true。
|
||||
*
|
||||
* @param param 包含相关字段的 JSON 对象,必须包含以下键:
|
||||
* "currentLeft", "currentLeftSize", "currentLeftSpec",
|
||||
* "currentRight", "currentRightSize", "currentRightSpec"
|
||||
* @param size 校验模式大小,决定校验逻辑:
|
||||
* - 1:表示任一轴(左或右)数据完整即可(逻辑或)
|
||||
* - 2:表示左右两轴数据都必须完整(逻辑与)
|
||||
* @return 符合校验规则时返回 true,否则返回 false
|
||||
*/
|
||||
public static boolean singleShaftCheck(JSONObject param, int size) {
|
||||
String currentLeft = param.getString("currentLeft");
|
||||
String currentLeftSize = param.getString("currentLeftSize");
|
||||
String currentLeftSpec = param.getString("currentLeftSpec");
|
||||
String currentRight = param.getString("currentRight");
|
||||
String currentRightSize = param.getString("currentRightSize");
|
||||
String currentRightSpec = param.getString("currentRightSpec");
|
||||
|
||||
// 根据 size 值执行不同的校验策略:1 表示任一轴有效即可,2 表示双轴均需有效
|
||||
switch (size) {
|
||||
case 1:
|
||||
return checkComplete(currentLeft, currentLeftSpec, currentLeftSize)
|
||||
|| checkComplete(currentRight, currentRightSpec, currentRightSize);
|
||||
case 2:
|
||||
return checkComplete(currentLeft, currentLeftSpec, currentLeftSize)
|
||||
&& checkComplete(currentRight, currentRightSpec, currentRightSize);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static boolean checkComplete(String... checks) {
|
||||
if (checks == null) {
|
||||
return false;
|
||||
}
|
||||
for (String check : checks) {
|
||||
if (ObjectUtil.isEmpty(check)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.nl.config.thread;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/**
|
||||
* @author ManMan.Yang
|
||||
* @version V1.1
|
||||
* @date 2026/5/14
|
||||
* @description 外部系统接口执行异步线程池配置
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class ApiLogExecutorConfig {
|
||||
|
||||
@Bean("apiLogExecutor")
|
||||
public Executor apiLogExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(5);
|
||||
executor.setMaxPoolSize(10);
|
||||
executor.setQueueCapacity(200);
|
||||
executor.setKeepAliveSeconds(60);
|
||||
executor.setThreadNamePrefix("sys-api-log-");
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||
executor.setAwaitTerminationSeconds(60);
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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 ManMan.Yang
|
||||
* @version V1.1
|
||||
* @date 2026/5/14
|
||||
* @description 注解
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ApiLog {
|
||||
|
||||
String bizCode() default "";
|
||||
|
||||
String bizDesc() default "";
|
||||
|
||||
String systemFlag() default "";
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package org.nl.modules.logging.aspect;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.modules.logging.annotation.ApiLog;
|
||||
import org.nl.system.service.sysapi.entity.SysApiLog;
|
||||
import org.nl.system.service.sysapi.service.ISysApiLogService;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ManMan.Yang
|
||||
* @version V1.1
|
||||
* @date 2026/5/14
|
||||
* @description aop
|
||||
*/
|
||||
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ApiLogAspect {
|
||||
|
||||
private final ISysApiLogService apiLogService;
|
||||
|
||||
public ApiLogAspect(ISysApiLogService apiLogService) {
|
||||
this.apiLogService = apiLogService;
|
||||
}
|
||||
|
||||
@Around("@annotation(apiLog)")
|
||||
public Object around(ProceedingJoinPoint joinPoint, ApiLog apiLog) throws Throwable {
|
||||
long startTime = System.currentTimeMillis();
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
|
||||
SysApiLog logEntity = new SysApiLog();
|
||||
logEntity.setLogId(IdUtil.getStringId());
|
||||
logEntity.setDirection(1);
|
||||
logEntity.setSystemFlag(apiLog.systemFlag());
|
||||
logEntity.setBizCode(apiLog.bizCode());
|
||||
logEntity.setBizDesc(apiLog.bizDesc());
|
||||
logEntity.setTraceId(MDC.get("traceId"));
|
||||
logEntity.setCreateTime(DateUtil.now());
|
||||
|
||||
try {
|
||||
if (attributes != null) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
logEntity.setApiUrl(request.getRequestURI());
|
||||
logEntity.setRequestMethod(request.getMethod());
|
||||
logEntity.setRequestIp(getIpAddress(request));
|
||||
logEntity.setRequestHeaders(JSONUtil.toJsonStr(getRequestHeaders(request)));
|
||||
}
|
||||
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
Object[] args = joinPoint.getArgs();
|
||||
logEntity.setRequestParams(buildRequestParams(method, args));
|
||||
|
||||
Object result = joinPoint.proceed();
|
||||
|
||||
long costTime = System.currentTimeMillis() - startTime;
|
||||
logEntity.setCostTime(costTime);
|
||||
logEntity.setResponseStatus(200);
|
||||
logEntity.setStatus("SUCCESS");
|
||||
logEntity.setResponseBody(JSONUtil.toJsonStr(result));
|
||||
|
||||
return result;
|
||||
|
||||
} catch (Throwable throwable) {
|
||||
long costTime = System.currentTimeMillis() - startTime;
|
||||
logEntity.setCostTime(costTime);
|
||||
logEntity.setStatus("FAIL");
|
||||
logEntity.setErrorMsg(throwable.getMessage());
|
||||
|
||||
throw throwable;
|
||||
|
||||
} finally {
|
||||
apiLogService.saveAsync(logEntity);
|
||||
}
|
||||
}
|
||||
|
||||
private String getIpAddress(HttpServletRequest request) {
|
||||
String ip = request.getHeader("X-Forwarded-For");
|
||||
if (ip == null || ip.isEmpty() || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("X-Real-IP");
|
||||
}
|
||||
if (ip == null || ip.isEmpty() || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
private Map<String, String> getRequestHeaders(HttpServletRequest request) {
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("Content-Type", request.getContentType());
|
||||
headers.put("User-Agent", request.getHeader("User-Agent"));
|
||||
return headers;
|
||||
}
|
||||
|
||||
private String buildRequestParams(Method method, Object[] args) {
|
||||
try {
|
||||
if (args == null || args.length == 0) {
|
||||
return "{}";
|
||||
}
|
||||
return JSONUtil.toJsonStr(args);
|
||||
} catch (Exception e) {
|
||||
return "参数序列化失败";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package org.nl.system.controller.sysapi;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.system.service.sysapi.entity.SysApiLog;
|
||||
import org.nl.system.service.sysapi.entity.dto.ApiLogQuery;
|
||||
import org.nl.system.service.sysapi.service.ISysApiLogService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author ManMan.Yang
|
||||
* @version V1.1
|
||||
* @date 2026/5/14
|
||||
* @description 外部系统接口日志控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/sysApiLog")
|
||||
@Slf4j
|
||||
public class SysApiLogController {
|
||||
|
||||
private final ISysApiLogService apiLogService;
|
||||
|
||||
/**
|
||||
* 分页查询接口日志列表
|
||||
*/
|
||||
@GetMapping
|
||||
@Log("查询接口日志列表")
|
||||
public ResponseEntity<Map<String, Object>> query(ApiLogQuery query) {
|
||||
LambdaQueryWrapper<SysApiLog> wrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if (query.getDirection() != null) {
|
||||
wrapper.eq(SysApiLog::getDirection, query.getDirection());
|
||||
}
|
||||
|
||||
if (query.getSystemFlag() != null && !query.getSystemFlag().isEmpty()) {
|
||||
wrapper.eq(SysApiLog::getSystemFlag, query.getSystemFlag());
|
||||
}
|
||||
|
||||
if (query.getBizCode() != null && !query.getBizCode().isEmpty()) {
|
||||
wrapper.eq(SysApiLog::getBizCode, query.getBizCode());
|
||||
}
|
||||
|
||||
if (query.getTraceId() != null && !query.getTraceId().isEmpty()) {
|
||||
wrapper.eq(SysApiLog::getTraceId, query.getTraceId());
|
||||
}
|
||||
|
||||
if (query.getApiUrl() != null && !query.getApiUrl().isEmpty()) {
|
||||
wrapper.like(SysApiLog::getApiUrl, query.getApiUrl());
|
||||
}
|
||||
|
||||
if (query.getStatus() != null && !query.getStatus().isEmpty()) {
|
||||
wrapper.eq(SysApiLog::getStatus, query.getStatus());
|
||||
}
|
||||
|
||||
if (query.getBeginTime() != null && !query.getBeginTime().isEmpty()) {
|
||||
wrapper.ge(SysApiLog::getCreateTime, query.getBeginTime());
|
||||
}
|
||||
|
||||
if (query.getEndTime() != null && !query.getEndTime().isEmpty()) {
|
||||
wrapper.le(SysApiLog::getCreateTime, query.getEndTime());
|
||||
}
|
||||
|
||||
if (query.getKeyword() != null && !query.getKeyword().isEmpty()) {
|
||||
wrapper.and(w -> w.like(SysApiLog::getBizDesc, query.getKeyword())
|
||||
.or().like(SysApiLog::getApiDesc, query.getKeyword())
|
||||
.or().like(SysApiLog::getRequestParams, query.getKeyword())
|
||||
.or().like(SysApiLog::getResponseBody, query.getKeyword()));
|
||||
}
|
||||
|
||||
wrapper.orderByDesc(SysApiLog::getCreateTime);
|
||||
|
||||
Page<SysApiLog> page = new Page<>(query.getPage()+1, query.getSize());
|
||||
IPage<SysApiLog> result = apiLogService.page(page, wrapper);
|
||||
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("content", result.getRecords());
|
||||
response.put("totalElements", result.getTotal());
|
||||
response.put("totalPages", result.getPages());
|
||||
response.put("size", result.getSize());
|
||||
response.put("number", result.getCurrent());
|
||||
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询日志详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
@Log("查询接口日志详情")
|
||||
public ResponseEntity<SysApiLog> findById(@PathVariable String id) {
|
||||
SysApiLog apiLog = apiLogService.getById(id);
|
||||
return new ResponseEntity<>(apiLog, HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务类型列表(根据系统标识)
|
||||
*/
|
||||
@GetMapping("/bizCodeList")
|
||||
@Log("获取业务类型列表")
|
||||
public ResponseEntity<List<Map<String, String>>> getBizCodeList(@RequestParam String systemFlag, @RequestParam String direction) {
|
||||
LambdaQueryWrapper<SysApiLog> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysApiLog::getSystemFlag, systemFlag)
|
||||
.eq(SysApiLog::getDirection, direction)
|
||||
.select(SysApiLog::getBizCode, SysApiLog::getBizDesc)
|
||||
.groupBy(SysApiLog::getBizCode, SysApiLog::getBizDesc)
|
||||
.orderByAsc(SysApiLog::getBizCode);
|
||||
|
||||
List<SysApiLog> list = apiLogService.list(wrapper);
|
||||
|
||||
List<Map<String, String>> result = list.stream()
|
||||
.map(log -> {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("bizCode", log.getBizCode());
|
||||
map.put("bizDesc", log.getBizCode() + " - " +log.getBizDesc());
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return new ResponseEntity<>(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志归档
|
||||
*/
|
||||
@PostMapping("/archive")
|
||||
@Log("接口日志归档")
|
||||
public ResponseEntity<Void> archiveLogs() {
|
||||
try {
|
||||
LambdaQueryWrapper<SysApiLog> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.lt(SysApiLog::getCreateTime,
|
||||
java.time.LocalDateTime.now().minusDays(30).toString().replace('T', ' '));
|
||||
|
||||
List<SysApiLog> oldLogs = apiLogService.list(wrapper);
|
||||
|
||||
if (!oldLogs.isEmpty()) {
|
||||
log.info("开始归档接口日志,共 {} 条数据", oldLogs.size());
|
||||
// TODO: 这里可以实现归档逻辑,比如:
|
||||
// 1. 备份到历史表 sys_api_log_history
|
||||
apiLogService.remove(wrapper);
|
||||
log.info("接口日志归档完成,已删除 {} 条旧数据", oldLogs.size());
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
log.error("接口日志归档失败", e);
|
||||
throw new RuntimeException("日志归档失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,17 +39,17 @@ public class JobRunner implements ApplicationRunner {
|
||||
System.out.println("本机ip:"+localIp);
|
||||
|
||||
log.info("--------------------注入定时任务---------------------");
|
||||
List<SysQuartzJob> quartzJobs = quartzJobService.findByIsPauseIsFalse();
|
||||
quartzJobs.forEach(job -> {
|
||||
if (judgmentIp(job.getJob_ip())) {
|
||||
log.info("定时任务:{}, 执行ip: {}, 定时任务开启", job.getJob_name(), localIp);
|
||||
System.out.println("定时任务: " + job.getJob_name() + ", 执行ip: " + localIp + ", 定时任务开启");
|
||||
quartzManage.addJob(job);
|
||||
} else {
|
||||
log.info("定时任务 {} 未开启, 本机ip{} 与 调度ip{} 不同", job.getJob_name(), localIp, job.getJob_ip());
|
||||
System.out.println("定时任务 " + job.getJob_name() + " 未开启, 本机ip: " + localIp + " 与 调度ip: " + job.getJob_ip() + " 不同");
|
||||
}
|
||||
});
|
||||
// List<SysQuartzJob> quartzJobs = quartzJobService.findByIsPauseIsFalse();
|
||||
// quartzJobs.forEach(job -> {
|
||||
// if (judgmentIp(job.getJob_ip())) {
|
||||
// log.info("定时任务:{}, 执行ip: {}, 定时任务开启", job.getJob_name(), localIp);
|
||||
// System.out.println("定时任务: " + job.getJob_name() + ", 执行ip: " + localIp + ", 定时任务开启");
|
||||
// quartzManage.addJob(job);
|
||||
// } else {
|
||||
// log.info("定时任务 {} 未开启, 本机ip{} 与 调度ip{} 不同", job.getJob_name(), localIp, job.getJob_ip());
|
||||
// System.out.println("定时任务 " + job.getJob_name() + " 未开启, 本机ip: " + localIp + " 与 调度ip: " + job.getJob_ip() + " 不同");
|
||||
// }
|
||||
// });
|
||||
|
||||
log.info("--------------------定时任务注入完成---------------------");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.nl.system.service.sysapi.entity.dto;
|
||||
import lombok.Data;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
|
||||
/**
|
||||
* @author ManMan.Yang
|
||||
* @version V1.1
|
||||
* @date 2026/5/14
|
||||
* @description 外部系统接口查询实体Vo类
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class ApiLogQuery extends PageQuery {
|
||||
|
||||
private Integer direction;
|
||||
|
||||
private String systemFlag;
|
||||
|
||||
private String bizCode;
|
||||
|
||||
private String traceId;
|
||||
|
||||
private String apiUrl;
|
||||
|
||||
private String status;
|
||||
|
||||
private String beginTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
private String keyword;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.system.service.sysapi.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.nl.system.service.sysapi.entity.SysApiLog;
|
||||
|
||||
/**
|
||||
* @author ManMan.Yang
|
||||
* @version V1.1
|
||||
* @date 2026/5/14
|
||||
* @description TODO
|
||||
*/
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface SysApiLogMapper extends BaseMapper<SysApiLog> {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.system.service.sysapi.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.system.service.sysapi.entity.SysApiLog;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
/**
|
||||
* @author ManMan.Yang
|
||||
* @version V1.1
|
||||
* @date 2026/5/14
|
||||
* @description TODO
|
||||
*/
|
||||
|
||||
public interface ISysApiLogService extends IService<SysApiLog> {
|
||||
|
||||
@Async("apiLogExecutor")
|
||||
void saveAsync(SysApiLog apiLog);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.nl.system.service.sysapi.service;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.system.service.sysapi.entity.SysApiLog;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author ManMan.Yang
|
||||
* @version V1.1
|
||||
* @date 2026/5/14
|
||||
* @description 外部系统外出接口出口日志记录Logger
|
||||
*/
|
||||
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class OutboundApiLogger {
|
||||
|
||||
private static ISysApiLogService apiLogService;
|
||||
|
||||
@Autowired
|
||||
public void setApiLogService(ISysApiLogService service) {
|
||||
OutboundApiLogger.apiLogService = service;
|
||||
}
|
||||
|
||||
public static void log(String systemFlag, String bizCode, String bizDesc,
|
||||
String apiUrl, String requestMethod, String requestParams,
|
||||
String responseBody, Integer responseStatus, Long costTime,
|
||||
String status, String errorMsg) {
|
||||
try {
|
||||
SysApiLog logEntity = new SysApiLog();
|
||||
logEntity.setLogId(IdUtil.getStringId());
|
||||
logEntity.setDirection(0);
|
||||
logEntity.setSystemFlag(systemFlag);
|
||||
logEntity.setBizCode(bizCode);
|
||||
logEntity.setBizDesc(bizDesc);
|
||||
logEntity.setTraceId(MDC.get("traceId"));
|
||||
logEntity.setApiUrl(apiUrl);
|
||||
logEntity.setRequestMethod(requestMethod);
|
||||
logEntity.setRequestParams(requestParams);
|
||||
logEntity.setResponseBody(responseBody);
|
||||
logEntity.setResponseStatus(responseStatus);
|
||||
logEntity.setCostTime(costTime);
|
||||
logEntity.setStatus(status);
|
||||
logEntity.setErrorMsg(errorMsg);
|
||||
logEntity.setCreateTime(DateUtil.now());
|
||||
|
||||
apiLogService.saveAsync(logEntity);
|
||||
} catch (Exception e) {
|
||||
log.error("记录出站接口日志失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void logSuccess(String systemFlag, String bizType, String bizDesc,
|
||||
String apiUrl, String requestMethod, String requestParams,
|
||||
String responseBody, Integer responseStatus, Long costTime) {
|
||||
log(systemFlag, bizType, bizDesc, apiUrl, requestMethod, requestParams,
|
||||
responseBody, responseStatus, costTime, "SUCCESS", null);
|
||||
}
|
||||
|
||||
public static void logFail(String systemFlag, String bizType, String bizDesc,
|
||||
String apiUrl, String requestMethod, String requestParams,
|
||||
String errorMsg, Long costTime) {
|
||||
log(systemFlag, bizType, bizDesc, apiUrl, requestMethod, requestParams,
|
||||
null, null, costTime, "FAIL", errorMsg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.nl.system.service.sysapi.service;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.system.service.sysapi.entity.SysApiLog;
|
||||
import org.nl.system.service.sysapi.mapper.SysApiLogMapper;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author ManMan.Yang
|
||||
* @version V1.1
|
||||
* @date 2026/5/14
|
||||
* @description TODO
|
||||
*/
|
||||
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SysApiLogServiceImpl extends ServiceImpl<SysApiLogMapper, SysApiLog> implements ISysApiLogService {
|
||||
|
||||
@Override
|
||||
@Async("apiLogExecutor")
|
||||
public void saveAsync(SysApiLog apiLog) {
|
||||
try {
|
||||
if (apiLog.getLogId() == null) {
|
||||
apiLog.setLogId(IdUtil.getStringId());
|
||||
}
|
||||
if (apiLog.getCreateTime() == null) {
|
||||
apiLog.setCreateTime(DateUtil.now());
|
||||
}
|
||||
this.save(apiLog);
|
||||
} catch (Exception e) {
|
||||
log.error("保存接口日志失败, logId: {}", apiLog.getLogId(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.ApiLog;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.ext.crm.service.CrmToLmsService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -22,16 +23,24 @@ public class CrmToLmsController {
|
||||
private final CrmToLmsService crmToLmsService;
|
||||
|
||||
@PostMapping("/getCustomerInfo")
|
||||
@Log("CRM给LMS推送客户信息")
|
||||
|
||||
// @Log("CRM给LMS推送客户信息")
|
||||
@ApiLog(
|
||||
bizCode = "/crm/getCustomerInfo",
|
||||
bizDesc = "CRM给LMS推送客户信息",
|
||||
systemFlag = "crm"
|
||||
)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> momRollFoilWeighing(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(crmToLmsService.getCustomerInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getCPIvtInfo")
|
||||
@Log("CRM获取LMS成品库存信息")
|
||||
|
||||
// @Log("CRM获取LMS成品库存信息")
|
||||
@ApiLog(
|
||||
bizCode = "/crm/getCPIvtInfo",
|
||||
bizDesc = "CRM获取LMS成品库存信息",
|
||||
systemFlag = "crm"
|
||||
)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getCPIvtInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(crmToLmsService.getCPIvtInfo(jo), HttpStatus.OK);
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.ApiLog;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.ext.mdm.entity.CommonResponseDto;
|
||||
import org.nl.wms.ext.mdm.service.MdmToLmsService;
|
||||
@@ -34,20 +35,38 @@ public class MdmToLmsController {
|
||||
private MdmToLmsService mdmToLmsService;
|
||||
|
||||
@PostMapping("/transCustomerInfo")
|
||||
@Log("MDM给LMS推送客户信息")
|
||||
// @Log("MDM给LMS推送客户信息")
|
||||
@ApiLog(
|
||||
bizCode = "/mdm/transCustomerInfo",
|
||||
bizDesc = "MDM给LMS推送客户信息",
|
||||
systemFlag = "mdm"
|
||||
)
|
||||
@SaIgnore
|
||||
public CommonResponseDto transCustomerInfo(@RequestBody JSONObject jsonData){
|
||||
return mdmToLmsService.transCustomerInfo(jsonData);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/transSupplierInfo")
|
||||
@Log("MDM给LMS推送供应商信息")
|
||||
// @Log("MDM给LMS推送供应商信息")
|
||||
@ApiLog(
|
||||
bizCode = "/mdm/transSupplierInfo",
|
||||
bizDesc = "MDM给LMS推送供应商信息",
|
||||
systemFlag = "mdm"
|
||||
)
|
||||
@SaIgnore
|
||||
public CommonResponseDto transSupplierInfo(@RequestBody JSONObject jsonData){
|
||||
return mdmToLmsService.transSupplierInfo(jsonData);
|
||||
}
|
||||
|
||||
@PostMapping("/transMaterialInfo")
|
||||
@Log("MDM给LMS推送物料主数据信息")
|
||||
// @Log("MDM给LMS推送物料主数据信息")
|
||||
@ApiLog(
|
||||
bizCode = "/mdm/transMaterialInfo",
|
||||
bizDesc = "MDM给LMS推送物料主数据信息",
|
||||
systemFlag = "mdm"
|
||||
)
|
||||
@SaIgnore
|
||||
public CommonResponseDto transMaterialInfo(@RequestBody JSONObject jsonData){
|
||||
return mdmToLmsService.transMaterialInfo(jsonData);
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ package org.nl.wms.ext.mdm.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
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 com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
@@ -50,7 +50,7 @@ public class MdmToLmsServiceImpl implements MdmToLmsService {
|
||||
for (int i = 0; i < customers.size(); i++) {
|
||||
JSONObject json = customers.getJSONObject(i);
|
||||
//主编码主键
|
||||
long mdId = json.getLongValue("mdId");
|
||||
long mdId = IdUtil.getLongId();
|
||||
//客户编号
|
||||
String mdCode = json.getString("mdCode");
|
||||
//主数据描述
|
||||
@@ -151,7 +151,7 @@ public class MdmToLmsServiceImpl implements MdmToLmsService {
|
||||
for (int i = 0; i < supplier.size(); i++) {
|
||||
JSONObject json = supplier.getJSONObject(i);
|
||||
//主编码主键
|
||||
long mdId = json.getLongValue("mdId");
|
||||
long mdId = IdUtil.getLongId();
|
||||
//客户编号
|
||||
String mdCode = json.getString("mdCode");
|
||||
//主数据描述
|
||||
@@ -230,7 +230,7 @@ public class MdmToLmsServiceImpl implements MdmToLmsService {
|
||||
for (int i = 0; i < materiels.size(); i++) {
|
||||
JSONObject json = materiels.getJSONObject(i);
|
||||
//主编码主键
|
||||
long mdId = json.getLongValue("mdId");
|
||||
long mdId = IdUtil.getLongId();
|
||||
//物料编码
|
||||
String mdCode = json.getString("mdCode");
|
||||
//物料名称
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.ApiLog;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.ext.mes.service.MesToLmsService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -23,177 +24,302 @@ public class MesToLmsController {
|
||||
private final MesToLmsService mesToLmsService;
|
||||
|
||||
@PostMapping("/momRollFoilStart")
|
||||
@Log("母卷批次创建信息发送智能物流(MES生箔工序Move In)")
|
||||
// @Log("母卷批次创建信息发送智能物流(MES生箔工序Move In)")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/momRollFoilStart",
|
||||
bizDesc = "母卷批次创建信息发送智能物流(MES生箔工序Move In)",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> momRollFoilStart(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.momRollFoilStart(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("momRollFoilWeighing")
|
||||
@Log("MES获取AGV称重信息")
|
||||
// @Log("MES获取AGV称重信息")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/momRollFoilWeighing",
|
||||
bizDesc = "MES获取AGV称重信息",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> momRollFoilWeighing(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.momRollFoilWeighing(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/momRollFoilComplete")
|
||||
@Log("MES执行下卷动作告诉LMS")
|
||||
// @Log("MES执行下卷动作告诉LMS")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/momRollFoilComplete",
|
||||
bizDesc = "MES执行下卷动作告诉LMS",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> momRollFoilComplete(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.momRollFoilComplete(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/momRollBakeNextSpecTransfer")
|
||||
@Log("MES下达烘箱温度和时间配方给智能物流(MES 包装防护工序Move Out)")
|
||||
// @Log("MES下达烘箱温度和时间配方给智能物流(MES 包装防护工序Move Out)")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/momRollBakeNextSpecTransfer",
|
||||
bizDesc = "MES下达烘箱温度和时间配方给智能物流(MES 包装防护工序Move Out)",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> momRollBakeNextSpecTransfer(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.momRollBakeNextSpecTransfer(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/cutPlanTransfer")
|
||||
@Log("分切包装段:分切计划(单表,包含母卷/改制子卷-包装箱号、空包装箱物料、纸筒/FRP管)MES下发智能物流")
|
||||
// @Log("分切包装段:分切计划(单表,包含母卷/改制子卷-包装箱号、空包装箱物料、纸筒/FRP管)MES下发智能物流")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/cutPlanTransfer",
|
||||
bizDesc = "分切包装段:分切计划(单表,包含母卷/改制子卷-包装箱号、空包装箱物料、纸筒/FRP管)MES下发智能物流",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> cutPlanTransfer(@RequestBody JSONArray ja) {
|
||||
return new ResponseEntity<>(mesToLmsService.cutPlanTransfer(ja), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/callNextAssAndMomRoll")
|
||||
@Log("分切即将完成,呼叫配送下一个母卷/改制子卷,MES传智能物流")
|
||||
// @Log("分切即将完成,呼叫配送下一个母卷/改制子卷,MES传智能物流")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/callNextAssAndMomRoll",
|
||||
bizDesc = "分切即将完成,呼叫配送下一个母卷/改制子卷,MES传智能物流",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> callNextAssAndMomRoll(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.callNextAssAndMomRoll(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/childRollCutStartComp")
|
||||
@Log("当母卷开始分切时,MES系统会将对应的子卷进站信息发送给只能物流系统,一方面物流系统可以预估下个母卷的送达时间,也可以闭环期分切计划指令")
|
||||
// @Log("当母卷开始分切时,MES系统会将对应的子卷进站信息发送给只能物流系统,一方面物流系统可以预估下个母卷的送达时间,也可以闭环期分切计划指令")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/childRollCutStartComp",
|
||||
bizDesc = "当母卷开始分切时,MES系统会将对应的子卷进站信息发送给只能物流系统,一方面物流系统可以预估下个母卷的送达时间,也可以闭环期分切计划指令",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> childRollCutStartComp(@RequestBody JSONArray ja) {
|
||||
return new ResponseEntity<>(mesToLmsService.childRollCutStartComp(ja), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/childRollPackComplete")
|
||||
@Log("包装完成,传智能物流包装箱与子卷关系及子卷属性值,LMS执行入库")
|
||||
// @Log("包装完成,传智能物流包装箱与子卷关系及子卷属性值,LMS执行入库")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/childRollPackComplete",
|
||||
bizDesc = "包装完成,传智能物流包装箱与子卷关系及子卷属性值,LMS执行入库",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> childRollPackComplete(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.childRollPackComplete(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/inventoryTransferInfoSync")
|
||||
@Log("转单指令在MES平台查看后,更新信息,发送LMS(是否拆包、更新后的入库日期、是否更换外包装箱标签),LMS重打子卷标签、包装箱外标签")
|
||||
// @Log("转单指令在MES平台查看后,更新信息,发送LMS(是否拆包、更新后的入库日期、是否更换外包装箱标签),LMS重打子卷标签、包装箱外标签")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/inventoryTransferInfoSync",
|
||||
bizDesc = "转单指令在MES平台查看后,更新信息,发送LMS(是否拆包、更新后的入库日期、是否更换外包装箱标签),LMS重打子卷标签、包装箱外标签",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> inventoryTransferInfoSync(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.inventoryTransferInfoSync(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/childRollInfoUpdate")
|
||||
@Log("子卷信息更新:计划外需求有可能入库完成后,ERP才回传计划外需求SalesOrder")
|
||||
// @Log("子卷信息更新:计划外需求有可能入库完成后,ERP才回传计划外需求SalesOrder")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/childRollInfoUpdate",
|
||||
bizDesc = "子卷信息更新:计划外需求有可能入库完成后,ERP才回传计划外需求SalesOrder",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> childRollInfoUpdate(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.childRollInfoUpdate(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/cutPlanTransferCancel")
|
||||
@Log("分切计划取消")
|
||||
// @Log("分切计划取消")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/cutPlanTransferCancel",
|
||||
bizDesc = "分切计划取消",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> cutPlanTransferCancel(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.cutPlanTransferCancel(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendAuditResult")
|
||||
@Log("子卷审批结果")
|
||||
// @Log("子卷报废审批结果回传")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/sendAuditResult",
|
||||
bizDesc = "子卷报废审批结果回传",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> sendAuditResult(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.sendAuditResult(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendProcessInfo")
|
||||
@Log("表处母卷上料、下料接口")
|
||||
// @Log("表处母卷上料、下料接口")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/sendProcessInfo",
|
||||
bizDesc = "表处母卷上料、下料接口",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> sendProcessInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.sendProcessInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/momRollTRStartMock")
|
||||
@Log("表处工单推送")
|
||||
// @Log("表处工单推送")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/momRollTRStartMock",
|
||||
bizDesc = "表处工单推送",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> processFoilStart(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.processFoilStart(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/sendTargetHouse")
|
||||
@Log("MES传递给LMS入线边库或者入成品库")
|
||||
// @Log("MES传递给LMS入线边库或者入成品库")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/sendTargetHouse",
|
||||
bizDesc = "MES传递给LMS入线边库或者入成品库",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> sendTargetHouse(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.sendTargetHouse(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/momSendSplitMfgOrderBOM")
|
||||
@Log("MES传递LMS订单BOM")
|
||||
// @Log("MES传递LMS订单BOM")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/momSendSplitMfgOrderBOM",
|
||||
bizDesc = "MES传递LMS订单BOM",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> momSendSplitMfgOrderBOM(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.momSendSplitMfgOrderBOM(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getRollInfo")
|
||||
@Log("MES传递LMS获取子卷重量信息")
|
||||
// @Log("MES传递LMS获取子卷重量信息")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/getRollInfo",
|
||||
bizDesc = "MES传递LMS获取子卷重量信息",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> getRollInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.getRollInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendLevelInfo")
|
||||
@Log("MES传递LMS定级数据")
|
||||
// @Log("MES传递LMS定级数据")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/sendLevelInfo",
|
||||
bizDesc = "MES传递LMS定级数据",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> sendLevelInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.sendLevelInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/containerNeedDown")
|
||||
@Log("子卷拼接完成是否下轴")
|
||||
// @Log("子卷拼接完成是否下轴")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/containerNeedDown",
|
||||
bizDesc = "子卷拼接完成是否下轴",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> containerNeedDown(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.containerNeedDown(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendSubInfo")
|
||||
@Log("子卷下料信息MES传递给LMS")
|
||||
// @Log("子卷下料信息MES传递给LMS")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/sendSubInfo",
|
||||
bizDesc = "子卷下料信息MES传递给LMS",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> sendSubInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.sendSubInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/changeSect")
|
||||
@Log("MES传递给LMS入线边库或者入成品库、撤销入线边库、人工改变入线边还是包装")
|
||||
// @Log("MES传递给LMS入线边库或者入成品库、撤销入线边库、人工改变入线边还是包装")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/changeSect",
|
||||
bizDesc = "MES传递给LMS入线边库或者入成品库、撤销入线边库、人工改变入线边还是包装",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> changeSect(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.sendTargetHouse(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getWasteFoilWeight")
|
||||
@Log("分切子卷获取LMS,AGV废箔称重重量")
|
||||
// @Log("分切子卷获取LMS,AGV废箔称重重量")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/getWasteFoilWeight",
|
||||
bizDesc = "分切子卷获取LMS,AGV废箔称重重量",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> getWasteFoilWeight(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.getWasteFoilWeight(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/WasteFoilSuccess")
|
||||
@Log("分切子卷获取LMS,AGV废箔称重重量")
|
||||
// @Log("分切子卷获取LMS,AGV废箔称重重量")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/WasteFoilSuccess",
|
||||
bizDesc = "分切子卷获取LMS,AGV废箔称重重量",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> WasteFoilSuccess(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.WasteFoilSuccess(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/boxIsPass")
|
||||
@Log("飞书通知LMS木箱是否通过")
|
||||
// @Log("飞书通知LMS木箱是否通过")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/boxIsPass",
|
||||
bizDesc = "飞书通知LMS木箱是否通过",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> boxIsPass(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.boxIsPass(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/changeBomInfo")
|
||||
@Log("MES更新LMS分切工单、订单BOM信息")
|
||||
// @Log("MES更新LMS分切工单、订单BOM信息")
|
||||
@SaIgnore
|
||||
@ApiLog(
|
||||
bizCode = "/mes/changeBomInfo",
|
||||
bizDesc = "MES更新LMS分切工单、订单BOM信息",
|
||||
systemFlag = "mes"
|
||||
)
|
||||
public ResponseEntity<Object> changeBomInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.changeBomInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.ext.mes.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -24,6 +25,7 @@ import org.nl.modules.wql.WQL;
|
||||
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.system.service.sysapi.service.OutboundApiLogger;
|
||||
import org.nl.wms.ext.mes.service.LmsToMesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -61,7 +63,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
@Override
|
||||
public JSONObject momRollFoilWeighing(JSONObject param) {
|
||||
log.info("momRollFoilWeighing接口输入参数为:-------------------" + param);
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
JSONObject result = new JSONObject();
|
||||
if (StrUtil.equals("0", is_connect_mes)) {
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
@@ -94,8 +96,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// 记录失败日志
|
||||
OutboundApiLogger.logFail("mes", "/sap/center/lms/004", "LMS的PDA操作AGV下卷,AGV称重完成后AGV称重信息发送MES",
|
||||
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
|
||||
System.currentTimeMillis() - startTime);
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
// 记录成功日志
|
||||
OutboundApiLogger.logSuccess("sap", "/sap/center/lms/004", "LMS的PDA操作AGV下卷,AGV称重完成后AGV称重信息发送MES",
|
||||
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
|
||||
System.currentTimeMillis() - startTime);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -135,7 +145,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
result.put("data", new JSONObject());
|
||||
return result;
|
||||
}
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
|
||||
String api = "CamstarApi/MomRollBakeInBound";
|
||||
url = url + api;
|
||||
@@ -152,8 +162,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 记录失败日志
|
||||
OutboundApiLogger.logFail("mes", "/CamstarApi/MomRollBakeInBound", "智能桁架将母卷调进烘箱完成,智能物流发送MES",
|
||||
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
|
||||
System.currentTimeMillis() - startTime);
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
// 记录成功日志
|
||||
OutboundApiLogger.logSuccess("mes", "/CamstarApi/MomRollBakeInBound", "智能桁架将母卷调进烘箱完成,智能物流发送MES",
|
||||
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
|
||||
System.currentTimeMillis() - startTime);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -194,7 +212,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
|
||||
String Password = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||
param.put("UserName", UserName);
|
||||
@@ -216,8 +234,15 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 记录失败日志
|
||||
OutboundApiLogger.logFail("mes", "/CamstarApi/MomRollBakeOutBound", "母卷出烘箱信息智能物流传MES",
|
||||
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
|
||||
System.currentTimeMillis() - startTime);
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
OutboundApiLogger.logSuccess("mes", "/CamstarApi/MomRollBakeOutBound", "母卷出烘箱信息智能物流传MES",
|
||||
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
|
||||
System.currentTimeMillis() - startTime);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -449,7 +474,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
result.put("data", new JSONObject());
|
||||
return result;
|
||||
}
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("iPackageBoxSN", PackageBoxSN);
|
||||
jo.put("iSpec", "FGPRODUCT");
|
||||
@@ -482,8 +507,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// 记录失败日志
|
||||
OutboundApiLogger.logFail("mes", "/CamstarApi/ChildRollFGInboundComplete", "入库完成,LMS回传MES,MES成品入库Move Out",
|
||||
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
|
||||
System.currentTimeMillis() - startTime);
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
// 记录成功日志
|
||||
OutboundApiLogger.logSuccess("mes", "/CamstarApi/ChildRollFGInboundComplete", "入库完成,LMS回传MES,MES成品入库Move Out",
|
||||
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
|
||||
System.currentTimeMillis() - startTime);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -505,7 +538,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
result.put("data", new JSONObject());
|
||||
return result;
|
||||
}
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
|
||||
String api = "CamstarApi/ChildRollFGOutboundComplete";
|
||||
url = url + api;
|
||||
@@ -525,8 +558,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// 记录失败日志
|
||||
OutboundApiLogger.logFail("mes", "/CamstarApi/ChildRollFGOutboundComplete", "发货完成,LMS同步MES子卷及包装箱状态,MES更新信息",
|
||||
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
|
||||
System.currentTimeMillis() - startTime);
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
// 记录成功日志
|
||||
OutboundApiLogger.logSuccess("mes", "/CamstarApi/ChildRollFGOutboundComplete", "发货完成,LMS同步MES子卷及包装箱状态,MES更新信息",
|
||||
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
|
||||
System.currentTimeMillis() - startTime);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -547,7 +588,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
result.put("data", new JSONObject());
|
||||
return result;
|
||||
}
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
|
||||
String api = "CamstarApi/LMSUnPackage";
|
||||
url = url + api;
|
||||
@@ -573,8 +614,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// 记录失败日志
|
||||
OutboundApiLogger.logFail("mes", "/CamstarApi/LMSUnPackage", "拆箱出库:回传mes箱号、子卷号",
|
||||
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
|
||||
System.currentTimeMillis() - startTime);
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
// 记录成功日志
|
||||
OutboundApiLogger.logSuccess("mes", "/CamstarApi/LMSUnPackage", "拆箱出库:回传mes箱号、子卷号",
|
||||
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
|
||||
System.currentTimeMillis() - startTime);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -595,7 +644,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
result.put("data", new JSONObject());
|
||||
return result;
|
||||
}
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
|
||||
String api = "CamstarApi/LMSPackage";
|
||||
url = url + api;
|
||||
@@ -621,8 +670,16 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// 记录失败日志
|
||||
OutboundApiLogger.logFail("mes", "/CamstarApi/LMSPackage", "拆箱入库:回传mes箱号、子卷号",
|
||||
url, "POST", JSONUtil.toJsonStr(param), e.getMessage(),
|
||||
System.currentTimeMillis() - startTime);
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
// 记录成功日志
|
||||
OutboundApiLogger.logSuccess("mes", "/CamstarApi/LMSPackage", "拆箱入库:回传mes箱号、子卷号",
|
||||
url, "POST", JSONUtil.toJsonStr(param), result.toString(), 200,
|
||||
System.currentTimeMillis() - startTime);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ public class LmsToSapController {
|
||||
|
||||
@PostMapping("/returnDelivery")
|
||||
@Log("LMS回传SAP交货单")
|
||||
|
||||
public ResponseEntity<Object> returnDelivery(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(LmsToSapService.returnDelivery(jo), HttpStatus.OK);
|
||||
}
|
||||
@@ -41,4 +40,11 @@ public class LmsToSapController {
|
||||
return new ResponseEntity<>(LmsToSapService.returnOutDtl(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/returnScrapDtl")
|
||||
@Log("LMS成品报废明细回传")
|
||||
|
||||
public ResponseEntity<Object> returnScrapDtl(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(LmsToSapService.returnScrapDtl(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.ApiLog;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.ext.sap.service.SapToLmsService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -23,48 +24,72 @@ public class SapToLmsController {
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/getMaterialInfo")
|
||||
@Log("SAP给LMS推送物料信息")
|
||||
|
||||
// @Log("SAP给LMS推送物料信息")
|
||||
@ApiLog(
|
||||
bizCode = "/sap/getMaterialInfo",
|
||||
bizDesc = "SAP给LMS推送物料信息",
|
||||
systemFlag = "sap"
|
||||
)
|
||||
public ResponseEntity<Object> getMaterialInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(sapToLmsService.getMaterialInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/getDeliveryInfo")
|
||||
@Log("SAP给LMS推送交货单信息")
|
||||
|
||||
// @Log("SAP给LMS推送交货单信息")
|
||||
@ApiLog(
|
||||
bizCode = "/sap/getDeliveryInfo",
|
||||
bizDesc = "SAP给LMS推送交货单信息",
|
||||
systemFlag = "sap"
|
||||
)
|
||||
public ResponseEntity<Object> getDeliveryInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(sapToLmsService.getDeliveryInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/getReturnDeliveryInfo")
|
||||
@Log("SAP给LMS推送退货交货单信息")
|
||||
|
||||
// @Log("SAP给LMS推送退货交货单信息")
|
||||
@ApiLog(
|
||||
bizCode = "/sap/getReturnDeliveryInfo",
|
||||
bizDesc = "SAP给LMS推送退货交货单信息",
|
||||
systemFlag = "sap"
|
||||
)
|
||||
public ResponseEntity<Object> getReturnDeliveryInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(sapToLmsService.getReturnDeliveryInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/getCannibalize")
|
||||
@Log("SAP给LMS推送调拨出库单")
|
||||
|
||||
// @Log("SAP给LMS推送调拨出库单")
|
||||
@ApiLog(
|
||||
bizCode = "/sap/getCannibalize",
|
||||
bizDesc = "SAP给LMS推送调拨出库单",
|
||||
systemFlag = "sap"
|
||||
)
|
||||
public ResponseEntity<Object> getCannibalize(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(sapToLmsService.getCannibalize(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/getReCutInfo")
|
||||
@Log("SAP给LMS推送改切出库单")
|
||||
|
||||
// @Log("SAP给LMS推送改切出库单")
|
||||
@ApiLog(
|
||||
bizCode = "/sap/getReCutInfo",
|
||||
bizDesc = "SAP给LMS推送改切出库单",
|
||||
systemFlag = "sap"
|
||||
)
|
||||
public ResponseEntity<Object> getReCutInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(sapToLmsService.getReCutInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/getUnPlanInfo")
|
||||
@Log("SAP给LMS推送计划外子卷转单信息")
|
||||
|
||||
// @Log("SAP给LMS推送计划外子卷转单信息")
|
||||
@ApiLog(
|
||||
bizCode = "/sap/getUnPlanInfo",
|
||||
bizDesc = "SAP给LMS推送计划外子卷转单信息",
|
||||
systemFlag = "sap"
|
||||
)
|
||||
public ResponseEntity<Object> getUnPlanInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(sapToLmsService.getUnPlanInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -52,4 +52,21 @@ public interface LmsToSapService {
|
||||
* KALAB 重量
|
||||
*/
|
||||
JSONObject returnOutDtl(JSONObject jo);
|
||||
|
||||
/*
|
||||
WERKS 工厂
|
||||
MATNR 物料编码
|
||||
LGORT 库存地点
|
||||
CHARG SAP批次
|
||||
BDMNG 数量
|
||||
ZCJZ 返检修改差异重量
|
||||
ZGHZL 返检修改后重量
|
||||
VRKME 单位
|
||||
Z1 MES批次
|
||||
VBELN 销售订单
|
||||
POSNR 销售订单行
|
||||
ZYDYY 移动原因
|
||||
ZLYXT 来源系统
|
||||
*/
|
||||
JSONObject returnScrapDtl(JSONObject jo);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.ext.sap.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -9,6 +10,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.system.service.sysapi.service.OutboundApiLogger;
|
||||
import org.nl.wms.ext.sap.service.LmsToSapService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -38,7 +40,7 @@ public class LmsToSapServiceImpl implements LmsToSapService {
|
||||
* */
|
||||
{
|
||||
log.info("returnDelivery接口输入参数为:-------------------" + jo.toString());
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
JSONObject result = new JSONObject();
|
||||
String isConnect = "1";
|
||||
if (StrUtil.equals("0", isConnect)) {
|
||||
@@ -68,8 +70,16 @@ public class LmsToSapServiceImpl implements LmsToSapService {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// 记录失败日志
|
||||
OutboundApiLogger.logFail("sap", "/sap/center/lms/004", "LMS回传SAP交货单",
|
||||
url, "POST", JSONUtil.toJsonStr(jo), e.getMessage(),
|
||||
System.currentTimeMillis() - startTime);
|
||||
throw new BadRequestException("SAP提示错误:" + e.getMessage());
|
||||
}
|
||||
// 记录成功日志
|
||||
OutboundApiLogger.logSuccess("sap", "/sap/center/lms/004", "LMS回传SAP交货单",
|
||||
url, "POST", JSONUtil.toJsonStr(jo), result.toString(), 200,
|
||||
System.currentTimeMillis() - startTime);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -100,7 +110,7 @@ public class LmsToSapServiceImpl implements LmsToSapService {
|
||||
* */
|
||||
{
|
||||
log.info("returnMoveDtl接口输入参数为:-------------------" + jo.toString());
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
JSONObject result = new JSONObject();
|
||||
String isConnect = "1";
|
||||
if (StrUtil.equals("0", isConnect)) {
|
||||
@@ -129,8 +139,15 @@ public class LmsToSapServiceImpl implements LmsToSapService {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// 记录失败日志
|
||||
OutboundApiLogger.logFail("sap", "/sap/center/lms/005", "LMS移库接口回传",
|
||||
url, "POST", JSONUtil.toJsonStr(jo), e.getMessage(),
|
||||
System.currentTimeMillis() - startTime);
|
||||
throw new BadRequestException("SAP提示错误:" + e.getMessage());
|
||||
}
|
||||
OutboundApiLogger.logSuccess("sap", "/sap/center/lms/005", "LMS移库接口回传",
|
||||
url, "POST", JSONUtil.toJsonStr(jo), result.toString(), 200,
|
||||
System.currentTimeMillis() - startTime);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -139,7 +156,7 @@ public class LmsToSapServiceImpl implements LmsToSapService {
|
||||
public JSONObject returnOutDtl(JSONObject jo) {
|
||||
{
|
||||
log.info("returnOutDtl接口输入参数为:-------------------" + jo.toString());
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
JSONObject result = new JSONObject();
|
||||
String isConnect = "1";
|
||||
if (StrUtil.equals("0", isConnect)) {
|
||||
@@ -170,8 +187,65 @@ public class LmsToSapServiceImpl implements LmsToSapService {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// 记录失败日志
|
||||
OutboundApiLogger.logFail("sap", "/sap/center/lms/007", "LMS调拨出库接口回传",
|
||||
url, "POST", JSONUtil.toJsonStr(jo), e.getMessage(),
|
||||
System.currentTimeMillis() - startTime);
|
||||
throw new BadRequestException("SAP提示错误:" + e.getMessage());
|
||||
}
|
||||
// 记录成功日志
|
||||
OutboundApiLogger.logSuccess("sap", "/sap/center/lms/007", "LMS调拨出库接口回传",
|
||||
url, "POST", JSONUtil.toJsonStr(jo), result.toString(), 200,
|
||||
System.currentTimeMillis() - startTime);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject returnScrapDtl(JSONObject jo) {
|
||||
{
|
||||
log.info("returnScrapDtl接口输入参数为:-------------------" + jo.toString());
|
||||
long startTime = System.currentTimeMillis();
|
||||
JSONObject result = new JSONObject();
|
||||
String isConnect = "1";
|
||||
if (StrUtil.equals("0", isConnect)) {
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "下发成功,但未连接MES!");
|
||||
result.put("data", new JSONObject());
|
||||
return result;
|
||||
}
|
||||
|
||||
JSONArray list = new JSONArray();
|
||||
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("SAP_URL").getValue();
|
||||
String token = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("SAP_TOKEN").getValue();
|
||||
String sap_client = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("SAP_CLIENT").getValue();
|
||||
String api = "/sap/center/lms/001";
|
||||
url = url + api;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url).header("TOKEN", token)
|
||||
.header("sap-client", sap_client)
|
||||
.body(String.valueOf(jo))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
log.info("returnScrapDtl接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
String type = result.getString("TYPE");
|
||||
if (StrUtil.equals(type, "E")) {
|
||||
throw new BadRequestException(result.getString("MESSAGE"));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// 记录失败日志
|
||||
OutboundApiLogger.logFail("sap", "/sap/center/lms/001", "LMS成品报废明细回传",
|
||||
url, "POST", JSONUtil.toJsonStr(jo), e.getMessage(),
|
||||
System.currentTimeMillis() - startTime);
|
||||
throw new BadRequestException("SAP提示错误:" + e.getMessage());
|
||||
}
|
||||
// 记录成功日志
|
||||
OutboundApiLogger.logSuccess("sap", "/sap/center/lms/001", "LMS成品报废明细回传",
|
||||
url, "POST", JSONUtil.toJsonStr(jo), result.toString(), 200,
|
||||
System.currentTimeMillis() - startTime);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,8 +182,8 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
||||
|
||||
//查询仓库
|
||||
JSONObject stor = new JSONObject();
|
||||
if ("BC01".equals(sub_jo.getString("ext_code"))) {
|
||||
stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_delete = '0' AND is_used = '1' AND is_productstore = '0' AND stor_code = 'BC01'").uniqueResult(0);
|
||||
if ("F002".equals(sub_jo.getString("ext_code"))) {
|
||||
stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_delete = '0' AND is_used = '1' AND is_productstore = '0' AND stor_code = 'F002'").uniqueResult(0);
|
||||
} else {
|
||||
stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_delete = '0' AND is_used = '1' AND is_productstore = '1'").uniqueResult(0);
|
||||
}
|
||||
@@ -206,7 +206,7 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
||||
|
||||
//判断是否虚拟
|
||||
if (!"1".equals(is_virtual)) {
|
||||
if ("BC01".equals(sub_jo.getString("ext_code"))) {
|
||||
if ("F002".equals(sub_jo.getString("ext_code"))) {
|
||||
throw new BadRequestException("二期仓库木箱,请进行虚拟入库!");
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
||||
// 木箱实称重重量
|
||||
double real_weight = sub_jo.getDoubleValue("real_weight");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(sub_jo.getString("real_weight")) && "AC01".equals(sub_jo.getString("ext_code"))) {
|
||||
if (ObjectUtil.isNotEmpty(sub_jo.getString("real_weight")) && "F001".equals(sub_jo.getString("ext_code"))) {
|
||||
// 判断木箱毛重是否超标
|
||||
if (NumberUtil.sub(box_weight, weight_sys) <= real_weight && NumberUtil.add(box_weight, weight_sys) >= real_weight) {
|
||||
} else {
|
||||
@@ -413,7 +413,7 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
||||
|
||||
String task_id = IdUtil.getLongId() + "";
|
||||
//直接分配虚拟区货位,并确认
|
||||
if ("BC01".equals(sub_jo.getString("ext_code"))) {
|
||||
if ("F002".equals(sub_jo.getString("ext_code"))) {
|
||||
JSONObject jsonObject = WQLObject.getWQLObject("st_ivt_sectattr").query("sect_id = '" + whereJson.getString("sect_id") + "'")
|
||||
.uniqueResult(0);
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
mst.is_delete = '0'
|
||||
AND mst.io_type = '1'
|
||||
AND point.point_type = '8'
|
||||
AND mst.stor_code = 'BC01'
|
||||
AND mst.stor_code = 'F002'
|
||||
|
||||
OPTION 输入.box_no <> ""
|
||||
point.vehicle_code LIKE 输入.box_no
|
||||
@@ -315,4 +315,4 @@
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
@@ -4,9 +4,9 @@ package org.nl.wms.sch;
|
||||
* 仓库枚举
|
||||
*/
|
||||
public enum AutoQueryEnum {
|
||||
AC01("01", "兰州一期仓库", "1582991156504039424"),
|
||||
BC01("02", "兰州二期仓库", "1582991156504039455"),
|
||||
WK01("03", "东莞仓库", "1597073830499717120");
|
||||
F001("01", "铜箔一期成品库", "1582991156504039424"),
|
||||
F002("02", "铜箔二期成品库", "1582991156504039455"),
|
||||
F037("03", "东莞仓库", "1597073830499717120");
|
||||
|
||||
private String name;
|
||||
private String code;
|
||||
|
||||
@@ -711,34 +711,34 @@ public class AutoQueryProudDayData {
|
||||
|
||||
// 兰州一期仓(除BC)
|
||||
List<JSONObject> collect = dataList.stream()
|
||||
.filter(row -> row.getString("stor_id").equals(AutoQueryEnum.AC01.getId()))
|
||||
.filter(row -> row.getString("stor_id").equals(AutoQueryEnum.F001.getId()))
|
||||
.filter(row -> !custBandC.contains(row.getString("customer_name")))
|
||||
.collect(Collectors.toList());
|
||||
result.put("Customerqty1", NumberUtil.round(collect.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.00).toString(), 2) + "");
|
||||
|
||||
// 兰州二期仓(除BC)
|
||||
List<JSONObject> collect2 = dataList.stream()
|
||||
.filter(row -> row.getString("stor_id").equals(AutoQueryEnum.BC01.getId()))
|
||||
.filter(row -> row.getString("stor_id").equals(AutoQueryEnum.F002.getId()))
|
||||
.filter(row -> !custBandC.contains(row.getString("customer_name")))
|
||||
.collect(Collectors.toList());
|
||||
result.put("Customerqty2", NumberUtil.round(collect2.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.00).toString(), 2) + "");
|
||||
|
||||
// 东莞仓
|
||||
List<JSONObject> collect3 = dataList.stream()
|
||||
.filter(row -> row.getString("stor_id").equals(AutoQueryEnum.WK01.getId()))
|
||||
.filter(row -> row.getString("stor_id").equals(AutoQueryEnum.F037.getId()))
|
||||
.collect(Collectors.toList());
|
||||
result.put("Customerqty3", NumberUtil.round(collect3.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.00).toString(), 2) + "");
|
||||
|
||||
// 兰州一期仓(B)
|
||||
List<JSONObject> collect4 = dataList.stream()
|
||||
.filter(row -> row.getString("stor_id").equals(AutoQueryEnum.AC01.getId()))
|
||||
.filter(row -> row.getString("stor_id").equals(AutoQueryEnum.F001.getId()))
|
||||
.filter(row -> custB.contains(row.getString("customer_name")))
|
||||
.collect(Collectors.toList());
|
||||
result.put("Customerqty4", NumberUtil.round(collect4.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.00).toString(), 2) + "");
|
||||
|
||||
// 兰州一期仓(C)
|
||||
List<JSONObject> collect5 = dataList.stream()
|
||||
.filter(row -> row.getString("stor_id").equals(AutoQueryEnum.AC01.getId()))
|
||||
.filter(row -> row.getString("stor_id").equals(AutoQueryEnum.F001.getId()))
|
||||
.filter(row -> custC.contains(row.getString("customer_name")))
|
||||
.collect(Collectors.toList());
|
||||
result.put("Customerqty5", NumberUtil.round(collect5.stream().map(row -> row.getDoubleValue("num")).reduce(Double::sum).orElse(0.00).toString(), 2) + "");
|
||||
|
||||
@@ -34,7 +34,7 @@ public class AutoQueryUpload {
|
||||
if (tryLock){
|
||||
//查询已经处于分配中、分配完但还未回传给MES的销售出库单
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_iostorinv");
|
||||
JSONArray send_rows = wo.query("bill_type = '1001' AND bill_status IN ( '30', '40' ) AND stor_code = 'AC01' AND upload_mes = '0' AND is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray send_rows = wo.query("bill_type = '1001' AND bill_status IN ( '30', '40' ) AND stor_code = 'F001' AND upload_mes = '0' AND is_delete = '0'").getResultJSONArray(0);
|
||||
this.sendInfo(send_rows);
|
||||
}
|
||||
}finally {
|
||||
|
||||
@@ -108,6 +108,7 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
mst_jo.put("biz_date", DateUtil.today());
|
||||
mst_jo.put("stor_id", MapUtil.getStr(map, "stor_id"));
|
||||
mst_jo.put("stor_code", MapUtil.getStr(map, "stor_code"));
|
||||
mst_jo.put("scrap_type", MapUtil.getStr(map, "scrap_type"));
|
||||
mst_jo.put("stor_name", MapUtil.getStr(map, "stor_name"));
|
||||
mst_jo.put("bill_status", "10");
|
||||
mst_jo.put("input_optid", currentUserId + "");
|
||||
@@ -215,6 +216,10 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
WQLObject ivt = WQLObject.getWQLObject("st_ivt_structivt");
|
||||
|
||||
try {
|
||||
String scrap_type = whereJson.getString("scrap_type");
|
||||
if(StrUtil.isEmpty(scrap_type)){
|
||||
scrap_type = "1002";
|
||||
}
|
||||
// 查询所有明细
|
||||
JSONArray dtlArr = dtl.query("scrap_id = '" + whereJson.getString("scrap_id") + "'").getResultJSONArray(0);
|
||||
|
||||
@@ -253,8 +258,8 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
||||
jsonOutMst.put("create_mode", "03");
|
||||
jsonOutMst.put("biz_date", DateUtil.now());
|
||||
jsonOutMst.put("io_type", "1");
|
||||
jsonOutMst.put("buss_type", "1002");
|
||||
jsonOutMst.put("bill_type", "1002");
|
||||
jsonOutMst.put("buss_type", scrap_type);
|
||||
jsonOutMst.put("bill_type", scrap_type);
|
||||
jsonOutMst.put("source_name", "成品报废审核单");
|
||||
|
||||
JSONArray tableData = new JSONArray();
|
||||
|
||||
@@ -127,4 +127,4 @@
|
||||
code = 'FAIL_SOURCE'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
@@ -5660,7 +5660,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
jsonDtl.put("BWART", "311");
|
||||
jsonDtl.put("MENGE", json.getDoubleValue("real_qty"));
|
||||
jsonDtl.put("MEINS", json.getString("qty_unit_name"));
|
||||
jsonDtl.put("WERKS", "2460");
|
||||
jsonDtl.put("WERKS", "2461");
|
||||
|
||||
JSONObject jsonSect = sectTab.query("sect_id = '" + json.getString("sect_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonSect)) {
|
||||
|
||||
@@ -1042,7 +1042,8 @@
|
||||
mater.material_code,
|
||||
unit.unit_name AS qty_unit_name,
|
||||
attr.storagevehicle_code AS box_no,
|
||||
sub.sap_pcsn
|
||||
sub.sap_pcsn,
|
||||
sub.sale_order_name source_bill_code
|
||||
FROM
|
||||
ST_IVT_StructIvt ivt
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = ivt.material_id
|
||||
|
||||
@@ -191,6 +191,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("stor_id = '" + stor_id + "'").uniqueResult(0);
|
||||
String lgort = stor_jo.getString("ext_id");
|
||||
String is_productstore = stor_jo.getString("is_productstore");
|
||||
|
||||
//生产入库
|
||||
if (StrUtil.equals(bill_type, "0001") || StrUtil.equals(bill_type, "0007")) {
|
||||
|
||||
@@ -421,68 +422,69 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
}
|
||||
|
||||
// 报废出库:回传mes
|
||||
if (StrUtil.equals(bill_type, "1007") || StrUtil.equals(bill_type, "1008") || StrUtil.equals(bill_type, "1010") || StrUtil.equals(bill_type, "1002")) {
|
||||
// if (StrUtil.equals(bill_type, "1007") || StrUtil.equals(bill_type, "1008") || StrUtil.equals(bill_type, "1010") || StrUtil.equals(bill_type, "1002")) {
|
||||
//
|
||||
// JSONArray disArr = WQL.getWO("QST_IVT_INANDOUTRETRUN").addParam("flag", "3").addParam("iostorinv_id", jo_mst.getString("iostorinv_id")).process().getResultJSONArray(0);
|
||||
//
|
||||
// String box_no_in = disArr.toJavaList(JSONObject.class).stream()
|
||||
// .map(row -> row.getString("box_no"))
|
||||
// .collect(Collectors.joining("','"));
|
||||
//
|
||||
// // 所有子卷
|
||||
// List<JSONObject> disList = WQLObject.getWQLObject("st_ivt_iostorinvdis").query("box_no in ('" + box_no_in + "') and iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
//
|
||||
// // 查询仓库
|
||||
// JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr")
|
||||
// .query("stor_code = '" + jo_mst.getString("stor_code") + "'").uniqueResult(0);
|
||||
//
|
||||
// for (int j = 0; j < disArr.size(); j++) {
|
||||
// JSONObject param = new JSONObject();
|
||||
// JSONArray item = new JSONArray();
|
||||
//
|
||||
// JSONObject json = disArr.getJSONObject(j);
|
||||
//
|
||||
// JSONObject jsonDtl = new JSONObject();
|
||||
// JSONArray details = new JSONArray();
|
||||
//
|
||||
// jsonDtl.put("PackageBoxSN", json.getString("box_no"));
|
||||
// jsonDtl.put("Status", "1");
|
||||
//
|
||||
// List<JSONObject> collect = disList.stream()
|
||||
// .filter(row -> row.getString("box_no").equals(json.getString("box_no")))
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// for (int k = 0; k < collect.size(); k++) {
|
||||
// JSONObject jsonObject = collect.get(k);
|
||||
//
|
||||
// JSONObject jsonObject1 = new JSONObject();
|
||||
// jsonObject1.put("ContainerName", jsonObject.getString("pcsn"));
|
||||
// jsonObject1.put("NetWeight",NumberUtil.toStr(jsonObject.getDoubleValue("plan_qty")));
|
||||
// details.add(jsonObject1);
|
||||
// }
|
||||
// jsonDtl.put("Details", details);
|
||||
// item.add(jsonDtl);
|
||||
//
|
||||
// param.put("Items", item);
|
||||
//
|
||||
// // 仓库编码
|
||||
// param.put("WareHouse", jsonStor.getString("ext_id"));
|
||||
// SpringContextHolder.getBean(LmsToMesServiceImpl.class).ChildScrapUpdate(param);
|
||||
//
|
||||
// // 更新分配回传成功
|
||||
// JSONObject jsonUpdate = new JSONObject();
|
||||
// jsonUpdate.put("is_upload", "1");
|
||||
//
|
||||
// WQLObject.getWQLObject("st_ivt_iostorinvdis")
|
||||
// .update(jsonUpdate,"iostorinv_id = '"+jo_mst.getString("iostorinv_id")+"' and box_no = '"+json.getString("box_no")+"'");
|
||||
// }
|
||||
//
|
||||
// jo_mst.put("upload_mes", "1");
|
||||
// jo_mst.put("is_upload", "1");
|
||||
// jo_mst.put("upload_optid", SecurityUtils.getCurrentUserId());
|
||||
// jo_mst.put("upload_time", DateUtil.now());
|
||||
// WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst);
|
||||
// }
|
||||
|
||||
JSONArray disArr = WQL.getWO("QST_IVT_INANDOUTRETRUN").addParam("flag", "3").addParam("iostorinv_id", jo_mst.getString("iostorinv_id")).process().getResultJSONArray(0);
|
||||
|
||||
String box_no_in = disArr.toJavaList(JSONObject.class).stream()
|
||||
.map(row -> row.getString("box_no"))
|
||||
.collect(Collectors.joining("','"));
|
||||
|
||||
// 所有子卷
|
||||
List<JSONObject> disList = WQLObject.getWQLObject("st_ivt_iostorinvdis").query("box_no in ('" + box_no_in + "') and iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
// 查询仓库
|
||||
JSONObject jsonStor = WQLObject.getWQLObject("st_ivt_bsrealstorattr")
|
||||
.query("stor_code = '" + jo_mst.getString("stor_code") + "'").uniqueResult(0);
|
||||
|
||||
for (int j = 0; j < disArr.size(); j++) {
|
||||
JSONObject param = new JSONObject();
|
||||
JSONArray item = new JSONArray();
|
||||
|
||||
JSONObject json = disArr.getJSONObject(j);
|
||||
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
JSONArray details = new JSONArray();
|
||||
|
||||
jsonDtl.put("PackageBoxSN", json.getString("box_no"));
|
||||
jsonDtl.put("Status", "1");
|
||||
|
||||
List<JSONObject> collect = disList.stream()
|
||||
.filter(row -> row.getString("box_no").equals(json.getString("box_no")))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (int k = 0; k < collect.size(); k++) {
|
||||
JSONObject jsonObject = collect.get(k);
|
||||
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("ContainerName", jsonObject.getString("pcsn"));
|
||||
jsonObject1.put("NetWeight",NumberUtil.toStr(jsonObject.getDoubleValue("plan_qty")));
|
||||
details.add(jsonObject1);
|
||||
}
|
||||
jsonDtl.put("Details", details);
|
||||
item.add(jsonDtl);
|
||||
|
||||
param.put("Items", item);
|
||||
|
||||
// 仓库编码
|
||||
param.put("WareHouse", jsonStor.getString("ext_id"));
|
||||
SpringContextHolder.getBean(LmsToMesServiceImpl.class).ChildScrapUpdate(param);
|
||||
|
||||
// 更新分配回传成功
|
||||
JSONObject jsonUpdate = new JSONObject();
|
||||
jsonUpdate.put("is_upload", "1");
|
||||
|
||||
WQLObject.getWQLObject("st_ivt_iostorinvdis")
|
||||
.update(jsonUpdate,"iostorinv_id = '"+jo_mst.getString("iostorinv_id")+"' and box_no = '"+json.getString("box_no")+"'");
|
||||
}
|
||||
|
||||
jo_mst.put("upload_mes", "1");
|
||||
jo_mst.put("is_upload", "1");
|
||||
jo_mst.put("upload_optid", SecurityUtils.getCurrentUserId());
|
||||
jo_mst.put("upload_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst);
|
||||
}
|
||||
|
||||
/*// 改切出库
|
||||
if (StrUtil.equals(bill_type, "1003")) {
|
||||
@@ -527,6 +529,10 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelationrecord");
|
||||
// 子卷包装关系表
|
||||
WQLObject subTab2 = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
// 成品报废审核主表
|
||||
WQLObject scrapTab = WQLObject.getWQLObject("st_ivt_productscrapmst");
|
||||
//成品报废审核明细表
|
||||
WQLObject scrapDtlTab = WQLObject.getWQLObject("st_ivt_productscrapdtl");
|
||||
|
||||
JSONArray rows = whereJson.getJSONArray("rows");
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
@@ -538,9 +544,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("stor_id = '" + stor_id + "'").uniqueResult(0);
|
||||
String lgort = stor_jo.getString("ext_id");
|
||||
String is_productstore = stor_jo.getString("is_productstore");
|
||||
//退货入库
|
||||
if (StrUtil.equals(bill_type, "0002")) {
|
||||
// 1.回传sap
|
||||
//退货入库 1.回传sap
|
||||
if (StrUtil.equals(bill_type, "0002") || StrUtil.equals(bill_type, "0013") || StrUtil.equals(bill_type, "0014")) {
|
||||
JSONArray paramSapMstArr = new JSONArray();
|
||||
|
||||
JSONObject paramSapMst = new JSONObject();
|
||||
@@ -834,7 +839,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
jsonDtl.put("BWART", "311");
|
||||
jsonDtl.put("MENGE", json.getDoubleValue("real_qty"));
|
||||
jsonDtl.put("MEINS", json.getString("qty_unit_name"));
|
||||
jsonDtl.put("WERKS", "2460");
|
||||
jsonDtl.put("WERKS", "2461");
|
||||
|
||||
JSONObject jsonSect = sectTab.query("sect_id = '" + json.getString("sect_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonSect)) {
|
||||
@@ -942,6 +947,72 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 报废出库
|
||||
// 2026年05月08日 新改需求修改。
|
||||
// 修改内容 1: 报废出库以前回传MES,现不回传MES,直接回传SAP
|
||||
// 修改内容2: 调整报废出库的类型 bill_type 其中 1002 为 其他报废,进行保留,适配历史数据
|
||||
// 其他报废类型: 传SAP业务类型字段: 2003:成品库整卷报废 2004:成品库超期报废 2005:成品库退货报废
|
||||
if (StrUtil.equals(bill_type, "2003") || StrUtil.equals(bill_type, "2004") || StrUtil.equals(bill_type, "2005") || StrUtil.equals(bill_type, "1002")) {
|
||||
JSONObject paramSapScrapMst = new JSONObject();
|
||||
JSONArray paramSapScrapDtlArr = new JSONArray();
|
||||
JSONArray dtlArr = wo_dtl.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0);
|
||||
for (int k = 0; k < dtlArr.size(); k++) {
|
||||
JSONObject json = dtlArr.getJSONObject(k);
|
||||
JSONObject jsonMater = materTab.query("material_id = '" + json.getString("material_id") + "'").uniqueResult(0);
|
||||
|
||||
// 明细
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("WERKS", "2461");
|
||||
jsonDtl.put("MATNR", jsonMater.getString("material_code"));
|
||||
|
||||
//获取分配表相关信息
|
||||
JSONArray disArr = wo_dis.query("iostorinvdtl_id = '" + json.getString("iostorinvdtl_id") + "'").getResultJSONArray(0);
|
||||
for (int j = 0; j < disArr.size(); j++) {
|
||||
JSONObject json2 = disArr.getJSONObject(j);
|
||||
JSONObject jsonSect = sectTab.query("sect_id = '" + json2.getString("sect_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonSect)) {
|
||||
jsonDtl.put("LGORT", lgort); // 明細储存地点
|
||||
}
|
||||
JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "' AND package_box_sn = '" + json2.getString("box_no") + "' AND bill_id = '" + json2.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonSub)) {
|
||||
jsonDtl.put("CHARG", jsonSub.getString("sap_pcsn")); // sap批次
|
||||
}
|
||||
}
|
||||
// 数量
|
||||
jsonDtl.put("BDMNG", json.getString("assign_qty"));
|
||||
// 返检修改差异重量
|
||||
jsonDtl.put("ZCJZ", json.getString("assign_qty"));
|
||||
// 返检修改后重量
|
||||
jsonDtl.put("ZGHZL", "0");
|
||||
// 单位
|
||||
jsonDtl.put("VRKME", json.getString("qty_unit_name"));
|
||||
// MES批次
|
||||
jsonDtl.put("Z1", json.getString("pcsn"));
|
||||
|
||||
String sourceBillCode = json.getString("source_bill_code");
|
||||
String[] billCode = sourceBillCode.split("-");
|
||||
if(billCode.length == 2){
|
||||
//销售订单
|
||||
jsonDtl.put("VBELN", billCode[0]);
|
||||
//销售订单行
|
||||
jsonDtl.put("POSNR", billCode[1]);
|
||||
}
|
||||
//移动原因
|
||||
jsonDtl.put("ZYDYY", bill_type);
|
||||
//来源系统
|
||||
jsonDtl.put("ZLYXT", "lms");
|
||||
paramSapScrapDtlArr.add(jsonDtl);
|
||||
}
|
||||
paramSapScrapMst.put("IT_ITEM", paramSapScrapDtlArr);
|
||||
// 调用接口回传
|
||||
SpringContextHolder.getBean(LmsToSapServiceImpl.class).returnScrapDtl(paramSapScrapMst);
|
||||
jo_mst.put("upload_sap", "1");
|
||||
jo_mst.put("is_upload", "1");
|
||||
jo_mst.put("upload_optid", SecurityUtils.getCurrentUserId());
|
||||
jo_mst.put("upload_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1152,7 +1223,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
||||
paramDis.put("ZZWLHD", jsonSub.getString("thickness"));
|
||||
paramDis.put("CHARG", jsonSub.getString("sap_pcsn"));
|
||||
paramDis.put("KALAB", NumberUtil.round(jsonDis.getDoubleValue("plan_qty"), 3));
|
||||
paramDis.put("WERKS", "2460");
|
||||
paramDis.put("WERKS", "2461");
|
||||
paramSapMstArr.add(paramDis);
|
||||
}
|
||||
param.put("ITEM", paramSapMstArr);
|
||||
|
||||
@@ -43,9 +43,9 @@ spring:
|
||||
reset-enable: false
|
||||
filters:
|
||||
DruidFilter,stat
|
||||
url: jdbc:mysql://localhost:3306/lms_xc?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
url: jdbc:mysql://10.1.3.88:3306/lms?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: root
|
||||
password: NLABC&hl123
|
||||
slave:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
@@ -84,9 +84,9 @@ spring:
|
||||
reset-enable: false
|
||||
filters:
|
||||
DruidFilter,stat
|
||||
url: jdbc:mysql://127.0.0.1:3306/lms_xc?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
url: jdbc:mysql://10.1.3.88:3306/lms?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: root
|
||||
password: NLABC&hl123
|
||||
rules:
|
||||
readwrite-splitting:
|
||||
data-sources:
|
||||
|
||||
Reference in New Issue
Block a user