余料管理,增加退回功能和手工上料功能

master
董哲奇 1 year ago
parent 64fa99b6e5
commit 6f9d3a7214

@ -412,6 +412,9 @@ public class DmYdjh implements Serializable {
return StrUtil.format("{}_{}_{}_{}",this.dcCh,this.dcPl,this.dcFd,this.tzbh);
}
public boolean 图纸已使用(){
return false;
}
public void setZtForSl(){
this.zt=ZyjhzxEnum.SLFK.code;

@ -94,13 +94,41 @@ public class DmYlInfo {
使用状态=UseStatus.已使用.ordinal();
}
public void 修正退回信息(){
使用船号="";
使用批量="";
使用分段="";
使用图纸="";
使用日期="";
使用状态=UseStatus.未使用.ordinal();
}
public static DmYlInfo of(DmBchxylp bchxylp, DmYdjh ydjh){
DmYlInfo dmYlInfo = new DmYlInfo();
dmYlInfo.余料编号=bchxylp.getYlbh();
String _板厚=null;
if(StrUtil.isNotEmpty(ydjh.getWpgg())){
String[] _split=ydjh.getWpgg().split("\\*");
if (_split.length>=3){
_板厚=_split[0];
}
}
dmYlInfo.规格=bchxylp.getYlgg();
//兼容余料规格两种模式:带板厚和不带板厚
if (dmYlInfo.规格!=null){
String[] split = dmYlInfo.规格.split("\\*");
if (split.length==2){
if(StrUtil.isNotEmpty(_板厚)){
dmYlInfo.板厚=new BigDecimal(_板厚);
dmYlInfo.规格=_板厚+"\\*"+dmYlInfo.规格;
}
dmYlInfo.板宽=new BigDecimal(split[0]);
dmYlInfo.板长=new BigDecimal(split[1]);
}
if (split.length>=3){
dmYlInfo.板厚=new BigDecimal(split[0]);
dmYlInfo.板宽=new BigDecimal(split[1]);

@ -17,7 +17,8 @@ import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
@ -45,11 +46,39 @@ public class YlController {
* 保存功能
*/
@PostMapping("edit")
@Transactional(rollbackFor = Exception.class)
public ResultBean<?> edit(@RequestBody List<DmYlInfo> list){
ylInfoService.updateBatchById(list);
return new ResultBean<>();
}
/**
* 退回
*/
@PostMapping("rollback")
@Transactional(rollbackFor = Exception.class)
public ResultBean<?> rollback(@RequestBody List<DmYlInfo> list){
List<DmYdjh> updateList=new ArrayList<>();
list.stream()
.filter(item->item.get使用状态()<=2)
.forEach(item->{
DmYdjh one = ydjhService.getOne(Wrappers.<DmYdjh>lambdaQuery()
.eq(DmYdjh::getDcCh, item.get使用船号())
.eq(DmYdjh::getTzbh, item.get使用图纸())
);
//退回作业计划
//fixme 修正作业计划,余料上料相关属性
if (ObjectUtil.isNotEmpty(one)){
}
//退回余料库存信息
item.修正退回信息();
});
ydjhService.updateBatchById(updateList);
this.edit(list);
return new ResultBean<>();
}
/**
* 打印
*/
@ -58,6 +87,7 @@ public class YlController {
public ResultBean<?> print(@RequestBody List<DmYlInfo> list){
ArrayList<DmYdjh> updateList = new ArrayList<>();
list.forEach(item->{
if (StrUtil.isAllNotEmpty(item.get使用船号(),item.get使用船号())){
String date = DateUtil.date().toString("yyyy/MM/dd");
item.set使用日期(date);
item.set使用状态(2);//已打印
@ -65,7 +95,16 @@ public class YlController {
.eq(DmYdjh::getDcCh, item.get使用船号())
.eq(DmYdjh::getTzbh,item.get使用图纸())
);
if (ObjectUtil.isEmpty(ydjhList)){
String str=StrUtil.format("使用船号:{},使用图号{}错误,请核对修正后再打印", item.get使用船号(), item.get使用图纸());
throw new ServiceException(99999,str);
}
List<DmYdjh> collect = ydjhList.stream().peek(it -> {
//fixme 确定以下方法具体算法
if (it.图纸已使用()){
String str=StrUtil.format("作业计划船号:{},图号{}已使用,请核对修正后再打印", item.get使用船号(), item.get使用图纸());
throw new ServiceException(99999,str);
}
it.setSllph(item.get炉批号());
it.setSlfkrq(date);
//fixme 不确定是否还需要抛丸,先执行到上料
@ -76,9 +115,12 @@ public class YlController {
}).collect(Collectors.toList());
updateList.addAll(collect);
}
});
ydjhService.updateBatchById(updateList);
ylInfoService.updateBatchById(list);
return new ResultBean<>();
}
@ -120,8 +162,6 @@ public class YlController {
}
}
return new ResultBean<>(匹配成功的余料信息);
}
}

Loading…
Cancel
Save