1.修复月度计划审核生成作业计划时状态错误的问题

2.修复看板数据显示异常问题
3.排产功能优化
master
董哲奇 8 months ago
parent e39ec92547
commit e9eb11d3f1

@ -89,10 +89,32 @@ public class DmDhqdp implements Serializable {
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
private TypeEnum type;//T型材,板材,型材
private String plzlsl;//批量组立数量
private String kdzlsl;//跨道组立数量
private String ptybsl;//平铁用板数量
private String dhqdrq;//日期(订货清单)
private String rev;//版本
private String revisor;//编制
private String reviewed;//审核
private String approved;//批准
@TableField(exist = false)
private String xh;//序号列用于去除合计行
public void setTxc(){
this.type=TypeEnum.TXC;
}
public void setXc(){
this.type=TypeEnum.XC;
}
public void setBc(){
this.type=TypeEnum.BC;
}
private enum TypeEnum{
TXC,XC,BC
}
}

@ -194,4 +194,7 @@ public class DmSygdMxLj implements Serializable {
private String id;
public String getUniqueData(){
return this.dcch+this.pl+this.tzbh;
}
}

@ -72,72 +72,72 @@ public class DmYdjhController {
.orderByAsc("jssj,dc_ch,dc_pl,zl,lqlb")
);
Map<String, List<DmYdjh>> collect = list.stream().collect(Collectors.groupingBy(DmYdjh::getDcCh));
List<Map<String, Object>> resultMap=new ArrayList<>();
// Map<String, List<DmYdjh>> collect = list.stream().collect(Collectors.groupingBy(DmYdjh::getDcCh));
// List<Map<String, Object>> resultMap=new ArrayList<>();
//验证数据获取方法,后续可以都在这里进行获取
collect.forEach((key,val)->{
List<ImCkwpkwp> bcKcxx = kcService.getBcKcxx(key);
List<DmCzplpNew> czplpNewList = czplpNewService.list(Wrappers.<DmCzplpNew>lambdaQuery()
.eq(DmCzplpNew::getDcCh, key)
);
val.forEach(item->{
Map<String, Object> itemMap = BeanUtil.beanToMap(item);
resultMap.add(itemMap);
bcKcxx.forEach(kc->{
if (item.getDcCh().equals(kc.getDcCh())
&&item.getDcFd().equals(kc.getDcPl())
&&item.getTzbh().equals(kc.getDcTh())){
itemMap.put("kc",kc);
}
});
czplpNewList.forEach(czplpNew->{
if (item.getDcCh().equals(czplpNew.getDcCh())&&item.getDcPl().equals(czplpNew.getDcPl())) {
/// 判断颜色
itemMap.put("czplpNew", czplpNew);
// if (StringUtils.isBlank(czplpNew.getXfqLqb())|| StringUtils.isBlank(item.getSlrq())) {
// // corlor red
// itemMap.put("color", "red");
// } else {
// DateTime dateStr1 = DateUtil.parse(czplpNew.getXfqLqb(), "yyyy/MM/dd");
// DateTime dateStr2 = DateUtil.parse(item.getSlrq(), "yyyy/MM/dd");
// int result = DateUtil.compare(dateStr1, dateStr2);
// if (result > 0) {
// System.out.println(dateStr1 + " is after " + dateStr2);
// itemMap.put("color", "red");
// } else if (result < 0) {
// System.out.println(dateStr1 + " is before " + dateStr2);
//
// } else {
// System.out.println(dateStr1 + " is equal to " + dateStr2);
// itemMap.put("color", "yellow");
// }
// }
// if (StringUtils.isBlank(czplpNew.getXfqTlt())||StringUtils.isBlank(item.getHxrq())) {
// // corlor yellow
// itemMap.put("color", "red");
// } else {
// DateTime dateStr1 = DateUtil.parse(czplpNew.getXfqTlt(), "yyyy/MM/dd");
// DateTime dateStr2 = DateUtil.parse(item.getHxrq(), "yyyy/MM/dd");
// int result = DateUtil.compare(dateStr1, dateStr2);
// if (result > 0) {
// System.out.println(dateStr1 + " is after " + dateStr2);
// itemMap.put("color", "red");
// } else if (result < 0) {
// System.out.println(dateStr1 + " is before " + dateStr2);
// collect.forEach((key,val)->{
// List<ImCkwpkwp> bcKcxx = kcService.getBcKcxx(key);
// List<DmCzplpNew> czplpNewList = czplpNewService.list(Wrappers.<DmCzplpNew>lambdaQuery()
// .eq(DmCzplpNew::getDcCh, key)
// );
//
// } else {
// System.out.println(dateStr1 + " is equal to " + dateStr2);
// itemMap.put("color", "yellow");
// val.forEach(item->{
// Map<String, Object> itemMap = BeanUtil.beanToMap(item);
// resultMap.add(itemMap);
// bcKcxx.forEach(kc->{
// if (item.getDcCh().equals(kc.getDcCh())
// &&item.getDcFd().equals(kc.getDcPl())
// &&item.getTzbh().equals(kc.getDcTh())){
// itemMap.put("kc",kc);
// }
// });
// czplpNewList.forEach(czplpNew->{
// if (item.getDcCh().equals(czplpNew.getDcCh())&&item.getDcPl().equals(czplpNew.getDcPl())) {
// /// 判断颜色
// itemMap.put("czplpNew", czplpNew);
//// if (StringUtils.isBlank(czplpNew.getXfqLqb())|| StringUtils.isBlank(item.getSlrq())) {
//// // corlor red
//// itemMap.put("color", "red");
//// } else {
//// DateTime dateStr1 = DateUtil.parse(czplpNew.getXfqLqb(), "yyyy/MM/dd");
//// DateTime dateStr2 = DateUtil.parse(item.getSlrq(), "yyyy/MM/dd");
//// int result = DateUtil.compare(dateStr1, dateStr2);
//// if (result > 0) {
//// System.out.println(dateStr1 + " is after " + dateStr2);
//// itemMap.put("color", "red");
//// } else if (result < 0) {
//// System.out.println(dateStr1 + " is before " + dateStr2);
////
//// } else {
//// System.out.println(dateStr1 + " is equal to " + dateStr2);
//// itemMap.put("color", "yellow");
//// }
//// }
//// if (StringUtils.isBlank(czplpNew.getXfqTlt())||StringUtils.isBlank(item.getHxrq())) {
//// // corlor yellow
//// itemMap.put("color", "red");
//// } else {
//// DateTime dateStr1 = DateUtil.parse(czplpNew.getXfqTlt(), "yyyy/MM/dd");
//// DateTime dateStr2 = DateUtil.parse(item.getHxrq(), "yyyy/MM/dd");
//// int result = DateUtil.compare(dateStr1, dateStr2);
//// if (result > 0) {
//// System.out.println(dateStr1 + " is after " + dateStr2);
//// itemMap.put("color", "red");
//// } else if (result < 0) {
//// System.out.println(dateStr1 + " is before " + dateStr2);
////
//// } else {
//// System.out.println(dateStr1 + " is equal to " + dateStr2);
//// itemMap.put("color", "yellow");
//// }
//// }
// }else {
// // itemMap.put("color", "red");
// }
}else {
// itemMap.put("color", "red");
}
});
});
});
return new ResultBean(resultMap);
// });
// });
// });
return new ResultBean(list);
}
@RequestMapping("/hz")

@ -33,6 +33,8 @@ import com.dsic.gj_erp.service.jhgk.DmSygdxqService;
import com.dsic.gj_erp.service.jhgk.DmZrcjhService;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.AtomicDouble;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import java.io.FileOutputStream;
@ -72,9 +74,10 @@ public class DataFactory {
public static void 4(){
();
.clear();
Manager.=new ArrayList<>();
=new ArrayList<>();
List<> list=1();
// list=list.stream().filter(item->"G175K-4".equals(item.getDcCh())&&"116".equals(item.getDcPl())).collect(Collectors.toList());
List<> = (list);
try {
@ -85,23 +88,27 @@ public class DataFactory {
}finally {
(list);
}
}
private static final Map<String,PcDto> lastedData=new HashMap<>();
public static void (List<> list){
CD _CD = getBean(CD.class);
List<CD> CDS = _CD.get();
Map<Constant.,CD> CDMap=new HashMap<>();
CDS.forEach(item->CDMap.put(item.getGx(),item));
lastedData.clear();
for ( item:list){
if (ObjUtil.isNotEmpty(item.getBomList())){
(item,CDMap);
PcDto dto=(item,CDMap);
if (dto!=null){
lastedData.put(dto.getCh(),dto);
}
}
}
}
private static void ( item,Map<Constant.,CD> CDMap){
private static PcDto ( item,Map<Constant.,CD> CDMap){
Constant. =Constant..;
//需求日期可利用范围是±3天
int times=-3;
@ -123,15 +130,22 @@ public class DataFactory {
DateTime xzglxq = item.get().offset(DateField.DAY_OF_YEAR,cd);
if (xzglxq.isBefore(DateUtil.date())){
//break;
//continue;
}
_ = (xzglxq);
if (_.get_date().isBefore(DateUtil.date())){
//break;
//continue;
}
//记录6次计算的全部资源
PcDto dto=lastedData.get(item.getDcCh());
if (times==-3){
tmpList.add(_);
}else if (dto!=null&&dto.get_().get_date().isBefore(_.get_date())){
tmpList.add(_);
}
if (_.()){
(item.getBomList(),item.get(),CDMap);
break;
@ -142,23 +156,31 @@ public class DataFactory {
}while (true);
//若在需求期±3天内无法正常排产时,查找最大可用空闲资源进行占用
AtomicReference<String> date=new AtomicReference<>();
if (times>3){
AtomicReference<> _tmp= new AtomicReference<>();
//查找最小可用资源,进行占用
tmpList.sort(Comparator.comparingDouble((tmp)->tmp.getMAP().get(Constant..).get()));
tmpList.stream().findFirst().ifPresent(tmp->{
DateTime offset = DateUtil.parse(tmp.getDate()).offset(DateField.DAY_OF_MONTH, -CDMap.get().getCd());
(item.getBomList(),offset,CDMap);
date.set(tmp.getDate());
(item.getBomList(),tmp.get_date(),CDMap);
_tmp.set(tmp);
});
_=_tmp.get();
}
if (_!=null){
date.set(_.getDate());
}else {
log.info("船号:{},批次:{},早于当前日期无需排产",item.getDcCh(),item.getDcPl());
return;
log.info("船号:{},批次:{},占用资源成功,切割日期:{}",item.getDcCh(),item.getDcPl(),_.getDate());
PcDto pcDto = new PcDto();
pcDto.setCh(item.getDcCh());
pcDto.setPl(item.getDcPl());
pcDto.set_(_);
return pcDto;
}
log.info("船号:{},批次:{},占用资源成功,切割日期:{}",item.getDcCh(),item.getDcPl(),date.get());
@Getter
@Setter
private static class PcDto{
private String ch;
private String pl;
private _;
}
private static void (List<Bom> list,DateTime ,Map<Constant.,CD> CDMap){
@ -166,6 +188,10 @@ public class DataFactory {
for (Bom bom:list){
_ = (bom);
if ("G175K-12".equals(bom.getDcch())&&"077".equals(bom.getPl())){
System.out.println();
}
if (_==null){
latch.countDown();
log.info("船号:{},批次:{},图纸编号:{},无法找到对应套料图",bom.getDcch(),bom.getPl(),bom.getTzbh());

@ -84,7 +84,7 @@ public class 钢料需求 {
if (this. ==null){
return DateUtil.parse(this.xzglxq,"yyyy/MM/dd");
}
return this.;
return (DateTime) this..clone();
}
}

@ -188,6 +188,9 @@ public abstract class 套料图工序 implements 套料图工序接口 {
Integer cd = CD.get(_).getCd();
DateTime dateTime = DateUtil.offsetDay(this._, cd);
_ = (dateTime);
if ("G175K-12".equals(bom.getDcch())&&"077".equals(bom.getPl())&&_== Constant..){
System.out.println(_);
}
try {
if (_.(_,this.bom,)){
// this.bom.set所在资源(_资源);

@ -2,6 +2,7 @@ package com.dsic.gj_erp.pc.service;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsic.gj_erp.bean.ResultBean;
@ -19,8 +20,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@ -47,8 +47,10 @@ public class 三月滚动接口 {
return new ResultBean(false, 1, "请先导入" + begin + " ~ " + end + "分段钢料需求!");
}
//2.根据
List<DmSygdMx> mxList = ljList.stream().map(DmSygdMx::ofWithDmSygdMxlj).collect(Collectors.toList());
List<DmSygdMx> mxList = ljList.stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(DmSygdMxLj::getUniqueData))), ArrayList::new)
).stream().map(DmSygdMx::ofWithDmSygdMxlj).collect(Collectors.toList());
Map<String, List<DmSygdMx>> collect = mxList.stream().collect(Collectors.groupingBy(item -> item.getDcCh() + item.getDcPl()));
@ -62,9 +64,11 @@ public class 三月滚动接口 {
_.get().values().forEach(_->{
_.get().forEach(_bom->{
List<DmSygdMx> dmSygdMxes = collect.get(_bom.getDcch() + _bom.getPl());
if (ObjectUtil.isNotEmpty(dmSygdMxes)){
for (DmSygdMx mx:dmSygdMxes){
mx.(_.get(),_.getDate());
}
}
});
});
});
@ -72,7 +76,6 @@ public class 三月滚动接口 {
sygdMxService.saveBatch(mxList,500);
new Thread(()->{
ljList.forEach(lj-> mxList.forEach(mx->{
if (lj.getDcch().equals(mx.getDcCh())
&&lj.getPl().equals(mx.getDcPl())
@ -81,7 +84,6 @@ public class 三月滚动接口 {
}
}));
ljService.saveBatch(ljList,500);
}).start();
List<DmYdjhxf> list= sygdMxService.tqSygd1(begin,end);
return new ResultBean<>(list);

@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsic.gj_erp.bean.jhgk.DmDhqdp;
import com.dsic.gj_erp.mapper.jhgk.DmDhqdpMapper;
import com.dsic.gj_erp.service.jhgk.DmDhqdpService;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.*;
@ -24,6 +25,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -68,34 +70,66 @@ public class DmDhqdpServiceImpl extends ServiceImpl<DmDhqdpMapper, DmDhqdp> impl
Sheet sheet = workbook.getSheetAt(0);
List<CellRangeAddress> mergedRegions = sheet.getMergedRegions();
if (mergedRegions.size() > 74) {
String ddh = null;
String dcch = null;
String qc = null;
String ddh = null,dcch = null;
String qc,date,revisor,reviewed,approved;
HashMap<String, String> map = new HashMap<>();
CellRangeAddress ddhAddr = mergedRegions.get(68);
if (ddhAddr != null) {
ddh = this.getMergedData(sheet, ddhAddr);
map.put("ddh",ddh);
}
CellRangeAddress chAddr = mergedRegions.get(74);
if (chAddr != null) {
dcch = this.getMergedData(sheet, chAddr);
map.put("dcch",dcch);
}
CellRangeAddress qcAddr = mergedRegions.get(75);
if (qcAddr != null) {
qc = this.getMergedData(sheet, qcAddr);
qc=StrUtil.subBetween(qc, "", "");
map.put("qc",qc);
}
CellRangeAddress dateAddr = mergedRegions.get(103);
if (dateAddr != null) {
date = this.getMergedData(sheet, dateAddr);
map.put("date",date);
}
CellRangeAddress revisorAddr = mergedRegions.get(107);
if (dateAddr != null) {
revisor = this.getMergedData(sheet, revisorAddr);
map.put("revisor",revisor);
}
CellRangeAddress reviewedAddr = mergedRegions.get(110);
if (reviewedAddr != null) {
reviewed = this.getMergedData(sheet, reviewedAddr);
map.put("reviewed",reviewed);
}
CellRangeAddress approvedAddr = mergedRegions.get(111);
if (approvedAddr != null) {
approved = this.getMergedData(sheet, approvedAddr);
map.put("approved",approved);
}
if (StrUtil.isAllNotEmpty(dcch, ddh)) {
List<DmDhqdp> list = new ArrayList<>();
List<DmDhqdp> dmDhqdps = this.readExcel(file, dcch, ddh, qc, 1, req);
List<DmDhqdp> dmDhqdps1 = this.readExcel(file, dcch, ddh, qc, 2, req);
List<DmDhqdp> dmDhqdps = this.readExcel(file, map, 1, req);//T型材
List<DmDhqdp> dmDhqdps1 = this.readExcel(file, map, 2, req);//板材
List<DmDhqdp> dmDhqdps2 = this.readExcel(file, map, 3, req);//型材
if (ObjUtil.isNotEmpty(dmDhqdps)) {
list.addAll(dmDhqdps);
}
if (ObjUtil.isNotEmpty(dmDhqdps1)) {
list.addAll(dmDhqdps1);
}
if (ObjUtil.isNotEmpty(dmDhqdps1)) {
list.addAll(dmDhqdps2);
}
this.saveBatch(list.stream().filter(item->StrUtil.isNotEmpty(item.getDcCh())).collect(Collectors.toList()));
return list;
}
@ -117,7 +151,7 @@ public class DmDhqdpServiceImpl extends ServiceImpl<DmDhqdpMapper, DmDhqdp> impl
}
@Transactional
public List<DmDhqdp> readExcel(MultipartFile file, String dcch, String ddh, String qc, int sheet, HttpServletRequest req) throws IOException {
public List<DmDhqdp> readExcel(MultipartFile file, Map<String,String> map, int sheet, HttpServletRequest req) throws IOException {
ExcelReader reader = ExcelUtil.getReader(file.getInputStream());
Map<String, String> alias = Maps.newLinkedHashMap();
alias.put("序号\nNo.", "xh");
@ -149,11 +183,23 @@ public class DmDhqdpServiceImpl extends ServiceImpl<DmDhqdpMapper, DmDhqdp> impl
.eq("qc", qc));
dmDhqdps.stream().filter(item->StrUtil.isNotEmpty(item.getXh())&&!item.getXh().contains("合计"))
.forEach(l -> {
l.setDcCh(dcch);
l.setQdh(ddh);
l.setQc(qc);
l.setDcCh(map.get("dcch"));
l.setQdh(map.get("ddh"));
l.setQc(map.get("qc"));
l.setDhqdrq(map.get("date"));
l.setRevisor(map.get("revisor"));
l.setReviewed(map.get("reviewed"));
l.setDrr(user);
l.setDrrq(day);
if (sheet==1){
l.setTxc();
}
if (sheet==2){
l.setBc();
}
if (sheet==3){
l.setXc();
}
});
return dmDhqdps;
}

@ -102,9 +102,7 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
}).collect(Collectors.toList());
this.updateBatchById(collect);
//生成作业计划
new Thread(()->{
this.generateYdjh(sygdMxes);
}).start();
}
}
@ -113,6 +111,11 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
List<DmYdjh> ydjhList = sygdMxes.stream().map(item -> {
DmYdjh dmYdjh = new DmYdjh();
BeanUtil.copyProperties(item, dmYdjh);
dmYdjh.setSljhrq(item.getSlrq());
dmYdjh.setPwjhrq(item.getPwrq());
dmYdjh.setHxjhrq(item.getHxrq());
dmYdjh.setQgjhrq(item.getQgrq());
dmYdjh.setZt("0");
return dmYdjh;
}).collect(Collectors.toList());
ydjhList.forEach(l->{
@ -985,7 +988,7 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
List<DmSygdMx> list = this.list(Wrappers.<DmSygdMx>lambdaQuery()
.eq(StrUtil.isNotEmpty(zt),DmSygdMx::getZt,zt)
.between(DmSygdMx::getJssj, begin, end)
.orderBy(true,true,DmSygdMx::getDcCh,DmSygdMx::getDcPl,DmSygdMx::getSlrq)
.orderBy(true,true,DmSygdMx::getSlrq)
);
Map<String, List<DmSygdMx>> collect = list.stream().collect(Collectors.groupingBy(item -> item.getDcCh() +"_"+ item.getDcPl()));

@ -5,19 +5,22 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsic.gj_erp.bean.jcsj.DmBom;
import com.dsic.gj_erp.bean.jcsj.DmCbxxp;
import com.dsic.gj_erp.bean.jhgk.DmDhqdp;
import com.dsic.gj_erp.bean.jhgk.DmSygdMx;
import com.dsic.gj_erp.bean.jhgk.DmSygdxq;
import com.dsic.gj_erp.bean.jhgk.DmSygdxqOld;
import com.dsic.gj_erp.mapper.jhgk.DmSygdxqMapper;
import com.dsic.gj_erp.pc.dto.data.Bom;
import com.dsic.gj_erp.service.jcsj.DmBomService;
import com.dsic.gj_erp.service.jcsj.DmCbxxpService;
import com.dsic.gj_erp.service.jcsj.impl.DmBomServiceImpl;
import com.dsic.gj_erp.service.jhgk.DmDhqdpService;
import com.dsic.gj_erp.service.jhgk.DmSygdMxService;
import com.dsic.gj_erp.service.jhgk.DmSygdxqOldService;
import com.dsic.gj_erp.service.jhgk.DmSygdxqService;
@ -25,8 +28,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* <p>
@ -48,7 +53,8 @@ public class DmSygdxqServiceImpl extends ServiceImpl<DmSygdxqMapper, DmSygdxq> i
@Autowired
DmCbxxpService dmCbxxpService;
@Autowired
private DmBomServiceImpl dmBomServiceImpl;
DmDhqdpService dhqdpService;
@Override
@Transactional
@ -158,19 +164,168 @@ public class DmSygdxqServiceImpl extends ServiceImpl<DmSygdxqMapper, DmSygdxq> i
DmCbxxp one = dmCbxxpService.getOne(Wrappers.<DmCbxxp>lambdaQuery()
.eq(DmCbxxp::getCbbm, xq.getDcCh())
);
Optional.ofNullable(one).ifPresent(item->{
if (one!=null){
List<DmBom> bomList = bomService.list(Wrappers.<DmBom>lambdaQuery()
.eq(DmBom::getDcch, xq.getDcCh())
.eq(DmBom::getPl, xq.getDcPl())
.eq(DmBom::getFd, xq.getDcFd())
);
xq.setBomList(bomList);
}else{//bom不存在从订货清单获取数据
List<DmDhqdp> list = dhqdpService.list(Wrappers.<DmDhqdp>lambdaQuery().eq(DmDhqdp::getDcCh, xq.getDcCh()));
List<DmDhqdp> collect = list.stream().filter(item -> item.getPlzlsl().contains(pl)).collect(Collectors.toList());
List<DmBom> bomList=new ArrayList<>();
collect.forEach(item->{
int num = item.getSdzs().intValue();
for (int i=0;i<num;i++){
DmBom bom = new DmBom();
bom.setDcch(dcch);
bom.setPl(pl);
bom.setWpcz(item.getWpxh());
bom.setWpgg(StrUtil.format("{}*{}*{}",item.getThickness(),item.getWidth(),item.getLength()));
Optional.ofNullable(item.getKdzlsl()).ifPresent(it->{
String kd= String.valueOf(it.charAt(1));
String kw= String.valueOf(it.charAt(0));
String kw4= String.valueOf(it.charAt(2));
String zl=String.valueOf(it.charAt(3));
switch (kd){
case "1":
this.handlerFor1(bom,zl,kw,kw4);
break;
case "2":
this.handlerFor2(bom,zl,kw,kw4);
break;
case "3":
this.handlerFor3(bom,zl,kw,kw4);
break;
case "4":
this.handlerFor4(bom,zl,kw,kw4);
break;
case "7"://型材
this.handlerFor7(bom,zl,kw,kw4);
break;
case "8"://光电
this.handlerFor8(bom,zl,kw,kw4);
break;
}
});
bomList.add(bom);
}
});
xq.setBomList(bomList);
}
}
}
return xqWithBom;
}
private void handlerFor1(DmBom bom,String zl,String kw,String kw4){
if ("X".equals(zl)){
bom.setZl("1010");
}
if ("D".equals(zl)){
bom.setZl("1110");
}
if ("N".equals(kw)&&"A".equals(kw4)){
bom.setKw("7");
}
if ("N".equals(kw)&&"L".equals(kw4)){
bom.setKw("8");
}
}
private void handlerFor2(DmBom bom,String zl,String kw,String kw4){
if ("X".equals(zl)){
bom.setZl("1010");
}
if ("D".equals(zl)){
bom.setZl("1110");
}
if ("S".equals(kw)&&"T".equals(kw4)){
bom.setKw("5");
}
if ("N".equals(kw)&&"B".equals(kw4)){
bom.setKw("9");
}
if ("N".equals(kw)&&"C".equals(kw4)){
bom.setKw("10");
}
if ("N".equals(kw)&&"T".equals(kw4)){
bom.setKw("11");
}
if ("N".equals(kw)&&"J".equals(kw4)){
bom.setKw("12");
}
}
private void handlerFor3(DmBom bom,String zl,String kw,String kw4){
if ("X".equals(zl)){
bom.setZl("1010");
}
if ("D".equals(zl)){
bom.setZl("1110");
}
if ("X".equals(zl)){
bom.setZl("4230");
}
if ("S".equals(kw)&&"P".equals(kw4)){
bom.setKw("6");
}
if ("S".equals(kw)&&"X".equals(kw4)){
bom.setKw("6");
}
if ("N".equals(kw)&&"C".equals(kw4)){
bom.setKw("13");
}
if ("N".equals(kw)&&"H".equals(kw4)){
bom.setKw("14");
}
}
private void handlerFor4(DmBom bom,String zl,String kw,String kw4){
if ("X".equals(zl)){
bom.setZl("1010");
}
if ("D".equals(zl)){
bom.setZl("1110");
}
if ("X".equals(zl)){
bom.setZl("4230");
}
if ("N".equals(kw)&&"P".equals(kw4)){
bom.setKw("15");
}
if ("N".equals(kw)&&"X".equals(kw4)){
bom.setKw("15");
}
}
private void handlerFor7(DmBom bom,String zl,String kw,String kw4){
if ("X".equals(zl)){
bom.setZl("1010");
}
if ("D".equals(zl)){
bom.setZl("1110");
}
if ("X".equals(kw)&&"X".equals(kw4)){
bom.setKw("16");
}
}
private void handlerFor8(DmBom bom,String zl,String kw,String kw4){
if ("X".equals(zl)){
bom.setZl("1120");
}
if ("N".equals(kw)&&"G".equals(kw4)){
bom.setKw("17");
}
}
private List<DmSygdxq> t2(String from, String to,String dcch,String pl){
return baseMapper.getXqWithBom2(from,to,dcch,pl);
}

@ -38,7 +38,7 @@ public class ZyjhService extends ServiceImpl<DmYdjhMapper,DmYdjh> {
}
public List<Map<String, Object>> gxjhwcqk(){
DateTime date = DateUtil.lastMonth();
DateTime date = DateUtil.date();
String from= DateUtil.beginOfMonth(date).toString("yyyy/MM/dd");
String to =DateUtil.endOfMonth(date).toString("yyyy/MM/dd");
return baseMapper.gxjhwcqk(from,to);
@ -49,14 +49,14 @@ public class ZyjhService extends ServiceImpl<DmYdjhMapper,DmYdjh> {
}
public List<Map<String, Object>> jhwcqk(){
DateTime date = DateUtil.lastMonth();
DateTime date = DateUtil.date();
String from= DateUtil.beginOfMonth(date).toString("yyyy/MM/dd");
String to =DateUtil.endOfMonth(date).toString("yyyy/MM/dd");
return baseMapper.jhwcqk(from,to);
}
public Map<String,Object> gekuachaliang(){
DateTime date = DateUtil.lastMonth();
DateTime date = DateUtil.date();
String from= DateUtil.beginOfMonth(date).toString("yyyy/MM/dd");
String to =DateUtil.endOfMonth(date).toString("yyyy/MM/dd");
return baseMapper.gekuachaliang(from,to,"11");

@ -62,8 +62,9 @@
</if>
) a
where a.rn=1
order by a.xzglxq
order by a.dc_ch,a.dc_pl
</select>
<select id="getXqWithBom2" resultMap="sqgdxqVo">
select * from
(select

@ -78,7 +78,7 @@
SELECT zt,bcshzl,slfkrq,pwfkrq,llfkrq,hxfkrq,qgfkrq
from dm_ydjh
WHERE
jssj BETWEEN #{from} and #{to}
jssj BETWEEN #{from} and #{to} and zt>='2'
</select>
<select id="gyfcl" resultType="map">
@ -690,7 +690,8 @@
SUM(1) over(PARTITION by dc_ch) total,
SUM(CASE isnull(qgfkrq,'') WHEN '' then 0 else 1 end) over(PARTITION by dc_ch) complete
from
dm_ydjh where dc_ch in
dm_ydjh
where zt>='2' and dc_ch in
<foreach collection="czbh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>

Loading…
Cancel
Save