diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackReceiveController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackReceiveController.java index 01851002..30394be8 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackReceiveController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/BackReceiveController.java @@ -278,7 +278,7 @@ public class BackReceiveController extends BaseController { @PostMapping("backReceiveRecordWeb") public AjaxResult backReceiveRecordWeb(@RequestBody BackApplyInfo record) { try { - List list = backReceiveService.backReceiveRecord(record); + List list = backReceiveService.backReceiveRecordWeb(record); Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); return AjaxResult.success(ListPagingUtil.paging(pageIndex,pageSize, list)); diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/BackApplyInfo.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/BackApplyInfo.java index 4ee721dc..3c108b28 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/BackApplyInfo.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/BackApplyInfo.java @@ -21,6 +21,7 @@ public class BackApplyInfo { */ private String userName; private String badId; + private String[] typeIds; @Excel(name = "退料状态",sort = 9) private String taskName; 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 a8d6b0e0..1254e837 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 @@ -198,4 +198,6 @@ public interface BackReceiveMapper { int selectNumByTypeId(@Param("parentId")Integer parentId,@Param("typeId") String typeId); int selectTaskStatus(int taskId); + + BackApplyInfo backReceiveRecordWeb(BackApplyInfo record); } \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/LeaseOutDetailsMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/LeaseOutDetailsMapper.java index 47b392e5..89e7e4dc 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/LeaseOutDetailsMapper.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/LeaseOutDetailsMapper.java @@ -99,4 +99,6 @@ public interface LeaseOutDetailsMapper { MachinePart getMachineParts(TmTask typeId); int updateMaTypeStockNumCt(TmTask record); + + int getmaChineByCt(LeaseOutDetails record); } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BackReceiveService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BackReceiveService.java index 10e057b7..634fc3c9 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BackReceiveService.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BackReceiveService.java @@ -95,4 +95,6 @@ public interface BackReceiveService { List getRecord(TmTask task); int revoke(BackApplyInfo record); + + List backReceiveRecordWeb(BackApplyInfo record); } 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 a04958fd..94058fd7 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 @@ -83,10 +83,6 @@ public class BackReceiveServiceImpl implements BackReceiveService { if (res == 0) { throw new RuntimeException("插入back_check_details异常"); } - /* int insSltInfoNum = insSltInfo(lTask.getAgreementId().toString(), leaseOutDetail); - if (insSltInfoNum < 1) { - return res; - }*/ } catch (Exception e) { throw new RuntimeException(e.getMessage()); } @@ -115,7 +111,7 @@ public class BackReceiveServiceImpl implements BackReceiveService { break; } //根据maId和taskId查询是否已接收 - re = backReceiveMapper.selectCodeByMaIdAndTaskId(arr[i].getMaId(), record.getTaskId()); + re = backReceiveMapper.selectCodeByMaIdAndTaskId(arr[i].getMaId(), record.getTaskId()); if (re > 0) { res = -1; break; @@ -325,6 +321,21 @@ public class BackReceiveServiceImpl implements BackReceiveService { return res; } + @Override + public List backReceiveRecordWeb(BackApplyInfo record) { + String typeId = record.getTypeId(); + String[] split = typeId.split(","); + List backApplyInfoList = new ArrayList<>(); + for (String s : split) { + record.setTypeId(s); + BackApplyInfo backApplyInfo = backReceiveMapper.backReceiveRecordWeb(record); + if (backApplyInfo != null) { + backApplyInfoList.add(backApplyInfo); + } + } + return backApplyInfoList; + } + private int insertRad(int taskId, List wxList) { int result = 0; if (wxList != null) { @@ -452,8 +463,17 @@ public class BackReceiveServiceImpl implements BackReceiveService { //机具状态变为在用 backReceiveMapper.updateMaStatus(s, "16"); } + res = backReceiveMapper.deleteCheckDetails(record); + } else if ("2".equals(manageType)) { + String[] split = record.getTypeIds(); + for (String s : split) { + record.setTypeId(s); + res = backReceiveMapper.deleteCheckDetails(record); + } + } else { + res = backReceiveMapper.deleteCheckDetails(record); } - res = backReceiveMapper.deleteCheckDetails(record); + } return res; 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 66052870..e8182fdb 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 @@ -158,7 +158,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { if ((record.getManageType() == 1 || record.getManageType() == 2) && record.getInputNum() != null) { record.setOutNum(record.getInputNum().doubleValue()); } - //2、判断库存是否足够 + //2、判断成套机具出库库存是否足够 if (record.getManageType() == 2) { res = checkStorageNumCt(record); if (res == 0) { @@ -206,8 +206,10 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { // 插入领料出库明细表(lease_out_details) res = leaseOutDetailsMapper.insertSelective(record); if (res > 0) { - if (record.getManageType() == 2){ + if (record.getManageType() == 2) { // 成套机具减少 (ma_type 设备规格表)的库存数量 + res = leaseOutDetailsMapper.updateMaTypeStockNum(record); + // 成套机具减少 (ma_type 设备规格表)配件的库存数量 List typeIds = leaseOutDetailsMapper.getMaTypeDetails(record); typeIds.removeIf(item -> item == null); for (TmTask typeId : typeIds) { @@ -216,7 +218,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { typeId.setNum(machinePart.getNum() - machinePart.getPartNum()); res = leaseOutDetailsMapper.updateMaTypeStockNumCt(typeId); } - }else { + } else { // 普通机具减少 (ma_type 设备规格表)的库存数量 res = leaseOutDetailsMapper.updateMaTypeStockNum(record); } @@ -268,14 +270,20 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { } private int checkStorageNumCt(LeaseOutDetails record) { + int res = 0; double outNum = 0.1; if (StringUtils.isNull(record)) { - return 0; + return res; } if (record.getOutNum() == null || record.getOutNum() < outNum) { record.setOutNum(0.00); } + //先判断成套机具的库存是否足够 + int num = leaseOutDetailsMapper.getmaChineByCt(record); + if (num < record.getOutNum()) { + return res; + } //判断(ma_type 设备规格表)中的库存够不够出库的 List typeIds = leaseOutDetailsMapper.getMaTypeDetails(record); typeIds.removeIf(item -> item == null); @@ -283,7 +291,7 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId); machinePart.setPartNum((int) (typeId.getPartNum() * record.getOutNum())); if (machinePart.getNum() < machinePart.getPartNum()) { - return 0; + return res; } } return 1; diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackReceiveMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackReceiveMapper.xml index 48ef85a8..62f1348a 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackReceiveMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BackReceiveMapper.xml @@ -959,4 +959,30 @@ ) res HAVING backNum > -1 + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/LeaseOutDetailsMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/LeaseOutDetailsMapper.xml index c1f3214f..e476aa13 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/LeaseOutDetailsMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/LeaseOutDetailsMapper.xml @@ -303,7 +303,7 @@ UPDATE ma_type SET - num = num - #{num} ,update_time = NOW() + num = #{num} ,update_time = NOW() WHERE type_id = #{typeId} @@ -412,7 +412,7 @@ SELECT mt.type_name AS typeModelName, mt.unit_name as unitName, - mt.num as num, + ifnull(mt.num , 0) as num, m2.type_name As typeName FROM ma_type mt @@ -420,4 +420,7 @@ WHERE mt.type_id = #{typeId} + \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/MachinePart.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/MachinePart.java index 04cb1536..e168051d 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/MachinePart.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/MachinePart.java @@ -12,4 +12,5 @@ public class MachinePart { private String unitName; private String typeName; private Integer partNum; + private Integer typeId; } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseMacodeInfoMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseMacodeInfoMapper.java index 44f617af..37ede482 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseMacodeInfoMapper.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/PurchaseMacodeInfoMapper.java @@ -7,6 +7,7 @@ import com.bonus.sgzb.base.api.domain.MaMachineLabel; import com.bonus.sgzb.base.api.domain.MaType; import com.bonus.sgzb.material.domain.InputApplyDetails; import com.bonus.sgzb.material.domain.MaInputRecord; +import com.bonus.sgzb.material.domain.MachinePart; import com.bonus.sgzb.material.domain.PurchaseMacodeInfo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -277,4 +278,6 @@ public interface PurchaseMacodeInfoMapper { * @return */ int selectPurchaseCheckDetailsStatus(Long taskId); + + int updateMaTypeNum(MachinePart wholeSetDetail); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java index f2c31785..bfef04db 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/PurchaseMacodeInfoServiceImpl.java @@ -13,6 +13,7 @@ import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.material.domain.*; import com.bonus.sgzb.material.mapper.*; +import com.bonus.sgzb.material.service.IPurchaseCheckInfoService; import com.bonus.sgzb.material.service.IPurchaseMacodeInfoService; import com.bonus.sgzb.common.core.utils.DateUtils; import com.bonus.sgzb.material.vo.EquipmentNumberVO; @@ -39,6 +40,9 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService @Resource private TaskMapper taskMapper; + @Autowired + private IPurchaseCheckInfoService purchaseCheckInfoService; + @Resource private BmQrcodeInfoMapper qrcodeInfoMapper; @@ -298,6 +302,17 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService .add(maType.getNum() == null ? new BigDecimal(0) : maType.getNum())); purchaseMacodeInfoMapper.updateTypeByTypeId(maType); + //判断是否是成套机具,是的话配件库存也要增加 + if ("2".equals(maType.getManageType())){ + PurchaseCheckInfo purchaseCheckInfo = new PurchaseCheckInfo(); + purchaseCheckInfo.setPurchaseNum(maInputRecord.getInputNum().toString()); + purchaseCheckInfo.setTypeId(maInputRecord.getTypeId()); + List wholeSetDetails = purchaseCheckInfoService.getWholeSetDetails(purchaseCheckInfo); + for (MachinePart wholeSetDetail : wholeSetDetails) { + purchaseMacodeInfoMapper.updateMaTypeNum(wholeSetDetail); + } + } + BigDecimal inputNum = checkDetailsMapper.selectInputNumByTypeId(taskId, typeId); PurchaseCheckDetails purchaseCheckDetails = new PurchaseCheckDetails(); purchaseCheckDetails.setTaskId(taskId); diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckInfoMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckInfoMapper.xml index e097c7a1..ac6cffa5 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckInfoMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckInfoMapper.xml @@ -312,6 +312,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseMacodeInfoMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseMacodeInfoMapper.xml index ee665c61..05a64e5b 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseMacodeInfoMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseMacodeInfoMapper.xml @@ -534,4 +534,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and type_id = #{typeId} and ma_code = #{maCode} + + UPDATE ma_type + SET num = ifnull( num, 0 ) + #{partNum} WHERE type_id = #{typeId} + \ No newline at end of file diff --git a/sgzb-ui/src/views/claimAndRefund/receive/receiveApply.vue b/sgzb-ui/src/views/claimAndRefund/receive/receiveApply.vue index 8bb6d2ac..85d6af43 100644 --- a/sgzb-ui/src/views/claimAndRefund/receive/receiveApply.vue +++ b/sgzb-ui/src/views/claimAndRefund/receive/receiveApply.vue @@ -416,7 +416,7 @@ resetQuery() { this.queryParams.time = [] this.queryParams.unitId = '' - this.queryParams.proId = '' + this.queryParams.proId = '' this.resetForm('queryForm') this.GetUnitData() this.GetProData() diff --git a/sgzb-ui/src/views/claimAndRefund/receiveByCq/receiveApply.vue b/sgzb-ui/src/views/claimAndRefund/receiveByCq/receiveApply.vue index 2fd2c627..14918e39 100644 --- a/sgzb-ui/src/views/claimAndRefund/receiveByCq/receiveApply.vue +++ b/sgzb-ui/src/views/claimAndRefund/receiveByCq/receiveApply.vue @@ -432,7 +432,7 @@ resetQuery() { this.queryParams.time = [] this.queryParams.unitId = '' - this.queryParams.proId = '' + this.queryParams.proId = '' this.resetForm('queryForm') this.GetUnitData() this.GetProData() diff --git a/sgzb-ui/src/views/claimAndRefund/return/returnInDetail.vue b/sgzb-ui/src/views/claimAndRefund/return/returnInDetail.vue index e8fafd0a..cd61b465 100644 --- a/sgzb-ui/src/views/claimAndRefund/return/returnInDetail.vue +++ b/sgzb-ui/src/views/claimAndRefund/return/returnInDetail.vue @@ -126,7 +126,7 @@ size="mini" type="primary" @click="handleNumReturn(scope.row)" - v-if="!isView&&(scope.row.manageType=='1'||'2')&&scope.row.num>0" + v-if="!isView&&(scope.row.manageType=='1'||scope.row.manageType=='2')&&scope.row.num>0" >数量退料 diff --git a/sgzb-ui/src/views/store/newBuy/newDevices/newDevicesWarehousing.vue b/sgzb-ui/src/views/store/newBuy/newDevices/newDevicesWarehousing.vue index 9201f191..c4912952 100644 --- a/sgzb-ui/src/views/store/newBuy/newDevices/newDevicesWarehousing.vue +++ b/sgzb-ui/src/views/store/newBuy/newDevices/newDevicesWarehousing.vue @@ -1,37 +1,14 @@