From 6207d42ee5112034de45a0bcd9e2cc7294cee93a Mon Sep 17 00:00:00 2001 From: "liang.chao" Date: Sat, 20 Apr 2024 10:42:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=BA=86=E6=9C=BA=E5=85=B7=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sgzb/base/api/domain/LeaseOutDetails.java | 2 +- .../app/controller/BackReceiveController.java | 11 +- .../controller/CompositeQueryController.java | 38 ++++ .../bonus/sgzb/app/domain/BackApplyInfo.java | 4 + .../bonus/sgzb/app/domain/MachinePart.java | 3 + .../com/bonus/sgzb/app/domain/TmTask.java | 1 + .../sgzb/app/mapper/BackReceiveMapper.java | 2 +- .../sgzb/app/mapper/HoldingLedgerMapper.java | 20 ++ .../app/mapper/LeaseOutDetailsMapper.java | 8 + .../bonus/sgzb/app/mapper/TmTaskMapper.java | 13 +- .../app/service/HoldingLedgerService.java | 13 ++ .../service/impl/BackReceiveServiceImpl.java | 45 ++++- .../app/service/impl/HoldingLedgerImpl.java | 37 ++++ .../impl/LeaseOutDetailsServiceImpl.java | 53 ++++- .../app/service/impl/TmTaskServiceImpl.java | 24 ++- .../mapper/app/BackReceiveMapper.xml | 7 +- .../mapper/app/LeaseOutDetailsMapper.xml | 30 +++ .../resources/mapper/app/TmTaskMapper.xml | 45 +++++ .../mapper/base/HoldingLedgerMapper.xml | 41 ++++ .../sgzb/material/domain/BackApplyInfo.java | 3 + .../sgzb/material/domain/MachinePart.java | 15 ++ .../bonus/sgzb/material/domain/TmTask.java | 182 +++++++++--------- .../sgzb/material/mapper/TaskMapper.java | 5 + .../service/impl/BackApplyServiceImpl.java | 25 ++- .../mapper/material/BackApplyMapper.xml | 6 +- .../resources/mapper/material/TaskMapper.xml | 22 +++ 26 files changed, 542 insertions(+), 113 deletions(-) create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/CompositeQueryController.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/HoldingLedgerMapper.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/HoldingLedgerService.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/HoldingLedgerImpl.java create mode 100644 sgzb-modules/sgzb-base/src/main/resources/mapper/base/HoldingLedgerMapper.xml create mode 100644 sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/MachinePart.java diff --git a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/LeaseOutDetails.java b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/LeaseOutDetails.java index 764b3b95..83663a78 100644 --- a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/LeaseOutDetails.java +++ b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/LeaseOutDetails.java @@ -153,7 +153,7 @@ public class LeaseOutDetails implements Serializable { */ @ApiModelProperty(value = "数据所属组织") private Integer companyId; - @ApiModelProperty(value = "出库类型 0编码出库 1数量出库") + @ApiModelProperty(value = "出库类型 0编码出库 1数量出库 2成套出库") private Integer manageType; @ApiModelProperty(value = "数量出库-出库数量") private Integer inputNum; 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 44b32793..9ea59c53 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 @@ -3,6 +3,9 @@ package com.bonus.sgzb.app.controller; import com.bonus.sgzb.app.domain.BackApplyInfo; import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.service.*; +import com.bonus.sgzb.common.core.text.Convert; +import com.bonus.sgzb.common.core.utils.ListPagingUtil; +import com.bonus.sgzb.common.core.utils.ServletUtils; import com.bonus.sgzb.common.core.utils.poi.ExcelUtil; import com.bonus.sgzb.common.core.web.controller.BaseController; import com.bonus.sgzb.common.core.web.domain.AjaxResult; @@ -14,6 +17,9 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.List; +import static com.bonus.sgzb.common.core.constant.Constants.PAGE_NUM; +import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_SIZE; + /** * 退料接收-app * @@ -270,9 +276,10 @@ public class BackReceiveController extends BaseController { @PostMapping("backReceiveRecordWeb") public AjaxResult backReceiveRecordWeb(@RequestBody BackApplyInfo record) { try { - startPage(); List list = backReceiveService.backReceiveRecord(record); - return AjaxResult.success(getDataTable(list)); + 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)); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/CompositeQueryController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/CompositeQueryController.java new file mode 100644 index 00000000..8b0451c5 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/CompositeQueryController.java @@ -0,0 +1,38 @@ +package com.bonus.sgzb.app.controller; + +import cn.hutool.core.collection.CollUtil; +import com.bonus.sgzb.app.service.HoldingLedgerService; +import com.bonus.sgzb.base.api.domain.LeaseOutDetails; +import com.bonus.sgzb.common.core.web.controller.BaseController; +import com.bonus.sgzb.common.core.web.domain.AjaxResult; +import com.bonus.sgzb.common.log.annotation.Log; +import com.bonus.sgzb.common.log.enums.BusinessType; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @Author:梁超 + * @date:2024/4/19 - 17:43 + * 综合查询 + */ +@RestController +@RequestMapping("/composite") +public class CompositeQueryController extends BaseController { + + @Resource + private HoldingLedgerService holdingLedgerService; + + /** + * @param + * @return 抱杆台账查询 + */ + @Log(title = "抱杆台账查询", businessType = BusinessType.UPDATE) + @GetMapping("/getHoldingLedger") + public AjaxResult getHoldingLedger() { + startPage(); + return AjaxResult.success(getDataTable(holdingLedgerService.getHoldingLedger())); + } + +} 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 372e5823..1e436d51 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 @@ -56,6 +56,8 @@ public class BackApplyInfo { */ private String typeId; private String modelId; + + private List maTypeDetails; /** * 类型名称 */ @@ -113,6 +115,7 @@ public class BackApplyInfo { * 机具管理方式 */ private String manageType; + private String type; /** * 合格数量 */ @@ -180,4 +183,5 @@ public class BackApplyInfo { private String startTime; private String endTime; private Integer flag; + private Integer partNum; } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/MachinePart.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/MachinePart.java index 58c3ab4f..11e204f2 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/MachinePart.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/MachinePart.java @@ -11,5 +11,8 @@ public class MachinePart { private String typeModelName; private String unitName; private String typeName; + private String modelId; + private Integer parentId; private Integer partNum; + private Integer num; } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/TmTask.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/TmTask.java index 18bf219c..9cffc323 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/TmTask.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/TmTask.java @@ -41,6 +41,7 @@ public class TmTask implements Serializable { */ @ApiModelProperty(value = "任务类型(数据字典)") private Integer taskType; + private List outboundType; /** * 任务状态(定义数据字典) 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 7fd88b53..b9fa925a 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 @@ -160,7 +160,7 @@ public interface BackReceiveMapper { * @param record * @return List */ - List backReceiveRecord(BackApplyInfo record); + BackApplyInfo backReceiveRecord(BackApplyInfo record); /** * 查询 diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/HoldingLedgerMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/HoldingLedgerMapper.java new file mode 100644 index 00000000..9f494115 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/HoldingLedgerMapper.java @@ -0,0 +1,20 @@ +package com.bonus.sgzb.app.mapper; + +import com.bonus.sgzb.app.domain.MachinePart; +import com.bonus.sgzb.app.domain.TmTask; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @Author:梁超 + * @date:2024/4/19 - 17:51 + */ +@Mapper +public interface HoldingLedgerMapper { + List getHoldingLedger(); + + List getHoldingLedgerDetail(TmTask tmTask); + + MachinePart getMachineParts(TmTask typeId); +} 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 e46b7066..47b392e5 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 @@ -1,6 +1,8 @@ package com.bonus.sgzb.app.mapper; import com.bonus.sgzb.app.domain.LeaseApplyDetails; +import com.bonus.sgzb.app.domain.MachinePart; +import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.base.api.domain.LeaseOutDetails; import com.bonus.sgzb.base.api.domain.MaType; import com.bonus.sgzb.base.api.domain.SltAgreementInfo; @@ -91,4 +93,10 @@ public interface LeaseOutDetailsMapper { MaType selectByTypeId(@Param("record") LeaseOutDetails record); LeaseApplyDetails getOutboundNum(LeaseOutDetails record); + + List getMaTypeDetails(LeaseOutDetails record); + + MachinePart getMachineParts(TmTask typeId); + + int updateMaTypeStockNumCt(TmTask record); } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/TmTaskMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/TmTaskMapper.java index 18512a8b..b5a59a74 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/TmTaskMapper.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/TmTaskMapper.java @@ -1,9 +1,6 @@ package com.bonus.sgzb.app.mapper; -import com.bonus.sgzb.app.domain.LeaseApplyDetails; -import com.bonus.sgzb.app.domain.LeaseApplyInfo; -import com.bonus.sgzb.app.domain.MachinePart; -import com.bonus.sgzb.app.domain.TmTask; +import com.bonus.sgzb.app.domain.*; import com.bonus.sgzb.base.domain.MaintenanceGang; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -119,4 +116,12 @@ public interface TmTaskMapper { List getMaTypeDetails(LeaseApplyDetails leaseApplyDetails); MachinePart getMachineParts(TmTask typeId); + + List getMaTypeDetailsByTypeId(BackApplyInfo backApplyInfo); + + List getManageTypeByTypeId(TmTask tmTask); + + int getCountMachine(BackApplyInfo record); + + int getCountMachineByPidAndTid(MachinePart machinePart); } \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/HoldingLedgerService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/HoldingLedgerService.java new file mode 100644 index 00000000..b09e9d4d --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/HoldingLedgerService.java @@ -0,0 +1,13 @@ +package com.bonus.sgzb.app.service; + +import com.bonus.sgzb.app.domain.TmTask; + +import java.util.List; + +/** + * @Author:梁超 + * @date:2024/4/19 - 17:48 + */ +public interface HoldingLedgerService{ + List getHoldingLedger(); +} 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 514d5965..0bc58d15 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 @@ -1,18 +1,22 @@ package com.bonus.sgzb.app.service.impl; import com.bonus.sgzb.app.domain.BackApplyInfo; +import com.bonus.sgzb.app.domain.MachinePart; import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.mapper.BackReceiveMapper; +import com.bonus.sgzb.app.mapper.TmTaskMapper; import com.bonus.sgzb.app.service.BackReceiveService; import com.bonus.sgzb.base.api.domain.SltAgreementInfo; import com.bonus.sgzb.common.core.utils.DateUtils; import com.bonus.sgzb.common.core.utils.GlobalConstants; import com.bonus.sgzb.common.core.utils.StringHelper; +import org.apache.commons.lang3.ObjectUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -28,6 +32,9 @@ public class BackReceiveServiceImpl implements BackReceiveService { @Resource private BackReceiveMapper backReceiveMapper; + @Resource + private TmTaskMapper tmTaskMapper; + @Override public List getbackReceiveList(BackApplyInfo record) { @@ -36,7 +43,31 @@ public class BackReceiveServiceImpl implements BackReceiveService { @Override public List receiveView(BackApplyInfo record) { - return backReceiveMapper.receiveView(record); + List backApplyInfoList = backReceiveMapper.receiveView(record); + int machinePartNum = 0; + for (BackApplyInfo backApplyInfo : backApplyInfoList) { + if ("2".equals(backApplyInfo.getManageType())) { + List machineParts = new ArrayList<>(); + List typeIds = tmTaskMapper.getMaTypeDetailsByTypeId(backApplyInfo); + typeIds.removeIf(item -> item == null); + for (TmTask typeId : typeIds) { + MachinePart machinePart = tmTaskMapper.getMachineParts(typeId); + machinePart.setParentId(record.getId()); + int countMachineByPidAndTid = tmTaskMapper.getCountMachineByPidAndTid(machinePart); + machinePartNum = typeId.getPartNum() * (int) Double.parseDouble(backApplyInfo.getPreNum()); + machinePart.setPartNum(machinePartNum - countMachineByPidAndTid); + machineParts.add(machinePart); + } + backApplyInfo.setMaTypeDetails(machineParts); + int countMachine = tmTaskMapper.getCountMachine(record); + if (countMachine == machinePartNum) { + backApplyInfo.setPartNum(0); + } else { + backApplyInfo.setPartNum((int) Double.parseDouble(backApplyInfo.getPreNum())); + } + } + } + return backApplyInfoList; } @Override @@ -208,7 +239,17 @@ public class BackReceiveServiceImpl implements BackReceiveService { @Override public List backReceiveRecord(BackApplyInfo record) { - return backReceiveMapper.backReceiveRecord(record); + String typeId = record.getTypeId(); + String[] split = typeId.split(","); + List backApplyInfoList = new ArrayList<>(); + for (String s : split) { + record.setTypeId(s); + BackApplyInfo backApplyInfo = backReceiveMapper.backReceiveRecord(record); + if (backApplyInfo != null) { + backApplyInfoList.add(backApplyInfo); + } + } + return backApplyInfoList; } @Override diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/HoldingLedgerImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/HoldingLedgerImpl.java new file mode 100644 index 00000000..e6732ae8 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/HoldingLedgerImpl.java @@ -0,0 +1,37 @@ +package com.bonus.sgzb.app.service.impl; + +import com.bonus.sgzb.app.domain.MachinePart; +import com.bonus.sgzb.app.domain.TmTask; +import com.bonus.sgzb.app.mapper.HoldingLedgerMapper; +import com.bonus.sgzb.app.service.HoldingLedgerService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @Author:梁超 + * @date:2024/4/19 - 17:48 + */ + +@Service +public class HoldingLedgerImpl implements HoldingLedgerService { + + @Resource + private HoldingLedgerMapper holdingLedgerMapper; + + @Override + public List getHoldingLedger() { + /*List holdingLedger = holdingLedgerMapper.getHoldingLedger(); + for (TmTask tmTask : holdingLedger) { + List holdingLedgerDetail = holdingLedgerMapper.getHoldingLedgerDetail(tmTask); + holdingLedgerDetail.removeIf(item -> item == null); + for (TmTask typeId : holdingLedgerDetail) { + MachinePart machinePart = holdingLedgerMapper.getMachineParts(typeId); + machinePart.setPartNum((int) (typeId.getPartNum() * leaseApplyDetail.getPreNum())); + machineParts.add(machinePart); + } + }*/ + return null; + } +} 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 f9f174e9..7cb5c71f 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 @@ -2,6 +2,7 @@ package com.bonus.sgzb.app.service.impl; import cn.hutool.core.collection.CollUtil; import com.bonus.sgzb.app.domain.LeaseApplyDetails; +import com.bonus.sgzb.app.domain.MachinePart; import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.mapper.LeaseApplyDetailsMapper; import com.bonus.sgzb.app.mapper.LeaseOutDetailsMapper; @@ -147,11 +148,19 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { // 1、判断是否重复提交 res = checkRepeatSubmit(record); if (res > 0) { - if (record.getManageType() == 1 && record.getInputNum() != null) { + if ((record.getManageType() == 1 || record.getManageType() == 2) && record.getInputNum() != null) { record.setOutNum(record.getInputNum().doubleValue()); } //2、判断库存是否足够 - res = checkStorageNum(record); + if (record.getManageType() == 2) { + res = checkStorageNumCt(record); + if (res == 0) { + throw new RuntimeException("出库失败,库存不足"); + } + } else { + res = checkStorageNum(record); + } + if (res > 0) { // 3、插入出库记录,修改库存,修改机具状态 res = insertRecords(record); @@ -190,8 +199,20 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { // 插入领料出库明细表(lease_out_details) res = leaseOutDetailsMapper.insertSelective(record); if (res > 0) { - // 减少 (ma_type 设备规格表)的库存数量 - res = leaseOutDetailsMapper.updateMaTypeStockNum(record); + if (record.getManageType() == 2){ + // 成套机具减少 (ma_type 设备规格表)的库存数量 + List typeIds = leaseOutDetailsMapper.getMaTypeDetails(record); + typeIds.removeIf(item -> item == null); + for (TmTask typeId : typeIds) { + MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId); + machinePart.setPartNum((int) (typeId.getPartNum() * record.getOutNum())); + typeId.setNum(machinePart.getNum() - machinePart.getPartNum()); + res = leaseOutDetailsMapper.updateMaTypeStockNumCt(typeId); + } + }else { + // 普通机具减少 (ma_type 设备规格表)的库存数量 + res = leaseOutDetailsMapper.updateMaTypeStockNum(record); + } // 更新 (ma_machine 设备表)的状态 leaseOutDetailsMapper.updateMaMachineStatus(record); } @@ -239,10 +260,32 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService { return 1; } + private int checkStorageNumCt(LeaseOutDetails record) { + double outNum = 0.1; + if (StringUtils.isNull(record)) { + return 0; + } + + if (record.getOutNum() == null || record.getOutNum() < outNum) { + record.setOutNum(0.00); + } + //判断(ma_type 设备规格表)中的库存够不够出库的 + List typeIds = leaseOutDetailsMapper.getMaTypeDetails(record); + typeIds.removeIf(item -> item == null); + for (TmTask typeId : typeIds) { + MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId); + machinePart.setPartNum((int) (typeId.getPartNum() * record.getOutNum())); + if (machinePart.getNum() < machinePart.getPartNum()) { + return 0; + } + } + return 1; + } + private int checkRepeatSubmit(LeaseOutDetails record) { String maStatus = "15"; int res = 0; - if (record.getManageType() == 1) { + if (record.getManageType() == 1 || record.getManageType() == 2) { // 如果是数量出库校验待出库数量 LeaseApplyDetails details = leaseOutDetailsMapper.getOutboundNum(record); if (details == null) { diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java index 1a266039..a499f44c 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java @@ -233,7 +233,15 @@ public class TmTaskServiceImpl implements TmTaskService { */ @Override public List getLeaseAuditListByOne(TmTask record) { - return tmTaskMapper.getLeaseDetailByParentId(record); + List leaseDetailByParentId = tmTaskMapper.getLeaseDetailByParentId(record); + /* for (TmTask tmTask : leaseDetailByParentId) { + if ("2".equals(tmTask.getManageType())) { + List manageTypeByTypeId = tmTaskMapper.getManageTypeByTypeId(tmTask); + // 目前先默认成套只能数量出库或编码出库 + tmTask.setOutboundType(manageTypeByTypeId); + } + }*/ + return leaseDetailByParentId; } /** @@ -546,8 +554,18 @@ public class TmTaskServiceImpl implements TmTaskService { if (leaseApplyInfo != null) { // 去查询领料任务详情表 List leaseApplyDetails = tmTaskMapper.getLeaseApplyDetailsCq(leaseApplyInfo); - if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) { -// tmTaskMapper.getMaTypeDetails(leaseApplyDetails); + if (leaseApplyDetails.size() > 0) { + for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { + List machineParts = new ArrayList<>(); + List typeIds = tmTaskMapper.getMaTypeDetails(leaseApplyDetail); + typeIds.removeIf(item -> item == null); + for (TmTask typeId : typeIds) { + MachinePart machinePart = tmTaskMapper.getMachineParts(typeId); + machinePart.setPartNum((int) (typeId.getPartNum() * leaseApplyDetail.getPreNum())); + machineParts.add(machinePart); + } + leaseApplyDetail.setMaTypeDetails(machineParts); + } listLeaseDetails.addAll(leaseApplyDetails); } } 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 d6289d6d..e5238188 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 @@ -667,7 +667,7 @@ mt2.type_name AS typeName, bad.pre_num as preNum, bad.status as status, - IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num, + IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as partNum, mt.manage_type as manageType, CONCAT('NSJJ',mt.`code`,mt.model_code) as `code` FROM @@ -797,9 +797,10 @@ SELECT mt2.type_name AS typeName, mt1.type_name AS typeCode, - bcd.back_num as backNum, + ifnull(sum( bcd.back_num ), 0) AS backNum, mm.ma_code as maCode, bcd.create_time AS backTime, + bcd.type_id as modelId, bcd.back_status AS backStatus FROM back_check_details bcd @@ -812,6 +813,8 @@ and mm.ma_code like concat('%', #{maCode}, '%') + GROUP BY + bcd.type_id ORDER BY bcd.create_time DESC 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 a92c6c29..c1f3214f 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 @@ -299,6 +299,14 @@ set num = #{num} where id = #{id} + + UPDATE + ma_type + SET + num = num - #{num} ,update_time = NOW() + WHERE + type_id = #{typeId} + insert into tm_task_agreement @@ -390,4 +398,26 @@ FROM lease_apply_details WHERE id = #{id} AND (pre_num - IFNULL(al_num, 0)) > 0 + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/TmTaskMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/TmTaskMapper.xml index f063f0dd..f5aa68ec 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/TmTaskMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/TmTaskMapper.xml @@ -980,6 +980,7 @@ + + + + diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/HoldingLedgerMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/HoldingLedgerMapper.xml new file mode 100644 index 00000000..cf18dc32 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/HoldingLedgerMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/BackApplyInfo.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/BackApplyInfo.java index b505487b..76c3b1c8 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/BackApplyInfo.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/BackApplyInfo.java @@ -31,6 +31,8 @@ public class BackApplyInfo extends BaseEntity { private String badId; private String[] split; + private List maTypeDetails; + /** * 工程名称 */ @@ -47,6 +49,7 @@ public class BackApplyInfo extends BaseEntity { */ @ApiModelProperty(value = "装备管理方式名称") private String manageTypeName; + private String manageType; private int flag; 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 new file mode 100644 index 00000000..04cb1536 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/MachinePart.java @@ -0,0 +1,15 @@ +package com.bonus.sgzb.material.domain; + +import lombok.Data; + +/** + * @Author:梁超 + * @date:2024/4/17 - 9:04 + */ +@Data +public class MachinePart { + private String typeModelName; + private String unitName; + private String typeName; + private Integer partNum; +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/TmTask.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/TmTask.java index 5195b807..3113510a 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/TmTask.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/TmTask.java @@ -12,13 +12,14 @@ import java.util.Date; import java.util.List; /** -* Description: 任务表tm_task -* @Author 阮世耀 -* @Create 2023/12/13 15:14 -* @Version 1.0 -*/ + * Description: 任务表tm_task + * + * @Author 阮世耀 + * @Create 2023/12/13 15:14 + * @Version 1.0 + */ -@ApiModel(description="任务表tm_task") +@ApiModel(description = "任务表tm_task") @Data public class TmTask implements Serializable { @@ -27,204 +28,207 @@ public class TmTask implements Serializable { private String id; /** - * 任务ID - */ - @ApiModelProperty(value="任务ID") + * 任务ID + */ + @ApiModelProperty(value = "任务ID") private Long taskId; /** - * 任务类型(定义数据字典) - */ - @ApiModelProperty(value="任务类型(数据字典)") + * 任务类型(定义数据字典) + */ + @ApiModelProperty(value = "任务类型(数据字典)") private Integer taskType; /** - * 任务状态(定义数据字典) - */ - @ApiModelProperty(value="任务状态(数据字典)") + * 任务状态(定义数据字典) + */ + @ApiModelProperty(value = "任务状态(数据字典)") private Integer taskStatus; /** - * 预领料合计数 - */ - @ApiModelProperty(value="预领料合计数") + * 预领料合计数 + */ + @ApiModelProperty(value = "预领料合计数") private int preCountNum; /** - * 编号 - */ - @ApiModelProperty(value="编号") - @Excel(name = "领料单号",sort = 1) + * 编号 + */ + @ApiModelProperty(value = "编号") + @Excel(name = "领料单号", sort = 1) private String code; /** - * 创建者 - */ - @ApiModelProperty(value="创建者") + * 创建者 + */ + @ApiModelProperty(value = "创建者") private String createBy; /** * 申请人手机号码 */ - @ApiModelProperty(value="手机号") + @ApiModelProperty(value = "手机号") private String phoneNumber; /** * 部门名称 单位名称 */ - @ApiModelProperty(value="部门/单位名称") + @ApiModelProperty(value = "部门/单位名称") private String deptName; /** * 工程名称 */ - @ApiModelProperty(value="工程名称") - @Excel(name = "领料工程",sort = 3) + @ApiModelProperty(value = "工程名称") + @Excel(name = "领料工程", sort = 3) private String proName; /** * 工程id */ - @ApiModelProperty(value="工程id") + @ApiModelProperty(value = "工程id") private int proId; /** - * 创建时间 - */ - @ApiModelProperty(value="创建时间") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createTime; /** - * 更新者 - */ - @ApiModelProperty(value="更新者") + * 更新者 + */ + @ApiModelProperty(value = "更新者") private String updateBy; /** - * 更新时间 - */ - @ApiModelProperty(value="更新时间") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + * 更新时间 + */ + @ApiModelProperty(value = "更新时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date updateTime; /** - * 备注 - */ - @ApiModelProperty(value="备注") - @Excel(name = "备注",sort = 11) + * 备注 + */ + @ApiModelProperty(value = "备注") + @Excel(name = "备注", sort = 11) private String remark; /** - * 数据所属组织 - */ - @ApiModelProperty(value="数据所属组织") + * 数据所属组织 + */ + @ApiModelProperty(value = "数据所属组织") private Integer companyId; /** * 领料任务实体 */ - @ApiModelProperty(value="领料任务实体") + @ApiModelProperty(value = "领料任务实体") private LeaseApplyInfo leaseApplyInfo; /** * 领料任务实体集合 */ - @ApiModelProperty(value="领料任务实体集合") + @ApiModelProperty(value = "领料任务实体集合") private List leaseApplyInfoList; /** * 领料任务详情集合 */ - @ApiModelProperty(value="领料任务详情集合") - private List leaseApplyDetails; + @ApiModelProperty(value = "领料任务详情集合") + private List leaseApplyDetails; - @ApiModelProperty(value="协议id") + @ApiModelProperty(value = "协议id") private Integer agreementId; - @ApiModelProperty(value="退料人") + @ApiModelProperty(value = "退料人") private String backPerson; - @ApiModelProperty(value="退料人联系电话") + @ApiModelProperty(value = "退料人联系电话") private String phone; - @ApiModelProperty(value="退料申请时间") + @ApiModelProperty(value = "退料申请时间") private String backTime; - @ApiModelProperty(value="退料审核人 机具分公司审批人") + @ApiModelProperty(value = "退料审核人 机具分公司审批人") private String directAuditBy; - @ApiModelProperty(value="退料审核时间 机具分公司审批时间") + @ApiModelProperty(value = "退料审核时间 机具分公司审批时间") private String directAuditTime; - @ApiModelProperty(value="退料审核备注 机具分公司审批备注") + @ApiModelProperty(value = "退料审核备注 机具分公司审批备注") private String directAuditRemark; - @ApiModelProperty(value="往来单位id") + @ApiModelProperty(value = "往来单位id") private Long unitId; - @ApiModelProperty(value="往来单位") - @Excel(name = "领料单位",sort = 2) + @ApiModelProperty(value = "往来单位") + @Excel(name = "领料单位", sort = 2) private String unitName; - @ApiModelProperty(value="工程id") + @ApiModelProperty(value = "工程id") private Long projectId; - @ApiModelProperty(value="关键字") + @ApiModelProperty(value = "关键字") private String keyWord; - @ApiModelProperty(value="开始时间") + @ApiModelProperty(value = "开始时间") private String startTime; - @ApiModelProperty(value="结束时间") + @ApiModelProperty(value = "结束时间") private String endTime; - @ApiModelProperty(value="类型") + @ApiModelProperty(value = "类型") private Integer types; - @ApiModelProperty(value="协议编号") - @Excel(name = "协议号",sort = 4) + @ApiModelProperty(value = "协议编号") + @Excel(name = "协议号", sort = 4) private String agreementCode; - @ApiModelProperty(value="领料人") - @Excel(name = "领料人",sort = 5) + @ApiModelProperty(value = "领料人") + @Excel(name = "领料人", sort = 5) private String leasePerson; - @ApiModelProperty(value="领料人手机号") - @Excel(name = "联系电话",sort = 6) + @ApiModelProperty(value = "领料人手机号") + @Excel(name = "联系电话", sort = 6) private String leasePhone; - @ApiModelProperty(value="申请人") - @Excel(name = "申请人",sort = 7) + @ApiModelProperty(value = "申请人") + @Excel(name = "申请人", sort = 7) private String applyFor; - @ApiModelProperty(value="任务状态") - @Excel(name = "任务状态",sort = 9) + @ApiModelProperty(value = "任务状态") + @Excel(name = "任务状态", sort = 9) private String taskName; - @ApiModelProperty(value="审批状态id") + @ApiModelProperty(value = "审批状态id") private String examineStatusId; - @ApiModelProperty(value="审批状态的备注") - @Excel(name = "审批结果",sort = 10) + @ApiModelProperty(value = "审批状态的备注") + @Excel(name = "审批结果", sort = 10) private String examineStatus; - @ApiModelProperty(value="创建时间") - @Excel(name = "申请时间",sort = 8) + @ApiModelProperty(value = "创建时间") + @Excel(name = "申请时间", sort = 8) private String createTimes; - @ApiModelProperty(value="更新时间") + @ApiModelProperty(value = "更新时间") private String updateTimes; - @ApiModelProperty(value="公司审批人") + @ApiModelProperty(value = "公司审批人") private String companyAuditBy; - @ApiModelProperty(value="公司审批时间") + @ApiModelProperty(value = "公司审批时间") private String companyAuditTime; - @ApiModelProperty(value="公司审批备注") + @ApiModelProperty(value = "公司审批备注") private String companyAuditRemark; - @ApiModelProperty(value="分管审批人") + @ApiModelProperty(value = "分管审批人") private String deptAuditBy; - @ApiModelProperty(value="分管审批时间") + @ApiModelProperty(value = "分管审批时间") private String deptAuditTime; - @ApiModelProperty(value="分管审批备注") + @ApiModelProperty(value = "分管审批备注") private String deptAuditRemark; + private String partNum; + private String typeId; + } \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/TaskMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/TaskMapper.java index d56d90aa..6bc7ba27 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/TaskMapper.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/TaskMapper.java @@ -2,6 +2,7 @@ package com.bonus.sgzb.material.mapper; import com.bonus.sgzb.material.domain.BackApplyInfo; +import com.bonus.sgzb.material.domain.MachinePart; import com.bonus.sgzb.material.domain.TmTask; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -80,4 +81,8 @@ public interface TaskMapper { int insertTmTaskByBackInfo(BackApplyInfo backApplyInfo); int insertAgreementByBackInfo(BackApplyInfo backApplyInfo); + + List getMaTypeDetails(BackApplyInfo backApplyInfo); + + MachinePart getMachineParts(TmTask typeId); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/BackApplyServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/BackApplyServiceImpl.java index 1fb4e9a3..18af4901 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/BackApplyServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/BackApplyServiceImpl.java @@ -6,6 +6,8 @@ import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.material.domain.BackApplyInfo; +import com.bonus.sgzb.material.domain.MachinePart; +import com.bonus.sgzb.material.domain.TmTask; import com.bonus.sgzb.material.domain.TypeTreeNode; import com.bonus.sgzb.material.mapper.BackApplyMapper; import com.bonus.sgzb.material.mapper.TaskMapper; @@ -136,13 +138,32 @@ public class BackApplyServiceImpl implements BackApplyService { bean.setSplit(split); if (companyId != null) { bean.setCompanyId(companyId.toString()); - return backApplyMapper.getView(bean); + List view = backApplyMapper.getView(bean); + return getMaTypeDetails(view); } else { - return backApplyMapper.getView(bean); + List view = backApplyMapper.getView(bean); + return getMaTypeDetails(view); } } + private List getMaTypeDetails(List view) { + if (view.size() > 0) { + for (BackApplyInfo backApplyInfo : view) { + List machineParts = new ArrayList<>(); + List typeIds = tmTaskMapper.getMaTypeDetails(backApplyInfo); + typeIds.removeIf(item -> item == null); + for (TmTask typeId : typeIds) { + MachinePart machinePart = tmTaskMapper.getMachineParts(typeId); + machinePart.setPartNum((int) (Double.parseDouble(typeId.getPartNum()) * Double.parseDouble(backApplyInfo.getPreNum()))); + machineParts.add(machinePart); + } + backApplyInfo.setMaTypeDetails(machineParts); + } + } + return view; + } + @Override public List getViewByApply(BackApplyInfo bean) { List viewByApply = backApplyMapper.getViewByApply(bean); diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/BackApplyMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/BackApplyMapper.xml index f6052927..2f9ed815 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/BackApplyMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/BackApplyMapper.xml @@ -514,9 +514,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lot.lot_name AS lotName, unit.unit_name AS unitName, mt.type_name typeCode, + mt.manage_type as manageType, mt2.type_name AS typeName, bagi.agreement_code as agreementCode, bad.pre_num AS preNum, + bad.type_id as typeId, bad.audit_num AS num FROM back_apply_details bad @@ -819,10 +821,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select mt.manage_type AS manageType FROM ma_type mt WHERE mt.type_id = #{typeId} \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/TaskMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/TaskMapper.xml index 154acb24..03128b14 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/TaskMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/TaskMapper.xml @@ -16,6 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + select task_id, task_type, task_status, code, create_by, create_time, update_by, update_time, remark, company_id from tm_task @@ -222,4 +223,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + \ No newline at end of file