| | |
| | | package com.example.erp.service.sd; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.example.erp.entity.sd.BasicData; |
| | | import com.example.erp.entity.sd.BasicOtherMoney; |
| | | import com.example.erp.entity.sd.BomBase; |
| | | import com.example.erp.entity.sd.Customer; |
| | | import com.example.erp.entity.pp.FlowCard; |
| | | import com.example.erp.entity.sd.*; |
| | | import com.example.erp.mapper.sd.BomDataMapper; |
| | | import com.example.erp.mapper.sd.BasicOtherMoneyMapper; |
| | | import com.example.erp.mapper.sd.CustomerMapper; |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public Object saveProductBOMSv(Map<String, Object> object) { |
| | | // 遍历每个产品 |
| | | for (Map.Entry<String, Object> entry : object.entrySet()) { |
| | | String productName = entry.getKey(); |
| | | Object value = entry.getValue(); |
| | | |
| | | if (value instanceof List) { |
| | | List<Map<String, Object>> rows = (List<Map<String, Object>>) value; |
| | | |
| | | for (Map<String, Object> row : rows) { |
| | | // 取每条数据 |
| | | Object produceId = row.get("produceId"); |
| | | Object tabId = row.get("tabId"); |
| | | Object layer = row.get("layer"); |
| | | |
| | | bomDataMapper.saveProductBOMMp(produceId,tabId,layer); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | public Map<String, Object> getOrderBomDataSv(String orderId) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", bomDataMapper.getOrderBomDataMp(orderId)); |
| | | return map; |
| | | } |
| | | |
| | | public Map<String, Object> getBomDataProductSv(Map<String, Object> object) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//最终结果 |
| | | List<OrderDetail> orderDetailsList = JSONArray.parseArray(JSONObject.toJSONString(object.get("productName")), OrderDetail.class); |
| | | if (!orderDetailsList.isEmpty()) { |
| | | for (OrderDetail od : orderDetailsList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", bomDataMapper.getBOMDetails(od.getProductId())); |
| | | list.add(itemmap); |
| | | |
| | | } |
| | | } |
| | | map.put("data", list); |
| | | return map; |
| | | } |
| | | } |