|
|
@ -82,8 +82,16 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<WorkVo> queryWorks() { |
|
|
|
return pdaMapper.getWorks(); |
|
|
|
public List<WorkVo> queryWorks(JSONObject whereJson) { |
|
|
|
if (StrUtil.isEmpty(whereJson.getString("mfg_order_name"))){ |
|
|
|
throw new BadRequestException("工单号为空!"); |
|
|
|
} |
|
|
|
return pdaMapper.getWorks(whereJson.getString("mfg_order_name")); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<WorkVo> getExcWorks() { |
|
|
|
return pdaMapper.getExcWorks(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -100,12 +108,19 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
@Override |
|
|
|
public PdaResponseVo reSendWork(JSONObject whereJson) { |
|
|
|
String work_code = whereJson.getString("work_code"); |
|
|
|
String require_num = whereJson.getString("require_num"); |
|
|
|
if (StrUtil.isEmpty(require_num)){ |
|
|
|
return PdaResponseVo.pdaResultOk("补发数量为空"); |
|
|
|
} |
|
|
|
if (StrUtil.isEmpty(work_code)){ |
|
|
|
return PdaResponseVo.pdaResultOk("补发作业号为空"); |
|
|
|
} |
|
|
|
Work work = workService.findByCode(work_code); |
|
|
|
if (work == null) { |
|
|
|
return PdaResponseVo.pdaResultOk("配料作业不存在"); |
|
|
|
} |
|
|
|
work.setRemain_num(work.getRemain_num() + whereJson.getIntValue("count")); |
|
|
|
work.setRequire_num(work.getRequire_num() + whereJson.getIntValue("count")); |
|
|
|
work.setRemain_num(work.getRemain_num() + whereJson.getIntValue("require_num")); |
|
|
|
work.setRequire_num(work.getRequire_num() + whereJson.getIntValue("require_num")); |
|
|
|
workService.updateById(work); |
|
|
|
return PdaResponseVo.pdaResultOk("补发成功"); |
|
|
|
} |
|
|
@ -147,7 +162,6 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
JSONArray errArr = new JSONArray(); |
|
|
|
String start_device_code = dto.getStart_device_code(); |
|
|
|
String next_device_code = dto.getNext_device_code(); |
|
|
|
String task_type = dto.getTask_type(); |
|
|
|
|
|
|
|
if (StrUtil.isEmpty(start_device_code)) { |
|
|
|
throw new BadRequestException("起点不能为空"); |
|
|
@ -155,22 +169,18 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
if (StrUtil.isEmpty(next_device_code)) { |
|
|
|
throw new BadRequestException("终点不能为空"); |
|
|
|
} |
|
|
|
if (StrUtil.isEmpty(task_type)) { |
|
|
|
throw new BadRequestException("任务类型不能为空"); |
|
|
|
} |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("start_device_code", start_device_code); |
|
|
|
jo.put("next_device_code", next_device_code); |
|
|
|
jo.put("start_point_code", start_device_code); |
|
|
|
jo.put("next_point_code", next_device_code); |
|
|
|
jo.put("task_type", task_type); |
|
|
|
jo.put("task_type", "1"); |
|
|
|
jo.put("priority", "1"); |
|
|
|
|
|
|
|
TaskDto task_dto = jo.toJavaObject(TaskDto.class); |
|
|
|
try { |
|
|
|
taskserver.create(task_dto); |
|
|
|
} catch (Exception e) { |
|
|
|
// e.printStackTrace();
|
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
json.put("message", e.getMessage()); |
|
|
|
errArr.add(json); |
|
|
@ -187,4 +197,15 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
} |
|
|
|
return resultJson; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public PdaResponseVo pause(JSONObject whereJson) { |
|
|
|
String work_code = whereJson.getString("work_code"); |
|
|
|
Work work = workService.findByCode(work_code); |
|
|
|
if (work == null) { |
|
|
|
return PdaResponseVo.pdaResultOk("配料作业不存在"); |
|
|
|
} |
|
|
|
workService.pause(work.getWork_id()); |
|
|
|
return PdaResponseVo.pdaResultOk("暂停成功"); |
|
|
|
} |
|
|
|
} |
|
|
|