| | |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.utils.SaasUtils; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | |
| | | @RequestMapping(value = "/taskWrk/updatePoint/auth") |
| | | @ManagerAuth |
| | | public R updatePoint(TaskWrk taskWrk){ |
| | | public R updatePoint(TaskWrk taskWrk) throws UnknownHostException { |
| | | if (Cools.isEmpty(taskWrk) || null == taskWrk.getTaskNo()) { |
| | | return R.error(); |
| | | } |
| | |
| | | if (taskWrk1 == null) { |
| | | return R.error(); |
| | | } |
| | | InetAddress localHost = InetAddress.getLocalHost(); |
| | | String ipAddress = localHost.getHostAddress(); |
| | | |
| | | SaasUtils.insertLog(1,taskWrk1.getStartPoint()+"-"+taskWrk1.getTargetPoint(),taskWrk.getStartPoint()+"-"+taskWrk.getTargetPoint(), ipAddress,getUser().getUsername()); |
| | | |
| | | |
| | | taskWrk1.setStartPoint(taskWrk.getStartPoint()); |
| | | taskWrk1.setTargetPoint(taskWrk.getTargetPoint()); |
| | | if (taskWrk1.getIoType() == 1){ |
| | | taskWrk1.setOriginTargetPoint(Utils.getWmsLocNo(taskWrk.getTargetPoint())); |
| | | } else if (taskWrk1.getIoType() == 2) { |
| | | taskWrk1.setOriginStartPoint(Utils.getWmsLocNo(taskWrk.getStartPoint())); |
| | | } else if (taskWrk1.getIoType() == 3) { |
| | | taskWrk1.setOriginTargetPoint(Utils.getWmsLocNo(taskWrk.getTargetPoint())); |
| | | taskWrk1.setOriginStartPoint(Utils.getWmsLocNo(taskWrk.getStartPoint())); |
| | | } |
| | | taskWrk1.setModiTime(new Date()); |
| | | taskWrk1.setModiUser(getUserId()); |
| | | |
| | | taskWrkService.updateById(taskWrk1); |
| | | return R.ok(); |
| | | } |
| | |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | @PostMapping(value = "/taskWrk/upIoPri") |
| | | public R upIoPri(@RequestParam String taskNo){ |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); |
| | | if (taskWrk.getIoPri() > 300){ |
| | | return R.error("优先级已最高"); |
| | | } |
| | | Map<Integer,Integer> map = new HashMap<>(); |
| | | map.put(100,200);map.put(200,300);map.put(300,400); |
| | | Integer pri = map.get(taskWrk.getIoPri()); |
| | | taskWrk.setIoPri(pri); |
| | | if (!taskWrkService.updateById(taskWrk)){ |
| | | return R.error("增加优先级失败"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @PostMapping(value = "/taskWrk/downIoPri") |
| | | public R downIoPri(@RequestParam String taskNo){ |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); |
| | | if (taskWrk.getIoPri() <200){ |
| | | return R.error("优先级已最低"); |
| | | } |
| | | Map<Integer,Integer> map = new HashMap<>(); |
| | | map.put(200,100);map.put(300,200);map.put(400,300); |
| | | Integer pri = map.get(taskWrk.getIoPri()); |
| | | taskWrk.setIoPri(pri); |
| | | if (!taskWrkService.updateById(taskWrk)){ |
| | | return R.error("降低优先级失败"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | public static String getTaskType(Integer paramIoType){ |
| | | switch (paramIoType){ |