package cn.stylefeng.guns.modular.om.productionOrderBatchInfo.service.impl; import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory; import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; import cn.stylefeng.guns.modular.bs.bomInfo.entity.BomInfo; import cn.stylefeng.guns.modular.bs.bomInfo.service.BomInfoService; import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.entity.ProductionOrderBatchInfo; import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.mapper.ProductionOrderBatchInfoMapper; import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.model.params.ProductionOrderBatchInfoParam; import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.model.result.ProductionOrderBatchInfoResult; import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.service.ProductionOrderBatchInfoService; import cn.stylefeng.roses.core.util.ToolUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.Serializable; import java.util.List; /** *

* 工单批次上料信息 服务实现类 *

* * @author ruimin * @since 2023-02-24 */ @Service public class ProductionOrderBatchInfoServiceImpl extends ServiceImpl implements ProductionOrderBatchInfoService { @Autowired private BomInfoService bomInfoService; @Autowired private ProductionOrderBatchInfoService infoService; @Override public void add(ProductionOrderBatchInfoParam param){ ProductionOrderBatchInfo entity = getEntity(param); this.save(entity); } @Override public void delete(ProductionOrderBatchInfoParam param){ this.removeById(getKey(param)); } @Override public void update(ProductionOrderBatchInfoParam param){ ProductionOrderBatchInfo oldEntity = getOldEntity(param); ProductionOrderBatchInfo newEntity = getEntity(param); ToolUtil.copyProperties(newEntity, oldEntity); this.updateById(newEntity); } @Override public ProductionOrderBatchInfoResult findBySpec(ProductionOrderBatchInfoParam param){ return null; } @Override public List findListBySpec(ProductionOrderBatchInfoParam param){ return this.baseMapper.customList(param); } @Override public LayuiPageInfo findPageBySpec(ProductionOrderBatchInfoParam param){ Page pageContext = getPageContext(); IPage page = this.baseMapper.customPageList(pageContext, param); return LayuiPageFactory.createPageInfo(page); } @Override public int barCodeCheck(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) { int i = infoService.count(new QueryWrapper() .eq("work_order_no", productionOrderBatchInfoParam.getWorkOrderNo()) .eq("material_code", productionOrderBatchInfoParam.getMaterialCode()) .eq("state","是") ); return i; } @Override public void updateState(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) { ProductionOrderBatchInfo one = infoService.getOne(new QueryWrapper() .eq("work_order_no", productionOrderBatchInfoParam.getWorkOrderNo()) .eq("material_code", productionOrderBatchInfoParam.getMaterialCode()) ); one.setStatus("是"); infoService.saveOrUpdate(one); } private Serializable getKey(ProductionOrderBatchInfoParam param){ return param.getId(); } private Page getPageContext() { return LayuiPageFactory.defaultPage(); } private ProductionOrderBatchInfo getOldEntity(ProductionOrderBatchInfoParam param) { return this.getById(getKey(param)); } private ProductionOrderBatchInfo getEntity(ProductionOrderBatchInfoParam param) { ProductionOrderBatchInfo entity = new ProductionOrderBatchInfo(); ToolUtil.copyProperties(param, entity); return entity; } }