diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/InventoryAndWarehousingMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/InventoryAndWarehousingMapper.java index 6d4f16a3..df85421e 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/InventoryAndWarehousingMapper.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/InventoryAndWarehousingMapper.java @@ -73,6 +73,11 @@ public interface InventoryAndWarehousingMapper { */ int selectTaskNumByMonth(@Param("date") Date nowDate); + /** + * 根据二维码code查重 + * @param code + * @return + */ int selectByCode(String code); /** @@ -81,4 +86,11 @@ public interface InventoryAndWarehousingMapper { * @return */ List getDetails(PutInStorageBean bean); + + /** + * 根据macode查重 + * @param maCode + * @return + */ + int selectByMaCode(String maCode); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/InventoryAndWarehousingServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/InventoryAndWarehousingServiceImpl.java index 6b59a247..38b55cbb 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/InventoryAndWarehousingServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/InventoryAndWarehousingServiceImpl.java @@ -1,5 +1,6 @@ package com.bonus.sgzb.material.service.impl; +import com.bonus.sgzb.common.core.exception.ServiceException; import com.bonus.sgzb.common.core.utils.DateUtils; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.security.utils.SecurityUtils; @@ -86,6 +87,15 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi } } String code = genderBackCode(); + List machIneDtoList = dto.getMachIneDtoList(); + if (CollectionUtils.isNotEmpty(machIneDtoList)) { + for (MachIneDto machIneDto : machIneDtoList) { + int count = selectByMaCode(machIneDto.getMaCode()); + if (count != 0) { + throw new ServiceException("以下设备编码与库中数据存在重复,请修改后重新提交:" + machIneDto.getMaCode()); + } + } + } int res; try { //1. 判断是数量还是编号入库,保存到不同表 @@ -119,6 +129,15 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi return AjaxResult.success(res); } + /** + * 根据设备编码code查重 + * @param maCode + * @return + */ + private int selectByMaCode(String maCode) { + return inventoryAndWarehousingMapper.selectByMaCode(maCode); + } + /** * 根据入库单号查看详情 * @param bean @@ -153,6 +172,9 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi machIneDto.setCreator(dto.getCreator()); machIneDto.setNum(dto.getNum()); machIneDto.setIsCode(dto.getIsCode()); + machIneDto.setUnitId(dto.getUnitId()); + machIneDto.setProId(dto.getProId()); + machIneDto.setRemarks(dto.getRemarks()); res += insertInfo(machIneDto); machIneDto.setInfoId(machIneDto.getId()); } @@ -164,7 +186,6 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi machIneDto.setIsCode(dto.getIsCode()); machIneDto.setTypeId(dto.getTypeId()); machIneDto.setCreator(dto.getCreator()); - machIneDto.setRemarks(dto.getRemarks()); machIneDto.setPutInType(dto.getPutInType()); machIneDto.setNum(dto.getNum()); machIneDto.setCheckMan(dto.getCheckMan()); @@ -234,6 +255,7 @@ public class InventoryAndWarehousingServiceImpl implements InventoryAndWarehousi machIneDto.setCreator(dto.getCreator()); machIneDto.setIsCode(dto.getIsCode()); machIneDto.setTotalNum(total); + machIneDto.setRemarks(dto.getRemarks()); res += insertInfo(machIneDto); machIneDto.setInfoId(machIneDto.getId()); } diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/InventoryAndWarehousingMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/InventoryAndWarehousingMapper.xml index 2939d7fc..10a046bb 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/InventoryAndWarehousingMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/InventoryAndWarehousingMapper.xml @@ -25,7 +25,7 @@ MACHINE, - + REMARKS, @@ -54,8 +54,8 @@ #{maId}, - - #{remarks}, + + #{remark}, #{maCode}, @@ -81,17 +81,8 @@ UNIT_ID, PROJECT_ID, CODE, - CREATE_DATE, - - - REMARKS - - - - REMARKS - - - + REMARKS, + CREATE_DATE VALUES @@ -110,17 +101,8 @@ #{unitId}, #{proId}, #{code}, - sysdate(), - - - #{remarks} - - - - #{remark} - - - + #{remarks}, + sysdate() @@ -262,7 +244,8 @@ mt2.type_name as typeName, mt.type_name as typeModelName, su.user_name as modelName, - pisi.CREATE_DATE as createDate + pisi.CREATE_DATE as createDate, + pisd.REMARKS as remark FROM ma_type_put_in_storage_info pisi LEFT JOIN ma_type_put_in_storage_details pisd on pisi.id = pisd.INFO LEFT JOIN bm_project_lot lot on lot.lot_id = pisi.PROJECT_ID @@ -286,4 +269,11 @@ order by pisi.CREATE_DATE desc + \ No newline at end of file diff --git a/sgzb-ui/src/views/claimAndreturn/picking/protocol/index.vue b/sgzb-ui/src/views/claimAndreturn/picking/protocol/index.vue index 787aafc8..2fb60b5e 100644 --- a/sgzb-ui/src/views/claimAndreturn/picking/protocol/index.vue +++ b/sgzb-ui/src/views/claimAndreturn/picking/protocol/index.vue @@ -35,6 +35,7 @@ v-model="queryParams.unitId" placeholder="请选择往来单位" clearable + filterable > @@ -349,6 +350,17 @@ type="date" placeholder="请输入检验时间" style="width: 13vw" + :disabled="!codeForm.thisCheckTime" + :picker-options="{ + disabledDate(time) { + if (codeForm.thisCheckTime) { + let today = new Date() + today.setHours(0, 0, 0, 0) + return time.getTime() < today.getTime() || time.getTime() < new Date(codeForm.thisCheckTime).getTime() + } + return false + } + }" /> @@ -523,22 +535,25 @@ :stripe="true" > - + /> --> + @@ -589,6 +604,7 @@ type="date" placeholder="请输入检验时间" style="width: 170px" + @change="changeCheckTimeRow(row)" > @@ -604,6 +620,17 @@ type="date" placeholder="请输入下次检验时间" style="width: 170px" + :disabled="!row.thisCheckTime" + :picker-options="{ + disabledDate(time) { + if (row.thisCheckTime) { + let today = new Date() + today.setHours(0, 0, 0, 0) + return time.getTime() < today.getTime() || time.getTime() < new Date(row.thisCheckTime).getTime() + } + return false + } + }" > @@ -950,6 +977,7 @@ export default { dialogConfig, getInventoryWarehousingApi, sendParams: {}, + requiredMaCode: false, } }, created() { @@ -1224,6 +1252,14 @@ export default { this.getList() }) } else { + // this.codeTableList 中只要有一个maCode为空, 则不允许提交 + this.requiredMaCode = this.codeTableList.some( + (item) => !item.maCode, + ) + if (this.requiredMaCode) { + this.$message.error('设备编码不能为空') + return + } // 统一处理时间格式为 yyyy-MM-dd this.codeTableList.forEach((item) => { if (item.thisCheckTime) { @@ -1492,6 +1528,28 @@ export default { closeDialogOuter() { this.dialogConfig.outerVisible = false }, + handleMaCodeBlur(row) { + if (!row.maCode) { + this.$message.warning('设备编码不能为空') + } + }, + // 校验检验日期 + changeCheckTime() { + if (this.codeForm.nextCheckTime && this.codeForm.thisCheckTime > this.codeForm.nextCheckTime) { + this.codeForm.nextCheckTime = '' + this.$message.warning('下次检验日期不能早于检验日期!') + } else if (!this.codeForm.thisCheckTime) { + this.codeForm.nextCheckTime = '' + } + }, + changeCheckTimeRow(row) { + if (row.nextCheckTime && row.thisCheckTime > row.nextCheckTime) { + row.nextCheckTime = '' + this.$message.warning('下次检验日期不能早于检验日期!') + } else if (!row.thisCheckTime) { + row.nextCheckTime = '' + } + }, }, } @@ -1503,4 +1561,7 @@ export default { ::v-deep.el-form-item__label { padding: 0 20px !important; } +::v-deep .el-input-number.is-without-controls .el-input__inner { + text-align: start; +} \ No newline at end of file