自动化立体仓库 - WMS系统
tqs
2022-09-13 e0caa6730a116f82888cc6fe2c2c2717553d1150
src/main/java/com/zy/asrs/service/impl/NodeServiceImpl.java
@@ -17,6 +17,7 @@
import com.zy.asrs.service.ManLocDetlService;
import com.zy.asrs.service.MatService;
import com.zy.asrs.service.NodeService;
import com.zy.asrs.utils.SaasUtils;
import com.zy.asrs.utils.VersionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -109,6 +110,7 @@
            manLocDetl.setCreateTime(now);
            manLocDetl.setModiTime(now);
            manLocDetl.setCreateBy(userId);
            SaasUtils.insertLog(0,manLocDetl.getLocNo(),manLocDetl.getMatnr(), manLocDetl.getAnfme());
            manLocDetlService.insert(manLocDetl);
        }
@@ -135,13 +137,34 @@
                if (manLocDetl.getAnfme() - param.getCount() < 0) {
                    return R.error("物料:"+ param.getMatnr() + " 在库位中数量不足");
                }else {
                    manLocDetl.setAnfme(manLocDetl.getAnfme() - param.getCount());
                    manLocDetlService.update(manLocDetl,new EntityWrapper<ManLocDetl>()
                            .eq("loc_no",node.getUuid())
                            .eq("matnr",param.getMatnr()));
                    SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),manLocDetl.getAnfme());
                }
            }
        }
        return R.ok("出库成功");
    }
    @Transactional
    @Override
    public void locMove(String sourceLocNo, String targetLocNo, Long userId) {
        List<ManLocDetl> targets = manLocDetlService.selectList(new EntityWrapper<ManLocDetl>()
                .like("loc_no", sourceLocNo));
        for (ManLocDetl target : targets) {
            Node uuid = nodeService.selectOne(new EntityWrapper<Node>()
                    .eq("uuid", targetLocNo));
            if (uuid == null || uuid.equals("")) {
                throw new RuntimeException("无法查询到移库的目标库位");
            }
            manLocDetlService.deleteById(target);
            target.setLocNo(uuid.getUuid());
            target.setNodeId(uuid.getId());
            SaasUtils.insertLog(2,target.getLocNo(), target.getMatnr(), target.getAnfme());
            manLocDetlService.insert(target);
        }
    }
}