package com.hzs.scm.trans.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.common.core.constant.ScmFieldConstants;
import com.hzs.common.core.constant.SystemFieldConstants;
import com.hzs.common.core.enums.EYesNo;
import com.hzs.common.core.utils.DateUtils;
import com.hzs.common.domain.scm.purchase.IcPurchaseInB;
import com.hzs.common.domain.scm.trans.IcTransOutB;
import com.hzs.common.domain.scm.trans.ext.IcTransOutBExt;
import com.hzs.scm.trans.mapper.IcTransOutBMapper;
import com.hzs.scm.trans.service.IIcTransOutBService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 调拨入库明细 服务实现类
 * </p>
 *
 * @author hzs
 * @since 2023-12-04
 */
@Service
public class IcTransOutBServiceImpl extends ServiceImpl<IcTransOutBMapper, IcTransOutB> implements IIcTransOutBService {

    @Override
    public List<IcTransOutBExt> queryTransferOutBiByPk(Integer orderType, List<IcTransOutBExt> icTransferOutbExtList) {
        return baseMapper.queryTransferOutBiByPk(orderType, icTransferOutbExtList);
    }

    @Override
    public void deleteTransferItemsByList(List<IcTransOutB> icTransferOutbList, Long pkMember) {
        baseMapper.deleteTransferItemsByList(icTransferOutbList, pkMember);
    }

    @Override
    public void deleteTransferItemsByPkTransfer(Long pkTransfer, Long pkMember) {
        UpdateWrapper<IcTransOutB> updateWrapper = new UpdateWrapper<>();
        updateWrapper.set(SystemFieldConstants.DEL_FLAG, EYesNo.NO.getIntValue());
        updateWrapper.set(SystemFieldConstants.PK_MODIFIED, pkMember);
        updateWrapper.set(SystemFieldConstants.MODIFIED_TIME, DateUtils.currentDateTime());
        updateWrapper.eq(ScmFieldConstants.PK_TRANSFER_OUT, pkTransfer);
        update(updateWrapper);
    }
}
