wu
2023-09-11 a120dc6724d90d80cf9adc7b02d11eaedc5ca021
springboot-vue3/src/main/java/com/example/springboot/controller/SpianController.java
@@ -1,6 +1,7 @@
package com.example.springboot.controller;
import com.example.springboot.common.Result;
import com.example.springboot.component.S7control;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.mapper.SpianMapper;
import com.example.springboot.service.SpianService;
@@ -13,6 +14,7 @@
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@RestController
@@ -23,72 +25,27 @@
    
    @Autowired
    SpianMapper spianMapper;
    @Autowired
    SpianService spianservice;
    //出片任务
@GetMapping("/all2")
    public Result selectdd(String orderid){
         StorageCage cageout=spianMapper.selectOut(orderid);
         //判断玻璃可直接出片时
         //玻璃内外片
         int cage =cageout.getCage();
         int cell =cageout.getCell();
         int tier =cageout.getTier();
         double width=cageout.getWidth();
         if(tier==2){
                return Result.success("执行出片");
         }
         else{
           int state= spianMapper.selectGlassState(cage,cell);
            //判断内片是否需要调拨
            if(state==0){
             return Result.success("状态为0,直接出片");
             }else{
              //玻璃需要调拨时
               return Result.success("状态为1,需要被调拨");
             }
        }
    public void selectdd(String orderid){
       SpianService service=new SpianService();
       service.selectout(orderid);
    
}
   @GetMapping("/all")
   //进片任务,传订单id
   //按订单优先进片
    public Result selectAll(String orderid){
        //return spianMapper.selectAll();
        int cage1;
        //String orderid="A001";
        //获取订单相关度最高的笼子排序
        List<StorageCage> storageCage=spianMapper.selectAll(orderid);
        for (StorageCage storageCage2 : storageCage) {
            //保存订单优先顺序笼子号
            cage1=storageCage2.getCage();
            //判断该笼子号相邻最大的空格数
            int cages=spianMapper.selectCage(cage1);
            //判断选中笼子是否有空格
            StorageCage cages1=spianMapper.selectCage1(cage1);
            if(cages>1 &&cages1.getTier()!=null){
                return Result.success(cages1);
            }
        }
        return Result.success("0");
    public void selectAll(Short glassid){
       SpianService service=new SpianService();
       service.selectAll(glassid);
      
    }
    
    @PostMapping("/save")
    public Result save(@RequestBody StorageCage spian){
        spianservice.Save(spian);
        return Result.success();
    }