chenlu
12 小时以前 94c0a729da1b88ab4a0067f1e14a00264e0447cf
north-glass-erp/src/main/java/com/example/erp/service/sd/BomDataService.java
@@ -34,14 +34,21 @@
        Object consume =  object.get("consume");
        Object price =  object.get("price");
        Integer type = (Integer) object.get("type");
        String unit="";
        if (type.equals(1)){
            unit = "㎡";
        } else if (type.equals(2)) {
            unit = "m";
        } else if (type.equals(3)) {
            unit = "片";
        }
        if (id!=null){
            //查询物料编号是否已存在
            Integer countId =  bomDataMapper.getMaterialId(id);
            if (countId == 0){
                bomDataMapper.saveMaterialBomDataMp(id,name,consume,price,type);
                bomDataMapper.saveMaterialBomDataMp(id,name,consume,price,type,unit);
            }else {
                bomDataMapper.updateMaterialBomDataMp(id,name,consume,price,type);
                bomDataMapper.updateMaterialBomDataMp(id,name,consume,price,type,unit);
            }
            return true;
@@ -64,8 +71,10 @@
                    Object produceId = row.get("produceId");
                    Object tabId = row.get("tabId");
                    Object layer = row.get("layer");
                    if (tabId!=null){
                        bomDataMapper.saveProductBOMMp(produceId,tabId,layer);
                    }
                    bomDataMapper.saveProductBOMMp(produceId,tabId,layer);
                }
            }
        }
@@ -76,6 +85,8 @@
    public Map<String, Object> getOrderBomDataSv(String orderId) {
        Map<String, Object> map = new HashMap<>();
        map.put("data", bomDataMapper.getOrderBomDataMp(orderId));
        map.put("sumData", bomDataMapper.getOrderBomSumDataMp(orderId));
        map.put("sumDataDatils", bomDataMapper.getOrderBomsumDataDatilsMp(orderId));
        return map;
    }
@@ -86,7 +97,7 @@
        if (!orderDetailsList.isEmpty()) {
            for (OrderDetail od : orderDetailsList) {
                Map<String, Object> itemmap = new HashMap<>();
                itemmap.put("data", bomDataMapper.getBOMDetails(od.getProductId()));
                itemmap.put("data", bomDataMapper.getBOMDetails(od.getProductId(),od.getOrderId()));
                list.add(itemmap);
            }
@@ -94,4 +105,10 @@
        map.put("data", list);
        return map;
    }
    public Map<String, Object> editProductBOMSv(String produceId) {
        Map<String, Object> map = new HashMap<>();
        map.put("data", bomDataMapper.getEditProductBOMSv(produceId));
        return map;
    }
}