白坯领料单生成

highway
zhaoxiaolin
parent 0c792e7856
commit 6708ff8f48

@ -4,6 +4,7 @@ import com.op.plan.domain.ProOrder;
import com.op.plan.domain.ProOrderWorkorder; import com.op.plan.domain.ProOrderWorkorder;
import com.op.system.api.domain.dto.BaseBomComponentDTO; import com.op.system.api.domain.dto.BaseBomComponentDTO;
import com.op.system.api.domain.dto.MesPrepareDTO; import com.op.system.api.domain.dto.MesPrepareDTO;
import com.op.system.api.domain.dto.MesPrepareDetailDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -25,7 +26,7 @@ public interface ProOrderWorkorderMapper {
* @return * @return
*/ */
public ProOrderWorkorder selectProOrderWorkorderByWorkorderId(String workorderId); public ProOrderWorkorder selectProOrderWorkorderByWorkorderId(String workorderId);
public ProOrderWorkorder selectWhiteOrderWorkorderById(ProOrderWorkorder proOrderWorkorder);
/** /**
* *
* *
@ -129,7 +130,7 @@ public interface ProOrderWorkorderMapper {
List<BaseBomComponentDTO> getBomComponents(@Param("order") ProOrder order, @Param("list") List<BaseBomComponentDTO> cumsDtos); List<BaseBomComponentDTO> getBomComponents(@Param("order") ProOrder order, @Param("list") List<BaseBomComponentDTO> cumsDtos);
void createPrepareDetails(@Param("list") List<BaseBomComponentDTO> allChildren,@Param("wo") ProOrderWorkorder wo); void createPrepareDetails(@Param("list") List<MesPrepareDetailDTO> list);
List<ProOrderWorkorder> selectProOrderWorkerderByWorkerIds(String[] ids); List<ProOrderWorkorder> selectProOrderWorkerderByWorkerIds(String[] ids);
} }

@ -93,4 +93,6 @@ public interface ProWetMaterialPlanDetailMapper {
* @return * @return
*/ */
List<ProWetMaterialPlanDetail> selectWetPlanList(ProWetMaterialPlan proWetMaterialPlan); List<ProWetMaterialPlanDetail> selectWetPlanList(ProWetMaterialPlan proWetMaterialPlan);
ProWetMaterialPlanDetail getWetInfo(String workorderId);
} }

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

@ -83,7 +83,10 @@
<include refid="selectProOrderWorkorderVo"/> <include refid="selectProOrderWorkorderVo"/>
where workorder_id = #{workorderId} where workorder_id = #{workorderId}
</select> </select>
<select id="selectWhiteOrderWorkorderById" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
where workorder_id = #{workorderId} and prod_type = #{prodType}
</select>
<select id="selectFirWorkOrder" parameterType="String" resultMap="ProOrderWorkorderResult"> <select id="selectFirWorkOrder" parameterType="String" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/> <include refid="selectProOrderWorkorderVo"/>
where order_id = #{id} where order_id = #{id}
@ -324,9 +327,9 @@
)values )values
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
( (
#{item.id},#{wo.prepareId},#{wo.productCode},#{wo.productDesc},#{wo.productModel},#{item.componentUnit}, #{item.id},#{item.prepareId},#{item.materialCode},#{item.materailName},#{item.materailSpc},#{item.unit},
#{item.quantity},#{wo.productDate},#{wo.shiftId}, #{item.quantity},#{item.productDate},#{item.shiftId},
#{item.createBy},#{item.createTime},#{wo.prodType},#{wo.factoryCode} #{item.createBy},#{item.createTime},#{item.prodType},#{item.factoryCode}
) )
</foreach> </foreach>
</insert> </insert>

@ -104,6 +104,10 @@
where CONVERT(date,plan_time) >= #{startTime} and #{endTime} >= CONVERT(date,plan_time) where CONVERT(date,plan_time) >= #{startTime} and #{endTime} >= CONVERT(date,plan_time)
ORDER BY plan_time DESC ORDER BY plan_time DESC
</select> </select>
<select id="getWetInfo" resultMap="ProWetMaterialPlanDetailResult">
<include refid="selectProWetMaterialPlanDetailVo"/>
where workorder_id = #{id}
</select>
<insert id="insertProWetMaterialPlanDetail" parameterType="ProWetMaterialPlanDetail"> <insert id="insertProWetMaterialPlanDetail" parameterType="ProWetMaterialPlanDetail">
insert into pro_wet_material_plan_detail insert into pro_wet_material_plan_detail

Loading…
Cancel
Save