AgvReceivingController.java 8.52 KB
package com.huaheng.pc.receipt.AgvReceiving.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huaheng.api.acs.service.AcsService;
import com.huaheng.common.utils.Wrappers;
import com.huaheng.common.utils.security.ShiroUtils;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.config.location.domain.Location;
import com.huaheng.pc.config.location.service.LocationService;
import com.huaheng.pc.config.points.domain.Points;
import com.huaheng.pc.config.points.service.PointsService;
import com.huaheng.pc.config.station.domain.AgvStation;
import com.huaheng.pc.config.station.domain.Station;
import com.huaheng.pc.config.station.service.AgvStationService;
import com.huaheng.pc.config.station.service.StationService;
import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerView;
import com.huaheng.pc.receipt.receiptContainerHeader.service.ReceiptContainerHeaderAGVService;
import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/receipt/AgvReceiving")
public class AgvReceivingController {

    private String prefix = "receipt/AgvReceiving";

    @Autowired
    private ReceiptContainerHeaderAGVService receiptContainerHeaderAGVService;
    @Autowired
    private AcsService acsService;
    @Resource
    private PointsService pointsService;
    @Autowired
    private LocationService locationService;
    @Autowired
    private ReceiptDetailService receiptDetailService;
    /*@Autowired
    private StationService stationService;*/
    @Autowired
    private AgvStationService agvStationService;

    @RequiresPermissions("receipt:AgvReceiving:view")
    @GetMapping()
    public String locationStatus()
    {
        return prefix + "/AgvReceiving";
    }

    /**
     * 获取订单明细
     */
    @ResponseBody
    @PostMapping("/scanBill")
    @RequiresPermissions("receipt:AgvReceiving:list")
    @Log(title = "入库-入库单", operating ="PC端扫描收货单号", action = BusinessType.OTHER)
    public AjaxResult scanBill(String code)  {
        AjaxResult result = receiptContainerHeaderAGVService.scanAGVReceipt(code);
        return result;
    }

    /**
     * 获取收货信息
     */
    @ResponseBody
    @PostMapping("/getReceiptInfoByBill")
    @RequiresPermissions("receipt:AgvReceiving:select")
    @Log(title = "入库-入库单", operating ="获取收货信息", action = BusinessType.OTHER)
    public AjaxResult getReceiptInfoByBill(String code)  {
        AjaxResult result = receiptContainerHeaderAGVService.getAGVReceiptInfoByBill(code);
        return result;
    }

    /**
     * 收货
     */
    @ResponseBody
    @PostMapping("/addBill")
    @RequiresPermissions("receipt:AgvReceiving:add")
    @Log(title = "入库-入库单", operating ="PC端扫描收货单号", action = BusinessType.OTHER)
    public AjaxResult addBill(ReceiptContainerView record)  {
        AjaxResult result = receiptContainerHeaderAGVService.save(record);
        return result;
    }



    @GetMapping("/remove")
    public String locationStatu()
    {
        return prefix + "/remove";
    }

    /**
     * AGV 任务取消
     */
    @RequiresPermissions("receipt:AgvReceiving:remove")
    @Log(title = "AGV 任务取消", action = BusinessType.DELETE)
    @PostMapping("/TaskCancel")
    @ResponseBody
    public AjaxResult TaskCancel(String message)
    {
        return acsService.taskCancel(message);
    }


    @GetMapping("/edit")
    public String locationStat()
    {
        return prefix + "/edit";
    }

    /**
     * AGV 旋转方向
     */
    @RequiresPermissions("receipt:AgvReceiving:edit")
    @Log(title = "AGV 旋转方向", action = BusinessType.UPDATE)
    @PostMapping("/TurnOriention")
    @ResponseBody
    public AjaxResult TurnOriention(String carNo,String orientation)
    {
        return acsService.TurnOriention(carNo, orientation);
    }


    /**
     * 货架列表
     */
    @RequiresPermissions("receipt:AgvReceiving:goodsShelfNo")
    @Log(title = "AGV 货架", action = BusinessType.UPDATE)
    @PostMapping("/goodsShelfNo")
    @ResponseBody
    public List<Map<String, Object>> goodsShelfNo()
    {
        String warehouseCode= ShiroUtils.getWarehouseCode();
        return pointsService.selectShlfno(warehouseCode);
    }


    /**
     *  手动叫车
     */
    @RequiresPermissions("receipt:AgvReceiving:add")
    @Log(title = "AGV 任务下发", action = BusinessType.OTHER)
    @PostMapping("/ManualCalling")
    @ResponseBody
    public AjaxResult ManualCalling(String station,String shelfNo)
    {
        return acsService.ManualCalling(station,shelfNo);
    }



    @GetMapping("/AgvOperate")
    public String AgvOperate()
    {
        return prefix + "/AgvOperate";
    }


    @RequiresPermissions("receipt:AgvReceiving:add")
    @Log(title = "AGV 任务下发", action = BusinessType.OTHER)
    @PostMapping("/getStation")
    @ResponseBody
    public AjaxResult GetStation()
    {
        String warehouseCode=ShiroUtils.getWarehouseCode();
        LambdaQueryWrapper<AgvStation> lamb = Wrappers.lambdaQuery();
        lamb.eq(AgvStation::getWarehouseCode,warehouseCode);
        List<AgvStation> list=agvStationService.list(lamb);
        return AjaxResult.success(list);
    }

    /**
     *  1站台
     */
    @RequiresPermissions("receipt:AgvReceiving:add")
    @Log(title = "AGV 任务下发", action = BusinessType.OTHER)
    @PostMapping("/TaskAssigns")
    @ResponseBody
    public AjaxResult TaskAssignOne(Integer id ,String containerCode,String taskType,String row,String line,String station)
    {
        AjaxResult ajaxResult=new AjaxResult();
        if(taskType.equals("1")) {
//            ajaxResult=acsService.TaskAssigns(id, containerCode, station,row,line);
        }else if(taskType.equals("0")){
            ajaxResult=acsService.TaskModel(station,id);
        }
        return ajaxResult;
    }

//    /**
//     *  2站台
//     */
//    @RequiresPermissions("receipt:AgvReceiving:add")
//    @Log(title = "AGV 任务下发", action = BusinessType.OTHER)
//    @PostMapping("/TaskAssignsTwo")
//    @ResponseBody
//    public AjaxResult TaskAssignsTwo(String code,String containerCode,String taskType,String row,String line)
//    {
//        AjaxResult ajaxResult=new AjaxResult();
//        String station="ws02";
//        if(taskType.equals("1")) {
//            ajaxResult=acsService.TaskAssigns(code, containerCode,station,row,line);
//        }else if(taskType.equals("0")){
//            ajaxResult=acsService.Task(code,station);
//        }
//        return ajaxResult;
//    }

    /**
     *  x轴,Y轴
     */
    @RequiresPermissions("receipt:AgvReceiving:add")
    @Log(title = "AGV 回库", action = BusinessType.OTHER)
    @PostMapping("/address")
    @ResponseBody
    public AjaxResult<Location> Address()
    {
        Location location=new Location();
        location.setWarehouseCode(ShiroUtils.getWarehouseCode());
        location=locationService.selectAddress(location);
        return AjaxResult.success(location);
    }

    /**
     *  获得已出货架的位置
     */
    @RequiresPermissions("receipt:AgvReceiving:goodsShelfNo")
    @Log(title = "AGV 回库", action = BusinessType.OTHER)
    @PostMapping("/EmptyAddress")
    @ResponseBody
    public AjaxResult EmptyAddress()
    {
        List<Location> list=locationService.selectEmptyAddress();
        return AjaxResult.success(list);
    }


    /**
     * 获取当前货架要完成的单据
     *
     */
    @ResponseBody
    @PostMapping("/getGoodsShelfNo")
    @RequiresPermissions("receipt:AgvReceiving:list")
    @Log(title = "入库-入库单", operating ="货架显示单据", action = BusinessType.OTHER)
    public List<Map<String, Object>> GetGoodShelfNo(String code,String goodsShelfNo){
        List<Map<String, Object>> AjaxResult = receiptDetailService.selectList(code,goodsShelfNo);
        return  AjaxResult;
    }

    @GetMapping("/AGVconfirm")
    public String AGVconfirm()
    {
        return prefix + "/AGVconfirm";
    }
}