|
|
|
@ -13,6 +13,7 @@ import com.op.mes.domain.dto.SplitOrderDTO;
|
|
|
|
|
import com.op.mes.domain.vo.LineAndShiftVo;
|
|
|
|
|
import com.op.mes.mapper.ProOrderWorkorderBatchMapper;
|
|
|
|
|
import com.op.mes.mapper.ProOrderWorkorderMapper;
|
|
|
|
|
import com.op.mes.mapper.ProRouteMapper;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -37,6 +38,8 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
private ProOrderWorkorderMapper proOrderWorkorderMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ProOrderWorkorderBatchMapper proOrderWorkorderBatchMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ProRouteMapper proRouteMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取换算值
|
|
|
|
@ -79,15 +82,14 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
ProOrder product = new ProOrder();
|
|
|
|
|
BeanUtils.copyProperties(splitOrderDTO.getProduct(), product);
|
|
|
|
|
// 设置通用属性
|
|
|
|
|
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(product, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId());
|
|
|
|
|
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(product, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(),splitOrderDTO.getRouteCode());
|
|
|
|
|
// 生成对应工单表
|
|
|
|
|
// 一级
|
|
|
|
|
ProOrderWorkorder firWorkOrder = setWorkOrder(proOrderWorkorder, product);
|
|
|
|
|
// code
|
|
|
|
|
int endCode = getEndCode(product.getId());
|
|
|
|
|
firWorkOrder.setWorkorderCode(product.getOrderCode()+"-"+endCode);
|
|
|
|
|
// 更新到数据库
|
|
|
|
|
proOrderWorkorderMapper.insertProOrderWorkorder(firWorkOrder);
|
|
|
|
|
|
|
|
|
|
// 创建通用批次表对象
|
|
|
|
|
ProOrderWorkorderBatch workBatch = setCommonBatchAttribute();
|
|
|
|
|
// 生成批次表并更新到数据库
|
|
|
|
@ -146,6 +148,13 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
proOrderWorkorderMapper.updateProOrderWorkorder(updateWorker);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 母工单设置底层节点(只有母工单的情况下)
|
|
|
|
|
if (checkEnd == 0) {
|
|
|
|
|
firWorkOrder.setIsEnd(1);
|
|
|
|
|
// 更新到数据库
|
|
|
|
|
proOrderWorkorderMapper.insertProOrderWorkorder(firWorkOrder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return success();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -235,10 +244,10 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public LineAndShiftVo getProdLineShift(String type) {
|
|
|
|
|
if (type.equals("white")){
|
|
|
|
|
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectProdLine(), proOrderMapper.selectProShift());
|
|
|
|
|
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectProdLine(), proOrderMapper.selectProShift(),proRouteMapper.selectAllRoute());
|
|
|
|
|
return lineAndShiftVo;
|
|
|
|
|
}
|
|
|
|
|
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectPackageLine(), proOrderMapper.selectProShift());
|
|
|
|
|
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectPackageLine(), proOrderMapper.selectProShift(),proRouteMapper.selectAllRoute());
|
|
|
|
|
return lineAndShiftVo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -335,12 +344,16 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
* @param proOrder
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private ProOrderWorkorder setCommonWorkAttribute(ProOrder proOrder, Date date, String proLineCode, String shiftId) {
|
|
|
|
|
private ProOrderWorkorder setCommonWorkAttribute(ProOrder proOrder, Date date, String proLineCode, String shiftId,String routeCode) {
|
|
|
|
|
ProOrderWorkorder proOrderWorkorder = new ProOrderWorkorder();
|
|
|
|
|
// 更新者
|
|
|
|
|
proOrderWorkorder.setUpdateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
// 更新时间
|
|
|
|
|
proOrderWorkorder.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
// 创建者
|
|
|
|
|
proOrderWorkorder.setCreateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
// 创建时间
|
|
|
|
|
proOrderWorkorder.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
// 工单生产日期
|
|
|
|
|
proOrderWorkorder.setProductDate(date);
|
|
|
|
|
// 产品(物料)编码
|
|
|
|
@ -356,6 +369,8 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
// TODO 产品类型(pro_type)
|
|
|
|
|
// 单据状态(1为已经下达0未下达)
|
|
|
|
|
proOrderWorkorder.setStatus("w0");
|
|
|
|
|
// 工艺编码
|
|
|
|
|
proOrderWorkorder.setRouteCode(routeCode);
|
|
|
|
|
return proOrderWorkorder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -401,6 +416,10 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
ProOrderWorkorderBatch workBatch = new ProOrderWorkorderBatch();
|
|
|
|
|
// 更新者
|
|
|
|
|
workBatch.setUpdateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
// 创建更新时间
|
|
|
|
|
workBatch.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
// 设置创建时间
|
|
|
|
|
workBatch.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
// 创建者
|
|
|
|
|
workBatch.setCreateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
// 设置单据状态(1正常)
|
|
|
|
|