/***文档注释***********************************************
 * 作者            ：
 * 创建日期     ：2019-01-10
 * 描述            ：生产订单表
 * 注意事项     ：
 * 遗留BUG   ：
 * 修改日期     ：
 * 修改人员     ：
 * 修改内容     ：
***********************************************************/
package market.Mes.OrderManager.Plan.impl;

import java.util.List;

import market.Api.Mes.impl.Utils;
import market.Mes.OrderManager.Plan.mapper.PlnProdorderMapper;
import market.Mes.OrderManager.Plan.service.PlnProdorderBakService;
import market.Mes.OrderManager.Plan.vo.PlnProdorder;
import market.Mes.OrderManager.Plan.vo.PlnProdorderBak;
import market.Slm.CustomerInformation.mapper.SlmCustomerTransSolutionMapper;
import market.Slm.CustomerInformation.vo.SlmCustomerTransSolution;
import market.Slm.OrderManagement.mapper.SlmOrderInfoMapper;
import market.Slm.OrderManagement.vo.SlmOrderInfo;

import com.hnshituo.basic.service.impl.BaseServiceImpl;
import com.hnshituo.basic.spring.remoting.annotation.RemoteService;

@RemoteService(path = "PlnProdorderBakService")
public class PlnProdorderBakServiceImpl extends BaseServiceImpl<PlnProdorderBak, Object>
		implements PlnProdorderBakService {

	/**
	 * 是否运输到优特
	 * @param prod_order_no
	 * @return true 是 入在制库 false 否
	 */
	public boolean getSoLutions(String prod_order_no) {
		boolean flag = false;
		// 获取生产订单信息
		List<PlnProdorder> pps = this.getMapper(PlnProdorderMapper.class).findWithCondition(null,
				"prod_order_no = '" + prod_order_no + "'", "", 0, 1);
		if (Utils.isNotEmpty(pps)) {
			// 获取订单行信息
			SlmOrderInfo soi = this.getMapper(SlmOrderInfoMapper.class).findById(pps.get(0).getOrd_pk());
			if (Utils.isNotEmpty(soi)) {
				// 获取运输方案
				List<SlmCustomerTransSolution> slms = this.getMapper(SlmCustomerTransSolutionMapper.class)
						.findWithCondition(null,
								"SOLUTIONS_NO = '" + soi.getSolutions_no() + "' and SOLUTIONS_NAME like '%到优特%'", "",
								0, 1);
				if (Utils.isNotEmpty(slms)) {
					flag = true;
				}
			}
		}
		return flag;
	}

}
