no message
							parent
							
								
									ef71394691
								
							
						
					
					
						commit
						18cc10b20e
					
				| 
						 | 
				
			
			@ -42,10 +42,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		|||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
 | 
			
		||||
import static org.springframework.http.HttpStatus.OK;
 | 
			
		||||
| 
						 | 
				
			
			@ -88,7 +85,11 @@ public class SceneAppController {
 | 
			
		|||
    @AnonymousAccess
 | 
			
		||||
    public ResponseEntity<Object> pointStockBack(@RequestBody JSONObject jsonObject) {
 | 
			
		||||
        String type = jsonObject.getString("type");
 | 
			
		||||
        String storageType = jsonObject.getString("code");
 | 
			
		||||
        String storageType = null;
 | 
			
		||||
        List<StockType> stockTypeList = stockTypeRepository.findByName(jsonObject.getString("code"));
 | 
			
		||||
        if (stockTypeList.size()>0){
 | 
			
		||||
            storageType=stockTypeList.get(0).getCode();
 | 
			
		||||
        }
 | 
			
		||||
        String pointCode = jsonObject.getString("pointCode");
 | 
			
		||||
        Point point=pointRepository.findByCode(pointCode);
 | 
			
		||||
        ApiResult apiResult=ApiResult.success(OK.value(), "操作成功", "");
 | 
			
		||||
| 
						 | 
				
			
			@ -542,7 +543,15 @@ public class SceneAppController {
 | 
			
		|||
    @AnonymousAccess
 | 
			
		||||
    public ResponseEntity<Object> getStockType() {
 | 
			
		||||
        List<StockType> stockTypeList=stockTypeRepository.findAll();
 | 
			
		||||
        ApiResult apiResult = ApiResult.fail(200,"加载完成",stockTypeList);
 | 
			
		||||
        List<JSONObject> jsonObjects=new ArrayList<>();
 | 
			
		||||
        for (StockType stockType:stockTypeList){
 | 
			
		||||
            if (stockType.getMode()!=null&&stockType.getMode().length()>0){
 | 
			
		||||
                JSONObject jsonObject=new JSONObject();
 | 
			
		||||
                jsonObject.put("code", stockType.getName());
 | 
			
		||||
                jsonObjects.add(jsonObject);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        ApiResult apiResult = ApiResult.fail(200,"加载完成",jsonObjects);
 | 
			
		||||
        return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
package com.youchain.basicdata.model;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
public class PointPickEnd {
 | 
			
		||||
    private String billCode;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -47,4 +47,6 @@ public interface BoxRepository extends JpaRepository<Box, Long>, JpaSpecificatio
 | 
			
		|||
    List<Box> getByEnabled(boolean enabled);
 | 
			
		||||
    @Query(value = "SELECT b FROM Box b where b.code=?1 and b.enabled=true ")
 | 
			
		||||
    List<Box> findByCodeAndItem(String code);
 | 
			
		||||
 | 
			
		||||
    List<Box> findByLampStatus(String billType);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,7 +56,7 @@ public interface PointRepository extends JpaRepository<Point, Long>, JpaSpecific
 | 
			
		|||
    @Query(value = "SELECT p FROM Point p WHERE p.name=?1")
 | 
			
		||||
    Point findByName(String pointName);
 | 
			
		||||
    @Query(value = "SELECT p FROM Point p WHERE p.type=?1 and p.area.code=?2 and p.enabled=true")
 | 
			
		||||
    Point findByTypeAndArea(String type,String areaCode);
 | 
			
		||||
    List<Point> findByTypeAndArea(String type,String areaCode);
 | 
			
		||||
    /** 查询深位是否有库存 */
 | 
			
		||||
    @Query(value = "SELECT p FROM Point p WHERE p.beatCode=?1 and p.enabled=true and p.storageType is not null and p.heat<?2")
 | 
			
		||||
    List<Point> findByBeatCode(String beatCode,double heat);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,4 +33,6 @@ public interface StockTypeRepository extends JpaRepository<StockType, Long>, Jpa
 | 
			
		|||
    StockType findByCode(String code);
 | 
			
		||||
 | 
			
		||||
    List<StockType> findByMode(String stockTypeCode);
 | 
			
		||||
 | 
			
		||||
    List<StockType> findByName(String storageType);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -22,7 +22,10 @@ import com.alibaba.fastjson.JSONObject;
 | 
			
		|||
import com.youchain.annotation.AnonymousAccess;
 | 
			
		||||
import com.youchain.annotation.Log;
 | 
			
		||||
import com.youchain.basicdata.domain.Area;
 | 
			
		||||
import com.youchain.basicdata.domain.Box;
 | 
			
		||||
import com.youchain.basicdata.domain.Point;
 | 
			
		||||
import com.youchain.basicdata.model.PointPickEnd;
 | 
			
		||||
import com.youchain.basicdata.repository.BoxRepository;
 | 
			
		||||
import com.youchain.basicdata.repository.PointRepository;
 | 
			
		||||
import com.youchain.basicdata.service.AreaService;
 | 
			
		||||
import com.youchain.basicdata.service.PointService;
 | 
			
		||||
| 
						 | 
				
			
			@ -32,10 +35,7 @@ import com.youchain.config.FileProperties;
 | 
			
		|||
import com.youchain.exception.handler.ApiError;
 | 
			
		||||
import com.youchain.exception.handler.ApiResult;
 | 
			
		||||
import com.youchain.modules.system.domain.Dept;
 | 
			
		||||
import com.youchain.utils.BaseStatus;
 | 
			
		||||
import com.youchain.utils.BizStatus;
 | 
			
		||||
import com.youchain.utils.FileUtil;
 | 
			
		||||
import com.youchain.utils.UserUtils;
 | 
			
		||||
import com.youchain.utils.*;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.data.domain.Pageable;
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
| 
						 | 
				
			
			@ -69,7 +69,7 @@ public class PointController {
 | 
			
		|||
 | 
			
		||||
    private final PointService pointService;
 | 
			
		||||
    private final PointRepository pointRepository;
 | 
			
		||||
 | 
			
		||||
    private final BoxRepository boxRepository;
 | 
			
		||||
    private final AreaService areaService;
 | 
			
		||||
 | 
			
		||||
    @Log("导出数据")
 | 
			
		||||
| 
						 | 
				
			
			@ -104,6 +104,31 @@ public class PointController {
 | 
			
		|||
    public ResponseEntity<Object> queryPointList(PointQueryCriteria criteria) {
 | 
			
		||||
        return new ResponseEntity<>(pointService.queryAll(criteria), HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
    @PostMapping(value = "/getPickEnd")
 | 
			
		||||
    @ApiOperation("加载出库单目标库位")
 | 
			
		||||
    @AnonymousAccess
 | 
			
		||||
    public ResponseEntity<Object> getPickEnd(@RequestBody PointPickEnd pickEnd) {
 | 
			
		||||
        String billType= pickEnd.getBillCode();
 | 
			
		||||
        List<Point> pointList=null;
 | 
			
		||||
        /* 查询按钮盒绑定·的出库位置*/
 | 
			
		||||
        List<Box> boxList=boxRepository.findByLampStatus(billType);
 | 
			
		||||
        if (billType.equals(BizStatus.FC_CK)){
 | 
			
		||||
            /* 成品出库*/
 | 
			
		||||
            pointList=pointRepository.findByTypeAndArea(BaseStatus.BOX, "CP");
 | 
			
		||||
        } else if (billType.equals(BizStatus.RM_CK)) {
 | 
			
		||||
            /* 料箱出库*/
 | 
			
		||||
            pointList=pointRepository.findByTypeAndArea(BaseStatus.BOX, "LX");
 | 
			
		||||
        } else if (billType.equals(BizStatus.SM_CK)) {
 | 
			
		||||
            /* 半成品出库*/
 | 
			
		||||
            pointList=pointRepository.findByTypeAndArea(BaseStatus.BOX, "BCP");
 | 
			
		||||
        }
 | 
			
		||||
        for (Box box:boxList){
 | 
			
		||||
            /* 将按钮盒绑定的出库位置提前*/
 | 
			
		||||
            YcDataUtil.getListSort(pointList, box.getPoint(), 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return new ResponseEntity<>(pointList, HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
    @PostMapping(value = "/getPointList")
 | 
			
		||||
    @AnonymousAccess
 | 
			
		||||
    public ResponseEntity<Object> getPointList(@RequestBody(required=false) String data) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -248,7 +248,8 @@ public class TaskController {
 | 
			
		|||
    public ResponseEntity<Object> readRfid(@RequestBody JSONObject body) {
 | 
			
		||||
        String rfid=body.getString("rfid");
 | 
			
		||||
        int agvFlag=body.getIntValue("agvFlag");
 | 
			
		||||
        Point pointStartCode=pointRepository.findByTypeAndArea(BaseStatus.PLATFORM,"TAGM");
 | 
			
		||||
        /* 感应门起点位*/
 | 
			
		||||
        Point pointStartCode=BaseStatus.DoorPoint;
 | 
			
		||||
        // 收货生成Task
 | 
			
		||||
        try {
 | 
			
		||||
            ApiResult apiResult = taskService.manualReceiving(rfid,pointStartCode,agvFlag,null);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,26 @@
 | 
			
		|||
package com.youchain.utils;
 | 
			
		||||
 | 
			
		||||
import com.youchain.basicdata.domain.Box;
 | 
			
		||||
import com.youchain.basicdata.domain.Point;
 | 
			
		||||
import org.apache.poi.ss.formula.functions.T;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
public class YcDataUtil {
 | 
			
		||||
    /**
 | 
			
		||||
     * List集合元素排序
 | 
			
		||||
     * @param list 集合
 | 
			
		||||
     * @param str 参数
 | 
			
		||||
     * @param index 下标前
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public static <T> List<T> getListSort(List list, T str, int index) {
 | 
			
		||||
        for (int i = 0; i < list.size(); i++) {
 | 
			
		||||
            if (list.get(i).equals(str)){
 | 
			
		||||
                list.add(index,list.remove(i));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return list;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue