白坯领料单生成

highway
zhaoxiaolin 1 year ago
parent 0c792e7856
commit 6708ff8f48

@ -4,6 +4,7 @@ import com.op.plan.domain.ProOrder;
import com.op.plan.domain.ProOrderWorkorder;
import com.op.system.api.domain.dto.BaseBomComponentDTO;
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.Param;
@ -25,7 +26,7 @@ public interface ProOrderWorkorderMapper {
* @return
*/
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);
void createPrepareDetails(@Param("list") List<BaseBomComponentDTO> allChildren,@Param("wo") ProOrderWorkorder wo);
void createPrepareDetails(@Param("list") List<MesPrepareDetailDTO> list);
List<ProOrderWorkorder> selectProOrderWorkerderByWorkerIds(String[] ids);
}

@ -93,4 +93,6 @@ public interface ProWetMaterialPlanDetailMapper {
* @return
*/
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.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);
}

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

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

Loading…
Cancel
Save