1.优化排产

master
董哲奇 9 months ago
parent 503bbee429
commit cc088a8f3c

@ -19,9 +19,8 @@ import java.util.List;
*/ */
public interface DmSygdxqMapper extends BaseMapper<DmSygdxq> { public interface DmSygdxqMapper extends BaseMapper<DmSygdxq> {
List<DmSygdxq> getXqWithBom(String from,String to); List<DmSygdxq> getXqWithBom(String from,String to,String dcch,String pl);
List<DmSygdMxLj> getSygdLjMx(String begin,String end); List<DmSygdMxLj> getSygdLjMx(String begin,String end);
} }

@ -33,12 +33,14 @@ 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.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import lombok.val;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.*; import java.util.*;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.dsic.gj_erp.pc.Manager.; import static com.dsic.gj_erp.pc.Manager.;
@ -141,6 +143,105 @@ public class DataFactory {
} }
public static void 4(){
();
.clear();
Manager.=new ArrayList<>();
List<> list=1();
List<> = (list);
try {
();
}catch (Exception e){
// e.printStackTrace();
throw e;
}finally {
(list);
}
}
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));
for ( item:list){
if (ObjUtil.isNotEmpty(item.getBomList())){
(item,CDMap);
}
}
}
private static void ( item,Map<Constant.,CD> CDMap){
Constant. =Constant..;
//需求日期可利用范围是±3天
int times=-3;
List<> tmpList=new ArrayList<>();
Map<String, AtomicDouble> = item.get();
_=null;
Integer cd = CDMap.get().getCd();
do {
//因为第一次计算时候就是当前批量小组需求日期,所以再次循环到的时候不需要再次计算
if (times==0){
times+=1;
item.set(DateUtil.offsetDay(DateUtil.parse(item.getXzglxq(),"yyyy/MM/dd"),times));
continue;
}
if (times>3){
break;
}
DateTime xzglxq = item.get().offset(DateField.DAY_OF_YEAR,cd);
if (xzglxq.isBefore(DateUtil.date())){
//break;
}
_ = (xzglxq);
if (_.get_date().isBefore(DateUtil.date())){
//break;
}
//记录6次计算的全部资源
tmpList.add(_);
if (_.()){
if (item.getDcCh().equals("G175K-5")&&item.getDcPl().equals("003")){
System.out.println(111);
}
(item.getBomList(),item.get(),CDMap);
break;
}
//需求日期可利用范围是±3天,排产是需要根据产能进行调整
item.set(DateUtil.offsetDay(DateUtil.parse(item.getXzglxq(),"yyyy/MM/dd"),times));
times+=1;
}while (true);
//若在需求期±3天内无法正常排产时,查找最大可用空闲资源进行占用
AtomicReference<String> date=new AtomicReference<>();
if (times>3){
//查找最小可用资源,进行占用
tmpList.sort(Comparator.comparingDouble((tmp)->tmp.getMAP().get(Constant..).get()));
tmpList.stream().findFirst().ifPresent(tmp->{
//由于资源日为切割日期,这里需要还原一下,修正传递的参照需求日期
DateTime offset = tmp.get_date().offset(DateField.DAY_OF_MONTH, -CDMap.get().getCd());
if (item.getDcCh().equals("G175K-5")&&item.getDcPl().equals("003")){
System.out.println(offset.toDateStr());
}
(item.getBomList(),offset,CDMap);
date.set(tmp.getDate());
});
}
if (_!=null){
date.set(_.getDate());
}else {
log.info("船号:{},批次:{},早于当前日期无需排产",item.getDcCh(),item.getDcPl());
return;
}
log.info("船号:{},批次:{},占用资源成功,切割日期:{}",item.getDcCh(),item.getDcPl(),date.get());
}
public static void (Collection<> _){ public static void (Collection<> _){
CD _CD = getBean(CD.class); CD _CD = getBean(CD.class);
List<CD> CDS = _CD.get(); List<CD> CDS = _CD.get();
@ -186,6 +287,9 @@ public class DataFactory {
// 上料.占用资源(Constant.工序.上料,bom,item.get产能需求().get(Constant.工序.上料).get()); // 上料.占用资源(Constant.工序.上料,bom,item.get产能需求().get(Constant.工序.上料).get());
// _资源.占用资源(Constant.工序.切割,bom,1); // _资源.占用资源(Constant.工序.切割,bom,1);
// } // }
if (item.getDcCh().equals("G175K-4")&&item.getDcPl().equals("020")){
System.out.println(111);
}
(item.getBomList(),item.get(),CDMap); (item.getBomList(),item.get(),CDMap);
break; break;
} }
@ -195,6 +299,7 @@ public class DataFactory {
}while (true); }while (true);
//若在需求期±3天内无法正常排产时,查找最大可用空闲资源进行占用 //若在需求期±3天内无法正常排产时,查找最大可用空闲资源进行占用
AtomicReference<String> date=new AtomicReference<>();
if (times>3){ if (times>3){
//查找最小可用资源,进行占用 //查找最小可用资源,进行占用
tmpList.sort(Comparator.comparingDouble((tmp)->tmp.getMAP().get(Constant..).get())); tmpList.sort(Comparator.comparingDouble((tmp)->tmp.getMAP().get(Constant..).get()));
@ -206,17 +311,22 @@ public class DataFactory {
// tmp.占用资源(Constant.工序.切割,bom,1); // tmp.占用资源(Constant.工序.切割,bom,1);
// } // }
//由于资源日为切割日期,这里需要还原一下,修正传递的参照需求日期 //由于资源日为切割日期,这里需要还原一下,修正传递的参照需求日期
if (item.getDcCh().equals("G175K-4")&&item.getDcPl().equals("020")){
System.out.println(111);
}
(item.getBomList(),tmp.get_date().offset(DateField.DAY_OF_YEAR,-CDMap.get().getCd()),CDMap); (item.getBomList(),tmp.get_date().offset(DateField.DAY_OF_YEAR,-CDMap.get().getCd()),CDMap);
date.set(tmp.getDate());
}); });
} }
if (_!=null){ if (_!=null){
log.info("船号:{},批次:{},占用资源成功,切割日期:{}",item.getDcCh(),item.getDcPl(),_.getDate()); date.set(_.getDate());
log.info("船号:{},批次:{},占用资源成功,切割日期:{}",item.getDcCh(),item.getDcPl(),date.get());
}else { }else {
log.info("船号:{},批次:{},早于当前日期无需排产",item.getDcCh(),item.getDcPl()); log.info("船号:{},批次:{},早于当前日期无需排产",item.getDcCh(),item.getDcPl());
} }
} }
private static void (List<Bom> list,DateTime ,Map<Constant.,CD> CDMap){ private static void (List<Bom> list,DateTime ,Map<Constant.,CD> CDMap){
CountDownLatch latch = new CountDownLatch(list.size()); CountDownLatch latch = new CountDownLatch(list.size());
for (Bom bom:list){ for (Bom bom:list){
@ -224,6 +334,7 @@ public class DataFactory {
if (_==null){ if (_==null){
latch.countDown(); latch.countDown();
log.info("船号:{},批次:{},图纸编号:{},无法找到对应套料图",bom.getDcch(),bom.getPl(),bom.getTzbh());
continue; continue;
} }
@ -252,20 +363,39 @@ public class DataFactory {
_.forEach(::); _.forEach(::);
} }
private static List<> (List<> list){
Map<String,> map=new HashMap<>();
list.forEach(item->{
String key=item.getDcCh() + item.getDcPl();
_ = map.get(key);
if (_==null){
map.put(key,item);
}else{
_.addBomList(item.getBomList());
}
});
return new ArrayList<>(map.values());
}
private static Collection<> (List<> list){ private static Collection<> (List<> list){
Map<String,> map=new HashMap<>(); Map<String,> map=new HashMap<>();
list.forEach(item->{ list.forEach(item->{
String key=item.getDcCh() + item.getDcPl(); String key=item.getDcCh() + item.getDcPl();
_ = map.get(key); _ = map.computeIfAbsent(key, k -> new ());
if (_==null){
_=new ();
map.put(key,_);
}
_.of(item); _.of(item);
}); });
return map.values(); return map.values();
} }
public static List<> 1(){
List<DmSygdxq> = getBean(DmSygdxqService.class).getXqWithBom(from, to);
return .stream().map(item->{
_ = .of(item);
_.();
return _;
}).collect(Collectors.toList());
}
public static List<> (){ public static List<> (){
List<DmSygdxq> = getBean(DmSygdxqService.class).getXqWithBom(from, to); List<DmSygdxq> = getBean(DmSygdxqService.class).getXqWithBom(from, to);
return .stream().map(::of).collect(Collectors.toList()); return .stream().map(::of).collect(Collectors.toList());
@ -417,7 +547,13 @@ public class DataFactory {
public static void (){ public static void (){
.clear(); .clear();
DateTime _from = DateUtil.parse(from, "yyyy/MM/dd").offset(DateField.DAY_OF_YEAR,-30);
DateTime _to = DateUtil.parse(to, "yyyy/MM/dd");
.stream().filter(item -> "1".equals(item.getXxr())) .stream().filter(item -> "1".equals(item.getXxr()))
.filter(item->{
DateTime gl = DateUtil.parse(item.getGl(), "yyyy/MM/dd");
return gl.isAfterOrEquals(_from)&&gl.isBeforeOrEquals(_to);
})
.forEach(item -> { .forEach(item -> {
Map<Constant., > map = (); Map<Constant., > map = ();
.put(item.getGl(), .of(item.getGl(), map)); .put(item.getGl(), .of(item.getGl(), map));

@ -4,14 +4,13 @@ import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.dsic.gj_erp.bean.jcsj.DmBom; import com.dsic.gj_erp.bean.jcsj.DmBom;
import com.dsic.gj_erp.pc.Constant; import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.gx.*;
import com.dsic.gj_erp.pc.dto.sb.*;
import com.dsic.gj_erp.pc.dto.; import com.dsic.gj_erp.pc.dto.;
import com.dsic.gj_erp.pc.dto.; import com.dsic.gj_erp.pc.dto.;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -49,6 +48,18 @@ public class Bom {
return _bom; return _bom;
} }
public boolean (){
String[] = {
"N1AX","N1AD","N1LD","N2BX","N2BD","N2CX","N2CD","N2HX","N2HD","S2TX","S2TD","N3CX","N3CD",
"S3PX","S3PD","S3XX","N4PX","N4PD","N4XX","N2TX","N2TD"
};
return Arrays.stream().anyMatch(it->it.equals(this.()));
}
public String (){
return this.tzbh.substring(4,8).toUpperCase();
}
public double (Constant. _){ public double (Constant. _){
switch (_) { switch (_) {
case : case :
@ -121,7 +132,6 @@ public class Bom {
this.errors.add(ErrorType.使); this.errors.add(ErrorType.使);
} }
public void (Constant. _){ public void (Constant. _){
switch (_) { switch (_) {
case : case :

@ -10,10 +10,7 @@ import com.google.common.util.concurrent.AtomicDouble;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Getter @Getter
@Setter @Setter
@ -28,20 +25,35 @@ public class 按批次合并的钢料需求 {
private String ; private String ;
private Map<Constant., AtomicDouble> ;//fixme 要求必须所有工序都不可以打乱才能用 private Map<Constant., AtomicDouble> ;
private Map<String,AtomicDouble> ;
private Map<Constant., String> ; private Map<Constant., String> ;
public void (){ public void (){
=new HashMap<>(); =new HashMap<>();
=new HashMap<>();
this.bomList.forEach(item->{ this.bomList.forEach(item->{
_ = DataFactory.(item); _ = DataFactory.(item);
_.get().forEach(_->{ Optional.ofNullable(_).ifPresent(it->{
AtomicDouble aDouble = .get(_); this.(item,it);
if (aDouble==null){
aDouble=new AtomicDouble(0);
.put(_,aDouble);
}
aDouble.addAndGet(item.(_));
}); });
this.(item);
});
}
private void (Bom item){
if (item.getTzbh().contains("N1AX")||item.getTzbh().contains("N1AD")){
String key="N1AX-N1AD";
AtomicDouble aDouble = .computeIfAbsent(key, k -> new AtomicDouble(0));
aDouble.addAndGet(1);
}
}
private void (Bom item, _){
_.get().forEach(_->{
AtomicDouble aDouble = .computeIfAbsent(_, k -> new AtomicDouble(0));
aDouble.addAndGet(item.(_));
}); });
} }

@ -1,11 +1,21 @@
package com.dsic.gj_erp.pc.dto.data; package com.dsic.gj_erp.pc.dto.data;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.dsic.gj_erp.bean.SpringContextHolder;
import com.dsic.gj_erp.bean.jhgk.DmSygdxq; import com.dsic.gj_erp.bean.jhgk.DmSygdxq;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.service.;
import com.dsic.gj_erp.pc.;
import com.google.common.util.concurrent.AtomicDouble;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Getter @Getter
@ -17,11 +27,64 @@ public class 钢料需求 {
private String xzglxq; private String xzglxq;
private String dzglxq; private String dzglxq;
private List<Bom> bomList; private List<Bom> bomList;
private Map<String, AtomicDouble> ;
private DateTime ;
public static of(DmSygdxq qfxq){ public static of(DmSygdxq qfxq){
_ = new (); _ = new ();
BeanUtil.copyProperties(qfxq,_,"bomList"); BeanUtil.copyProperties(qfxq,_,"bomList");
_.bomList=qfxq.getBomList().stream().map(item->Bom.of(_.getXzglxq(),_.getDzglxq(),item)).collect(Collectors.toList()); _.bomList=qfxq.getBomList().stream()
.map(item->Bom.of(_.getXzglxq(),_.getDzglxq(),item))
.collect(Collectors.toList());
return _; return _;
} }
/**
*
*/
public void (){
//从redis获取各切割设备产能
_ = getBean(.class);
List<> = _.get().stream()
.filter(item->item.get_()== Constant..).collect(Collectors.toList());
}
public void (){
=new HashMap<>();
this.bomList.forEach(item->{
this.(item,"N1AX-N1AD");//一跨龙门
this.(item,"N1LD");//一跨数控
this.(item,"N2BX-N2BD-N2CX-N2CD-N2HX-N2HD");//二跨
// this.切割(item,"N2TX-N2TD");//二跨转移4,5,6垮
this.(item,"S2TX-S2TD");//二跨手工
this.(item,"N3CX-N3CD");//三跨
this.(item,"S3PX-S3PD");//三跨手工
this.(item,"S3XX");//三跨手工
this.(item,"N4PX-N4PD-N4XX-N2TX-N2TD");//456垮
});
}
public void addBomList(List<Bom> list){
this.bomList.addAll(list);
}
private void (Bom item,String key){
if (StrUtil.containsAny(item.getTzbh(),key.split("-"))){
AtomicDouble aDouble = .computeIfAbsent(key, k -> new AtomicDouble(0));
aDouble.addAndGet(1);//按张计算
}
}
private static <T> T getBean(Class<T> clazz) {
return SpringContextHolder.getBean(clazz);
}
public DateTime get(){
if (this. ==null){
return DateUtil.parse(this.xzglxq,"yyyy/MM/dd");
}
return this.;
}
} }

@ -19,14 +19,13 @@ public class 工序01上料 extends 工序产能 {
@Override @Override
public void () { public void () {
this.=0; this.=0;
if (this.>0){ this..values().forEach(->{
this.+=this.*Constant..01.get()/7.0; .(this.,this.);
} this.+=.get();
if (this.>0){ });
this.+=this.*Constant..01.get()/7.0;
}
} }
@Override @Override
public void (double ) { public void (double ) {
super.(1.0); super.(1.0);

@ -18,14 +18,13 @@ public class 工序02抛丸 extends 工序产能 {
@Override @Override
public void () { public void () {
this.=0; this.=0;
if (this.>0){ this..values().forEach(->{
this.+=this.*Constant..01.get()/7.0; .(this.,this.);
} this.+=.get();
if (this.>0){ });
this.+=this.*Constant..01.get()/7.0;
}
} }
@Override @Override
public void (double ) { public void (double ) {
super.(1.0); super.(1.0);

@ -18,14 +18,13 @@ public class 工序03理料 extends 工序产能 {
@Override @Override
public void () { public void () {
this.=0; this.=0;
if (this.>0){ this..values().forEach(->{
this.+=this.*Constant..01.get()/7.0; .(this.,this.);
} this.+=.get();
if (this.>0){ });
this.+=this.*Constant..01.get()/7.0;
}
} }
@Override @Override
public void (double ) { public void (double ) {
super.(); super.();

@ -19,14 +19,13 @@ public class 工序04划线 extends 工序产能 {
@Override @Override
public void () { public void () {
this.=0; this.=0;
if (this.>0){ this..values().forEach(->{
this.+=this.*Constant..线01.get()/7.0; .(this.,this.);
} this.+=.get();
if (this.>0){ });
this.+=this.*Constant..线01.get()/7.0;
}
} }
@Override @Override
public void (double ) { public void (double ) {
super.(); super.();

@ -1,16 +1,23 @@
package com.dsic.gj_erp.pc.dto.gx; package com.dsic.gj_erp.pc.dto.gx;
import com.dsic.gj_erp.pc.Constant; import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.data.Bom;
import com.dsic.gj_erp.pc.dto.; import com.dsic.gj_erp.pc.dto.;
import com.dsic.gj_erp.pc.dto.; import com.dsic.gj_erp.pc.dto.;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map; import java.util.Map;
import java.util.Optional;
@Getter @Getter
@Setter @Setter
public class 05 extends { public class 05 extends {
private static final Logger log = LoggerFactory.getLogger(05.class);
public 05(Map<String, > _) { public 05(Map<String, > _) {
super(Constant..,_); super(Constant..,_);
} }
@ -24,6 +31,30 @@ public class 工序05切割 extends 工序产能 {
}); });
} }
@Override
public void (String ,double , Bom bom){
if (!bom.()){
this.(bom.getTzbh(),1,bom);
return;
}
Optional<> = this.(bom.(),);
if (!.isPresent()){
log.info("强占:{}",bom);
bom.(Constant..);
this.(bom.getTzbh(),1,bom);
}
.ifPresent(it->{
it.();
it.(bom);
});
}
@Override
public Optional<> (String ,double ){
return this..values().stream()
.filter(item->item.getKey().contains()&&item.get()+<=this.).findFirst();
}
@Override @Override
public void (double ) { public void (double ) {
super.(); super.();

@ -18,14 +18,13 @@ public class 工序07坡口 extends 工序产能 {
@Override @Override
public void () { public void () {
this.=0; this.=0;
if (this.>0){ this..values().forEach(->{
this.+=this.*Constant..01.get()/7.0; .(this.,this.);
} this.+=.get();
if (this.>0){ });
this.+=this.*Constant..01.get()/7.0;
}
} }
@Override @Override
public void (double ) { public void (double ) {
super.(); super.();

@ -18,14 +18,13 @@ public class 工序08曲面 extends 工序产能 {
@Override @Override
public void () { public void () {
this.=0; this.=0;
if (this.>0){ this..values().forEach(->{
this.+=this.*Constant..01.get()/7.0; .(this.,this.);
} this.+=.get();
if (this.>0){ });
this.+=this.*Constant..01.get()/7.0;
}
} }
@Override @Override
public void (double ) { public void (double ) {
super.(); super.();

@ -11,6 +11,7 @@ import java.util.Map;
@Getter @Getter
@Setter @Setter
public class 09 extends { public class 09 extends {
public 09(Map<String, > _) { public 09(Map<String, > _) {
super(Constant..,_); super(Constant..,_);
} }
@ -18,12 +19,10 @@ public class 工序09打磨 extends 工序产能 {
@Override @Override
public void () { public void () {
this.=0; this.=0;
if (this.>0){ this..values().forEach(->{
this.+=this.*Constant..01.get()/7.0; .(this.,this.);
} this.+=.get();
if (this.>0){ });
this.+=this.*Constant..01.get()/7.0;
}
} }
@Override @Override

@ -18,14 +18,13 @@ public class 工序10型材 extends 工序产能 {
@Override @Override
public void () { public void () {
this.=0; this.=0;
if (this.>0){ this..values().forEach(->{
this.+=this.*Constant..01.get()/7.0; .(this.,this.);
} this.+=.get();
if (this.>0){ });
this.+=this.*Constant..01.get()/7.0;
}
} }
@Override @Override
public void (double ) { public void (double ) {
super.(); super.();

@ -18,14 +18,13 @@ public class 工序21自由边处理 extends 工序产能 {
@Override @Override
public void () { public void () {
this.=0; this.=0;
if (this.>0){ this..values().forEach(->{
this.+=this.*Constant..01.get()/7.0; .(this.,this.);
} this.+=.get();
if (this.>0){ });
this.+=this.*Constant..01.get()/7.0;
}
} }
@Override @Override
public void (double ) { public void (double ) {
super.(); super.();

@ -18,14 +18,13 @@ public class 工序31光电 extends 工序产能 {
@Override @Override
public void () { public void () {
this.=0; this.=0;
if (this.>0){ this..values().forEach(->{
this.+=this.*Constant..01.get()/7.0; .(this.,this.);
} this.+=.get();
if (this.>0){ });
this.+=this.*Constant..01.get()/7.0;
}
} }
@Override @Override
public void (double ) { public void (double ) {
super.(); super.();

@ -13,4 +13,14 @@ public class 设备01上料 extends 设备 {
public 01(Constant. _) { public 01(Constant. _) {
super(_); super(_);
} }
@Override
public void (double , double ){
this.=this.;
}
@Override
public boolean (double ){
return this.+>this.;
}
} }

@ -13,4 +13,14 @@ public class 设备02抛丸 extends 设备 {
public 02(Constant. _) { public 02(Constant. _) {
super(_); super(_);
} }
@Override
public void (double , double ){
this.=this.;
}
@Override
public boolean (double ){
return this.+>this.;
}
} }

@ -13,4 +13,14 @@ public class 设备03理料 extends 设备 {
public 03(Constant. _) { public 03(Constant. _) {
super(_); super(_);
} }
@Override
public void (double , double ){
this.=this.;
}
@Override
public boolean (double ){
return this.+>this.;
}
} }

@ -13,4 +13,14 @@ public class 设备04划线 extends 设备 {
public 04线(Constant. _) { public 04线(Constant. _) {
super(_); super(_);
} }
@Override
public void (double , double ){
this.=this.;
}
@Override
public boolean (double ){
return this.+>this.;
}
} }

@ -22,14 +22,13 @@ public class 设备05切割 extends 设备 {
super(_); super(_);
} }
// @Override @Override
// public void 修正工作量(double 白班时长, double 二班时长) { public void (double , double ){
// this.白班时长=白班时长; this.=this.;
// this.二班时长=二班时长; }
// this.修正产能();
// } @Override
// public boolean (double ){
// public void 修正产能(){ return this.+>this.;
// this.产能=this.白班设备产能*this.白班时长+this.二班设备产能*this.二班时长; }
// }
} }

@ -13,4 +13,14 @@ public class 设备07坡口 extends 设备 {
public 07(Constant. _) { public 07(Constant. _) {
super(_); super(_);
} }
@Override
public void (double , double ){
this.=this.;
}
@Override
public boolean (double ){
return this.+>this.;
}
} }

@ -13,4 +13,14 @@ public class 设备08曲面 extends 设备 {
public 08(Constant. _) { public 08(Constant. _) {
super(_); super(_);
} }
@Override
public void (double , double ){
this.=this.;
}
@Override
public boolean (double ){
return this.+>this.;
}
} }

@ -13,4 +13,14 @@ public class 设备09打磨 extends 设备 {
public 09(Constant. _) { public 09(Constant. _) {
super(_); super(_);
} }
@Override
public void (double , double ){
this.=this.;
}
@Override
public boolean (double ){
return this.+>this.;
}
} }

@ -13,4 +13,14 @@ public class 设备10型材 extends 设备 {
public 10(Constant. _) { public 10(Constant. _) {
super(_); super(_);
} }
@Override
public void (double , double ){
this.=this.;
}
@Override
public boolean (double ){
return this.+>this.;
}
} }

@ -13,4 +13,14 @@ public class 设备21自由边处理 extends 设备 {
public 21(Constant. _) { public 21(Constant. _) {
super(_); super(_);
} }
@Override
public void (double , double ){
this.=this.;
}
@Override
public boolean (double ){
return this.+>this.;
}
} }

@ -13,4 +13,14 @@ public class 设备31光电 extends 设备 {
public 31(Constant. _) { public 31(Constant. _) {
super(_); super(_);
} }
@Override
public void (double , double ){
this.=this.;
}
@Override
public boolean (double ){
return this.+>this.;
}
} }

@ -102,7 +102,6 @@ public abstract class 套料图工序 implements 套料图工序接口 {
public void run(AtomicBoolean atomicBoolean) { public void run(AtomicBoolean atomicBoolean) {
if (!this.()){ if (!this.()){
// System.out.println(String.format("船号:%s,批量:%s,未订货",this.bom.getDcch(),this.bom.getPl()));
bom.(); bom.();
} }
@ -191,11 +190,12 @@ public abstract class 套料图工序 implements 套料图工序接口 {
_ = (dateTime); _ = (dateTime);
try { try {
if (_.(_,this.bom,)){ if (_.(_,this.bom,)){
this.bom.set(_); // this.bom.set所在资源(_资源);
this.bom.get().add(0,_); this.bom.get().add(0,_);
} }
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
throw e;
} }
return _; return _;
@ -208,7 +208,7 @@ public abstract class 套料图工序 implements 套料图工序接口 {
AtomicBoolean =new AtomicBoolean(false); AtomicBoolean =new AtomicBoolean(false);
try { try {
if (_.(_,this.bom,)){ if (_.(_,this.bom,)){
this.bom.set(_); // this.bom.set所在资源(_资源);
this.bom.get().add(0,_); this.bom.get().add(0,_);
.set(true); .set(true);
} }

@ -69,13 +69,12 @@ public abstract class 工序产能 implements 工序排产处理接口 {
.findFirst(); .findFirst();
} }
public Optional<> (double ){ public Optional<> (String ,double ){
return this..values().stream().findAny(); return this..values().stream().findAny();
} }
public boolean (String ,double ){ public Optional<> (double ){
_ = this..get(); return this..values().stream().findAny();
return _.+<=_.;
} }
public boolean (double ){ public boolean (double ){
@ -87,7 +86,7 @@ public abstract class 工序产能 implements 工序排产处理接口 {
} }
public void (String ){ public void (String ){
this..add(); //this.资源占用图纸表.add(占用源);
} }
public void (String ,double , Bom bom){ public void (String ,double , Bom bom){
@ -97,6 +96,7 @@ public abstract class 工序产能 implements 工序排产处理接口 {
it.(bom); it.(bom);
}); });
} }
public void (String ,double , Bom bom){ public void (String ,double , Bom bom){
Optional<> _ = this..values().stream().findAny(); Optional<> _ = this..values().stream().findAny();
_.ifPresent(it->{ _.ifPresent(it->{

@ -1,5 +1,8 @@
package com.dsic.gj_erp.pc.dto; package com.dsic.gj_erp.pc.dto;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.dsic.gj_erp.pc.Constant; import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.data.Bom; import com.dsic.gj_erp.pc.dto.data.Bom;
import com.dsic.gj_erp.pc.service.; import com.dsic.gj_erp.pc.service.;
@ -16,10 +19,12 @@ public abstract class 设备 implements 设备接口 {
protected String ; protected String ;
protected double ; protected double ;
protected double ; protected double ;
protected double ;
protected double ; protected double ;
protected volatile double =0.0; protected volatile double =0.0;
protected ConcurrentLinkedDeque<String> ; protected ConcurrentLinkedDeque<String> ;
protected ConcurrentLinkedDeque<Bom> ; protected ConcurrentLinkedDeque<Bom> ;
protected String key;
@Override @Override
public void (double , double ) { public void (double , double ) {
@ -31,6 +36,11 @@ public abstract class 设备 implements 设备接口 {
this.+=*/7.0; this.+=*/7.0;
} }
} }
public boolean (double ){
return false;
}
@Override @Override
public void (double ) { public void (double ) {
this.+=; this.+=;
@ -52,17 +62,25 @@ public abstract class 设备 implements 设备接口 {
this.= _.get(); this.= _.get();
this.= _.get(); this.= _.get();
this.= _.get(); this.= _.get();
this.=_.get();
this.key=_.get();
this.=new ConcurrentLinkedDeque<>(); this.=new ConcurrentLinkedDeque<>();
this.=new ConcurrentLinkedDeque<>(); this.=new ConcurrentLinkedDeque<>();
} }
public (Constant. _){ public (Constant. _){
this.= _.; this.= _.;
this.= _.; this.= _.;
this.= _.; this.= _.;
this.= _.; this.= _.;
this.=_.get();
this.=new ConcurrentLinkedDeque<>(); this.=new ConcurrentLinkedDeque<>();
this.=new ConcurrentLinkedDeque<>(); this.=new ConcurrentLinkedDeque<>();
} }
public static void main(String[] args) {
int d=-7;
DateTime offset = DateUtil.date().offset(DateField.DAY_OF_YEAR, -d);
System.out.println(offset.toDateStr());
}
} }

@ -2,8 +2,10 @@ package com.dsic.gj_erp.pc.dto;
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.StrUtil;
import com.dsic.gj_erp.pc.Constant; import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.data.Bom; import com.dsic.gj_erp.pc.dto.data.Bom;
import com.google.common.util.concurrent.AtomicDouble;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -31,6 +33,19 @@ public class 资源 {
}); });
} }
public boolean (Map<String, AtomicDouble> ){
= MAP.get(Constant..);
Map<String, > = .get();
AtomicBoolean flag=new AtomicBoolean(true);
.values().forEach(it->{
AtomicDouble =.get(it.getKey());
if (!=null&&it.get()+.get()>it.){
flag.set(false);
}
});
return flag.get();
}
public boolean (Constant. _ ,double ){ public boolean (Constant. _ ,double ){
= MAP.get(_); = MAP.get(_);
AtomicBoolean atomicBoolean = new AtomicBoolean(false); AtomicBoolean atomicBoolean = new AtomicBoolean(false);
@ -44,8 +59,14 @@ public class 资源 {
public boolean (Constant. , Bom bom, double ){ public boolean (Constant. , Bom bom, double ){
AtomicBoolean atomicBoolean = new AtomicBoolean(false); AtomicBoolean atomicBoolean = new AtomicBoolean(false);
if (bom.getTzbh().equals("B020N4PX004")){
System.out.println(111);
}
= MAP.get(); = MAP.get();
Optional.ofNullable().ifPresent(it->{ Optional.ofNullable().ifPresent(it->{
if (it.==0){
return;
}
if (!it.()){ if (!it.()){
bom.(); bom.();
} }

@ -1,5 +1,7 @@
package com.dsic.gj_erp.pc.service; package com.dsic.gj_erp.pc.service;
import cn.hutool.core.date.DateTime;
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 cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -51,18 +53,22 @@ public class 三月滚动接口 {
Map<String, List<DmSygdMx>> collect = mxList.stream().collect(Collectors.groupingBy(item -> item.getDcCh() + item.getDcPl() + item.getTzbh())); Map<String, List<DmSygdMx>> collect = mxList.stream().collect(Collectors.groupingBy(item -> item.getDcCh() + item.getDcPl() + item.getTzbh()));
Manager..values().forEach(_->{ DateTime from = DateUtil.parse(begin, "yyyy/MM/dd");
_.getMAP().values().forEach(_->{ DateTime to = DateUtil.parse(end, "yyyy/MM/dd");
_.get().values().forEach(_->{
_.get().parallelStream().forEach(_bom->{ Manager..values().parallelStream()
List<DmSygdMx> dmSygdMxes = collect.get(_bom.getDcch() + _bom.getPl() + _bom.getTzbh()); .filter(_->DateUtil.isIn(_.get_date(),from,to))
for (DmSygdMx mx:dmSygdMxes){ .forEach(_->{_.getMAP().values().forEach(_->{
mx.(_.get(),_.getDate()); _.get().values().forEach(_->{
} _.get().parallelStream().forEach(_bom->{
List<DmSygdMx> dmSygdMxes = collect.get(_bom.getDcch() + _bom.getPl() + _bom.getTzbh());
for (DmSygdMx mx:dmSygdMxes){
mx.(_.get(),_.getDate());
}
});
}); });
}); });
}); });
});
sygdMxService.saveBatch(mxList,500); sygdMxService.saveBatch(mxList,500);

@ -3,6 +3,7 @@ package com.dsic.gj_erp.pc.service;
import com.dsic.gj_erp.pc.dto.data.Bom; import com.dsic.gj_erp.pc.dto.data.Bom;
public interface { public interface {
void (double ,double ); void (double ,double );

@ -20,4 +20,6 @@ public interface 设备接口 {
void (String ); void (String );
void (Bom bom); void (Bom bom);
boolean (double );
} }

@ -17,15 +17,14 @@ public class 排产 {
List<> list; List<> list;
public static void execute(@NotNull String from, @NotNull String to) { public static void execute(@NotNull String from, @NotNull String to) {
_ = .of(from, to); Manager. = .of(from, to);
Manager. = _;
Manager.from = from; Manager.from = from;
Manager.to = to; Manager.to = to;
DataFactory.(); DataFactory.();
DataFactory.(); DataFactory.();
DataFactory.(); DataFactory.();
DataFactory.(); DataFactory.();
DataFactory.3(); DataFactory.4();
} }
private static of(@NotNull String from, @NotNull String to){ private static of(@NotNull String from, @NotNull String to){
@ -34,6 +33,7 @@ public class 排产 {
.to = to; .to = to;
.complete = false; .complete = false;
.list = new ArrayList<>(); .list = new ArrayList<>();
Manager. = ;
return Manager.; return Manager.;
} }

@ -15,5 +15,7 @@ public class 设备产能 {
private double ; private double ;
private double ; private double ;
private boolean ; private boolean ;
private String ;
private String ;
} }

@ -8,7 +8,6 @@ import cn.hutool.core.util.ObjUtil;
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.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.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;
@ -131,7 +130,11 @@ public class DmSygdxqServiceImpl extends ServiceImpl<DmSygdxqMapper, DmSygdxq> i
@Override @Override
public List<DmSygdxq> getXqWithBom(String from, String to) { public List<DmSygdxq> getXqWithBom(String from, String to) {
return baseMapper.getXqWithBom(from,to); return t(from,to,"","");
}
private List<DmSygdxq> t(String from, String to,String dcch,String pl){
return baseMapper.getXqWithBom(from,to,dcch,pl);
} }
//零件信息 //零件信息

@ -54,6 +54,12 @@
dm_sygdxq xq left join dm_bom bom on bom.dcch = xq.DC_CH and bom.pl = xq.DC_PL and bom.fd = xq.DC_FD dm_sygdxq xq left join dm_bom bom on bom.dcch = xq.DC_CH and bom.pl = xq.DC_PL and bom.fd = xq.DC_FD
where where
xq.xzglxq between #{from} and #{to} xq.xzglxq between #{from} and #{to}
<if test="dcch!=null and dcch!=''">
and xq.DC_CH=#{dcch}
</if>
<if test="pl!=null and pl!=''">
and bom.pl=#{pl}
</if>
) a ) a
where a.rn=1 where a.rn=1
order by a.xzglxq order by a.xzglxq

Loading…
Cancel
Save