diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesShippingKanbanCfgService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesShippingKanbanCfgService.java index 153bd52..6a99563 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesShippingKanbanCfgService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesShippingKanbanCfgService.java @@ -1,8 +1,12 @@ package cn.estsh.i3plus.ext.mes.pcn.api.busi; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanCfgModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanViewModel; + +import java.util.List; public interface IMesShippingKanbanCfgService { MesShippingKanbanCfgModel queryShippingKanbanCfg(String organizeCode); void saveShippingKanbanCfg(String organizeCode, MesShippingKanbanCfgModel request); + List queryShippingKanbanContext(String organizeCode); } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShippingKanbanCfgController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShippingKanbanCfgController.java index 9f3f417..7c78aad 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShippingKanbanCfgController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesShippingKanbanCfgController.java @@ -51,4 +51,17 @@ public class MesShippingKanbanCfgController { return ImppExceptionBuilder.newInstance().buildExceptionResult(e); } } + + @GetMapping("/queryContext") + @ApiOperation(value = "查询发运看板内容") + public ResultBean queryShippingKanbanContext(String organizeCode) { + try { + organizeCode = !StringUtils.isEmpty(organizeCode) ? organizeCode : AuthUtil.getOrganize().getOrganizeCode(); + return ResultBean.success("查询成功").setResultList(shippingKanbanCfgService.queryShippingKanbanContext(organizeCode)); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingKanbanCfgServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingKanbanCfgServiceImpl.java index d4a5f1b..7e7c632 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingKanbanCfgServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesShippingKanbanCfgServiceImpl.java @@ -2,6 +2,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesShippingKanbanCfgService; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanCfgModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanViewModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.platform.common.tool.TimeTool; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; @@ -14,8 +15,10 @@ import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; @Service public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgService { @@ -32,7 +35,7 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer model.setConfig(kanbanCfg); if (kanbanCfg != null) { DdlPackBean detailPackBean = DdlPackBean.getDdlPackBean(organizeCode); - DdlPreparedPack.getNumberBiggerEqualPack(kanbanCfg.getId(), "configID", packBean); + DdlPreparedPack.getNumEqualPack(kanbanCfg.getId(), "configID", packBean); List details = shippingKanbanCfgDetailRDao.findByHqlWhere(detailPackBean); model.setDetails(details); } @@ -75,4 +78,87 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer } } } + + @Override + public List queryShippingKanbanContext(String organizeCode) { + List viewModels = new ArrayList<>(); + Map cfgDetailMap = null; + MesShippingKanbanCfgModel cfgModel = queryShippingKanbanCfg(organizeCode); + if (cfgModel != null && !CollectionUtils.isEmpty(cfgModel.getDetails())) { + cfgDetailMap = cfgModel.getDetails().stream().collect(Collectors.toMap(MesShippingKanbanCfgDetail::getDetailCode, v -> v)); + } + + for (MesExtEnumUtil.SHIPPING_KANBAN_DETAIL_INDEX index : MesExtEnumUtil.SHIPPING_KANBAN_DETAIL_INDEX.values()) { + MesShippingKanbanCfgDetail cfgDetail = cfgDetailMap != null ? cfgDetailMap.get(index.getValue()) : null; + if (cfgDetail == null || cfgDetail.getIsShow() == null || !cfgDetail.getIsShow() || cfgDetail.getOrderNumber() == null) { + continue; + } + + MesShippingKanbanViewModel model = new MesShippingKanbanViewModel(); + model.setDetailName(index.getDescription()); + model.setOrderNumber(cfgDetail.getOrderNumber()); + String rangDescription = ""; + if (!StringUtils.isEmpty(cfgDetail.getRangValueLess())) { + rangDescription += "<" + cfgDetail.getRangValueLess(); + } + if (!StringUtils.isEmpty(cfgDetail.getRangValueMore())) { + if (StringUtils.isEmpty(rangDescription)) { + rangDescription += "&"; + } + rangDescription += ">=" + cfgDetail.getRangValueMore(); + } + model.setRangDescription(rangDescription); + List values = null; + switch (index) { + case CLIENT_STOCK_QTY: + values = getClientStockQty(cfgDetail); + break; + case WAIT_SHIPPING_QTY: + values = getWaitShippingQty(cfgDetail); + break; + case CP_WAIT_SHIPPING_QTY: + break; + case WAIT_PRODUCT_QTY: + break; + case LAST_SHIPPING_TIME: + break; + case CP_LAST_SHIPPING_TIME: + break; + case NEXT_SHIPPING_TIME: + break; + case TREE_STOP_WARNING: + break; + case SHIPPING_VIN: + break; + case CP_SHIPPING_VIN: + break; + case TODAY_ONLINE: + break; + case TODAY_SHIPPING: + break; + case TODAY_CAR: + break; + case CLIENT_JPH: + break; + case PRODUCT_JPH: + break; + } + model.setValues(values); + viewModels.add(model); + } + viewModels.sort(Comparator.comparing(MesShippingKanbanViewModel::getOrderNumber)); + return viewModels; + } + + private List getClientStockQty(MesShippingKanbanCfgDetail cfgDetail) { + List values = new ArrayList<>(); + + return values; + } + + private List getWaitShippingQty(MesShippingKanbanCfgDetail cfgDetail) { + List values = new ArrayList<>(); + + return values; + } } diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesShippingKanbanViewModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesShippingKanbanViewModel.java new file mode 100644 index 0000000..eec677f --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesShippingKanbanViewModel.java @@ -0,0 +1,23 @@ +package cn.estsh.i3plus.ext.mes.pcn.pojo.model; + +import io.swagger.annotations.ApiParam; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class MesShippingKanbanViewModel { + + @ApiParam("名称") + private String detailName; + + @ApiParam("排序") + private Integer orderNumber; + + @ApiParam("计算值") + private List values = new ArrayList<>(); + + @ApiParam("范围描述") + private String rangDescription; +}