diff --git a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java index aa32149..fce9082 100644 --- a/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java +++ b/mes-module-heli/mes-module-heli-api/src/main/java/com/chanko/yunxi/mes/module/heli/enums/ErrorCodeConstants.java @@ -103,6 +103,7 @@ public interface ErrorCodeConstants { ErrorCode TASK_REPORT_PARAMS_ERRORBG = new ErrorCode(1_009_009, "开始报工和结束报工操作人员不同,无法报工"); ErrorCode TASK_REPORT_PARAMS_ERRORJD = new ErrorCode(1_009_010, "报工进度不能超过100%"); ErrorCode TASK_REPORT_PARAMS_ERRORSJBG = new ErrorCode(1_009_011, "报工进度不能小于上次报工进度"); + ErrorCode TASK_DISPATCH_TASK_NOT_EXISTS = new ErrorCode(1_009_004, "任务不存在或已完成"); ErrorCode TASK_DISPATCH_TASK_NO_PERMISSION_FOR_OPERATE = new ErrorCode(1_009_005, "任务不满足操作条件"); ErrorCode TASK_DISPATCH_TASK_REPORT_AMOUNT_EXCESS = new ErrorCode(1_009_006, "无法超额报工"); diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/bgmasterline/BgMasterLineServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/bgmasterline/BgMasterLineServiceImpl.java index 0daaa57..b6f4424 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/bgmasterline/BgMasterLineServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/bgmasterline/BgMasterLineServiceImpl.java @@ -38,6 +38,10 @@ public class BgMasterLineServiceImpl implements BgMasterLineService { //结束本次报工 @Override public Integer updateBgMasterLines(BgMasterLineSaveReqVO createReqVO){ + if(createReqVO.getAmount() == null || createReqVO.getWorkTime() == null){ + throw exception(TASK_REPORT_PARAMS_ERROR); + } + //先取出总的派工数量和预计工时 PgMasterLineDO pgMasterLineDO = pgMasterLineMapper.selectById(createReqVO.getZjMxId()); //然后再取出这条ID明细ID下的所有工时和报工数量相加 diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/zjbgmasterline/ZjBgMasterLineServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/zjbgmasterline/ZjBgMasterLineServiceImpl.java index ace3a43..1b28a26 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/zjbgmasterline/ZjBgMasterLineServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/zjbgmasterline/ZjBgMasterLineServiceImpl.java @@ -50,6 +50,9 @@ public class ZjBgMasterLineServiceImpl implements ZjBgMasterLineService { //结束本次报工 @Override public Integer updateBgMasterLines(ZjBgMasterLineSaveReqVO createReqVO){ + if(createReqVO.getAmount() == null || createReqVO.getWorkTime() == null){ + throw exception(TASK_REPORT_PARAMS_ERROR); + } //先取出总的派工数量和预计工时 ZjPgMasterLineDO zjPgMasterLineDO = zjPgMasterLineMapper.selectById(createReqVO.getZjMxId()); //然后再取出这条ID明细ID下的所有工时和报工数量相加 diff --git a/mes-ui/mini-app/src/pages/pgMaster/pgMaster-detail.vue b/mes-ui/mini-app/src/pages/pgMaster/pgMaster-detail.vue index bb43d77..0a8d71b 100644 --- a/mes-ui/mini-app/src/pages/pgMaster/pgMaster-detail.vue +++ b/mes-ui/mini-app/src/pages/pgMaster/pgMaster-detail.vue @@ -113,17 +113,26 @@ const handleComplate = async () => { } // 提交报工 const handleOk = async (active) => { - const params = { - zjMxId: detailInfo.value?.id, - amount: amount.value, - workTime: workTime.value, - bgUser: userId, - } - const data = await postOperateAPIEnd(params) - const url = `/pages/pgMaster/pgMaster-detail?id=${detailInfo.value.id}` - uni.redirectTo({ - url, - }) + if(amount.value>0&&workTime.value>0){ + const params = { + zjMxId: detailInfo.value?.id, + amount: amount.value, + workTime: workTime.value, + bgUser: userId, + } + const data = await postOperateAPIEnd(params) + const url = `/pages/pgMaster/pgMaster-detail?id=${detailInfo.value.id}` + uni.redirectTo({ + url, + }) + }else{ + uni.showToast({ + title: '报工数量或报工时间必须大于0,请检查!', + icon: 'none', // 显示纯文本时icon设为none + duration: 2000 + }); + } + } // 开始生产 const handleStart = async () => { @@ -248,14 +257,14 @@ const handleStop = async () => { - + *本次报工工时: diff --git a/mes-ui/mini-app/src/pages/zjPgMaster/zjPgMaster-detail.vue b/mes-ui/mini-app/src/pages/zjPgMaster/zjPgMaster-detail.vue index afa7a9d..3fad50d 100644 --- a/mes-ui/mini-app/src/pages/zjPgMaster/zjPgMaster-detail.vue +++ b/mes-ui/mini-app/src/pages/zjPgMaster/zjPgMaster-detail.vue @@ -113,17 +113,27 @@ const handleComplate = async () => { } // 提交报工 const handleOk = async (active) => { - const params = { - zjMxId: detailInfo.value?.id, - amount: amount.value, - workTime: workTime.value, - bgUser: userId, - } - const data = await postOperateAPIEnd(params) - const url = `/pages/zjPgMaster/zjPgMaster-detail?id=${detailInfo.value.id}` - uni.redirectTo({ - url, - }) + if(amount.value>0&&workTime.value>0){ + const params = { + zjMxId: detailInfo.value?.id, + amount: amount.value, + workTime: workTime.value, + bgUser: userId, + } + const data = await postOperateAPIEnd(params) + const url = `/pages/zjPgMaster/zjPgMaster-detail?id=${detailInfo.value.id}` + uni.redirectTo({ + url, + }) + }else{ + uni.showToast({ + title: '报工数量或报工时间必须大于0,请检查!', + icon: 'none', // 显示纯文本时icon设为none + duration: 2000 + }); + } + + } // 开始生产 const handleStart = async () => { @@ -259,14 +269,14 @@ const handleStop = async () => { - + *本次报工工时: