|
|
@ -5,6 +5,7 @@ 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.dsic.gj_erp.pc.Constant;
|
|
|
|
import com.dsic.gj_erp.pc.Constant;
|
|
|
|
|
|
|
|
import com.dsic.gj_erp.pc.Manager;
|
|
|
|
import com.dsic.gj_erp.pc.dto.data.Bom;
|
|
|
|
import com.dsic.gj_erp.pc.dto.data.Bom;
|
|
|
|
import com.dsic.gj_erp.pc.dto.data.钢料需求;
|
|
|
|
import com.dsic.gj_erp.pc.dto.data.钢料需求;
|
|
|
|
import com.dsic.gj_erp.pc.service.套料图工序接口;
|
|
|
|
import com.dsic.gj_erp.pc.service.套料图工序接口;
|
|
|
@ -20,7 +21,6 @@ import static com.dsic.gj_erp.pc.Constant.工序CD;
|
|
|
|
import static com.dsic.gj_erp.pc.DataFactory.提取资源;
|
|
|
|
import static com.dsic.gj_erp.pc.DataFactory.提取资源;
|
|
|
|
import static com.dsic.gj_erp.pc.DataFactory.搜索可用资源;
|
|
|
|
import static com.dsic.gj_erp.pc.DataFactory.搜索可用资源;
|
|
|
|
import static com.dsic.gj_erp.pc.Manager.from;
|
|
|
|
import static com.dsic.gj_erp.pc.Manager.from;
|
|
|
|
import static com.dsic.gj_erp.pc.Manager.套料图所占工序的资源;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Getter
|
|
|
|
@Getter
|
|
|
|
@Setter
|
|
|
|
@Setter
|
|
|
@ -41,18 +41,26 @@ public abstract class 套料图工序 implements 套料图工序接口 {
|
|
|
|
this._需求日期 = DateUtil.parse(this.需求日期, "yyyy/MM/dd");
|
|
|
|
this._需求日期 = DateUtil.parse(this.需求日期, "yyyy/MM/dd");
|
|
|
|
double 需求数量 = 1;
|
|
|
|
double 需求数量 = 1;
|
|
|
|
this.工序.forEach(_工序 -> {
|
|
|
|
this.工序.forEach(_工序 -> {
|
|
|
|
if (!this.已占资源(_工序)&&!this.占用资源(_工序,需求数量)){
|
|
|
|
if (!this.占用资源(_工序,需求数量)){
|
|
|
|
if (bom.get所在资源() == null) {
|
|
|
|
if (bom.get已排工序().size()==0||bom.get已排工序().get(0) != _工序) {
|
|
|
|
Optional<资源> 可用资源 = 搜索可用资源(_工序, DateUtil.parse(from, "yyyy/MM/dd"), this._需求日期, 需求数量);
|
|
|
|
//可用资源最大前推日期设置为N天,最大前推日期意味从上料开始最小施工周期
|
|
|
|
可用资源.ifPresent(_资源 -> {
|
|
|
|
//fixme 这里应该安装工序设置,暂时写死一个日期
|
|
|
|
_资源.占用资源(_工序,this.bom,需求数量);
|
|
|
|
Optional<资源> 可用资源 = 搜索可用资源(_工序, DateUtil.parse(from, "yyyy/MM/dd"), DateUtil.offsetDay(this._需求日期,0), 需求数量);
|
|
|
|
});
|
|
|
|
if (可用资源!=null){
|
|
|
|
|
|
|
|
可用资源.ifPresent(_资源 -> {
|
|
|
|
|
|
|
|
if (_资源.占用资源(_工序,this.bom,需求数量)){
|
|
|
|
|
|
|
|
this.bom.set所在资源(_资源);
|
|
|
|
|
|
|
|
this.bom.get已排工序().add(0,_工序);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//没有可用资源放入月末(强占),待手工调整
|
|
|
|
if (bom.get已排工序().size()==0||bom.get已排工序().get(0) != _工序) {
|
|
|
|
if (bom.get所在资源() == null) {
|
|
|
|
if (_工序 == Constant.工序.上料){
|
|
|
|
资源 _资源 = 提取资源(DateUtil.endOfMonth(DateUtil.parse(this.需求日期, "yyyy/MM/dd")));
|
|
|
|
Manager.排产结果.add(this.bom);
|
|
|
|
_资源.强占资源(_工序,this.bom,需求数量);
|
|
|
|
System.out.println(this.bom.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -64,18 +72,20 @@ public abstract class 套料图工序 implements 套料图工序接口 {
|
|
|
|
资源 _资源 = 提取资源(dateTime);
|
|
|
|
资源 _资源 = 提取资源(dateTime);
|
|
|
|
AtomicBoolean 占用成功=new AtomicBoolean(false);
|
|
|
|
AtomicBoolean 占用成功=new AtomicBoolean(false);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
_资源.占用资源(_工序,this.bom,需求数量);
|
|
|
|
if (_资源.占用资源(_工序,this.bom,需求数量)){
|
|
|
|
this.bom.set所在资源(_资源);
|
|
|
|
this.bom.set所在资源(_资源);
|
|
|
|
占用成功.set(true);
|
|
|
|
this.bom.get已排工序().add(0,_工序);
|
|
|
|
|
|
|
|
占用成功.set(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
}catch (Exception e){
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 占用成功.get();
|
|
|
|
return 占用成功.get();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected boolean 已占资源(Constant.工序 _工序){
|
|
|
|
protected boolean 已占资源(Constant.工序 _工序,String 套料图){
|
|
|
|
资源 已占资源 = this.获取所在资源();
|
|
|
|
资源 已占资源 = 资源.读取套料图所在资源(套料图);
|
|
|
|
工序产能 工序产能 = null;
|
|
|
|
工序产能 工序产能 = null;
|
|
|
|
if (已占资源 != null) {
|
|
|
|
if (已占资源 != null) {
|
|
|
|
工序产能 = 已占资源.get工序产能MAP().get(_工序);
|
|
|
|
工序产能 = 已占资源.get工序产能MAP().get(_工序);
|
|
|
@ -89,10 +99,6 @@ public abstract class 套料图工序 implements 套料图工序接口 {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected 资源 获取所在资源() {
|
|
|
|
|
|
|
|
return 套料图所占工序的资源.get(this.bom.getTzbh());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public 套料图工序 钢料需求(钢料需求 _钢料需求) {
|
|
|
|
public 套料图工序 钢料需求(钢料需求 _钢料需求) {
|
|
|
|
this._钢料需求=_钢料需求;
|
|
|
|
this._钢料需求=_钢料需求;
|
|
|
|