package com.rongwei.bsserver.controller; import com.rongwei.bscommon.sys.service.ZhcxPmqManagementDistributionDetailService; import com.rongwei.bscommon.sys.service.ZhcxPmqManagementLogService; import com.rongwei.bscommon.sys.service.ZhcxPmqManagementRecoredService; import com.rongwei.bscommon.sys.service.ZhcxPmqManagementService; import com.rongwei.rwcommon.base.R; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; 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.Map; import java.util.Objects; /** *

* 三单管理(Integrated Management of Production Orders, Material Documents, and Quality Records in Manufacturing) 前端控制器 *

* * @author wm * @since 2024-10-30 */ @Slf4j @RestController @RequestMapping("/zhcxPmqManagement") public class ZhcxPmqManagementController { @Autowired private ZhcxPmqManagementRecoredService managementRecoredService; @Autowired private ZhcxPmqManagementDistributionDetailService distributionDetailService; @Autowired private ZhcxPmqManagementLogService logService; @Autowired private ZhcxPmqManagementService zhcxPmqManagementService; @PostMapping("/generateDistributionDetail") @ApiOperation("第二层生成三单派单数据(左边列表 NA/已关闭)") public R generateDistributionDetail(@RequestBody Map map){ try { if(Objects.isNull(map.get("id"))){ return R.error("id不能为空"); } if(Objects.isNull(map.get("closestatus"))){ return R.error("关闭状态不能为空"); } log.info("生成三单派单数据__>map:{}",map); return managementRecoredService.generateDistributionDetail(map); } catch (Exception e) { log.info(String.valueOf(e)); return R.error("生成三单派单数据异常"); } } /** * 三单执行页面关闭之后的操作接口 * @param map * @return */ @PostMapping("/updateClosedStateInThirdFloor") @ApiOperation("更新关闭状态-第三层(在已保存状态的情况后)") public R updateClosedStateInThirdFloor(@RequestBody Map map){ try { if(Objects.isNull(map.get("id"))){ return R.error("id不能为空"); } log.info("更新关闭状态-第三层(在已保存状态的情况后)__>map:{}",map.get("id")); String type = "关闭"; if(!Objects.isNull(map.get("type"))){ type = (String) map.get("type"); } // 塞入操作日志 logService.logFoThirdFloor((String) map.get("id"),type); return distributionDetailService.updateClosedStateInThirdFloor((String) map.get("id")); } catch (Exception e) { log.info(String.valueOf(e)); return R.error("更新关闭状态-第三层(在已保存状态的情况后)数据异常"); } } /** * 三单执行页面改派 * @param map * @return */ @PostMapping("/reassignment") @ApiOperation("三单执行页面改派") public R reassignment(@RequestBody Map map){ try { if(Objects.isNull(map.get("id"))){ return R.error("id不能为空"); } log.info("三单执行页面改派__>map:{}",map.get("id")); return distributionDetailService.reassignment(map); } catch (Exception e) { log.info(String.valueOf(e)); return R.error("三单执行页面改派异常"); } } @PostMapping("/getData") @ApiOperation("三单页面数据回传") public R getData(@RequestBody Map map){ try { if(Objects.isNull(map.get("data"))){ return R.error("日期不能为空"); } log.info("三单页面数据回传->接收的日期是:{}",map.get("data")); return distributionDetailService.getDataByTime((String)map.get("data")); } catch (Exception e) { log.info(String.valueOf(e)); return R.error("三单页面数据回传异常"); } } /** * 三单执行页面修改关闭状态 * @param map * @return */ @PostMapping("/updateDetailStatus") @ApiOperation("三单执行页面修改关闭状态") public R updateDetailStatus(@RequestBody Map map){ try { if(Objects.isNull(map.get("id"))){ return R.error("id不能为空"); } if(Objects.isNull(map.get("olderStatus"))){ return R.ok("历史关闭状态为空"); } log.info("三单执行页面修改关闭状态__>map:{}",map.get("id")); return distributionDetailService.updateDetailStatus(map); } catch (Exception e) { log.info(String.valueOf(e)); return R.error("三单执行页面修改关闭状态"); } } @RequestMapping("largeScreenData") @ApiOperation("大屏数据源(三单)") public R largeScreenData(@RequestBody Map map) { zhcxPmqManagementService.largeScreenData(map); return R.ok(); } }