skyouc
2025-10-13 fdec63ed357fcde85e218a5db087c8d6e7f19dfb
open-api添加单据下发,单据修改,单据删除接口
11个文件已修改
10个文件已添加
587 ■■■■■ 已修改文件
rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/WmsErpController.java 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/constant/WmsConstant.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/dto/OrderDto.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/ErpOpParams.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/ErpQueryParams.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/WmsOrderItemParam.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/mapper/WmsErpMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/WmsErpService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsErpServiceImpl.java 165 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/resources/application-dev.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/resources/mapper/WmsErpMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/ErpQueryController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/SyncOrderController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/QueryOrderParam.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/SyncOrderParams.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/SyncOrdersItem.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReceiveMsgServiceImpl.java 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/common/utils/FieldsUtils.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/CommonStatus.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderItemServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/resources/application-dev.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/WmsErpController.java
New file
@@ -0,0 +1,85 @@
package com.vincent.rsf.openApi.controller;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.openApi.entity.dto.CommonResponse;
import com.vincent.rsf.openApi.entity.params.ErpOpParams;
import com.vincent.rsf.openApi.service.WmsErpService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Objects;
@RestController
@RequestMapping("/erp")
public class WmsErpController {
    @Autowired
    private WmsErpService wmsErpService;
    /**
     * @author Ryan
     * @date 2025/9/27
     * @description: 订单信息查询
     * @version 1.0
     */
    @ApiOperation("订单信息查询")
    @PostMapping("/order")
    public CommonResponse getOrders(@RequestBody ErpOpParams params) {
        if (Objects.isNull(params)) {
            throw new CoolException("参数不能为空!!");
        }
        return wmsErpService.getOrderInfo(params);
    }
    /**
     * 订单修改
     * @param params
     * @return
     */
    @ApiOperation("单据修改")
    @PostMapping("/order/upadte")
    public CommonResponse modifyOrderDtel(@RequestBody ErpOpParams params) {
        if (Objects.isNull(params)) {
            throw new CoolException("参数不能为空!!");
        }
        return wmsErpService.updateOrderDetl(params);
    }
    /**
     * 订单新增
     * @param params
     * @return
     */
    @ApiOperation("新增单据")
    @PostMapping("/order/add")
    public CommonResponse orderAdd(@RequestBody ErpOpParams params) {
        if (Objects.isNull(params)) {
            throw new CoolException("参数不能为空!!");
        }
        return wmsErpService.updateOrderDetl(params);
    }
    /**
     * 删除订单
     * @param params
     * @return
     */
    @ApiOperation("删除订单")
    @PostMapping("/order/del")
    public CommonResponse orderDel(@RequestBody ErpOpParams params) {
        if (Objects.isNull(params)) {
            throw new CoolException("参数不能为空!!");
        }
        return wmsErpService.orderDel(params);
    }
}
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/constant/WmsConstant.java
@@ -7,4 +7,16 @@
    public static String callBack = "/rsf-server/wcs/receive/ex/msg";
    //订单信息查询
    public static String QUERY_ORDER_AND_DETLS = "/rsf-server/erp/query/order";
    //订单信息修改/添加
    public static String MODIFY_ORDER_DETLS = "/rsf-server/order/sync/orders/update";
    //删除单据信息
    public static String ORDER_DEL = "/rsf-server/order/sync/orders/delete";
}
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/dto/OrderDto.java
New file
@@ -0,0 +1,57 @@
package com.vincent.rsf.openApi.entity.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@ApiModel(value = "OrderDto", description = "订单信息")
public class OrderDto {
    /**
     * 单号
     */
    @ApiModelProperty("订单号")
    private String orderNo;
    /**
     * PO单号
     */
    @ApiModelProperty(value = "PO单号")
    private String poCode;
    /**
     * 单据类型
     */
    @ApiModelProperty(value = "单据类型")
    private String type;
    /**
     * 业务类型
     */
    @ApiModelProperty(value = "业务类型")
    private String wkType;
    /**
     * 送货数量
     */
    @ApiModelProperty(value = "送货数量")
    private Double anfme;
    @ApiModelProperty("执行数量")
    private Double workQty;
    /**
     * 已收数量
     */
    @ApiModelProperty(value = "已收数量")
    private Double qty;
    @ApiModelProperty("执行状态")
    private Short exceStatus;
}
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/ErpOpParams.java
New file
@@ -0,0 +1,37 @@
package com.vincent.rsf.openApi.entity.params;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@Data
@Accessors(chain = true)
@ApiModel(value = "ErpOpParams", description = "ERP操作请求参数")
public class ErpOpParams {
    /**
     * 单号
     */
    @ApiModelProperty("订单号")
    private String orderNo;
    @ApiModelProperty("业务类型")
    private String wkType;
    @ApiModelProperty("订单类型")
    private String type;
    @ApiModelProperty("数量")
    private Double anfme;
    @ApiModelProperty("执行状态")
    private Short exceStatus;
    @ApiModelProperty("订单明细")
    private List<WmsOrderItemParam> orderItems;
}
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/ErpQueryParams.java
New file
@@ -0,0 +1,15 @@
package com.vincent.rsf.openApi.entity.params;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@ApiModel(value = "ErpQueryParams", description = "ERP查询参数")
public class ErpQueryParams {
}
rsf-open-api/src/main/java/com/vincent/rsf/openApi/entity/params/WmsOrderItemParam.java
New file
@@ -0,0 +1,56 @@
package com.vincent.rsf.openApi.entity.params;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@ApiModel(value = "WmsOrderItemParam", description = "订单明细参数")
public class WmsOrderItemParam {
    @ApiModelProperty("物料编码")
    private String matnrCode;
    @ApiModelProperty("物料名称")
    private String maktx;
    @ApiModelProperty("客单号")
    private String platOrderCode;
    @ApiModelProperty("平台标识(行号)")
    private String platItemId;
    @ApiModelProperty("工单号")
    private String platWorkCode;
    @ApiModelProperty("项目号")
    private String projectCode;
    @ApiModelProperty("现金票号")
    private String crushNo;
    @ApiModelProperty("规格")
    private String spec;
    @ApiModelProperty("型号")
    private String model;
    @ApiModelProperty("数量")
    private Double anfme;
    @ApiModelProperty("库存单位")
    private String unit;
    @ApiModelProperty("批次")
    private String batch;
    @ApiModelProperty("已收数量")
    private Double qty;
    @ApiModelProperty("条形码")
    private String barcode;
}
rsf-open-api/src/main/java/com/vincent/rsf/openApi/mapper/WmsErpMapper.java
New file
@@ -0,0 +1,12 @@
package com.vincent.rsf.openApi.mapper;
import com.vincent.rsf.openApi.entity.dto.OrderDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@Mapper
public interface WmsErpMapper {
    OrderDto getOrderByNo(@Param("orderNo") String orderNo);
}
rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/WmsErpService.java
New file
@@ -0,0 +1,13 @@
package com.vincent.rsf.openApi.service;
import com.vincent.rsf.openApi.entity.dto.CommonResponse;
import com.vincent.rsf.openApi.entity.params.ErpOpParams;
public interface WmsErpService {
    CommonResponse getOrderInfo(ErpOpParams params);
    CommonResponse updateOrderDetl(ErpOpParams params);
    CommonResponse orderDel(ErpOpParams params);
}
rsf-open-api/src/main/java/com/vincent/rsf/openApi/service/impl/WmsErpServiceImpl.java
New file
@@ -0,0 +1,165 @@
package com.vincent.rsf.openApi.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.cfg.CoercionAction;
import com.fasterxml.jackson.databind.cfg.CoercionInputShape;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.openApi.config.PlatformProperties;
import com.vincent.rsf.openApi.entity.constant.WmsConstant;
import com.vincent.rsf.openApi.entity.dto.CommonResponse;
import com.vincent.rsf.openApi.entity.dto.OrderDto;
import com.vincent.rsf.openApi.entity.params.ErpOpParams;
import com.vincent.rsf.openApi.service.WmsErpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.*;
@Slf4j
@Service("WmsErpService")
public class WmsErpServiceImpl implements WmsErpService {
    @Autowired
    private PlatformProperties.WmsApi wmsApi;
    @Autowired
    private RestTemplate restTemplate;
    /**
     * 获取订单明细
     *
     * @param params
     * @return
     */
    @Override
    public CommonResponse getOrderInfo(ErpOpParams params) {
        if (Objects.isNull(params.getOrderNo()) || params.getOrderNo().isEmpty()) {
            throw new CoolException("订单号不能为空!!");
        }
        /**WMS基础配置链接*/
        String rcsUrl = wmsApi.getHost() + ":" + wmsApi.getPort() + WmsConstant.QUERY_ORDER_AND_DETLS;
        log.info("查询订单信息及状态: {}, 请求参数: {}", rcsUrl, JSONObject.toJSONString(params));
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        headers.add("api-version", "v2.0");
        HttpEntity httpEntity = new HttpEntity(params, headers);
        ResponseEntity<String> exchange = restTemplate.exchange(rcsUrl, HttpMethod.POST, httpEntity, String.class);
        log.info("查询响应结果: {}", exchange);
        if (Objects.isNull(exchange.getBody())) {
            throw new CoolException("查询失败!!");
        } else {
            ObjectMapper objectMapper = new ObjectMapper();
            objectMapper.coercionConfigDefaults().setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty);
            try {
                CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class);
                if (result.getCode() == 200) {
                    JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(result.getData()));
                    OrderDto dto = new OrderDto();
                    dto.setOrderNo(object.getString("code")).setAnfme(object.getDouble("anfme")).setType(object.getString("type")).setWkType(object.getString("wkType")).setQty(object.getDouble("qty")).setPoCode(object.getString("poCode")).setExceStatus(object.getShort("exceStatus")).setWorkQty(object.getDouble("workQty"));
                    result.setData(dto);
                    return result;
                } else {
                    throw new CoolException("查询失败!!");
                }
            } catch (JsonProcessingException e) {
                throw new CoolException(e.getMessage());
            }
        }
    }
    /**
     * 订单修改
     *
     * @param params
     * @return
     */
    @Override
    public CommonResponse updateOrderDetl(ErpOpParams params) {
        if (Objects.isNull(params.getOrderNo()) || params.getOrderNo().isEmpty()) {
            throw new CoolException("订单号不能为空!!");
        }
        /**WMS基础配置链接*/
        String wmsUrl = wmsApi.getHost() + ":" + wmsApi.getPort() + WmsConstant.MODIFY_ORDER_DETLS;
        log.info("修改订单信息及状态: {}, 请求参数: {}", wmsUrl, JSONObject.toJSONString(params));
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        headers.add("api-version", "v2.0");
        List<Map<String, Object>> maps = new ArrayList<>();
        Map<String, Object> mapParams = new HashMap<>();
        mapParams.put("orderNo", Arrays.asList(params.getOrderNo()));
        mapParams.put("anfme", params.getAnfme());
        mapParams.put("type", params.getType());
        mapParams.put("wkType", params.getWkType());
        mapParams.put("exceStatus", params.getExceStatus());
        mapParams.put("orderItems", params.getOrderItems());
        maps.add(mapParams);
        HttpEntity httpEntity = new HttpEntity(maps, headers);
        ResponseEntity<String> exchange = restTemplate.exchange(wmsUrl, HttpMethod.POST, httpEntity, String.class);
        log.info("订单修改返回结果: {}", exchange);
        if (Objects.isNull(exchange.getBody())) {
            throw new CoolException("查询失败!!");
        } else {
            ObjectMapper objectMapper = new ObjectMapper();
            objectMapper.coercionConfigDefaults().setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty);
            try {
                CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class);
                if (result.getCode() == 200) {
//                    JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(result.getData()));
                    return result;
                } else {
                    throw new CoolException("查询失败!!");
                }
            } catch (JsonProcessingException e) {
                throw new CoolException(e.getMessage());
            }
        }
    }
    /**
     * 删除单据
     * @param params
     * @return
     */
    @Override
    public CommonResponse orderDel(ErpOpParams params) {
        if (Objects.isNull(params.getOrderNo()) || params.getOrderNo().isEmpty()) {
            throw new CoolException("订单号不能为空!!");
        }
        /**WMS基础配置链接*/
        String rcsUrl = wmsApi.getHost() + ":" + wmsApi.getPort() + WmsConstant.ORDER_DEL;
        log.info("查询订单信息及状态: {}, 请求参数: {}", rcsUrl, JSONObject.toJSONString(params));
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        headers.add("api-version", "v2.0");
        HttpEntity httpEntity = new HttpEntity(params, headers);
        ResponseEntity<String> exchange = restTemplate.exchange(rcsUrl, HttpMethod.POST, httpEntity, String.class);
        log.info("查询响应结果: {}", exchange);
        if (Objects.isNull(exchange.getBody())) {
            throw new CoolException("查询失败!!");
        } else {
            ObjectMapper objectMapper = new ObjectMapper();
            objectMapper.coercionConfigDefaults().setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty);
            try {
                CommonResponse result = objectMapper.readValue(exchange.getBody(), CommonResponse.class);
                if (result.getCode() == 200) {
                    return result;
                } else {
                    throw new CoolException("查询失败!!");
                }
            } catch (JsonProcessingException e) {
                throw new CoolException(e.getMessage());
            }
        }
    }
}
rsf-open-api/src/main/resources/application-dev.yml
@@ -65,4 +65,4 @@
    #链接
    host: http://127.0.0.1
    #端口
    port: 8081
    port: 8085
rsf-open-api/src/main/resources/mapper/WmsErpMapper.xml
New file
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.vincent.rsf.openApi.mapper.WmsErpMapper">
    <select id="getOrderByNo" resultType="com.vincent.rsf.openApi.entity.dto.OrderDto">
        SELECT
            `code` AS order_no,
            po_code,
            type,
            wk_type,
            anfme,
            work_qty,
            qty,
            exce_status
        FROM
            man_asn_order
        WHERE
            `code` = #{orderNo}
    </select>
</mapper>
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/ErpQueryController.java
@@ -38,6 +38,7 @@
    @Autowired
    private ReceiveMsgService receiveMsgService;
    @Autowired
    private MatnrGroupService matnrGroupService;
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/SyncOrderController.java
@@ -91,7 +91,7 @@
    /**
     * @author Ryan
     * @date 2025/8/19
     * @description: 同步盘点单据
     * @description: 收货通知单同步
     * @version 1.0
     */
    @ApiOperation("同步单据")
@@ -164,7 +164,8 @@
        if (Objects.isNull(orders) || orders.isEmpty()) {
            return R.error("参数不能为空!!");
        }
        return receiveMsgService.syncOrderUpdate(orders);
//        return receiveMsgService.syncOrderUpdate(orders);
        return receiveMsgService.syncCheckOrder(orders, getLoginUserId());
    }
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/QueryOrderParam.java
@@ -18,7 +18,7 @@
    private String type;
    @ApiModelProperty("订单号")
    private List<String> orderNo;
    private String orderNo;
}
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/SyncOrderParams.java
@@ -21,6 +21,9 @@
    @ApiModelProperty("业务类型")
    private String wkType;
    @ApiModelProperty("单据类型")
    private String type;
    @ApiModelProperty("单号")
    private String orderNo;
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/erp/params/SyncOrdersItem.java
@@ -63,4 +63,7 @@
    @ApiModelProperty("条形码")
    private String barcode;
    @ApiModelProperty("现金票号")
    private String crushNo;
}
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/ReceiveMsgServiceImpl.java
@@ -1,11 +1,14 @@
package com.vincent.rsf.server.api.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.api.controller.erp.params.*;
@@ -14,6 +17,7 @@
import com.vincent.rsf.server.api.controller.erp.params.dto.WkOrderDto;
import com.vincent.rsf.server.common.domain.BaseParam;
import com.vincent.rsf.server.common.domain.PageParam;
import com.vincent.rsf.server.common.utils.FieldsUtils;
import com.vincent.rsf.server.manager.controller.dto.LocStockDto;
import com.vincent.rsf.server.manager.entity.*;
import com.vincent.rsf.server.manager.enums.*;
@@ -221,8 +225,8 @@
    @Override
    public R queryOrderStatus(QueryOrderParam queryParams) {
        WkOrder wkOrders = asnOrderService.getOne(new LambdaQueryWrapper<WkOrder>()
                .in(WkOrder::getCode, queryParams.getOrderNo())
                .eq(WkOrder::getType, queryParams.getType()));
                .eq(WkOrder::getCode, queryParams.getOrderNo())
                .eq(StringUtils.isNotBlank(queryParams.getType()), WkOrder::getType, queryParams.getType()));
        if (Objects.isNull(wkOrders)) {
            throw new CoolException("单据不存在!!");
        }
@@ -396,10 +400,32 @@
                if (Objects.isNull(one)) {
                    throw new CoolException("单据:" + syncOrder.getOrderNo() + ", 业务类型不存在!!");
                }
                wkOrder.setType(OrderWorkType.getOrderType(syncOrder.getWkType()))
                WkOrder order = asnOrderService.getOne(new LambdaQueryWrapper<WkOrder>()
                        .eq(!Objects.isNull(syncOrder.getOrderId()), WkOrder::getPoId, syncOrder.getOrderId())
                        .eq(WkOrder::getPoCode, syncOrder.getOrderNo()));
                if (!Objects.isNull(order)) {
                    if (order.getExceStatus().equals(AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val) ||
                            order.getExceStatus().equals(AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val)) {
                        /**删除单据明细*/
                        asnOrderItemService.remove(new LambdaQueryWrapper<WkOrderItem>().eq(WkOrderItem::getOrderId, order.getId()));
                        /**删除主单*/
                        asnOrderService.removeById(order.getId());
                    } else {
                        throw new CoolException("单据已添加,不可执行修改或添加操作!!");
                    }
                }
                String rule = SerialRuleCode.SYS_ASN_ORDER;
                if (syncOrder.getType().equals(OrderType.ORDER_OUT.type)) {
                    rule = SerialRuleCode.SYS_OUT_STOCK_CODE;
                }
                String ruleCode = SerialRuleUtils.generateRuleCode(rule, null);
                wkOrder.setType(syncOrder.getType())
                        .setWkType(OrderWorkType.getWorkType(syncOrder.getWkType()))
                        .setAnfme(syncOrder.getAnfme())
                        .setCode(syncOrder.getOrderNo())
                        .setPoCode(syncOrder.getOrderNo())
                        .setPoId(syncOrder.getOrderId())
                        .setCode(ruleCode)
                        .setArrTime(syncOrder.getArrTime())
                        .setId(null)
                        .setCreateTime(new Date())
@@ -409,17 +435,25 @@
                if (!asnOrderService.save(wkOrder)) {
                    throw new CoolException("单据保存失败!!");
                }
                List<SyncOrdersItem> ordersItems = syncOrder.getOrdersItems();
                ordersItems.forEach(item -> {
                    WkOrderItem wkOrderItem = new WkOrderItem();
                    BeanUtils.copyProperties(item, wkOrderItem);
                    wkOrderItem.setOrderCode(wkOrder.getCode())
                            .setOrderId(wkOrder.getId())
                            .setId(null);
                    if (!asnOrderItemService.save(wkOrderItem)) {
                        throw new CoolException("单据明细保存失败!!");
                syncOrder.getOrdersItems().forEach(orderItem -> {
                    Map<String, Object> map = new ObjectMapper().convertValue(orderItem, Map.class);
                    map.put("orderId", wkOrder.getId());
                    map.put("poId", wkOrder.getPoId());
                    map.put("poCode", wkOrder.getPoCode());
                    map.put("order_code", wkOrder.getCode());
                    if (!asnOrderItemService.fieldsSave(map, loginUserId)) {
                        throw new CoolException("明细保存失败!!");
                    }
                });
                List<WkOrderItem> orderItems = asnOrderItemService.list(new LambdaQueryWrapper<WkOrderItem>()
                        .eq(WkOrderItem::getOrderId, wkOrder.getId()));
                double sum = orderItems.stream().mapToDouble(WkOrderItem::getAnfme).sum();
                wkOrder.setAnfme(sum);
                if (!asnOrderService.updateById(wkOrder)) {
                    throw new CoolException("计划收货数量修改失败!!");
                }
            });
        }
        return R.ok();
rsf-server/src/main/java/com/vincent/rsf/server/common/utils/FieldsUtils.java
@@ -9,6 +9,7 @@
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.common.domain.BaseParam;
import com.vincent.rsf.server.common.domain.PageParam;
import com.vincent.rsf.server.manager.enums.CommonStatus;
import com.vincent.rsf.server.system.entity.Fields;
import com.vincent.rsf.server.system.entity.FieldsItem;
import com.vincent.rsf.server.system.service.FieldsItemService;
@@ -137,7 +138,9 @@
     */
    public static List<Fields> getFieldsSta() {
        FieldsService fieldsService = SpringUtils.getBean(FieldsService.class);
        return fieldsService.list(new LambdaQueryWrapper<Fields>().eq(Fields::getStatus, 1).eq(Fields::getFlagEnable, 1));
        return fieldsService.list(new LambdaQueryWrapper<Fields>().eq(Fields::getStatus, CommonStatus.COMMONSTATUS_YES.val)
                .eq(Fields::getUnique, CommonStatus.COMMONSTATUS_YES.val)
                .eq(Fields::getFlagEnable, CommonStatus.COMMONSTATUS_YES.val).orderByAsc(Fields::getId));
    }
    /**
rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/CommonStatus.java
New file
@@ -0,0 +1,21 @@
package com.vincent.rsf.server.manager.enums;
/**
 * 通用状态
 */
public enum CommonStatus {
    //通用状态
    COMMONSTATUS_YES(1, "是否"),
    COMMONSTATUS_NO(0, "否"),
    ;
    CommonStatus(Integer val, String desc) {
        this.val = val;
        this.desc = desc;
    }
    public Integer val;
    public String desc;
}
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderItemServiceImpl.java
@@ -30,6 +30,7 @@
import com.vincent.rsf.server.manager.service.CompanysService;
import com.vincent.rsf.server.manager.service.MatnrService;
import com.vincent.rsf.server.system.constant.SerialRuleCode;
import com.vincent.rsf.server.system.entity.Fields;
import com.vincent.rsf.server.system.service.DictDataService;
import com.vincent.rsf.server.system.service.FieldsItemService;
import com.vincent.rsf.server.system.service.FieldsService;
@@ -242,7 +243,15 @@
        try {
            StringBuffer sb = new StringBuffer();
            if (Objects.isNull(wkOrderItem.getFieldsIndex()) || StringUtils.isBlank(wkOrderItem.getFieldsIndex())) {
                sb.append(wkOrderItem.getMatnrId() + wkOrderItem.getSplrBatch() );
                List<Fields> fields = FieldsUtils.getFieldsSta();
                for (Fields field : fields) {
                    if (Objects.isNull(params.get(field.getFields()))) {
                        continue;
                    }
                    //字段拼接
                    sb.append(params.get(field.getFields()));
                }
                sb.append(wkOrderItem.getMatnrId() + wkOrderItem.getSplrBatch());
                //获取16位uuid
                String uuid16 = Cools.md5Chinese(sb.toString());
                wkOrderItem.setFieldsIndex(uuid16);
rsf-server/src/main/resources/application-dev.yml
@@ -14,7 +14,7 @@
#    url: jdbc:mysql://47.76.147.249:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
#    username: rsf
    username: root
#    url: jdbc:mysql://10.10.10.200:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
#    url: jdbc:mysql://10.10.10.200:3306/rsf-xiri?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
#    password: xltys1995
    url: jdbc:mysql://127.0.0.1:3306/rsf-xiri?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
    password: 34821015