|
|
|
@ -4,13 +4,10 @@ package com.dsic.gj_erp.service.jhgk.impl;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
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.ResultBean;
|
|
|
|
|
import com.dsic.gj_erp.bean.jhgk.DmQfxq;
|
|
|
|
|
import com.dsic.gj_erp.bean.jhgk.DmSygdMx;
|
|
|
|
|
import com.dsic.gj_erp.bean.jhgk.DmYdjh;
|
|
|
|
|
import com.dsic.gj_erp.bean.jiuzhou.Sljh;
|
|
|
|
|
import com.dsic.gj_erp.bean.pgd.*;
|
|
|
|
|
import com.dsic.gj_erp.mapper.jhgk.DmYdjhMapper;
|
|
|
|
|
import com.dsic.gj_erp.service.jhgk.DmQfxqService;
|
|
|
|
@ -21,11 +18,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.context.ApplicationEventPublisher;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
@ -82,16 +76,71 @@ public class DmYdjhServiceImpl extends ServiceImpl<DmYdjhMapper, DmYdjh> impleme
|
|
|
|
|
return sygdmx;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public Map<String,Object> hz(List<DmYdjh> ydjhList){
|
|
|
|
|
public Map<String,Object> hz2(String from, String to){
|
|
|
|
|
Map<String,Object> map=new HashMap<>();
|
|
|
|
|
//月度计划汇总
|
|
|
|
|
//汇总时生成切割之前的派工单 状态为空
|
|
|
|
|
// String begin= DateUtil.format(DateUtil.nextMonth(),"yyyy/MM/01");
|
|
|
|
|
String begin=from;
|
|
|
|
|
String end=to;
|
|
|
|
|
// String begin= DateUtil.format(from,"yyyy/MM/01");
|
|
|
|
|
// String end =DateUtil.format(DateUtil.endOfMonth(DateUtil.offsetMonth(DateUtil.date(),1)),"yyyy/MM/dd");
|
|
|
|
|
String begin="2024/02/01";
|
|
|
|
|
String end ="2024/03/1";
|
|
|
|
|
//图纸计划
|
|
|
|
|
|
|
|
|
|
List<PgdTzjh> tzjhList=tzjhService.list(new QueryWrapper<PgdTzjh>().between("qgxqrq",begin,end).orderByAsc("czbh,pl,qgxqrq"));
|
|
|
|
|
if (tzjhList.size()<1){
|
|
|
|
|
baseMapper.getTzjh(begin,end);
|
|
|
|
|
tzjhList=tzjhService.list(new QueryWrapper<PgdTzjh>().between("qgxqrq",begin,end)
|
|
|
|
|
.orderByAsc("czbh,pl,qgxqrq")
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
//订货清单
|
|
|
|
|
List<PgdDh> dhList=dhService.list(new QueryWrapper<PgdDh>().between("slxqrq",begin,end).orderByAsc("czbh,slxqrq"));
|
|
|
|
|
if (dhList.size()<1){
|
|
|
|
|
List<PgdDh> dh= baseMapper.getDhjh(begin,end);
|
|
|
|
|
if (dh.size()>0){
|
|
|
|
|
|
|
|
|
|
dhService.saveBatch(dh);
|
|
|
|
|
dhList=dhService.list(new QueryWrapper<PgdDh>().between("slxqrq",begin,end).orderByAsc("czbh,slxqrq"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//上料计划
|
|
|
|
|
List<PgdSljh> slList=slService.list(new QueryWrapper<PgdSljh>().between("sljhrq",begin,end).orderByAsc("czbh,pl,sljhrq"));
|
|
|
|
|
if (slList.size()<1){
|
|
|
|
|
baseMapper.getSljh(begin,end);
|
|
|
|
|
slList=slService.list(new QueryWrapper<PgdSljh>().between("sljhrq",begin,end).orderByAsc("czbh,pl,sljhrq"));
|
|
|
|
|
}
|
|
|
|
|
//抛丸计划
|
|
|
|
|
|
|
|
|
|
List<PgdPwjh> pwList=pwService.list(new QueryWrapper<PgdPwjh>().between("pwjhrq",begin,end).orderByAsc("czbh,pl,pwjhrq"));
|
|
|
|
|
if (pwList.size()<1){
|
|
|
|
|
baseMapper.getPwjh(begin,end);
|
|
|
|
|
pwList=pwService.list(new QueryWrapper<PgdPwjh>().between("pwjhrq",begin,end).orderByAsc("czbh,pl,pwjhrq"));
|
|
|
|
|
}
|
|
|
|
|
//切割计划
|
|
|
|
|
List<PgdQgjh> qgList=qgService.list(new QueryWrapper<PgdQgjh>().between("qgjhrq",begin,end).orderByAsc("czbh,pl,qgjhrq"));
|
|
|
|
|
if (qgList.size()<1){
|
|
|
|
|
baseMapper.getQgjh(begin,end);
|
|
|
|
|
qgList=qgService.list(new QueryWrapper<PgdQgjh>().between("qgjhrq",begin,end).orderByAsc("czbh,pl,qgjhrq"));
|
|
|
|
|
}
|
|
|
|
|
map.put("tzjhList",tzjhList);
|
|
|
|
|
map.put("dhList",dhList);
|
|
|
|
|
map.put("slList",slList);
|
|
|
|
|
map.put("pwList",pwList);
|
|
|
|
|
map.put("qgList",qgList);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public Map<String,Object> hz(List<DmYdjh> ydjhList){
|
|
|
|
|
Map<String,Object> map=new HashMap<>();
|
|
|
|
|
//月度计划汇总
|
|
|
|
|
//汇总时生成切割之前的派工单 状态为空
|
|
|
|
|
String begin= DateUtil.format(DateUtil.nextMonth(),"yyyy/MM/01");
|
|
|
|
|
String end =DateUtil.format(DateUtil.endOfMonth(DateUtil.offsetMonth(DateUtil.date(),1)),"yyyy/MM/dd");
|
|
|
|
|
//图纸计划
|
|
|
|
|
|
|
|
|
|
List<PgdTzjh> tzjhList=tzjhService.list(new QueryWrapper<PgdTzjh>().between("qgxqrq",begin,end).orderByAsc("czbh,pl,qgxqrq"));
|
|
|
|
|