扫描二维码
This commit is contained in:
parent
547af18752
commit
bf77815eb7
|
|
@ -456,33 +456,97 @@ public class MachineServiceImpl implements IMachineService
|
||||||
if (baseInfo == null) {
|
if (baseInfo == null) {
|
||||||
return AjaxResult.error("扫描二维码信息为空");
|
return AjaxResult.error("扫描二维码信息为空");
|
||||||
}
|
}
|
||||||
|
//获取服务工程次数、更换配件次数、报废时间、领退料工程时间等信息
|
||||||
|
fillMachineInfo(baseInfo, machine);
|
||||||
|
return success(baseInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getHisByCode(Machine machine) {
|
||||||
|
List<Machine> maList = machineMapper.getListByCode(machine);
|
||||||
|
if (CollectionUtils.isEmpty(maList)) {
|
||||||
|
if (!StringHelper.isNullOrEmptyString(machine.getQrCode())){
|
||||||
|
return AjaxResult.error("扫描二维码信息为空");
|
||||||
|
} else {
|
||||||
|
return error("暂无该设备信息");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (maList.size() == 1) {
|
||||||
|
Machine baseInfo = maList.get(0);
|
||||||
|
machine.setQrCode(baseInfo.getQrCode());
|
||||||
|
fillMachineInfo(baseInfo, machine);
|
||||||
|
return success(Collections.singletonList(baseInfo));
|
||||||
|
}
|
||||||
|
return success(maList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getHisByCodeNew(Machine machine) {
|
||||||
|
try {
|
||||||
|
List<Machine> maList=new ArrayList<>();
|
||||||
|
if (machine.getDevType()==0){
|
||||||
|
maList = machineMapper.getHisByCodeNew(machine);
|
||||||
|
} else if (machine.getDevType()==1){
|
||||||
|
maList = machineMapper.getHisByCodeNewByWsMaInfo(machine);
|
||||||
|
} else if (machine.getDevType()==2){
|
||||||
|
maList = machineMapper.getListByCode(machine);
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isEmpty(maList)) {
|
||||||
|
return error("暂无该设备信息");
|
||||||
|
}
|
||||||
|
if (maList.size() == 1) {
|
||||||
|
Machine baseInfo = maList.get(0);
|
||||||
|
if (baseInfo.getJiJuType() == 2) {
|
||||||
|
fillMachineInfo(baseInfo, machine);
|
||||||
|
}
|
||||||
|
return success(Collections.singletonList(baseInfo));
|
||||||
|
}
|
||||||
|
return success(maList);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return error("暂无该设备信息");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公共方法
|
||||||
|
* 获取服务工程次数、更换配件次数、报废时间、领退料工程时间等信息
|
||||||
|
*/
|
||||||
|
private void fillMachineInfo(Machine baseInfo, Machine machine) {
|
||||||
machine.setMaId(baseInfo.getMaId());
|
machine.setMaId(baseInfo.getMaId());
|
||||||
//2根据二维码查询初次入库时间
|
machine.setMaCode(baseInfo.getMaCode());
|
||||||
|
// 初次入库时间
|
||||||
Machine inTime = machineMapper.getInTimeByQrcode(machine);
|
Machine inTime = machineMapper.getInTimeByQrcode(machine);
|
||||||
//服务工程次数,检验次数
|
if (inTime != null) {
|
||||||
|
Integer taskId = inTime.getTaskId();
|
||||||
|
if (taskId != null) {
|
||||||
|
baseInfo.setInTime(inTime.getInTime() + "(新购)");
|
||||||
|
} else {
|
||||||
|
baseInfo.setInTime(inTime.getInTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 服务工程次数
|
||||||
Machine serviceNum = machineMapper.getServiceNumByQrcode(machine);
|
Machine serviceNum = machineMapper.getServiceNumByQrcode(machine);
|
||||||
|
baseInfo.setServiceNum(serviceNum != null ? serviceNum.getServiceNum() : 0);
|
||||||
// 更换配件次数
|
// 更换配件次数
|
||||||
Machine checkNum = machineMapper.getCheckNumByQrcode(machine);
|
Machine checkNum = machineMapper.getCheckNumByQrcode(machine);
|
||||||
|
baseInfo.setCheckNum(checkNum != null ? checkNum.getCheckNum() : 0);
|
||||||
// 报废时间
|
// 报废时间
|
||||||
Machine scrapTime = machineMapper.getScrapTimeByQrcode(machine);
|
Machine scrapTime = machineMapper.getScrapTimeByQrcode(machine);
|
||||||
// //3根据机具id查询领退工程
|
baseInfo.setScrapTime(scrapTime != null ? scrapTime.getScrapTime() : "暂无");
|
||||||
// Machine leaseInfo = machineMapper.getLeaseInfoByQrcode(machine);
|
// 查询领料任务
|
||||||
|
|
||||||
// 根据maid查询领料任务
|
|
||||||
LeaseApplyInfo leaseInfo = machineMapper.getLeaseParentId(machine);
|
LeaseApplyInfo leaseInfo = machineMapper.getLeaseParentId(machine);
|
||||||
if (leaseInfo == null || leaseInfo.getParentId() == null) {
|
if (leaseInfo == null || leaseInfo.getParentId() == null) {
|
||||||
baseInfo.setLeaseTime(null);
|
baseInfo.setLeaseTime(null);
|
||||||
baseInfo.setLeaseUnit(null);
|
baseInfo.setLeaseUnit(null);
|
||||||
baseInfo.setLeaseProject(null);
|
baseInfo.setLeaseProject(null);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
LeaseApplyInfo leaseDetail = machineMapper.getLeaseUnitAndProject(leaseInfo);
|
LeaseApplyInfo leaseDetail = machineMapper.getLeaseUnitAndProject(leaseInfo);
|
||||||
baseInfo.setLeaseTime(String.valueOf(leaseInfo.getLeaseTime()));
|
baseInfo.setLeaseTime(String.valueOf(leaseInfo.getLeaseTime()));
|
||||||
baseInfo.setLeaseUnit(leaseDetail.getUnitName());
|
baseInfo.setLeaseUnit(leaseDetail.getUnitName());
|
||||||
baseInfo.setLeaseProject(leaseDetail.getProjectName());
|
baseInfo.setLeaseProject(leaseDetail.getProjectName());
|
||||||
}
|
}
|
||||||
|
// 查询退料任务
|
||||||
// 根据maid查询退料任务
|
|
||||||
LeaseApplyInfo leaseInfoBack = machineMapper.getBackParentId(machine);
|
LeaseApplyInfo leaseInfoBack = machineMapper.getBackParentId(machine);
|
||||||
if (leaseInfoBack == null || leaseInfoBack.getParentId() == null) {
|
if (leaseInfoBack == null || leaseInfoBack.getParentId() == null) {
|
||||||
baseInfo.setBackTime(null);
|
baseInfo.setBackTime(null);
|
||||||
|
|
@ -494,186 +558,8 @@ public class MachineServiceImpl implements IMachineService
|
||||||
baseInfo.setBackUnit(leaseDetailBack.getUnitName());
|
baseInfo.setBackUnit(leaseDetailBack.getUnitName());
|
||||||
baseInfo.setBackProject(leaseDetailBack.getProjectName());
|
baseInfo.setBackProject(leaseDetailBack.getProjectName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (inTime != null){
|
|
||||||
Integer taskId = inTime.getTaskId();
|
|
||||||
if(taskId != null){
|
|
||||||
baseInfo.setInTime(inTime.getInTime()+"(新购)");
|
|
||||||
}else{
|
|
||||||
baseInfo.setInTime(inTime.getInTime());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(serviceNum != null){
|
|
||||||
baseInfo.setServiceNum(serviceNum.getServiceNum());
|
|
||||||
}else{
|
|
||||||
baseInfo.setServiceNum(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(checkNum != null){
|
|
||||||
baseInfo.setCheckNum(checkNum.getCheckNum());
|
|
||||||
}else{
|
|
||||||
baseInfo.setCheckNum(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scrapTime != null){
|
|
||||||
baseInfo.setScrapTime(scrapTime.getScrapTime());
|
|
||||||
}else{
|
|
||||||
baseInfo.setScrapTime("暂无");
|
|
||||||
}
|
|
||||||
|
|
||||||
return success(baseInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AjaxResult getHisByCode(Machine machine) {
|
|
||||||
List<Machine> result = new ArrayList<>();
|
|
||||||
List<Machine> maList = machineMapper.getListByCode(machine);
|
|
||||||
if (CollectionUtils.isNotEmpty(maList)){
|
|
||||||
if(maList.size() == 1){
|
|
||||||
Machine baseInfo = maList.get(0);
|
|
||||||
machine.setMaId(baseInfo.getMaId());
|
|
||||||
machine.setMaCode(baseInfo.getMaCode());
|
|
||||||
//2根据二维码查询初次入库时间
|
|
||||||
Machine inTime = machineMapper.getInTimeByQrcode(machine);
|
|
||||||
//服务工程次数,检验次数
|
|
||||||
Machine serviceNum = machineMapper.getServiceNumByQrcode(machine);
|
|
||||||
//更换配件次数
|
|
||||||
Machine checkNum = machineMapper.getCheckNumByQrcode(machine);
|
|
||||||
//报废时间
|
|
||||||
Machine scrapTime = machineMapper.getScrapTimeByQrcode(machine);
|
|
||||||
//3根据机具id查询领退工程
|
|
||||||
Machine leaseInfo = machineMapper.getLeaseInfoByQrcode(machine);
|
|
||||||
if (inTime != null){
|
|
||||||
Integer taskId = inTime.getTaskId();
|
|
||||||
if(taskId != null){
|
|
||||||
baseInfo.setInTime(inTime.getInTime()+"(新购)");
|
|
||||||
}else{
|
|
||||||
baseInfo.setInTime(inTime.getInTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(serviceNum != null){
|
|
||||||
baseInfo.setServiceNum(serviceNum.getServiceNum());
|
|
||||||
}else{
|
|
||||||
baseInfo.setServiceNum(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(checkNum != null){
|
|
||||||
baseInfo.setCheckNum(checkNum.getCheckNum());
|
|
||||||
}else{
|
|
||||||
baseInfo.setCheckNum(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scrapTime != null){
|
|
||||||
baseInfo.setScrapTime(scrapTime.getScrapTime());
|
|
||||||
}else{
|
|
||||||
baseInfo.setScrapTime("暂无");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(leaseInfo != null){
|
|
||||||
baseInfo.setLeaseTime(leaseInfo.getLeaseTime());
|
|
||||||
baseInfo.setLeaseUnit(leaseInfo.getLeaseUnit());
|
|
||||||
baseInfo.setLeaseProject(leaseInfo.getLeaseProject());
|
|
||||||
baseInfo.setBackTime(leaseInfo.getBackTime());
|
|
||||||
baseInfo.setBackUnit(leaseInfo.getBackUnit());
|
|
||||||
baseInfo.setBackProject(leaseInfo.getBackProject());
|
|
||||||
}
|
|
||||||
result.add(baseInfo);
|
|
||||||
return success(result);
|
|
||||||
|
|
||||||
}else{
|
|
||||||
return success(maList);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
return error("暂无该设备信息");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AjaxResult getHisByCodeNew(Machine machine) {
|
|
||||||
try {
|
|
||||||
List<Machine> result = new ArrayList<>();
|
|
||||||
List<Machine> maList=new ArrayList<>();
|
|
||||||
if (machine.getDevType()==0){
|
|
||||||
maList = machineMapper.getHisByCodeNew(machine);
|
|
||||||
} else if (machine.getDevType()==1){
|
|
||||||
maList = machineMapper.getHisByCodeNewByWsMaInfo(machine);
|
|
||||||
} else if (machine.getDevType()==2){
|
|
||||||
maList = machineMapper.getListByCode(machine);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(maList)){
|
|
||||||
if(maList.size() == 1){
|
|
||||||
Machine baseInfo = maList.get(0);
|
|
||||||
if (baseInfo.getJiJuType()==2){
|
|
||||||
machine.setMaId(baseInfo.getMaId());
|
|
||||||
machine.setMaCode(baseInfo.getMaCode());
|
|
||||||
//2根据二维码查询初次入库时间
|
|
||||||
Machine inTime = machineMapper.getInTimeByQrcode(machine);
|
|
||||||
//服务工程次数,检验次数
|
|
||||||
Machine serviceNum = machineMapper.getServiceNumByQrcode(machine);
|
|
||||||
//更换配件次数
|
|
||||||
Machine checkNum = machineMapper.getCheckNumByQrcode(machine);
|
|
||||||
//报废时间
|
|
||||||
Machine scrapTime = machineMapper.getScrapTimeByQrcode(machine);
|
|
||||||
//3根据机具id查询领退工程
|
|
||||||
Machine leaseInfo = machineMapper.getLeaseInfoByQrcode(machine);
|
|
||||||
if (inTime != null){
|
|
||||||
Integer taskId = inTime.getTaskId();
|
|
||||||
if(taskId != null){
|
|
||||||
baseInfo.setInTime(inTime.getInTime()+"(新购)");
|
|
||||||
}else{
|
|
||||||
baseInfo.setInTime(inTime.getInTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if(serviceNum != null){
|
|
||||||
baseInfo.setServiceNum(serviceNum.getServiceNum());
|
|
||||||
}else{
|
|
||||||
baseInfo.setServiceNum(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(checkNum != null){
|
|
||||||
baseInfo.setCheckNum(checkNum.getCheckNum());
|
|
||||||
}else{
|
|
||||||
baseInfo.setCheckNum(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scrapTime != null){
|
|
||||||
baseInfo.setScrapTime(scrapTime.getScrapTime());
|
|
||||||
}else{
|
|
||||||
baseInfo.setScrapTime("暂无");
|
|
||||||
}
|
|
||||||
if(leaseInfo != null){
|
|
||||||
baseInfo.setLeaseTime(leaseInfo.getLeaseTime());
|
|
||||||
baseInfo.setLeaseUnit(leaseInfo.getLeaseUnit());
|
|
||||||
baseInfo.setLeaseProject(leaseInfo.getLeaseProject());
|
|
||||||
baseInfo.setBackTime(leaseInfo.getBackTime());
|
|
||||||
baseInfo.setBackUnit(leaseInfo.getBackUnit());
|
|
||||||
baseInfo.setBackProject(leaseInfo.getBackProject());
|
|
||||||
}
|
|
||||||
result.add(baseInfo);
|
|
||||||
return success(result);
|
|
||||||
} else {
|
|
||||||
result.add(baseInfo);
|
|
||||||
return success(result);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return success(maList);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
return error("暂无该设备信息");
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return error("暂无该设备信息");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult editMachineStatus(Machine machine) {
|
public AjaxResult editMachineStatus(Machine machine) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue