package com.ruoyi.wrzs.weighbridge.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.wrzs.weighbridge.pojo.WeighbridgeErpLog; import com.ruoyi.wrzs.weighbridge.pojo.WeighbridgeRecord; import com.ruoyi.wrzs.weighbridge.service.WeighbridgeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; import java.util.List; /** * 无人值守地磅管理 *

* 自动采集皮重/毛重、红外防作弊、ERP实时上传、二维码磅单、采购销售订单自动匹配 */ @Api(tags = "无人值守地磅管理") @AllArgsConstructor @RestController @RequestMapping("/environmentAccess") public class WeighbridgeController { private final WeighbridgeService weighbridgeService; @ApiOperation("自动称重记录分页") @GetMapping("/weighbridgeRecordPage") public AjaxResult recordPage(Page page, WeighbridgeRecord query, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) { return AjaxResult.success(weighbridgeService.recordPage(page, query, startTime, endTime)); } @ApiOperation("称重记录详情") @GetMapping("/weighbridgeRecordInfo") public AjaxResult recordInfo(@RequestParam Long id) { return AjaxResult.success(weighbridgeService.recordInfo(id)); } @ApiOperation("第一次称重(皮重)自动采集") @PostMapping("/weighbridgeFirstWeight") public AjaxResult firstWeight(@RequestBody WeighbridgeRecord record) { try { return AjaxResult.success(weighbridgeService.firstWeight(record)); } catch (IllegalArgumentException e) { return AjaxResult.error(e.getMessage()); } } @ApiOperation("第二次称重(毛重)自动采集并完成过磅") @PostMapping("/weighbridgeSecondWeight") public AjaxResult secondWeight(@RequestBody WeighbridgeRecord record) { try { return AjaxResult.success(weighbridgeService.secondWeight(record)); } catch (IllegalArgumentException e) { return AjaxResult.error(e.getMessage()); } } @ApiOperation("红外偏移检测(防作弊)") @PostMapping("/weighbridgeInfraredCheck") public AjaxResult infraredCheck(@RequestParam Long recordId, @RequestParam(required = false) BigDecimal positionOffset, @RequestParam(required = false) String irStatus) { try { return AjaxResult.success(weighbridgeService.infraredCheck(recordId, positionOffset, irStatus)); } catch (IllegalArgumentException e) { return AjaxResult.error(e.getMessage()); } } @ApiOperation("采购/销售订单自动匹配") @GetMapping("/weighbridgeMatchOrder") public AjaxResult matchOrder(@RequestParam String orderNo) { return AjaxResult.success(weighbridgeService.matchOrder(orderNo)); } @ApiOperation("磅单上传ERP(手动重传)") @PostMapping("/weighbridgeSyncErp") public AjaxResult syncErp(@RequestParam Long id) { try { return AjaxResult.success(weighbridgeService.syncErp(id)); } catch (IllegalArgumentException e) { return AjaxResult.error(e.getMessage()); } } @ApiOperation("磅单打印数据(含二维码)") @GetMapping("/weighbridgePrintInfo") public AjaxResult printInfo(@RequestParam Long id) { try { return AjaxResult.success(weighbridgeService.printInfo(id)); } catch (IllegalArgumentException e) { return AjaxResult.error(e.getMessage()); } } @ApiOperation("扫码核验磅单") @GetMapping("/weighbridgeVerifyQr") public AjaxResult verifyQr(@RequestParam String code) { return AjaxResult.success(weighbridgeService.verifyQrCode(code)); } @ApiOperation("新增称重记录(人工补录)") @PostMapping("/weighbridgeRecordAdd") public AjaxResult recordAdd(@RequestBody WeighbridgeRecord record) { return AjaxResult.success(weighbridgeService.recordSave(record)); } @ApiOperation("修改称重记录") @PutMapping("/weighbridgeRecordUpdate") public AjaxResult recordUpdate(@RequestBody WeighbridgeRecord record) { return AjaxResult.success(weighbridgeService.recordUpdate(record)); } @ApiOperation("删除称重记录") @DeleteMapping("/weighbridgeRecordDelete") public AjaxResult recordDelete(@RequestBody List ids) { return AjaxResult.success(weighbridgeService.recordRemove(ids)); } @ApiOperation("ERP上传日志分页") @GetMapping("/weighbridgeErpLogPage") public AjaxResult erpLogPage(Page page, WeighbridgeErpLog query) { return AjaxResult.success(weighbridgeService.erpLogPage(page, query)); } @ApiOperation("今日过磅概览") @GetMapping("/weighbridgeOverview") public AjaxResult overview() { return AjaxResult.success(weighbridgeService.overview()); } }