|
|
|
@ -3,6 +3,7 @@ package com.dsic.gj_erp.service.jhgk.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
@ -15,9 +16,11 @@ import com.dsic.gj_erp.service.jhgk.DmQfxqService;
|
|
|
|
|
import com.dsic.gj_erp.service.jhgk.DmYdjhService;
|
|
|
|
|
import com.dsic.gj_erp.service.jiuzhou.SljhService;
|
|
|
|
|
import com.dsic.gj_erp.service.pgd.*;
|
|
|
|
|
import io.swagger.models.auth.In;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.context.ApplicationEventPublisher;
|
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
@ -232,24 +235,42 @@ public class DmYdjhServiceImpl extends ServiceImpl<DmYdjhMapper, DmYdjh> impleme
|
|
|
|
|
@Resource
|
|
|
|
|
private ApplicationEventPublisher publisher;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RedisTemplate<String,Object> redisTemplate;
|
|
|
|
|
|
|
|
|
|
//下发 派工单状态改为编制 生成零件信息
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void xf(List<DmYdjh> ydjhList, HttpServletRequest request) {
|
|
|
|
|
String bzry= (String) request.getAttribute("yhms");
|
|
|
|
|
String bzrq= DateUtil.format(DateUtil.date(), "yyyy/MM/dd");
|
|
|
|
|
//修改状态
|
|
|
|
|
|
|
|
|
|
//工单号
|
|
|
|
|
List<DmYdjh> updateList = ydjhList.stream().map(item -> {
|
|
|
|
|
Long increment = redisTemplate.opsForHash().increment("ZYJH_GDH::", item.getSljhrq(), 1);
|
|
|
|
|
DmYdjh dmYdjh = new DmYdjh();
|
|
|
|
|
dmYdjh.setId(item.getId());
|
|
|
|
|
dmYdjh.setZt("2");
|
|
|
|
|
dmYdjh.setDjh(StrUtil.format("{}{}",item.getSljhrq().replace("/",""), String.format("%03d",increment)));
|
|
|
|
|
return dmYdjh;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
this.updateBatchById(updateList);
|
|
|
|
|
|
|
|
|
|
List<String> idList = ydjhList.stream().map(DmYdjh::getId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
if (idList.size() > 100) {
|
|
|
|
|
List<String> list = idList.subList(idList.size() / 100 * 100, idList.size());
|
|
|
|
|
AtomicInteger index = new AtomicInteger(idList.size() / 100 + 1);
|
|
|
|
|
this.update(new UpdateWrapper<DmYdjh>().set("zt", "2")
|
|
|
|
|
.in("id", list)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// this.update(new UpdateWrapper<DmYdjh>().set("zt", "2")
|
|
|
|
|
// .in("id", list)
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
|
|
// 生成 数据
|
|
|
|
|
baseMapper.getTzjh(list,bzry,bzrq);
|
|
|
|
|
|
|
|
|
|
//作业计划零件数据
|
|
|
|
|
baseMapper.tqlj(list);
|
|
|
|
|
do {
|
|
|
|
|
int i = index.decrementAndGet();
|
|
|
|
@ -259,23 +280,22 @@ public class DmYdjhServiceImpl extends ServiceImpl<DmYdjhMapper, DmYdjh> impleme
|
|
|
|
|
);
|
|
|
|
|
baseMapper.getTzjh(list1,bzry,bzrq);
|
|
|
|
|
|
|
|
|
|
//作业计划零件数据
|
|
|
|
|
baseMapper.tqlj(list1);
|
|
|
|
|
}while (index.get()>1);
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
this.update(new UpdateWrapper<DmYdjh>().set("zt", "2")
|
|
|
|
|
.in("id", idList)
|
|
|
|
|
);
|
|
|
|
|
// this.update(new UpdateWrapper<DmYdjh>().set("zt", "2")
|
|
|
|
|
// .in("id", idList)
|
|
|
|
|
// );
|
|
|
|
|
// //修改汇总状态 改为 编制
|
|
|
|
|
// baseMapper.xfbc(idList);
|
|
|
|
|
// //生成对应零件信息 bom->tzjhLj
|
|
|
|
|
// baseMapper.tqlj(idList);
|
|
|
|
|
// baseMapper.xfbc(idList);
|
|
|
|
|
baseMapper.getTzjh(idList,bzry,bzrq);
|
|
|
|
|
baseMapper.getSljh(idList,bzry,bzrq);
|
|
|
|
|
baseMapper.getPwjh(idList,bzry,bzrq);
|
|
|
|
|
baseMapper.getQgjh(idList,bzry,bzrq);
|
|
|
|
|
|
|
|
|
|
//作业计划零件数据
|
|
|
|
|
baseMapper.tqlj(idList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|