#
Junjie
2025-05-01 e9efb50ea62a9ad58e652446c6528f1b49fcc39a
src/main/java/com/zy/asrs/controller/TaskWrkController.java
@@ -1,30 +1,22 @@
package com.zy.asrs.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.zy.asrs.domain.dto.NotifyCustomDataDto;
import com.zy.asrs.domain.enums.NotifyMsgType;
import com.zy.asrs.domain.enums.TaskStatusType;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.TaskWrk;
import com.zy.asrs.service.ApiLogService;
import com.zy.asrs.service.CommandInfoService;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.TaskWrkService;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
import com.zy.asrs.utils.NotifyUtils;
import com.zy.common.utils.HttpHandler;
import com.zy.common.web.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@@ -33,20 +25,10 @@
@Slf4j
public class TaskWrkController extends BaseController {
    @Value("${wms.url}")
    private String wmsUrl;
    @Autowired
    private TaskWrkService taskWrkService;
    @Autowired
    private CommandInfoService commandInfoService;
    @Autowired
    private LocMastService locMastService;
    @Value("${wms.TaskExecCallback}")
    private String TaskExecCallback;
    @Autowired
    private ApiLogService apiLogService;
    @Autowired
    private NotifyUtils notifyUtils;
    @RequestMapping(value = "/taskWrk/{wrkNo}/auth")
    @ManagerAuth
@@ -173,45 +155,10 @@
    @ManagerAuth(memo = "手动完成任务")
    public R complete(@RequestParam String taskNo) {
        TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo);
        if (Cools.isEmpty(taskWrk) || taskWrk.getStatus()>=3){
            return R.error("已完结或已取消") ;
        if (Cools.isEmpty(taskWrk) || taskWrk.getStatus() >= 3) {
            return R.error("已完结或已取消");
        }
        LocMast locMast = new LocMast();
        if(taskWrk.getIoType()==1){//入库任务完成库位为F
            locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint());
            if(Cools.isEmpty(locMast)){
              R.error("没有找到该库位") ;
            }
            locMast.setLocSts("F");
            locMast.setModiTime(new Date());
            locMast.setBarcode(taskWrk.getBarcode());
        }else if(taskWrk.getIoType()==2){//出库任务完成库位为O
            locMast = locMastService.selectByLocNo(taskWrk.getStartPoint());
            if(Cools.isEmpty(locMast)){
                R.error("没有找到该库位") ;
            }
            locMast.setLocSts("O");
            locMast.setModiTime(new Date());
        }else if(taskWrk.getIoType()==3){
            locMast = locMastService.selectByLocNo(taskWrk.getStartPoint());
            if(Cools.isEmpty(locMast)){
                R.error("没有找到该库位") ;
            }
            locMast.setLocSts("O");
            locMast.setModiTime(new Date());
            locMastService.updateById(locMast);
            locMast=locMastService.selectByLocNo(taskWrk.getTargetPoint());
            if(Cools.isEmpty(locMast)){
                R.error("没有找到该库位") ;
            }
            locMast.setLocSts("F");
            locMast.setModiTime(new Date());
            locMast.setBarcode(taskWrk.getBarcode());
        }
        locMastService.updateById(locMast);
        taskWrk.setStatus(7);//手动完成任务
        taskWrk.setStatus(TaskStatusType.MANUAL_OVER.id);//手动完成任务
        taskWrk.setModiTime(new Date());
        taskWrkService.updateById(taskWrk);
        return R.ok();