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) @TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id; private String id;
private TypeEnum type;//T型材,板材,型材
private String plzlsl;//批量组立数量 private String plzlsl;//批量组立数量
private String kdzlsl;//跨道组立数量 private String kdzlsl;//跨道组立数量
private String ptybsl;//平铁用板数量 private String ptybsl;//平铁用板数量
private String dhqdrq;//日期(订货清单)
private String rev;//版本
private String revisor;//编制
private String reviewed;//审核
private String approved;//批准
@TableField(exist = false) @TableField(exist = false)
private String xh;//序号列用于去除合计行 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; 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") .orderByAsc("jssj,dc_ch,dc_pl,zl,lqlb")
); );
Map<String, List<DmYdjh>> collect = list.stream().collect(Collectors.groupingBy(DmYdjh::getDcCh)); // Map<String, List<DmYdjh>> collect = list.stream().collect(Collectors.groupingBy(DmYdjh::getDcCh));
List<Map<String, Object>> resultMap=new ArrayList<>(); // List<Map<String, Object>> resultMap=new ArrayList<>();
//验证数据获取方法,后续可以都在这里进行获取 //验证数据获取方法,后续可以都在这里进行获取
collect.forEach((key,val)->{ // collect.forEach((key,val)->{
List<ImCkwpkwp> bcKcxx = kcService.getBcKcxx(key); // List<ImCkwpkwp> bcKcxx = kcService.getBcKcxx(key);
List<DmCzplpNew> czplpNewList = czplpNewService.list(Wrappers.<DmCzplpNew>lambdaQuery() // List<DmCzplpNew> czplpNewList = czplpNewService.list(Wrappers.<DmCzplpNew>lambdaQuery()
.eq(DmCzplpNew::getDcCh, key) // .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);
// //
// } else { // val.forEach(item->{
// System.out.println(dateStr1 + " is equal to " + dateStr2); // Map<String, Object> itemMap = BeanUtil.beanToMap(item);
// itemMap.put("color", "yellow"); // 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(list);
});
});
return new ResultBean(resultMap);
} }
@RequestMapping("/hz") @RequestMapping("/hz")

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

@ -84,7 +84,7 @@ public class 钢料需求 {
if (this. ==null){ if (this. ==null){
return DateUtil.parse(this.xzglxq,"yyyy/MM/dd"); 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(); Integer cd = CD.get(_).getCd();
DateTime dateTime = DateUtil.offsetDay(this._, cd); DateTime dateTime = DateUtil.offsetDay(this._, cd);
_ = (dateTime); _ = (dateTime);
if ("G175K-12".equals(bom.getDcch())&&"077".equals(bom.getPl())&&_== Constant..){
System.out.println(_);
}
try { try {
if (_.(_,this.bom,)){ if (_.(_,this.bom,)){
// this.bom.set所在资源(_资源); // 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.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsic.gj_erp.bean.ResultBean; import com.dsic.gj_erp.bean.ResultBean;
@ -19,8 +20,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
@ -47,8 +47,10 @@ public class 三月滚动接口 {
return new ResultBean(false, 1, "请先导入" + begin + " ~ " + end + "分段钢料需求!"); return new ResultBean(false, 1, "请先导入" + begin + " ~ " + end + "分段钢料需求!");
} }
//2.根据 List<DmSygdMx> mxList = ljList.stream().collect(
List<DmSygdMx> mxList = ljList.stream().map(DmSygdMx::ofWithDmSygdMxlj).collect(Collectors.toList()); 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())); 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().values().forEach(_->{
_.get().forEach(_bom->{ _.get().forEach(_bom->{
List<DmSygdMx> dmSygdMxes = collect.get(_bom.getDcch() + _bom.getPl()); List<DmSygdMx> dmSygdMxes = collect.get(_bom.getDcch() + _bom.getPl());
if (ObjectUtil.isNotEmpty(dmSygdMxes)){
for (DmSygdMx mx:dmSygdMxes){ for (DmSygdMx mx:dmSygdMxes){
mx.(_.get(),_.getDate()); mx.(_.get(),_.getDate());
} }
}
}); });
}); });
}); });
@ -72,7 +76,6 @@ public class 三月滚动接口 {
sygdMxService.saveBatch(mxList,500); sygdMxService.saveBatch(mxList,500);
new Thread(()->{
ljList.forEach(lj-> mxList.forEach(mx->{ ljList.forEach(lj-> mxList.forEach(mx->{
if (lj.getDcch().equals(mx.getDcCh()) if (lj.getDcch().equals(mx.getDcCh())
&&lj.getPl().equals(mx.getDcPl()) &&lj.getPl().equals(mx.getDcPl())
@ -81,7 +84,6 @@ public class 三月滚动接口 {
} }
})); }));
ljService.saveBatch(ljList,500); ljService.saveBatch(ljList,500);
}).start();
List<DmYdjhxf> list= sygdMxService.tqSygd1(begin,end); List<DmYdjhxf> list= sygdMxService.tqSygd1(begin,end);
return new ResultBean<>(list); 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.bean.jhgk.DmDhqdp;
import com.dsic.gj_erp.mapper.jhgk.DmDhqdpMapper; import com.dsic.gj_erp.mapper.jhgk.DmDhqdpMapper;
import com.dsic.gj_erp.service.jhgk.DmDhqdpService; import com.dsic.gj_erp.service.jhgk.DmDhqdpService;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
@ -24,6 +25,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -68,34 +70,66 @@ public class DmDhqdpServiceImpl extends ServiceImpl<DmDhqdpMapper, DmDhqdp> impl
Sheet sheet = workbook.getSheetAt(0); Sheet sheet = workbook.getSheetAt(0);
List<CellRangeAddress> mergedRegions = sheet.getMergedRegions(); List<CellRangeAddress> mergedRegions = sheet.getMergedRegions();
if (mergedRegions.size() > 74) { if (mergedRegions.size() > 74) {
String ddh = null; String ddh = null,dcch = null;
String dcch = null; String qc,date,revisor,reviewed,approved;
String qc = null;
HashMap<String, String> map = new HashMap<>();
CellRangeAddress ddhAddr = mergedRegions.get(68); CellRangeAddress ddhAddr = mergedRegions.get(68);
if (ddhAddr != null) { if (ddhAddr != null) {
ddh = this.getMergedData(sheet, ddhAddr); ddh = this.getMergedData(sheet, ddhAddr);
map.put("ddh",ddh);
} }
CellRangeAddress chAddr = mergedRegions.get(74); CellRangeAddress chAddr = mergedRegions.get(74);
if (chAddr != null) { if (chAddr != null) {
dcch = this.getMergedData(sheet, chAddr); dcch = this.getMergedData(sheet, chAddr);
map.put("dcch",dcch);
} }
CellRangeAddress qcAddr = mergedRegions.get(75); CellRangeAddress qcAddr = mergedRegions.get(75);
if (qcAddr != null) { if (qcAddr != null) {
qc = this.getMergedData(sheet, qcAddr); qc = this.getMergedData(sheet, qcAddr);
qc=StrUtil.subBetween(qc, "", ""); 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)) { if (StrUtil.isAllNotEmpty(dcch, ddh)) {
List<DmDhqdp> list = new ArrayList<>(); List<DmDhqdp> list = new ArrayList<>();
List<DmDhqdp> dmDhqdps = this.readExcel(file, dcch, ddh, qc, 1, req); List<DmDhqdp> dmDhqdps = this.readExcel(file, map, 1, req);//T型材
List<DmDhqdp> dmDhqdps1 = this.readExcel(file, dcch, ddh, qc, 2, req); List<DmDhqdp> dmDhqdps1 = this.readExcel(file, map, 2, req);//板材
List<DmDhqdp> dmDhqdps2 = this.readExcel(file, map, 3, req);//型材
if (ObjUtil.isNotEmpty(dmDhqdps)) { if (ObjUtil.isNotEmpty(dmDhqdps)) {
list.addAll(dmDhqdps); list.addAll(dmDhqdps);
} }
if (ObjUtil.isNotEmpty(dmDhqdps1)) { if (ObjUtil.isNotEmpty(dmDhqdps1)) {
list.addAll(dmDhqdps1); list.addAll(dmDhqdps1);
} }
if (ObjUtil.isNotEmpty(dmDhqdps1)) {
list.addAll(dmDhqdps2);
}
this.saveBatch(list.stream().filter(item->StrUtil.isNotEmpty(item.getDcCh())).collect(Collectors.toList())); this.saveBatch(list.stream().filter(item->StrUtil.isNotEmpty(item.getDcCh())).collect(Collectors.toList()));
return list; return list;
} }
@ -117,7 +151,7 @@ public class DmDhqdpServiceImpl extends ServiceImpl<DmDhqdpMapper, DmDhqdp> impl
} }
@Transactional @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()); ExcelReader reader = ExcelUtil.getReader(file.getInputStream());
Map<String, String> alias = Maps.newLinkedHashMap(); Map<String, String> alias = Maps.newLinkedHashMap();
alias.put("序号\nNo.", "xh"); alias.put("序号\nNo.", "xh");
@ -149,11 +183,23 @@ public class DmDhqdpServiceImpl extends ServiceImpl<DmDhqdpMapper, DmDhqdp> impl
.eq("qc", qc)); .eq("qc", qc));
dmDhqdps.stream().filter(item->StrUtil.isNotEmpty(item.getXh())&&!item.getXh().contains("合计")) dmDhqdps.stream().filter(item->StrUtil.isNotEmpty(item.getXh())&&!item.getXh().contains("合计"))
.forEach(l -> { .forEach(l -> {
l.setDcCh(dcch); l.setDcCh(map.get("dcch"));
l.setQdh(ddh); l.setQdh(map.get("ddh"));
l.setQc(qc); l.setQc(map.get("qc"));
l.setDhqdrq(map.get("date"));
l.setRevisor(map.get("revisor"));
l.setReviewed(map.get("reviewed"));
l.setDrr(user); l.setDrr(user);
l.setDrrq(day); l.setDrrq(day);
if (sheet==1){
l.setTxc();
}
if (sheet==2){
l.setBc();
}
if (sheet==3){
l.setXc();
}
}); });
return dmDhqdps; return dmDhqdps;
} }

@ -102,9 +102,7 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
}).collect(Collectors.toList()); }).collect(Collectors.toList());
this.updateBatchById(collect); this.updateBatchById(collect);
//生成作业计划 //生成作业计划
new Thread(()->{
this.generateYdjh(sygdMxes); this.generateYdjh(sygdMxes);
}).start();
} }
} }
@ -113,6 +111,11 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
List<DmYdjh> ydjhList = sygdMxes.stream().map(item -> { List<DmYdjh> ydjhList = sygdMxes.stream().map(item -> {
DmYdjh dmYdjh = new DmYdjh(); DmYdjh dmYdjh = new DmYdjh();
BeanUtil.copyProperties(item, 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; return dmYdjh;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
ydjhList.forEach(l->{ ydjhList.forEach(l->{
@ -985,7 +988,7 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
List<DmSygdMx> list = this.list(Wrappers.<DmSygdMx>lambdaQuery() List<DmSygdMx> list = this.list(Wrappers.<DmSygdMx>lambdaQuery()
.eq(StrUtil.isNotEmpty(zt),DmSygdMx::getZt,zt) .eq(StrUtil.isNotEmpty(zt),DmSygdMx::getZt,zt)
.between(DmSygdMx::getJssj, begin, end) .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())); 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.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjUtil; 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.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsic.gj_erp.bean.jcsj.DmBom; import com.dsic.gj_erp.bean.jcsj.DmBom;
import com.dsic.gj_erp.bean.jcsj.DmCbxxp; 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.DmSygdMx;
import com.dsic.gj_erp.bean.jhgk.DmSygdxq; import com.dsic.gj_erp.bean.jhgk.DmSygdxq;
import com.dsic.gj_erp.bean.jhgk.DmSygdxqOld; import com.dsic.gj_erp.bean.jhgk.DmSygdxqOld;
import com.dsic.gj_erp.mapper.jhgk.DmSygdxqMapper; 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.DmBomService;
import com.dsic.gj_erp.service.jcsj.DmCbxxpService; 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.DmSygdMxService;
import com.dsic.gj_erp.service.jhgk.DmSygdxqOldService; import com.dsic.gj_erp.service.jhgk.DmSygdxqOldService;
import com.dsic.gj_erp.service.jhgk.DmSygdxqService; 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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
@ -48,7 +53,8 @@ public class DmSygdxqServiceImpl extends ServiceImpl<DmSygdxqMapper, DmSygdxq> i
@Autowired @Autowired
DmCbxxpService dmCbxxpService; DmCbxxpService dmCbxxpService;
@Autowired @Autowired
private DmBomServiceImpl dmBomServiceImpl; DmDhqdpService dhqdpService;
@Override @Override
@Transactional @Transactional
@ -158,19 +164,168 @@ public class DmSygdxqServiceImpl extends ServiceImpl<DmSygdxqMapper, DmSygdxq> i
DmCbxxp one = dmCbxxpService.getOne(Wrappers.<DmCbxxp>lambdaQuery() DmCbxxp one = dmCbxxpService.getOne(Wrappers.<DmCbxxp>lambdaQuery()
.eq(DmCbxxp::getCbbm, xq.getDcCh()) .eq(DmCbxxp::getCbbm, xq.getDcCh())
); );
Optional.ofNullable(one).ifPresent(item->{
if (one!=null){
List<DmBom> bomList = bomService.list(Wrappers.<DmBom>lambdaQuery() List<DmBom> bomList = bomService.list(Wrappers.<DmBom>lambdaQuery()
.eq(DmBom::getDcch, xq.getDcCh()) .eq(DmBom::getDcch, xq.getDcCh())
.eq(DmBom::getPl, xq.getDcPl()) .eq(DmBom::getPl, xq.getDcPl())
.eq(DmBom::getFd, xq.getDcFd()) .eq(DmBom::getFd, xq.getDcFd())
); );
xq.setBomList(bomList); 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; 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){ private List<DmSygdxq> t2(String from, String to,String dcch,String pl){
return baseMapper.getXqWithBom2(from,to,dcch,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(){ public List<Map<String, Object>> gxjhwcqk(){
DateTime date = DateUtil.lastMonth(); DateTime date = DateUtil.date();
String from= DateUtil.beginOfMonth(date).toString("yyyy/MM/dd"); String from= DateUtil.beginOfMonth(date).toString("yyyy/MM/dd");
String to =DateUtil.endOfMonth(date).toString("yyyy/MM/dd"); String to =DateUtil.endOfMonth(date).toString("yyyy/MM/dd");
return baseMapper.gxjhwcqk(from,to); return baseMapper.gxjhwcqk(from,to);
@ -49,14 +49,14 @@ public class ZyjhService extends ServiceImpl<DmYdjhMapper,DmYdjh> {
} }
public List<Map<String, Object>> jhwcqk(){ public List<Map<String, Object>> jhwcqk(){
DateTime date = DateUtil.lastMonth(); DateTime date = DateUtil.date();
String from= DateUtil.beginOfMonth(date).toString("yyyy/MM/dd"); String from= DateUtil.beginOfMonth(date).toString("yyyy/MM/dd");
String to =DateUtil.endOfMonth(date).toString("yyyy/MM/dd"); String to =DateUtil.endOfMonth(date).toString("yyyy/MM/dd");
return baseMapper.jhwcqk(from,to); return baseMapper.jhwcqk(from,to);
} }
public Map<String,Object> gekuachaliang(){ public Map<String,Object> gekuachaliang(){
DateTime date = DateUtil.lastMonth(); DateTime date = DateUtil.date();
String from= DateUtil.beginOfMonth(date).toString("yyyy/MM/dd"); String from= DateUtil.beginOfMonth(date).toString("yyyy/MM/dd");
String to =DateUtil.endOfMonth(date).toString("yyyy/MM/dd"); String to =DateUtil.endOfMonth(date).toString("yyyy/MM/dd");
return baseMapper.gekuachaliang(from,to,"11"); return baseMapper.gekuachaliang(from,to,"11");

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

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

Loading…
Cancel
Save