parent
ed78a22991
commit
de907520a0
@ -0,0 +1,28 @@
|
||||
package com.dsic.gj_erp.bean.xiaochi;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 小池设备表
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("iot_m_machine")
|
||||
public class Device {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
private String machineId;//设备id
|
||||
|
||||
private String machineName;//设备名称
|
||||
|
||||
private String serialNumber;//序列号
|
||||
|
||||
private String machinemodelName;//设备型号
|
||||
|
||||
private String torchType;//割枪类型
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.dsic.gj_erp.bean.xiaochi;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 小池人员表
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("iot_m_employee")
|
||||
public class User extends Model<User> {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String employeeNumber;
|
||||
|
||||
private String name;
|
||||
|
||||
private String department;
|
||||
|
||||
private String position;
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package com.dsic.gj_erp.controller.xiaochi;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
public class XiaoChiController {
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.dsic.gj_erp.service.xiaochi;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.cron.CronUtil;
|
||||
import cn.hutool.cron.task.Task;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.dsic.gj_erp.bean.pgd.PgdQgjh;
|
||||
import com.dsic.gj_erp.bean.xiaochi.CutPlan;
|
||||
import com.dsic.gj_erp.bean.xiaochi.User;
|
||||
import com.dsic.gj_erp.service.pgd.PgdQgjhService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class XiaoChiService{
|
||||
|
||||
private final PgdQgjhService qgjhService;
|
||||
|
||||
//fixme 小池查询逻辑有出入,暂时不启用
|
||||
// @PostConstruct
|
||||
public void handler(){
|
||||
List<User> users = new User().selectAll();
|
||||
Map<String,User> userMap=new HashMap<>();
|
||||
users.forEach(item->{
|
||||
userMap.put(item.getEmployeeNumber(),item);
|
||||
});
|
||||
//CronUtil默认为分钟,目前未使用CronUtil.setMatchSecond(true)启动秒级任务,以下表示每30分钟执行一次
|
||||
//每30分钟执行一次,获取小池今日加工并且未更新切割计划派工单的数据去更新派工单
|
||||
CronUtil.schedule("*/30 * * * * *", (Task) () -> {
|
||||
List<CutPlan> cutPlans = new CutPlan().selectList(Wrappers.<CutPlan>lambdaQuery()
|
||||
.eq(CutPlan::getNestKakuyakuDate, DateUtil.today())
|
||||
.notExists("select b.czbh as nest_ext_c02,b.kw as nest_ext_c03 ,b.pl as nest_ext_c04 from pgd_qgjh b where b.czbh=tbl_nest_mast.nest_ext_c02 and b.tlth=tbl_nest_mast.nest_name_sub1 and b.kw=tbl_nest_mast.nest_ext_c03 and b.pl=tbl_nest_mast.nest_ext_c04 and (b.qgksrq is null or qgjsrq is null )")
|
||||
);
|
||||
List<PgdQgjh> list=new ArrayList<>();
|
||||
cutPlans.forEach(item->{
|
||||
PgdQgjh one = qgjhService.getOne(Wrappers.<PgdQgjh>lambdaQuery()
|
||||
.eq(PgdQgjh::getCzbh, item.getNestExtC02())
|
||||
.eq(PgdQgjh::getTlth, item.getNestNameSub1())
|
||||
.eq(PgdQgjh::getKw, item.getNestExtC03())
|
||||
.eq(PgdQgjh::getPl, item.getNestExtC04())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(one)){
|
||||
PgdQgjh _item=new PgdQgjh();
|
||||
_item.setId(one.getId());
|
||||
Optional.of(userMap.get(item.getNestExtC05()))
|
||||
.ifPresent(user-> _item.setFkry(userMap.get(item.getNestExtC05()).getName()));
|
||||
_item.setFkrq(DateUtil.format(DateUtil.date(), "yyyy/MM/dd HH:mm:ss"));
|
||||
_item.setQgksrq(item.getQgkssj());
|
||||
if (StrUtil.isNotEmpty(item.getQgjssj())){
|
||||
_item.setQgjsrq(item.getQgjssj());
|
||||
_item.setZt("09");
|
||||
}
|
||||
list.add(_item);
|
||||
}
|
||||
});
|
||||
qgjhService.updateBatchById(list,500);
|
||||
});
|
||||
CronUtil.start();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue