自动化立体仓库 - WMS系统
zyx
2024-01-25 439dd3583f2ea745aa5e70ce26f3489d75c90912
src/main/java/com/zy/asrs/utils/PlaExcelListener.java
@@ -5,8 +5,10 @@
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.Node;
import com.zy.asrs.entity.Pla;
import com.zy.asrs.entity.param.GlobleParameter;
import com.zy.asrs.service.NodeService;
import com.zy.asrs.service.PlaService;
import com.zy.common.entity.MatExcel;
import com.zy.common.entity.PlaExcel;
@@ -54,6 +56,7 @@
    @Override
    public void invoke(PlaExcel excel, AnalysisContext ctx) {
        PlaService plaService = SpringUtils.getBean(PlaService.class);
        NodeService nodeService = SpringUtils.getBean(NodeService.class);
        Date now = new Date();
        // 商品
@@ -65,17 +68,29 @@
            pla = excel;
            pla.setStep(2);
            pla.setCreateTime(new Date());
            pla.setStatus(GlobleParameter.PLA_STATUS_0);
            pla.setModifyTime(new Date());
            pla.setStatus(GlobleParameter.PLA_STATUS_00);
            pla.setStockFreeze(1);
            if(!Cools.isEmpty(pla.getLocNo())){
                Node node = nodeService.selectByUuid(pla.getLocNo());
                if(Cools.isEmpty(node)){
                    throw new CoolException("未能找到相应的库位信息");
                }
                pla.setStash(node.getParentName());
                pla.setLocNo(node.getUuid());
                pla.setStatus(GlobleParameter.PLA_STATUS_1);
                pla.setPakinTime(new Date());
            }
            if (!plaService.insert(pla)) {
                throw new CoolException("保存商品信息失败,商品编码:" + excel.getMatnr());
            }
            total++;
        }else if (pla.getStatus().equals(GlobleParameter.PLA_STATUS_0)){
        }else if (pla.getStatus().equals(GlobleParameter.PLA_STATUS_00)){
            excel.setId(pla.getId());
            excel.setCreateTime(pla.getCreateTime());
            excel.setModifyTime(pla.getModifyTime());
            excel.setModifyTime(new Date());
            excel.setStep(2);
            excel.setStatus(GlobleParameter.PLA_STATUS_0);
            excel.setStatus(GlobleParameter.PLA_STATUS_00);
            BeanUtils.copyProperties(excel,pla);
            plaService.updateById(pla);
            total++;