新火炬后端单体项目初始化代码
zhangherong
昨天 99af0223ae0858c69d1b75106d5f8bb0ab14b129
src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java
@@ -4,12 +4,22 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.lsw.entity.LswMaterial;
import org.jeecg.modules.lsw.entity.LswMaterialInventory;
import org.jeecg.modules.lsw.entity.LswMaterialOutbound;
import org.jeecg.modules.lsw.enums.MaterialInventoryStatusEnum;
import org.jeecg.modules.lsw.mapper.LswMaterialOutboundMapper;
import org.jeecg.modules.lsw.service.ILswMaterialInboundService;
import org.jeecg.modules.lsw.service.ILswMaterialInventoryService;
import org.jeecg.modules.lsw.service.ILswMaterialOutboundService;
import org.jeecg.modules.lsw.service.ILswMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -21,6 +31,10 @@
 */
@Service
public class LswMaterialOutboundServiceImpl extends ServiceImpl<LswMaterialOutboundMapper, LswMaterialOutbound> implements ILswMaterialOutboundService {
    @Autowired
    private ILswMaterialService materialService;
    @Autowired
    private ILswMaterialInventoryService materialInventoryService;
    @Override
    public IPage<Map<String, Object>> getlswMaterialOutboundListData(Integer pageNo, Integer pageSize, HttpServletRequest req) {
@@ -40,4 +54,30 @@
        }
        return super.getBaseMapper().getlswMaterialOutboundListData(pageData, paramMap);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean outboundMaterial(LswMaterialOutbound outbound) {
        if (StringUtils.isBlank(outbound.getMaterialNumber())
                || StringUtils.isBlank(outbound.getFactoryId())
                || StringUtils.isBlank(outbound.getWarehouseId())
                || outbound.getQuantity() == null
                || outbound.getQuantity().intValue() > 0
                || StringUtils.isBlank(outbound.getBatchNumber())
        || StringUtils.isBlank(outbound.getInventoryId())) {
            return false;
        }
        LswMaterialInventory inventory = materialInventoryService.getById(outbound.getInventoryId());
        if(inventory == null) {
            return false;
        }
        //更新库存状态
        inventory.setInventoryStatus(MaterialInventoryStatusEnum.OUTBOUND.name());
        materialInventoryService.updateById(inventory);
        //保存出库信息
        outbound.setDelFlag(CommonConstant.DEL_FLAG_0);
        outbound.setOutboundTime(new Date());
        super.save(outbound);
        return true;
    }
}