| | |
| | | |
| | | import com.gs.xiaomi.config.ResultMessage; |
| | | import com.gs.xiaomi.dto.NumbericalDto; |
| | | import com.gs.xiaomi.service.XM104Service; |
| | | import com.gs.xiaomi.service.Xm104Service; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | public class KMController { |
| | | |
| | | |
| | | private final XM104Service xm104Service; |
| | | private final Xm104Service xm104Service; |
| | | |
| | | @PostMapping("/manualSynByASN") |
| | | public ResultMessage manualSynByASN(@RequestBody NumbericalDto barcode) { |
| | |
| | | } |
| | | |
| | | try { |
| | | if (!xm104Service.manualSynchronization(barcode)) { |
| | | return ResultMessage.error("同步失败"); |
| | | String errorMessage = xm104Service.manualSynchronization(barcode); |
| | | if (errorMessage != null) { |
| | | // 有错误信息,返回具体的错误 |
| | | return ResultMessage.error(errorMessage); |
| | | } |
| | | return ResultMessage.ok(); |
| | | } catch (Exception e) { |
| | | return ResultMessage.error(e); |
| | | // 捕获其他未预期的异常 |
| | | return ResultMessage.error(e.getMessage() != null ? e.getMessage() : "同步失败: 系统异常"); |
| | | } |
| | | } |
| | | |