| | |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.api.entity.OrderParams; |
| | | import com.zy.api.entity.ReportOrderParam; |
| | | import com.zy.api.entity.PubOrderParams; |
| | | import com.zy.api.entity.ReportOrderParam; |
| | | import com.zy.api.entity.SyncMatParmas; |
| | | import com.zy.api.enums.MatLocType; |
| | | import com.zy.api.enums.MatType; |
| | |
| | | import com.zy.asrs.service.OrderService; |
| | | |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | * @return com.core.common.R |
| | | */ |
| | | @Override |
| | | public R receiveOrders(OrderParams params) { |
| | | public R receiveOrders(PubOrderParams params) { |
| | | if (params.getType().equals(OrderWkType.getTypeVal(params.getType()))) { |
| | | return R.error("当前类型不是上架派工单!!"); |
| | | } |
| | | addOrUpdateOrders(params, "add"); |
| | | return R.ok("单据下发成功!!"); |
| | | } |
| | | |
| | | /** |
| | | * 上架派工单反馈 |
| | | * @author Ryan |
| | | * @date 2025/11/24 15:33 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R getInDispatchResult(ReportOrderParam params) { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | String response = null; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri("127.0.0.1:8081") |
| | | .setPath("/wms/order/getInDispatchResult") |
| | | .setJson(JSONObject.toJSONString(params)) |
| | | .build() |
| | | .doPost(); |
| | | if (Objects.isNull(response) || response.trim().isEmpty()) { |
| | | return R.error("外网接口无响应!!"); |
| | | } |
| | | JSONObject jsonObject = JSONObject.parseObject(response); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (!Objects.isNull(code) && code.equals(1)) { |
| | | return R.ok("入库单上报完成!!"); |
| | | } else { |
| | | String msg = jsonObject.getString("message"); |
| | | return R.error(Objects.isNull(msg) ? "上报失败!!" : msg); |
| | | } |
| | | } catch (Exception e) { |
| | | return R.error(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addOrUpdateOrders(OrderParams params, String type) { |
| | | public void addOrUpdateOrders(PubOrderParams params, String type) { |
| | | if (Objects.isNull(params)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | |
| | | * @param params |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void generateOrders(OrderParams params) { |
| | | public void generateOrders(PubOrderParams params) { |
| | | // 将数据当新订单插入 |
| | | Order newOrder = new Order(); |
| | | if (OrderType.ORDER_IN.type.equals(OrderWkType.getTypeVal(params.getType()))) { |