| | |
| | | |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | @Service("kopenApiServiceImpl") |
| | | public class KopenApiServiceImpl implements KopenApiService { |
| | | |
| | |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private CheckOrderDetlService checkOrderDetlService; |
| | | @Value("${kopen.url}") |
| | | private String url; |
| | | @Value("${kopen.port}") |
| | | private String port; |
| | | @Value("${kopen.prefix}") |
| | | private String prefix; |
| | | |
| | | |
| | | /** |
| | | * 接收下发订单信息 |
| | |
| | | String response = null; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri("127.0.0.1:8081") |
| | | .setPath("/wms/order/getInDispatchResult") |
| | | .setUri(url + ":" + port) |
| | | .setPath(prefix + "/getInDispatchResult") |
| | | .setJson(JSONObject.toJSONString(params)) |
| | | .build() |
| | | .doPost(); |
| | |
| | | return XSR.error(Objects.isNull(msg) ? "上报失败!!" : msg); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | return XSR.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取自定义请求头 |
| | | * @author Ryan |
| | | * @date 2025/12/29 9:11 |
| | | * @return java.util.Map<java.lang.String,java.lang.Object> |
| | | */ |
| | | private Map<String, Object> getHeaderParam() { |
| | | Map<String, Object> headerParam = new HashMap<>(); |
| | | // headerParam.put("accept", "*/*"); |
| | | // headerParam.put("connection", "Keep-Alive"); |
| | | //设置请求连接的Token |
| | | headerParam.put("api_key", "WMS"); |
| | | headerParam.put("charset", "UTF-8"); |
| | | headerParam.put("timestamp", new Date()); |
| | | headerParam.put("format", "xml"); |
| | | headerParam.put("signature", "c56ced444ed772098ffeb59537bbfa59"); |
| | | |
| | | return headerParam; |
| | | } |
| | | |
| | | /* */ |
| | |
| | | // 备货指示派工单(EO/SO)出库 |
| | | order = orderService.selectOne(new EntityWrapper<Order>().eq("order_no", |
| | | orderParams.getDispatch_no())); |
| | | } else { |
| | | throw new CoolException("单据类型不存在,不支持添加!!"); |
| | | } |
| | | } else { |
| | | throw new CoolException("单据类型不存在,不支持添加!!"); |
| | | } |
| | | // 出库 |
| | | if (type.equals("add") && !Objects.isNull(order)) { |
| | |
| | | }); |
| | | } |
| | | |
| | | private String kopen() { |
| | | return url + ":" + port + prefix; |
| | | } |
| | | |
| | | } |