diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/LeaseOutDetailsController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/LeaseOutDetailsController.java index b0593c71..cdc48d37 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/LeaseOutDetailsController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/LeaseOutDetailsController.java @@ -69,7 +69,7 @@ public class LeaseOutDetailsController extends BaseController { if (i == 0) { return AjaxResult.success("绑定成功"); } else { - return AjaxResult.error("编号已存在,绑定失败"); + return AjaxResult.error("二维码已绑定或编号已存在,绑定失败"); } } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BackReceiveMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BackReceiveMapper.java index e372ba03..724bb7da 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BackReceiveMapper.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BackReceiveMapper.java @@ -45,7 +45,7 @@ public interface BackReceiveMapper { * @param taskType * @return String */ - String selectTaskNumByMonthWx(@Param("date") Date date, @Param("taskType") Integer taskType); + Integer selectTaskNumByMonthWx(@Param("date") Date date, @Param("taskType") Integer taskType); /** * 添加维修任务 diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java index 713d3b58..26c50d59 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BackReceiveServiceImpl.java @@ -144,77 +144,77 @@ public class BackReceiveServiceImpl implements BackReceiveService { @Transactional(rollbackFor = Exception.class) public int endBack(BackApplyInfo record) { int res; - try { - int taskId = record.getTaskId(); - //先判断是否已经完成退料了 - int taskStatus = selectTaskStatus(taskId); - if (taskStatus == 0) { - throw new RuntimeException("该退料单已完成退料"); - } - //修改任务状态 - res = updateTaskStatus(taskId, 40); +// try { + int taskId = record.getTaskId(); + //先判断是否已经完成退料了 + int taskStatus = selectTaskStatus(taskId); + if (taskStatus == 0) { + throw new RuntimeException("该退料单已完成退料"); + } + //修改任务状态 + res = updateTaskStatus(taskId, 40); + if (res == 0) { + throw new RuntimeException("tm_task修改状态"); + } + //更加退料接收的数据创建下一步流程 + //合格的插入入库记录input_apply_details,修改库存ma_type,修改机具状态 + List hgList = backReceiveMapper.getHgList(record); + if (hgList != null && hgList.size() > 0) { + res = insertIad(hgList); if (res == 0) { - throw new RuntimeException("tm_task修改状态"); + throw new RuntimeException("input_apply_details"); } - //更加退料接收的数据创建下一步流程 - //合格的插入入库记录input_apply_details,修改库存ma_type,修改机具状态 - List hgList = backReceiveMapper.getHgList(record); - if (hgList != null && hgList.size() > 0) { - res = insertIad(hgList); - if (res == 0) { - throw new RuntimeException("input_apply_details"); - } - // 如果是成套的机具,成套机具的库存也要添加 - List ctList = backReceiveMapper.getCtList(record); - if (ctList.size() > 0) { - for (BackApplyInfo backApplyInfo : ctList) { - if ("2".equals(backApplyInfo.getManageType())) { - backReceiveMapper.updateMt(backApplyInfo); - } + // 如果是成套的机具,成套机具的库存也要添加 + List ctList = backReceiveMapper.getCtList(record); + if (ctList.size() > 0) { + for (BackApplyInfo backApplyInfo : ctList) { + if ("2".equals(backApplyInfo.getManageType())) { + backReceiveMapper.updateMt(backApplyInfo); } } - res = updateMt(hgList); - if (res == 0) { - throw new RuntimeException("ma_type"); - } - res = updateMaStatus(hgList); - if (res == 0) { - throw new RuntimeException("ma_machines"); - } - } - //维修的创建维修任务,插入任务协议表 - List wxList = backReceiveMapper.getWxList(record); - if (wxList != null && wxList.size() > 0) { - //插入任务表tm_task - int newTaskId = insertTt(wxList, 41, record.getCreateBy()); - //插入协议任务表tm_task_agreement - res = insertTta(newTaskId, wxList); - //插入维修记录表repair_apply_details - res = insertRad(newTaskId, wxList); + res = updateMt(hgList); + if (res == 0) { + throw new RuntimeException("ma_type"); } - //待报废的创建报废任务,插入任务协议表 - - List bfList = backReceiveMapper.getBfList(record); - if (bfList != null && bfList.size() > 0) { - //插入任务表tm_task - int newTaskId = insertTt(bfList, 57, record.getCreateBy()); - //插入协议任务表tm_task_agreement - res = insertTta(newTaskId, bfList); - //插入维修记录表scrap_apply_details - res = insertSad(newTaskId, bfList); + res = updateMaStatus(hgList); + if (res == 0) { + throw new RuntimeException("ma_machines"); } - List allList = backReceiveMapper.getAllList(record); - if (allList != null && allList.size() > 0) { - res = updateSlt(record, allList); - if (res == 0) { - throw new RuntimeException("该机具未被领料使用"); - } - } - } catch (Exception e) { - throw new RuntimeException(e.getMessage()); } + //维修的创建维修任务,插入任务协议表 + List wxList = backReceiveMapper.getWxList(record); + if (wxList != null && wxList.size() > 0) { + //插入任务表tm_task + int newTaskId = insertTt(wxList, 41, record.getCreateBy()); + //插入协议任务表tm_task_agreement + res = insertTta(newTaskId, wxList); + //插入维修记录表repair_apply_details + res = insertRad(newTaskId, wxList); + } + //待报废的创建报废任务,插入任务协议表 + + List bfList = backReceiveMapper.getBfList(record); + if (bfList != null && bfList.size() > 0) { + //插入任务表tm_task + int newTaskId = insertTt(bfList, 57, record.getCreateBy()); + //插入协议任务表tm_task_agreement + res = insertTta(newTaskId, bfList); + //插入维修记录表scrap_apply_details + res = insertSad(newTaskId, bfList); + } + + List allList = backReceiveMapper.getAllList(record); + if (allList != null && allList.size() > 0) { + res = updateSlt(record, allList); + if (res == 0) { + throw new RuntimeException("该机具未被领料使用"); + } + } +// } catch (Exception e) { +// throw new RuntimeException(e.getMessage()); +// } return res; } @@ -498,16 +498,17 @@ public class BackReceiveServiceImpl implements BackReceiveService { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); Date nowDate = DateUtils.getNowDate(); String format = dateFormat.format(nowDate); - String taskNum = backReceiveMapper.selectTaskNumByMonthWx(nowDate, taskType); - if (StringHelper.isNotEmpty(taskNum)) { + Integer taskNum = backReceiveMapper.selectTaskNumByMonthWx(nowDate, taskType); + String taskNumStr = ""; + if (taskNum != null) { // 将字符串转换为整数 - int num = Integer.parseInt(taskNum); +// int num = Integer.parseInt(taskNum); // 执行加一操作 - num++; + taskNum++; // 将结果转换回字符串格式,并确保结果是四位数,不足四位则在前面补0 - taskNum = String.format("%04d", num); + taskNumStr = String.format("%04d", taskNum); } else { - taskNum = "0001"; + taskNumStr = "0001"; } String code = ""; if (GlobalConstants.INT_41 == taskType) { @@ -516,7 +517,7 @@ public class BackReceiveServiceImpl implements BackReceiveService { if (GlobalConstants.INT_57 == taskType) { code = "BF"; } - code = code + format + "-" + taskNum; + code = code + format + "-" + taskNumStr; return code; } } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java index 54b34efe..9ee94be6 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java @@ -189,7 +189,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { return AjaxResult.error("领料出库失败,机具库存不足"); } } else { - return AjaxResult.error("您已提交,请勿重复点击"); + return AjaxResult.error("已领数量大于预领数量或该机具未在库"); } } catch (Exception e) { e.printStackTrace(); diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackApplyAppMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackApplyAppMapper.xml index cc6eadb2..7432ec36 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackApplyAppMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackApplyAppMapper.xml @@ -415,56 +415,27 @@ \ No newline at end of file