zss
6 天以前 23d35c163bd5308fc4a8e94cda87881d9547a251
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/FinishProductSpotCheckServiceImpl.java
@@ -16,7 +16,6 @@
import com.deepoove.poi.data.Pictures;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.utils.DateImageUtil;
import com.ruoyi.common.utils.api.IfsApiUtils;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.framework.exception.ErrorException;
import com.ruoyi.inspect.dto.IfsStockQueryDTO;
@@ -57,8 +56,7 @@
@Transactional(rollbackFor = Exception.class)
public class FinishProductSpotCheckServiceImpl implements FinishProductSpotCheckService {
    @Resource
    private IfsApiUtils ifsApiUtils;
    @Resource
    private SpotCheckQuarterMapper spotCheckQuarterMapper;
    @Resource
@@ -76,146 +74,9 @@
    public Result getIfsStockReport(IfsStockQueryDTO ifsStockQueryDTO) {
        JSONObject jresult = new JSONObject();
        jresult.put("total", 0);
        jresult.put("count", 0);
        jresult.put("data", new JSONArray());
        JSONObject jsonObject = new JSONObject();
        generateIfsStockQueryParams(jsonObject, ifsStockQueryDTO, ifsStockQueryDTO.getPage(), ifsStockQueryDTO.getLimit());
        Result result = ifsApiUtils.getIfsStock(jsonObject.toJSONString());
        if (result.getCode() == 200) {
            JSONObject data = (JSONObject) JSON.toJSON(result.getData());
            JSONArray array = new JSONArray();
            for (int i = 0; i < data.getJSONArray("LIST_INFO").size(); i++) {
                JSONObject listInfo = data.getJSONArray("LIST_INFO").getJSONObject(i);
                array.add(listInfo);
            }
            //获取总数量
            int count = data.getIntValue("TOTAL_RECORD");
            //获取页数
            int total = (int) Math.ceil((double) count / (double) ifsStockQueryDTO.getLimit());
            jresult.put("total", total);
            jresult.put("count", count);
            jresult.put("data", array);
        }
        return Result.success(jresult);
        return Result.success();
    }
    public void generateIfsStockQueryParams(JSONObject result, IfsStockQueryDTO ifsStockQueryDTO, Long pageNo, Long pageSize) {
        result.put("PAGE", pageNo);
        result.put("LIMIT", pageSize);
        result.put("WAREHOUSE", "成品仓库");
        result.put("QUANTITY_FLAG", ">0");
        //表里面的OTC行号
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getCotcOrderNo())) {
            result.put("C_OTC_ORDER_NO", ifsStockQueryDTO.getCotcOrderNo());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getCotcLineNo())) {
            result.put("C_OTC_LINE_NO", ifsStockQueryDTO.getCotcLineNo());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getPartNo())) {
            result.put("PART_NO", ifsStockQueryDTO.getPartNo());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getPartDescription())) {
            result.put("PART_DESC", "%" + ifsStockQueryDTO.getPartDescription() + "%");
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getLocNo())) {
            result.put("LOCATION_NO", ifsStockQueryDTO.getLocNo());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getLocDesc())) {
            result.put("LOCATION_DESC", ifsStockQueryDTO.getLocDesc());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getLotBatchNo())) {
            result.put("LOT_BATCH_NO", ifsStockQueryDTO.getLotBatchNo());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getWdrNo())) {
            result.put("WDR_NO", ifsStockQueryDTO.getWdrNo());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getWarehouse())) {
            result.put("WAREHOUSE", ifsStockQueryDTO.getWarehouse());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getLocationGroup())) {
            result.put("LOCATION_GROUP", ifsStockQueryDTO.getLocationGroup());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getLocationGroupDesc())) {
            result.put("LOCATION_GROUP_DESC", ifsStockQueryDTO.getLocationGroupDesc());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getReelNumber())) {
            result.put("ATTR1", ifsStockQueryDTO.getReelNumber());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getStartMeter())) {
            result.put("ATTR2", ifsStockQueryDTO.getStartMeter());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getEndMeter())) {
            result.put("ATTR3", ifsStockQueryDTO.getEndMeter());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getOuterColor())) {
            result.put("ATTR4", ifsStockQueryDTO.getOuterColor());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getInsulationColor())) {
            result.put("ATTR5", ifsStockQueryDTO.getInsulationColor());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getOtcOrderNo())) {
            result.put("ATTR6", ifsStockQueryDTO.getOtcOrderNo());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getMpsNo())) {
            result.put("ATTR7", ifsStockQueryDTO.getMpsNo());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getLetteringInfo())) {
            result.put("ATTR8", ifsStockQueryDTO.getLetteringInfo());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getSStockQuantity())) {
            result.put("ATTR9", ifsStockQueryDTO.getSStockQuantity());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getSAvailableStockQuantity())) {
            result.put("ATTR10", ifsStockQueryDTO.getSAvailableStockQuantity());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getSunit())) {
            result.put("ATTR11", ifsStockQueryDTO.getSunit());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getStockSource())) {
            result.put("ATTR12", ifsStockQueryDTO.getStockSource());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getInspInstorageTime())) {
            result.put("ATTR13", ifsStockQueryDTO.getInspInstorageTime());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getTestRemark())) {
            result.put("ATTR14", ifsStockQueryDTO.getTestRemark());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getGrossWeight())) {
            result.put("ATTR15", ifsStockQueryDTO.getGrossWeight());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getNetWeight())) {
            result.put("ATTR16", ifsStockQueryDTO.getNetWeight());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getPackingManner())) {
            result.put("ATTR17", ifsStockQueryDTO.getPackingManner());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getCylinderNumber())) {
            result.put("ATTR18", ifsStockQueryDTO.getCylinderNumber());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getRemark())) {
            result.put("ATTR19", ifsStockQueryDTO.getRemark());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getLengthRequirement())) {
            result.put("ATTR20", ifsStockQueryDTO.getLengthRequirement());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getCustomerName())) {
            result.put("ATTR21", ifsStockQueryDTO.getCustomerName());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getSystemNo())) {
            result.put("ATTR22", ifsStockQueryDTO.getSystemNo());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getInSource())) {
            result.put("ATTR23", ifsStockQueryDTO.getInSource());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getSplitQuality())) {
            result.put("ATTR24", ifsStockQueryDTO.getSplitQuality());
        }
        if (StrUtil.isNotBlank(ifsStockQueryDTO.getReserveQuantity())) {
            result.put("QTY_RESERVED", ifsStockQueryDTO.getReserveQuantity());
        }
    }
    /************************************************* 季度抽样 ***********************************************************/