| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.core.exception.CoolException; |
| | | import zy.cloud.wms.manager.entity.FlowStatus; |
| | | import zy.cloud.wms.manager.entity.Item; |
| | | import zy.cloud.wms.manager.entity.Node; |
| | | import zy.cloud.wms.manager.entity.ProjectPlan; |
| | | import zy.cloud.wms.manager.service.FlowStatusService; |
| | | import zy.cloud.wms.manager.service.ItemService; |
| | | import zy.cloud.wms.manager.service.ProjectPlanService; |
| | | import com.core.annotations.ManagerAuth; |
| | |
| | | private ProjectPlanService projectPlanService; |
| | | @Autowired |
| | | private ItemService itemService; |
| | | @Autowired |
| | | private FlowStatusService flowStatusService; |
| | | |
| | | @RequestMapping(value = "/projectPlan/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param, |
| | | @RequestParam String target) { |
| | | param.remove("target"); |
| | | @RequestParam Map<String, Object> param) { |
| | | String target = (String) param.get("items"); |
| | | param.remove("items"); |
| | | |
| | | EntityWrapper<ProjectPlan> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("item_id",target); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | wrapper.orderBy("weight_num"); |
| | | // if (!Cools.isEmpty(orderByField)) { |
| | | // wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | // } |
| | | return R.ok(projectPlanService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | |
| | | @RequestMapping(value = "/projectPlan/add/auth") |
| | | @ManagerAuth |
| | | public R add(ProjectPlan projectPlan) { |
| | | |
| | | |
| | | ProjectPlan checkExist = projectPlanService.selectOne(new EntityWrapper<ProjectPlan>() |
| | | .eq("item_id", projectPlan.getItemId()) |
| | | .eq("weight_num", projectPlan.getWeightNum())); |
| | | if (!Cools.isEmpty(checkExist)) { |
| | | throw new CoolException("权重值冲突,请检查"); |
| | | } |
| | | FlowStatus id = flowStatusService.selectOne(new EntityWrapper<FlowStatus>() |
| | | .eq("id", projectPlan.getFlowId())); |
| | | if (!Cools.isEmpty(id)) { |
| | | projectPlan.setFlowName(id.getName()); |
| | | }else { |
| | | throw new CoolException("无法通过节点ID找到对应节点"); |
| | | } |
| | | projectPlan.setCreateId(getUserId()); |
| | | projectPlan.setModifyId(getUserId()); |
| | | projectPlanService.insert(projectPlan); |
| | | return R.ok(); |
| | | } |
| | |
| | | @RequestMapping(value = "/projectPlan/update/auth") |
| | | @ManagerAuth |
| | | public R update(ProjectPlan projectPlan) { |
| | | |
| | | if (Cools.isEmpty(projectPlan) || null == projectPlan.getId()) { |
| | | return R.error(); |
| | | } |
| | | projectPlanService.updateById(projectPlan); |
| | | |
| | | ProjectPlan checkExist = projectPlanService.selectOne(new EntityWrapper<ProjectPlan>() |
| | | .eq("item_id", projectPlan.getItemId()) |
| | | .eq("weight_num", projectPlan.getWeightNum())); |
| | | if (!Cools.isEmpty(checkExist)) { |
| | | throw new CoolException("权重值冲突,请检查"); |
| | | } |
| | | FlowStatus id = flowStatusService.selectOne(new EntityWrapper<FlowStatus>() |
| | | .eq("id", projectPlan.getFlowId())); |
| | | if (!Cools.isEmpty(id)) { |
| | | projectPlan.setFlowName(id.getName()); |
| | | }else { |
| | | throw new CoolException("无法通过节点ID找到对应节点"); |
| | | } |
| | | projectPlan.setModifyTime(new Date()); |
| | | projectPlan.setModifyId(getUserId()); |
| | | projectPlanService.update(projectPlan,new EntityWrapper<ProjectPlan>() |
| | | .eq("item_id",projectPlan.getItemId()) |
| | | .eq("weight_num",projectPlan.getWeightNum())); |
| | | // projectPlanService.updateById(projectPlan); |
| | | return R.ok(); |
| | | } |
| | | |