|
|
|
@ -6,11 +6,15 @@ import com.op.common.core.utils.DateUtils;
|
|
|
|
|
import com.op.common.core.utils.bean.BeanUtils;
|
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
|
import com.op.common.core.web.domain.AjaxResult;
|
|
|
|
|
import com.op.common.security.utils.SecurityUtils;
|
|
|
|
|
import com.op.plan.domain.*;
|
|
|
|
|
import com.op.plan.domain.dto.ProOrderDTO;
|
|
|
|
|
import com.op.plan.domain.dto.SplitOrderDTO;
|
|
|
|
|
import com.op.plan.mapper.*;
|
|
|
|
|
import com.op.plan.service.IProOrderWorkorderService;
|
|
|
|
|
import com.op.system.api.domain.dto.MesPrepareDTO;
|
|
|
|
|
import com.op.system.api.domain.dto.MesPrepareDetailDTO;
|
|
|
|
|
import net.bytebuddy.matcher.FilterableList;
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -191,34 +195,38 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// //生成备料单
|
|
|
|
|
// for(String workorderId:workorderIds){
|
|
|
|
|
// ProOrderWorkorder orderWorkorder = proOrderWorkorderMapper.selectProOrderWorkorderByWorkorderId(workorderId);
|
|
|
|
|
// //备(领)料主单
|
|
|
|
|
// MesPrepare mesPrepare = new MesPrepare();
|
|
|
|
|
// BeanUtils.copyBeanProp(mesPrepare,orderWorkorder);
|
|
|
|
|
// mesPrepare.setPrepareId(orderWorkorder.getWorkorderCode()+"L");//领料单号
|
|
|
|
|
// mesPrepare.setWorkorderCode(orderWorkorder.getWorkorderCode());
|
|
|
|
|
// mesPrepare.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
// mesPrepare.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
// mesPrepare.setStatus("L0");//待确认
|
|
|
|
|
// proOrderWorkorderMapper.createPrepare(mesPrepare);
|
|
|
|
|
// //备(领)料明细
|
|
|
|
|
// orderWorkorder.setPrepareId(mesPrepare.getPrepareId());
|
|
|
|
|
// List<BaseBomComponentDTO> boms = this.getBomDtos(workorderId);
|
|
|
|
|
// List<BaseBomComponentDTO> allChildren = new ArrayList<>();
|
|
|
|
|
// BaseBomComponentDTO bc = new BaseBomComponentDTO();
|
|
|
|
|
// bc.setComponent(orderWorkorder.getProductCode());
|
|
|
|
|
// getLastChildren(boms, allChildren, bc);
|
|
|
|
|
// allChildren.forEach((entity) ->{
|
|
|
|
|
// entity.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
// entity.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
// entity.setId(IdUtils.fastSimpleUUID());
|
|
|
|
|
//
|
|
|
|
|
// });
|
|
|
|
|
// proOrderWorkorderMapper.createPrepareDetails(allChildren,orderWorkorder);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//如果是白坯生成备料单
|
|
|
|
|
for(String workorderId:workorderIds){
|
|
|
|
|
ProOrderWorkorder whiteOrder = proOrderWorkorderMapper.selectProOrderWorkorderByWorkorderId(workorderId);
|
|
|
|
|
if(whiteOrder!=null){//是白坯订单,自主生成领料单;
|
|
|
|
|
//备(领)料主单
|
|
|
|
|
MesPrepareDTO mesPrepare = new MesPrepareDTO();
|
|
|
|
|
BeanUtils.copyBeanProp(mesPrepare,whiteOrder);
|
|
|
|
|
mesPrepare.setPrepareId(whiteOrder.getWorkorderCode()+"L");//领料单号
|
|
|
|
|
mesPrepare.setWorkorderCode(whiteOrder.getWorkorderCode());
|
|
|
|
|
mesPrepare.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
mesPrepare.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
mesPrepare.setStatus("L0");//待确认
|
|
|
|
|
proOrderWorkorderMapper.createPrepare(mesPrepare);
|
|
|
|
|
//备(领)料明细
|
|
|
|
|
ProWetMaterialPlanDetail planDetail= proWetMaterialPlanDetailMapper.getWetInfo(workorderId);
|
|
|
|
|
List<MesPrepareDetailDTO> details = new ArrayList<>();
|
|
|
|
|
MesPrepareDetailDTO detail = new MesPrepareDetailDTO();
|
|
|
|
|
detail.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
detail.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
detail.setRecordId(IdUtils.fastSimpleUUID());
|
|
|
|
|
if(planDetail != null){
|
|
|
|
|
detail.setMaterailName(planDetail.getMaterialName());
|
|
|
|
|
detail.setMaterialCode(planDetail.getMaterialCode());
|
|
|
|
|
detail.setProductDate(planDetail.getProductDate());
|
|
|
|
|
detail.setShiftId(planDetail.getShiftId()+"");
|
|
|
|
|
detail.setProdType("white");
|
|
|
|
|
detail.setFactoryCode(planDetail.getFactoryCode());
|
|
|
|
|
}
|
|
|
|
|
details.add(detail);
|
|
|
|
|
proOrderWorkorderMapper.createPrepareDetails(details);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//下达工单
|
|
|
|
|
return proOrderWorkorderMapper.downProOrderWorkorderByWorkorderIds(workorderIds);
|
|
|
|
|
}
|
|
|
|
|