package org.wcs.business.stock.impl.StockTaskDataCheck;

import org.wcs.business.stock.StockComposeTaskManage;
import org.wcs.business.stock.intf.IStockTaskDataCheck;
import org.wcs.model.po.app.AppStockComposeTask;
import org.wcs.utils.SpringUtils;

/**
 * 移库任务数据检查
 */
public class MoveStockTaskDataCheck implements IStockTaskDataCheck {
    @Override
    public String checkStockTaskData(AppStockComposeTask composeTask) {
        StockComposeTaskManage stockComposeTaskManage = SpringUtils.getBean(StockComposeTaskManage.class);
        boolean originExist = stockComposeTaskManage.checkLocationExist(composeTask.getOrigin());
        if(!originExist) {
            return "移库任务起点位置不能为空";
        }
        boolean destinationExist = stockComposeTaskManage.checkLocationExist(composeTask.getDestination());
        if(!destinationExist) {
            return "移库任务终点位置不能为空";
        }
        return null;
    }
}
