diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java index 99b27d3f..4bd96062 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java @@ -908,13 +908,6 @@ public class DepositoryRecordController { list = depositoryRecordService.findApplicationInRecordPByUser(userToken, map, userKey, token); recordPCount = depositoryRecordService.findApplicationInRecordPCountByUser(userToken, map); } - for (ApplicationInRecordP applicationInRecordP : list) { - if (applicationInRecordP.getPrice() != null) { - applicationInRecordP.setPrice(applicationInRecordP.getPrice() / 100); - } else { - applicationInRecordP.setPrice(0.0); - } - } return new RestResponse(list, recordPCount, 200); } diff --git a/src/main/java/com/dreamchaser/depository_manage/depository_mapper/DepositoryRecordMapper.xml b/src/main/java/com/dreamchaser/depository_manage/depository_mapper/DepositoryRecordMapper.xml index ced7ee44..956ae930 100644 --- a/src/main/java/com/dreamchaser/depository_manage/depository_mapper/DepositoryRecordMapper.xml +++ b/src/main/java/com/dreamchaser/depository_manage/depository_mapper/DepositoryRecordMapper.xml @@ -85,6 +85,7 @@ + @@ -183,7 +184,7 @@ - airid,did,airmproducedDate,mname,quantity,price,tname,applicant_time,aircode,dname,applicant_id,applyRemark,mcode,mversion,munit,mtexture,mkingdeecode,mdepositoryCode,airUnit,flagForGroup,mid,airPlaceId,airapproverPass,airapproverTime,airapproverId,airstate,airapproverMessage,airtoGroupId,mbrand,pkingdeecode + airid,did,airmproducedDate,mname,mprice,quantity,price,tname,applicant_time,aircode,dname,applicant_id,applyRemark,mcode,mversion,munit,mtexture,mkingdeecode,mdepositoryCode,airUnit,flagForGroup,mid,airPlaceId,airapproverPass,airapproverTime,airapproverId,airstate,airapproverMessage,airtoGroupId,mbrand,pkingdeecode diff --git a/src/main/java/com/dreamchaser/depository_manage/entity/ApplicationInRecord.java b/src/main/java/com/dreamchaser/depository_manage/entity/ApplicationInRecord.java index 28ffc566..e359d018 100644 --- a/src/main/java/com/dreamchaser/depository_manage/entity/ApplicationInRecord.java +++ b/src/main/java/com/dreamchaser/depository_manage/entity/ApplicationInRecord.java @@ -21,6 +21,11 @@ public class ApplicationInRecord { * 入库金额 */ private Double price; + + /** + * 物料单价 + */ + private Integer mprice; /** * 入库物品类型 */ diff --git a/src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationInRecordP.java b/src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationInRecordP.java index 1c0c0cad..ea99ea17 100644 --- a/src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationInRecordP.java +++ b/src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationInRecordP.java @@ -1,6 +1,7 @@ package com.dreamchaser.depository_manage.pojo; import com.dreamchaser.depository_manage.entity.ApplicationInRecord; +import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; import lombok.Data; @Data @@ -159,6 +160,10 @@ public class ApplicationInRecordP { * 物料品牌 */ private String mbrand; + /** + * 物料单价 + */ + private Double mprice; /** @@ -169,7 +174,7 @@ public class ApplicationInRecordP { public ApplicationInRecordP(ApplicationInRecord ar) { this.id = ar.getId(); this.mname = ar.getMname(); - this.quantity = (double) ar.getQuantity() / 100; + this.quantity = ObjectFormatUtil.divide(ar.getQuantity(), 100.0,2); this.price = ar.getPrice(); this.materialTypeName = ar.getMaterialTypeName(); this.applicantName = ar.getApplicantName(); @@ -189,6 +194,7 @@ public class ApplicationInRecordP { this.airUnit = ar.getAirUnit(); this.flagForGroup = ar.getFlagForGroup(); this.mid = ar.getMid(); + this.mprice = ObjectFormatUtil.divide(ar.getMprice(),100.0,2); this.placeId = ar.getPlaceId(); this.airtoGroupId = ar.getAirtoGroupId(); this.airapproverPass = ar.getAirapproverPass(); diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java index 17f6f1e8..75234667 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java @@ -70,7 +70,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { @Autowired private GroupMapper groupMapper; - + @Autowired private UserService userService; @@ -754,7 +754,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 定义用于获取当前岗位下的人的参数map Map paramForGetUserByPost = new HashMap<>(); paramForGetUserByPost.put("position", roleAndDepository.getUserId()); - List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost,null,null); + List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null); for (UserByPort userByPort : userByPortList) { int emptype = userByPort.getEmptype(); if (emptype > 10) { @@ -776,8 +776,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { flagForApproval = isApprovalPass; } map.put("flagForApproval", flagForApproval); - } - else { + } else { // 设置审批权限 map.put("inType", "mt"); // 获取当前类别物料是否需要审批 @@ -794,7 +793,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 定义用于获取当前岗位下的人的参数map Map paramForGetUserByPost = new HashMap<>(); paramForGetUserByPost.put("position", uid); - List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost,null,null); + List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null); for (UserByPort userByPort : userByPortList) { int emptype = userByPort.getEmptype(); if (emptype > 10) { @@ -1922,7 +1921,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 强行完成出库 // 获取当前出库人员 - UserByPort userByPort = PublicConfig.FindUserById(outRecordMin.getCheckId(),userKey,token); + UserByPort userByPort = PublicConfig.FindUserById(outRecordMin.getCheckId(), userKey, token); outRecord.setPass(1); updateApplicationMinOutInfo(id, outRecordMin, outRecord, (double) (quantity), userByPort, placeById.getId(), userAgent, userKey, token); @@ -1941,7 +1940,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { for (RoleAndMaterialType mt : materialTypeIdForIn ) { // 获取管理员数据 - UserByPort userByPort = PublicConfig.FindUserById(mt.getUid(),userKey,token); + UserByPort userByPort = PublicConfig.FindUserById(mt.getUid(), userKey, token); // 获取用户的用工关系 int emptype = userByPort.getEmptype(); if (emptype > 10) { @@ -1959,7 +1958,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { for (RoleAndDepository mt : materialTypeIdForIn ) { // 获取管理员数据 - UserByPort userByPort = PublicConfig.FindUserById(mt.getUserId(),userKey,token); + UserByPort userByPort = PublicConfig.FindUserById(mt.getUserId(), userKey, token); // 获取用户的用工关系 int emptype = userByPort.getEmptype(); if (emptype > 10) { @@ -2368,7 +2367,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { continue; } Long uid = ObjectFormatUtil.toLong(s); - UserByPort depositoryManager = PublicConfig.FindUserById(uid,userKey,token); + UserByPort depositoryManager = PublicConfig.FindUserById(uid, userKey, token); // 获取用户的用工关系 int emptype = depositoryManager.getEmptype(); if (emptype > 10) { @@ -2818,7 +2817,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { map.put("balancePosterTime", DateUtil.DateTimeToTimeStamp(simpleTime)); map.put("balancePoster", userByPort.getId()); // 获取综合办负责人 - List departmentHeadByUser = userService.getDepartmentHeaderByIdForNoPack(268L ); + List departmentHeadByUser = userService.getDepartmentHeaderByIdForNoPack(268L); StringBuilder departmentId = new StringBuilder(); for (UserByPort byPort : departmentHeadByUser) { departmentId.append(byPort.getId()).append(","); @@ -3098,7 +3097,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 获取当前转移物料仓库 Depository depositoryRecordById = depositoryMapper.findDepositoryById(material.getDepositoryId()); // Administration company = administrativeService.findAdministrationById(userByPort.getMaindeparment()); - Administration company = PublicConfig.getCompany(userByPort.getMaindeparment(),userKey,token); + Administration company = PublicConfig.getCompany(userByPort.getMaindeparment(), userKey, token); // 生成出库订单 map.put("code", createCode(depositoryRecordById.getDname(), "outOrderNumber", "out", company.getName())); Object placeId = map.get("fromPlaceId"); @@ -3188,7 +3187,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { List minByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(record.getId()); // 获取申请用户 - UserByPort applicantUser = PublicConfig.FindUserById(record.getApplicantId(),userKey,token); + UserByPort applicantUser = PublicConfig.FindUserById(record.getApplicantId(), userKey, token); // 用于标志该仓库是否为前置仓下的仓库 boolean flagForHasOtherDepository = true; //默认是前置仓下的仓库 // 获取当前出库是否为开放出库 @@ -3196,8 +3195,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { int flagForOpenDepository = record.getFlagForOpenDepository(); if (manager1 != null && !"".equals(manager1)) { flagForHasOtherDepository = false; - } - else { + } else { if (flagForOpenDepository != 1) { // 如果是开放仓库 @@ -3277,7 +3275,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { String adminorg = depositoryById.getAdminorg(); // List departmentHeadByUser = userService.getDepartmentHeaderByIdForNoPack(ObjectFormatUtil.toLong(adminorg)); - List departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toLong(adminorg),userKey,token); + List departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toLong(adminorg), userKey, token); for (UserByPort departmentHead : departmentHeadByUser ) { @@ -3293,7 +3291,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 获取仓储中心负责人 - List departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(361L,userKey,token); + List departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(361L, userKey, token); for (UserByPort userByPort : departmentHeadByUser) { depositoryManager.append(userByPort.getId()).append(","); @@ -3342,7 +3340,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { if ("".equals(depositorymanager)) { continue; } - UserByPort depositoryManage = PublicConfig.FindUserById(ObjectFormatUtil.toLong(depositorymanager),userKey,token); + UserByPort depositoryManage = PublicConfig.FindUserById(ObjectFormatUtil.toLong(depositorymanager), userKey, token); // 获取用户的用工关系 int emptype = depositoryManage.getEmptype(); if (emptype > 10) { @@ -3401,7 +3399,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { if ("".equals(s)) { continue; } - UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toLong(s),userKey,token); + UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toLong(s), userKey, token); // 获取用户的用工关系 int emptype = userByPort.getEmptype(); if (emptype > 10) { @@ -3417,8 +3415,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { s = "PangFuZhen,"; qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toLong(id), s, userAgent, 1, userKey, token); }); - } - else if (map.containsKey("balancePosterPass") && !flagForHasOtherDepository) { + } else if (map.containsKey("balancePosterPass") && !flagForHasOtherDepository) { // 如果是平衡岗人员审批且进入该流程 String result = ""; @@ -3438,7 +3435,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 获取综合办负责人 - List departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(268L,userKey,token); + List departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(268L, userKey, token); for (UserByPort userByPort : departmentHeadByUser) { depositoryManager.append(userByPort.getId()).append(","); @@ -3463,7 +3460,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { if ("".equals(depositorymanager)) { continue; } - UserByPort depositoryManage = PublicConfig.FindUserById(ObjectFormatUtil.toLong(depositorymanager),userKey,token); + UserByPort depositoryManage = PublicConfig.FindUserById(ObjectFormatUtil.toLong(depositorymanager), userKey, token); // 获取用户的用工关系 int emptype = depositoryManage.getEmptype(); if (emptype > 10) { @@ -3522,7 +3519,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { if ("".equals(s)) { continue; } - UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toLong(s),userKey,token); + UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toLong(s), userKey, token); // 获取用户的用工关系 int emptype = userByPort.getEmptype(); if (emptype > 10) { @@ -3538,8 +3535,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { s = "PangFuZhen,"; qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toLong(id), s, userAgent, 1, userKey, token); }); - } - else { + } else { String result = ""; // 开启线程更改其他用户卡片模板样式 String simpleTime = DateUtil.getSimpleTime(new Date()); @@ -3642,7 +3638,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 定义用于获取当前岗位下的人的参数map Map paramForGetUserByPost = new HashMap<>(); paramForGetUserByPost.put("position", roleAndMaterialType.getUid()); - List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost,userKey,token); + List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); for (UserByPort userByPort : userByPortList) { int emptype = userByPort.getEmptype(); if (emptype > 10) { @@ -3665,7 +3661,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { for (Long integer : userIdByDid) { // 获取仓库管理员信息 - UserByPort manager = PublicConfig.FindUserById(integer,userKey,token); + UserByPort manager = PublicConfig.FindUserById(integer, userKey, token); // 获取用户的用工关系 int emptype = manager.getEmptype(); if (emptype > 10) { @@ -3729,7 +3725,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 定义用于获取当前岗位下的人的参数map Map paramForGetUserByPost = new HashMap<>(); paramForGetUserByPost.put("position", roleAndDepository.getUserId()); - List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost,userKey,token); + List userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); for (UserByPort userByPort : userByPortList) { int emptype = userByPort.getEmptype(); if (emptype > 10) { @@ -3754,7 +3750,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 修改redis中用户的数据 updateRedisDataForUserManager(integer, minRecordKey); // 获取仓库管理员信息 - UserByPort manager = PublicConfig.FindUserById(integer,userKey,token); + UserByPort manager = PublicConfig.FindUserById(integer, userKey, token); // 获取用户的用工关系 int emptype = manager.getEmptype(); if (emptype > 10) { @@ -3792,7 +3788,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { if ("".equals(s)) { continue; } - UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toLong(s),userKey,token); + UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toLong(s), userKey, token); // 获取用户的用工关系 int emptype = userByPort.getEmptype(); if (emptype > 10) { @@ -3839,7 +3835,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { SendQyWxMessageThreadPool.execute(() -> { // 获取responseCode(key为申请人number) //获取部门负责人信息 - UserByPort departHead = PublicConfig.FindUserById(ObjectFormatUtil.toLong(record.getDepartmenthead()),userKey,token); + UserByPort departHead = PublicConfig.FindUserById(ObjectFormatUtil.toLong(record.getDepartmenthead()), userKey, token); // 获取用户的用工关系 int emptype = departHead.getEmptype(); if (emptype <= 10) { @@ -4793,6 +4789,31 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { userByPortById.setMaindeparmentname(departmentByUser.getName()); userByPortMap.put(applicantId, userByPortById); } + // 当前物料单价 + double mprice = ObjectFormatUtil.divide(applicationInRecord.getMprice(), 100.0, 2); + // 获取入库数据 + double quantity = ObjectFormatUtil.divide(applicationInRecord.getQuantity(), 100.0, 2); + // 获取入库单位 + String airUnit = applicationInRecord.getAirUnit(); + // 获取入库物料单位 + String munit = applicationInRecord.getMunit(); + double amounts = 0.0; + if (munit.equals(airUnit)) { + // 如果是基础单位 + amounts = ObjectFormatUtil.multiply(mprice, quantity); + } else { + // 获取当前对应的拆单记录 + Map paramForSplitInfo = new HashMap<>(); + paramForSplitInfo.put("mid", applicationInRecord.getMid()); + paramForSplitInfo.put("newUnit", airUnit); + SplitInfo splitInfo = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo); +// // 获取当前拆单记录与基础单位进制 + int splitInfoScaleQuantity = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1L); + BigDecimal bg = new BigDecimal(mprice / splitInfoScaleQuantity * quantity); + amounts = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + } + applicationInRecord.setPrice(amounts); + String time = DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(applicationInRecord.getApplicantTime())); applicationInRecord.setApplicantName(userByPortById.getName()); applicationInRecord.setApplicantTime(time); @@ -4941,9 +4962,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 当前单的总额 double amounts = 0.0; // 当前物料单价 - double mprice = ObjectFormatUtil.divide(recordP.getMprice(),100.0,2); + double mprice = ObjectFormatUtil.divide(recordP.getMprice(), 100.0, 2); // 当前出库数 - double quantity = ObjectFormatUtil.divide(recordP.getQuantity(),100.0,2); + double quantity = ObjectFormatUtil.divide(recordP.getQuantity(), 100.0, 2); if ("-1".equals(unit) || unit.equals("")) { amounts = ObjectFormatUtil.multiply(mprice, quantity); } else { @@ -4965,8 +4986,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { UserByPort userByPortById = null; if (userByPortMap.containsKey(applicantId)) { userByPortById = userByPortMap.get(applicantId); - } - else { + } else { userByPortById = userService.findUserByIdForNoPack(applicantId); Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById); userByPortById.setMaindeparmentname(departmentByUser.getName()); @@ -5097,11 +5117,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 当前单的总额 double amounts = 0.0; // 当前物料单价 - double mprice = ObjectFormatUtil.divide(recordP.getMprice(),100.0,2); + double mprice = ObjectFormatUtil.divide(recordP.getMprice(), 100.0, 2); // 当前出库数 - double quantity = ObjectFormatUtil.divide(recordP.getQuantity(),100.0,2); + double quantity = ObjectFormatUtil.divide(recordP.getQuantity(), 100.0, 2); if ("-1".equals(unit) || unit.equals("")) { - amounts = ObjectFormatUtil.multiply(mprice, quantity); + amounts = ObjectFormatUtil.multiply(mprice, quantity); } else { // // 获取当前对应的拆单记录 Map paramForSplitInfo = new HashMap<>(); @@ -5121,8 +5141,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { UserByPort userByPortById = null; if (userByPortMap.containsKey(applicantId)) { userByPortById = userByPortMap.get(applicantId); - } - else { + } else { userByPortById = userService.findUserByIdForNoPack(applicantId); Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById); userByPortById.setMaindeparmentname(departmentByUser.getName()); diff --git a/src/main/resources/templates/pages/depository/table-in.html b/src/main/resources/templates/pages/depository/table-in.html index 5866b3f8..0686dc7e 100644 --- a/src/main/resources/templates/pages/depository/table-in.html +++ b/src/main/resources/templates/pages/depository/table-in.html @@ -97,7 +97,7 @@