diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java index 9861cf4..1a95a27 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/app/service/impl/LeaseOutDetailsServiceImpl.java @@ -159,7 +159,6 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { @Override @Transactional(rollbackFor = Exception.class) public AjaxResult submitOut(LeaseOutDetails record) { - log.error("check0001"); int res = 0; try { // 1、判断是否重复提交 @@ -178,7 +177,6 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { } else { res = checkStorageNum(record); } - log.error("check0002"); if (res > 0) { // 3、插入出库记录,修改库存,修改机具状态 res = insertRecords(record); @@ -230,62 +228,58 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { int res = 0; // 首先更新领料任务详情表的领料数及状态(lease_apply_details) res = leaseOutDetailsMapper.updateLeaseApplyDetailsOutNum(record); - log.error("check001"); LeaseApplyDetails leaseApplyDetails = leaseOutDetailsMapper.getLeaseApplyDetails(record); - log.error("check002"); if (leaseApplyDetails.getPreNum().equals(leaseApplyDetails.getAlNum()) || leaseApplyDetails.getAuditNum().equals(leaseApplyDetails.getAlNum())) { leaseOutDetailsMapper.updateLeaseApplyDetails(record); - log.error("check003"); } if (res > 0) { // 插入领料出库明细表(lease_out_details) res = leaseOutDetailsMapper.insertSelective(record); - log.error("check004"); if (res > 0) { if (record.getManageType() == 2) { // 成套机具减少 (ma_type 设备规格表)的库存数量 res = leaseOutDetailsMapper.updateMaTypeStockNum(record); - log.error("check005"); + // 成套机具减少 (ma_type 设备规格表)配件的库存数量 List typeIds = leaseOutDetailsMapper.getMaTypeDetails(record); - log.error("check006"); + typeIds.removeIf(item -> item == null); for (TmTask typeId : typeIds) { MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId); - log.error("check007"); + machinePart.setPartNum((typeId.getPartNum() * record.getOutNum())); typeId.setNum(machinePart.getNum() - machinePart.getPartNum()); res = leaseOutDetailsMapper.updateMaTypeStockNumCt(typeId); - log.error("check008"); + } } else { // 普通机具减少 (ma_type 设备规格表)的库存数量 res = leaseOutDetailsMapper.updateMaTypeStockNum(record); - log.error("check009"); + } // 更新 (ma_machine 设备表)的状态 leaseOutDetailsMapper.updateMaMachineStatus(record); - log.error("check0010{}",record); - //查询装备是否推送到租赁 - MaMachine maMachine = maMachineMapper.selectMaMachineByMaId(Long.valueOf(record.getMaId())); - log.error("check0011"); - if (maMachine != null && maMachine.getPushStatus().equals(1)) { - //同步租赁商城机具状态 - try { - // 15---1在库,16---2已出库 - maMachine.setMaStatus("2"); - String content = JSONObject.toJSONString(maMachine); - Map map = new HashMap<>(); - map.put("body", content); - String body = JSONObject.toJSONString(map); - String data = HttpHelper.sendHttpPost(updateItemStatus, body); - log.info("dataString-=========:" + data); - } catch (Exception e) { - log.error("同步租赁商城机具状态失败"); - throw new RuntimeException("同步租赁商城机具状态失败"); + //判断是数量设备还是编码设备 + if (record.getMaId()!=null){ + //查询装备是否推送到租赁 + MaMachine maMachine = maMachineMapper.selectMaMachineByMaId(Long.valueOf(record.getMaId())); + if (maMachine != null && maMachine.getPushStatus().equals(1)) { + //同步租赁商城机具状态 + try { + // 15---1在库,16---2已出库 + maMachine.setMaStatus("2"); + String content = JSONObject.toJSONString(maMachine); + Map map = new HashMap<>(); + map.put("body", content); + String body = JSONObject.toJSONString(map); + String data = HttpHelper.sendHttpPost(updateItemStatus, body); + log.info("dataString-=========:" + data); + } catch (Exception e) { + log.error("同步租赁商城机具状态失败"); + throw new RuntimeException("同步租赁商城机具状态失败"); + } } } - log.error("check0012"); } } return res;