#
Junjie
2024-01-05 9bc4b04f1b946e31c719ec051c3c481f5faac5e8
zy-asrs-common/src/main/java/com/zy/asrs/common/openapi/service/impl/ApiServiceImpl.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.common.domain.dto.DetlDto;
import com.zy.asrs.common.openapi.entity.dto.OrderListDto;
import com.zy.asrs.common.openapi.entity.param.CreateMatParam;
import com.zy.asrs.common.openapi.entity.param.GenerateOrderPakInParam;
import com.zy.asrs.common.openapi.entity.param.GenerateOrderPakOutParam;
import com.zy.asrs.common.openapi.entity.param.OrderListParam;
@@ -15,6 +16,7 @@
import com.zy.asrs.framework.exception.CoolException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
@@ -35,6 +37,8 @@
    private MatService matService;
    @Autowired
    private OrderSettleService orderSettleService;
    @Autowired
    private TagService tagService;
    @Override
    public void generateOrderPakIn(GenerateOrderPakInParam param) {
@@ -253,4 +257,104 @@
        }
        return listDtos;
    }
    @Override
    @Transactional
    public int createMat(List<CreateMatParam> mats, Long hostId) {
        int count = 0;
        for (CreateMatParam matParam : mats) {
            //获取分类
            Tag tag = tagService.getTag(matParam.getFirstTag(), matParam.getSecondTag(), hostId);
            matService.remove(new LambdaQueryWrapper<Mat>()
                    .eq(Mat::getMatnr, matParam.getMatnr())
                    .eq(Mat::getHostId, hostId));
            Mat mat = new Mat();
            mat.setMatnr(matParam.getMatnr());//物料号
            mat.setHostId(hostId);//仓库ID
            mat.setTagId(tag.getId());//分类ID
            if (!Cools.isEmpty(matParam.getMaktx())) {
                mat.setMaktx(matParam.getMaktx());
            }
            if (!Cools.isEmpty(matParam.getMaktx())) {
                mat.setMaktx(matParam.getMaktx());
            }
            if (!Cools.isEmpty(matParam.getName())) {
                mat.setName(matParam.getName());
            }
            if (!Cools.isEmpty(matParam.getSpecs())) {
                mat.setSpecs(matParam.getSpecs());
            }
            if (!Cools.isEmpty(matParam.getModel())) {
                mat.setModel(matParam.getModel());
            }
            if (!Cools.isEmpty(matParam.getColor())) {
                mat.setColor(matParam.getColor());
            }
            if (!Cools.isEmpty(matParam.getBrand())) {
                mat.setBrand(matParam.getBrand());
            }
            if (!Cools.isEmpty(matParam.getUnit())) {
                mat.setUnit(matParam.getUnit());
            }
            if (!Cools.isEmpty(matParam.getPrice())) {
                mat.setPrice(matParam.getPrice());
            }
            if (!Cools.isEmpty(matParam.getSku())) {
                mat.setSku(matParam.getSku());
            }
            if (!Cools.isEmpty(matParam.getUnits())) {
                mat.setUnits(matParam.getUnits());
            }
            if (!Cools.isEmpty(matParam.getBarcode())) {
                mat.setBarcode(matParam.getBarcode());
            }
            if (!Cools.isEmpty(matParam.getOrigin())) {
                mat.setOrigin(matParam.getOrigin());
            }
            if (!Cools.isEmpty(matParam.getManu())) {
                mat.setManu(matParam.getManu());
            }
            if (!Cools.isEmpty(matParam.getManuDate())) {
                mat.setManuDate(matParam.getManuDate());
            }
            if (!Cools.isEmpty(matParam.getItemNum())) {
                mat.setItemNum(matParam.getItemNum());
            }
            if (!Cools.isEmpty(matParam.getWeight())) {
                mat.setWeight(matParam.getWeight());
            }
            if (!Cools.isEmpty(matParam.getLength())) {
                mat.setLength(matParam.getLength());
            }
            if (!Cools.isEmpty(matParam.getVolume())) {
                mat.setVolume(matParam.getVolume());
            }
            if (!Cools.isEmpty(matParam.getThreeCode())) {
                mat.setThreeCode(matParam.getThreeCode());
            }
            if (!Cools.isEmpty(matParam.getSupp())) {
                mat.setSupp(matParam.getSupp());
            }
            if (!Cools.isEmpty(matParam.getSuppCode())) {
                mat.setSuppCode(matParam.getSuppCode());
            }
            if (!Cools.isEmpty(matParam.getDeadTime())) {
                mat.setDeadTime(matParam.getDeadTime());
            }
            if (!Cools.isEmpty(matParam.getMemo())) {
                mat.setMemo(matParam.getMemo());
            }
            if (!Cools.isEmpty(matParam.getStatus())) {
                mat.setStatus(matParam.getStatus());
            }else {
                mat.setStatus(1);
            }
            if (matService.save(mat)) {
                count++;
            }
        }
        return count;
    }
}