完成龙兴发运看板

uat-temp-nht-202502180000-shippingkanban
jason 3 months ago
parent ff7b11e271
commit 84c3d427f2

@ -1,12 +1,10 @@
package cn.estsh.i3plus.ext.mes.pcn.api.busi; 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.MesShippingKanbanCfgModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanViewModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanModel;
import java.util.List;
public interface IMesShippingKanbanCfgService { public interface IMesShippingKanbanCfgService {
MesShippingKanbanCfgModel queryShippingKanbanCfg(String organizeCode); MesShippingKanbanCfgModel queryShippingKanbanCfg(String organizeCode);
void doSaveShippingKanbanCfg(MesShippingKanbanCfgModel request, String organizeCode, String username); void doSaveShippingKanbanCfg(MesShippingKanbanCfgModel request, String organizeCode, String username);
List<MesShippingKanbanViewModel> queryShippingKanbanContext(String organizeCode); MesShippingKanbanModel queryShippingKanbanContext(String organizeCode);
} }

@ -56,7 +56,7 @@ public class MesShippingKanbanCfgController {
public ResultBean queryShippingKanbanContext(String organizeCode) { public ResultBean queryShippingKanbanContext(String organizeCode) {
try { try {
organizeCode = !StringUtils.isEmpty(organizeCode) ? organizeCode : AuthUtil.getOrganize().getOrganizeCode(); organizeCode = !StringUtils.isEmpty(organizeCode) ? organizeCode : AuthUtil.getOrganize().getOrganizeCode();
return ResultBean.success("查询成功").setResultList(shippingKanbanCfgService.queryShippingKanbanContext(organizeCode)); return ResultBean.success("查询成功").setResultObject(shippingKanbanCfgService.queryShippingKanbanContext(organizeCode));
} catch (ImppBusiException imppException) { } catch (ImppBusiException imppException) {
return ResultBean.fail(imppException); return ResultBean.fail(imppException);
} catch (Exception e) { } catch (Exception e) {

@ -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.api.busi.IMesShippingKanbanCfgService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanCfgModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanCfgModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanViewModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanViewModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.util.DateUtil; import cn.estsh.i3plus.mes.pcn.util.DateUtil;
@ -129,14 +130,35 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
} }
@Override @Override
public List<MesShippingKanbanViewModel> queryShippingKanbanContext(String organizeCode) { public MesShippingKanbanModel queryShippingKanbanContext(String organizeCode) {
List<MesShippingKanbanViewModel> viewModels = new ArrayList<>(); MesShippingKanbanModel model = new MesShippingKanbanModel();
Map<String, MesShippingKanbanCfgDetail> cfgDetailMap = null; Map<String, MesShippingKanbanCfgDetail> cfgDetailMap = null;
MesShippingKanbanCfgModel cfgModel = queryShippingKanbanCfg(organizeCode); MesShippingKanbanCfgModel cfgModel = queryShippingKanbanCfg(organizeCode);
MesShippingKanbanCfg cfg = cfgModel != null ? cfgModel.getConfig() : null; MesShippingKanbanCfg cfg = cfgModel != null ? cfgModel.getConfig() : null;
if (cfg == null) { if (cfg == null) {
return viewModels; return model;
}
StringBuilder kabanTitle = new StringBuilder();
if (!StringUtils.isEmpty(cfg.getShippingGroupCode())) {
for (String groupCode : cfg.getShippingGroupCode().split(",")) {
DdlPackBean groupPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(groupCode, "shippingGroupCode", groupPackBean);
MesPartShippingGroup shippingGroup = partShippingGroupRDao.getByProperty(groupPackBean);
if (shippingGroup != null) {
if (kabanTitle.length() > 0) {
kabanTitle.append(" ");
}
kabanTitle.append(shippingGroup.getShippingGroupName());
}
} }
}
if (kabanTitle.length() > 0) {
kabanTitle.append("|");
}
kabanTitle.append("发运看板");
model.setKanbanTitle(kabanTitle.toString());
if (!CollectionUtils.isEmpty(cfgModel.getDetails())) { if (!CollectionUtils.isEmpty(cfgModel.getDetails())) {
cfgDetailMap = cfgModel.getDetails().stream().collect(Collectors.toMap(MesShippingKanbanCfgDetail::getDetailCode, v -> v)); cfgDetailMap = cfgModel.getDetails().stream().collect(Collectors.toMap(MesShippingKanbanCfgDetail::getDetailCode, v -> v));
} }
@ -147,9 +169,9 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
continue; continue;
} }
MesShippingKanbanViewModel model = new MesShippingKanbanViewModel(); MesShippingKanbanViewModel viewModel = new MesShippingKanbanViewModel();
model.setDetailName(index.getDescription()); viewModel.setDetailName(index.getDescription());
model.setOrderNumber(cfgDetail.getOrderNumber()); viewModel.setOrderNumber(cfgDetail.getOrderNumber());
String rangDescription = ""; String rangDescription = "";
if (!StringUtils.isEmpty(cfgDetail.getRangValueLess())) { if (!StringUtils.isEmpty(cfgDetail.getRangValueLess())) {
rangDescription += "<" + cfgDetail.getRangValueLess(); rangDescription += "<" + cfgDetail.getRangValueLess();
@ -160,7 +182,7 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
} }
rangDescription += ">=" + cfgDetail.getRangValueMore(); rangDescription += ">=" + cfgDetail.getRangValueMore();
} }
model.setRangDescription(rangDescription); viewModel.setRangDescription(rangDescription);
List<String> values = null; List<String> values = null;
switch (index) { switch (index) {
case CLIENT_STOCK_QTY: case CLIENT_STOCK_QTY:
@ -212,12 +234,12 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
if (values == null) { if (values == null) {
values = new ArrayList<>(); values = new ArrayList<>();
} }
model.setValues(values); viewModel.setValues(values);
model.setColor(getColor(cfgDetail, values)); viewModel.setColor(getColor(cfgDetail, values));
viewModels.add(model); model.getDetails().add(viewModel);
} }
viewModels.sort(Comparator.comparing(MesShippingKanbanViewModel::getOrderNumber)); model.getDetails().sort(Comparator.comparing(MesShippingKanbanViewModel::getOrderNumber));
return viewModels; return model;
} }
private String getColor(MesShippingKanbanCfgDetail cfgDetail, List<String> values) { private String getColor(MesShippingKanbanCfgDetail cfgDetail, List<String> values) {

@ -0,0 +1,16 @@
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 MesShippingKanbanModel {
@ApiParam("看板标题")
private String kanbanTitle;
@ApiParam("指标明细")
private List<MesShippingKanbanViewModel> details = new ArrayList<>();
}
Loading…
Cancel
Save