完成龙兴发运看板

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;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanCfgModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanViewModel;
import java.util.List;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesShippingKanbanModel;
public interface IMesShippingKanbanCfgService {
MesShippingKanbanCfgModel queryShippingKanbanCfg(String organizeCode);
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) {
try {
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) {
return ResultBean.fail(imppException);
} 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.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.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.util.DateUtil;
@ -129,14 +130,35 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
}
@Override
public List<MesShippingKanbanViewModel> queryShippingKanbanContext(String organizeCode) {
List<MesShippingKanbanViewModel> viewModels = new ArrayList<>();
public MesShippingKanbanModel queryShippingKanbanContext(String organizeCode) {
MesShippingKanbanModel model = new MesShippingKanbanModel();
Map<String, MesShippingKanbanCfgDetail> cfgDetailMap = null;
MesShippingKanbanCfgModel cfgModel = queryShippingKanbanCfg(organizeCode);
MesShippingKanbanCfg cfg = cfgModel != null ? cfgModel.getConfig() : 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())) {
cfgDetailMap = cfgModel.getDetails().stream().collect(Collectors.toMap(MesShippingKanbanCfgDetail::getDetailCode, v -> v));
}
@ -147,9 +169,9 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
continue;
}
MesShippingKanbanViewModel model = new MesShippingKanbanViewModel();
model.setDetailName(index.getDescription());
model.setOrderNumber(cfgDetail.getOrderNumber());
MesShippingKanbanViewModel viewModel = new MesShippingKanbanViewModel();
viewModel.setDetailName(index.getDescription());
viewModel.setOrderNumber(cfgDetail.getOrderNumber());
String rangDescription = "";
if (!StringUtils.isEmpty(cfgDetail.getRangValueLess())) {
rangDescription += "<" + cfgDetail.getRangValueLess();
@ -160,7 +182,7 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
}
rangDescription += ">=" + cfgDetail.getRangValueMore();
}
model.setRangDescription(rangDescription);
viewModel.setRangDescription(rangDescription);
List<String> values = null;
switch (index) {
case CLIENT_STOCK_QTY:
@ -212,12 +234,12 @@ public class MesShippingKanbanCfgServiceImpl implements IMesShippingKanbanCfgSer
if (values == null) {
values = new ArrayList<>();
}
model.setValues(values);
model.setColor(getColor(cfgDetail, values));
viewModels.add(model);
viewModel.setValues(values);
viewModel.setColor(getColor(cfgDetail, values));
model.getDetails().add(viewModel);
}
viewModels.sort(Comparator.comparing(MesShippingKanbanViewModel::getOrderNumber));
return viewModels;
model.getDetails().sort(Comparator.comparing(MesShippingKanbanViewModel::getOrderNumber));
return model;
}
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