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 b86e0efd..637353b4 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java @@ -14,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; import java.util.*; import java.util.concurrent.TimeUnit; @@ -727,7 +728,7 @@ public class DepositoryRecordController { // 获取申请的物料信息 Inventory materialById = materialService.findInventoryById(applicationOutMinById.getMid()); if ("-1".equals(applicationOutMinById.getUnit())) { - simpleApplicationOutMinRecordP.setShowQuantity(materialById.getUnit() + ":" + (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut())); + simpleApplicationOutMinRecordP.setShowQuantity(materialById.getUnit() + ":" + (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut())); } else { simpleApplicationOutMinRecordP.setShowQuantity(applicationOutMinById.getUnit() + ":" + (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut())); } @@ -754,7 +755,7 @@ public class DepositoryRecordController { simpleApplicationOutMinRecordP.setCheckerName(checker.getName()); simpleApplicationOutMinRecordP.setPcode(placeByDid.getCode()); // 当已经完成出库时设置数量为出库数 - simpleApplicationOutMinRecordP.setQuantity(applicationOutMinById.getQuantity()); + simpleApplicationOutMinRecordP.setQuantity(applicationOutMinById.getQuantity() ); } List materialAndProducedDateByMid = materialService.findMaterialAndProducedDateByMid(materialById.getId()); if (materialAndProducedDateByMid.size() > 0) { @@ -827,7 +828,22 @@ public class DepositoryRecordController { mcode.append(inventory.getCode()).append(","); depositoryName.append(depository.getDname()).append(","); sumQuantity += applicationOutRecordMin.getQuantity(); + String unit = applicationOutRecordMin.getUnit(); + if("-1".equals(unit)){ + sumPrice += (inventory.getPrice() * applicationOutRecordMin.getQuantity()); + }else{ + // 获取当前对应的拆单记录 + Map paramForSplitInfo = new HashMap<>(); + paramForSplitInfo.put("mid",inventory.getMid()); + paramForSplitInfo.put("newUnit",unit); + SplitInfo splitInfo = splitUnitService.findSplitInfoByMidAndUnit(paramForSplitInfo); + // 获取当前拆单记录与基础单位进制 + int splitInfoScaleQuantity = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); + BigDecimal bg = new BigDecimal(inventory.getPrice() / splitInfoScaleQuantity); + double newprice = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + sumPrice += (newprice * applicationOutRecordMin.getQuantity()); + } } outRecordP.setMcode(mcode.toString()); outRecordP.setMname(mname.toString()); diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java index a0591783..5eafec39 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java @@ -2527,9 +2527,9 @@ public class PageController { map.put("depositoryId", depositoryId); // 获取当前仓库下的所有库存 List inventoryByDepository = materialService.findInventoryByDepository(map); - for (int i = 0; i < inventoryByDepository.size(); i++) { + for (InventoryP inventoryP : inventoryByDepository) { // 如果该库存明细在默认库位中 - MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(0, inventoryByDepository.get(i).getId()); + MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(0, inventoryP.getId()); if (placeAndMaterialByMidAndPid != null) { // 如果是默认库位 midList.add(placeAndMaterialByMidAndPid.getMid()); diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml b/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml index c7bb3ede..02ac3d96 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml @@ -1341,13 +1341,14 @@ trueOut = #{trueOut}, - - adminorgid = #{adminorgid}, + + constructionunitid = #{constructionUnitId}, - - constructionunitid = #{constructionunitid} + + adminorgid = #{adminorgId} + where id = #{id} diff --git a/src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java b/src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java index e5138208..8aa3386e 100644 --- a/src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java +++ b/src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java @@ -124,7 +124,7 @@ public class ApplicationOutRecordMinP { /** * 已经出库的数量 */ - private Integer trueOut; + private Double trueOut; @@ -142,6 +142,6 @@ public class ApplicationOutRecordMinP { this.transferId = recordMin.getTransferId(); this.constructionUnitId = recordMin.getConstructionUnitId(); this.adminorgId = recordMin.getAdminorgId(); - this.trueOut = recordMin.getTrueOut(); + this.trueOut =(double) (recordMin.getTrueOut() / 100); } } diff --git a/src/main/java/com/dreamchaser/depository_manage/pojo/SimpleApplicationOutMinRecordP.java b/src/main/java/com/dreamchaser/depository_manage/pojo/SimpleApplicationOutMinRecordP.java index 9597a293..5debb3d4 100644 --- a/src/main/java/com/dreamchaser/depository_manage/pojo/SimpleApplicationOutMinRecordP.java +++ b/src/main/java/com/dreamchaser/depository_manage/pojo/SimpleApplicationOutMinRecordP.java @@ -80,7 +80,7 @@ public class SimpleApplicationOutMinRecordP { /** * 已经出库的数量 */ - private Integer trueOut; + private Double trueOut; /** * 用于展示的数量 diff --git a/src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java b/src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java index b9b9e365..7455914f 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java @@ -555,6 +555,6 @@ public interface DepositoryRecordService { * @param realSplitInfo 实际出库的拆单记录 * @return */ - RestResponse updateOutSplitInventoryInfo(SplitInfo splitInfo, MaterialAndPlace materialAndPlace, int quantity, int nowQuantity, SplitInfo realSplitInfo); + RestResponse updateOutSplitInventoryInfo(SplitInfo splitInfo, MaterialAndPlace materialAndPlace, double quantity, double nowQuantity, SplitInfo realSplitInfo); } 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 35d4072d..b043efa1 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 @@ -262,7 +262,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { String code = createCode(dname, "outOrderNumber", "out", company.getName()); map.put("code", code); map.put("pass", 3); - map.put("quantity",quantity); + map.put("quantity", quantity); return depositoryRecordMapper.insertApplicationOutRecord(map); } @@ -865,8 +865,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { public List findApplicationOutRecordMinByParent(Integer id) { List outRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(id); List recordMinPList = new ArrayList<>(); - for (ApplicationOutRecordMin aorm:outRecordMinByParent - ) { + for (ApplicationOutRecordMin aorm : outRecordMinByParent + ) { ApplicationOutRecordMinP aormP = new ApplicationOutRecordMinP(aorm); recordMinPList.add(aormP); } @@ -893,9 +893,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { @Override public List findApplicationOutMinByCondition(Map map) { List condition = depositoryRecordMapper.findApplicationOutMinByCondition(map); - List result = new ArrayList<>(); - for (ApplicationOutRecordMin aorm:condition - ) { + List result = new ArrayList<>(); + for (ApplicationOutRecordMin aorm : condition + ) { result.add(new ApplicationOutRecordMinP(aorm)); } return result; @@ -913,8 +913,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { map.put("parentId", parentId); List applicationOutMinByCondition = depositoryRecordMapper.findApplicationOutMinByCondition(map); List applicationOutRecordMinPList = new ArrayList<>(); - for (ApplicationOutRecordMin recordMin:applicationOutMinByCondition - ) { + for (ApplicationOutRecordMin recordMin : applicationOutMinByCondition + ) { ApplicationOutRecordMinP recordMinP = new ApplicationOutRecordMinP(recordMin); applicationOutRecordMinPList.add(recordMinP); } @@ -953,7 +953,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { Integer istransfer = record.getIstransfer(); // 获取要出库的数量 - Integer trueOut = ObjectFormatUtil.toInteger(param.get("trueOut")); + Double trueOut = ObjectFormatUtil.toDouble(param.get("trueOut")); // 获取出库库位 Integer placeId = ObjectFormatUtil.toInteger(param.get("placeId")); @@ -978,7 +978,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { placeAndMaterialByMidAndPid = placeMapper.findPlaceAndMaterialByMidAndPid(params); if (placeAndMaterialByMidAndPid != null) { // 如果当前库位存在该物料 - if (placeAndMaterialByMidAndPid.getQuantity() < trueOut) { + if (placeAndMaterialByMidAndPid.getQuantity() < trueOut * 100) { // 如果当前库位数量不足 flag = false; } @@ -1010,20 +1010,20 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 如果物料数量可以出库并且库位数量充足 if (inventory.getQuantity() >= trueOut && flag) { // 当前出库数量 - Integer quantity = trueOut; - inventory.setQuantity(inventory.getQuantity() - quantity); - inventory.setNumberOfTemporary(inventory.getNumberOfTemporary() - quantity); + Double quantity = trueOut * 100; + inventory.setQuantity(inventory.getQuantity() - quantity.intValue()); + inventory.setNumberOfTemporary(inventory.getNumberOfTemporary() - quantity.intValue()); // 修改物料信息 materialMapper.updateInventory(inventory); // 修改当前库位存放物料的数量 - placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - quantity); + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - quantity.intValue()); placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); // 修改库位数量 Place placeById = placeMapper.findPlaceById(placeId); - placeById.setQuantity(placeById.getQuantity() - quantity); + placeById.setQuantity(placeById.getQuantity() - quantity.intValue()); placeMapper.UpdatePlace(placeById); @@ -1057,9 +1057,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { materialAndProducedDateByMid) { if (materialAndProducedDate.getInventory() > quantity) { // 设置使用的数量 - materialAndProducedDate.setExpendnum(materialAndProducedDate.getExpendnum() + quantity); + materialAndProducedDate.setExpendnum(materialAndProducedDate.getExpendnum() + quantity.intValue()); // 设置剩余的数量 - materialAndProducedDate.setInventory(materialAndProducedDate.getInventory() - quantity); + materialAndProducedDate.setInventory(materialAndProducedDate.getInventory() - quantity.intValue()); materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); // 跳出循环 break; @@ -1073,7 +1073,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { restResponse.setData(""); restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); } - } else { + } + else { // 如果是拆单后的出库 // 用于获取对应的拆单记录 @@ -1100,16 +1101,16 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { if (splitInventory != null) { // 如果拆单库存处理记录存在 - if (splitInventory.getSaveQuantity() >= trueOut) { + if (splitInventory.getSaveQuantity() >= trueOut * 100) { // 如果当前待处理树可以满足需求 - splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - trueOut); + splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - (int) (trueOut * 100)); // 设置当前拆单后的出库数量 if (splitInventory.getOutQuantity() != null) { - splitInventory.setOutQuantity(splitInventory.getOutQuantity() + trueOut); + splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int) (trueOut * 100)); } else { - splitInventory.setOutQuantity(trueOut); + splitInventory.setOutQuantity((int) (trueOut * 100)); } // 修改库存处理记录 @@ -1141,7 +1142,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { SplitInfo splitInfoById = splitUnitMapper.findSplitInfoById(splitInventory.getSid()); // 获取剩余不足的数量 - int surplus = trueOut - splitInventory.getSaveQuantity(); + int surplus = (int) (trueOut * 100 - splitInventory.getSaveQuantity()); if (splitInfoById.getParentId() != null) { // 如果当前拆单有父级 @@ -1178,11 +1179,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { } updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); - } else { + } + else { // 如果当前拆单没有父级 - if (surplus <= splitInfoById.getQuantity()) { + if (surplus <= splitInfoById.getQuantity() * 100) { // 如果当前未处理的数量小于当前拆单库存数量 @@ -1196,7 +1198,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { if (placeAndMaterialByMidAndPid != null) { // 如果当前库位存在该物料 - if (placeAndMaterialByMidAndPid.getQuantity() < 1) { + if (placeAndMaterialByMidAndPid.getQuantity() < 100) { // 如果当前库存中的物料库存不足以出库 flag = false; } @@ -1208,10 +1210,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { } // 如果物料数量可以出库并且库位数量充足 - if (inventory.getQuantity() >= 1 && flag) { + if (inventory.getQuantity() >= 100 && flag) { // 令库存-1 - inventory.setQuantity(inventory.getQuantity() - 1); + inventory.setQuantity(inventory.getQuantity() - 100); // 修改库存记录 @@ -1219,12 +1221,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 修改当前库位存放物料的数量 - placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - 1); + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - 100); placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); // 修改库位数量 Place placeById = placeMapper.findPlaceById(placeId); - placeById.setQuantity(placeById.getQuantity() - 1); + placeById.setQuantity(placeById.getQuantity() - 100); placeMapper.UpdatePlace(placeById); @@ -1238,8 +1240,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { } // 设置剩余拆单库存处理数量 - splitInventory.setSaveQuantity(splitInfoById.getQuantity() + splitInventory.getSaveQuantity() - trueOut); - splitInventory.setOutQuantity(splitInventory.getOutQuantity() + trueOut); + splitInventory.setSaveQuantity(splitInfoById.getQuantity() * 100 + splitInventory.getSaveQuantity() - (int) (trueOut * 100)); + splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int) (trueOut * 100)); splitUnitMapper.updateSplitInventory(splitInventory); // 如果是库存转移订单 @@ -1258,16 +1260,18 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { restResponse.setData(""); restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功")); - } else { + } + else { restResponse.setStatus(508); restResponse.setData(""); restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); } - } else { + } + else { // 如果大于 // 获取库存重要减少的数量 - int surplus_redundant = surplus / splitInfoById.getQuantity(); + int surplus_redundant = surplus / (splitInfoById.getQuantity() * 100); // 获取拆单库存处理中要处理数量 int saveQuantity = surplus - surplus_redundant * splitInfoById.getQuantity(); @@ -1275,8 +1279,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 如果要处理的数量大于剩余数量 // 获取一个数量 - surplus_redundant += 1; - splitInventory.setSaveQuantity(splitInfoById.getQuantity() + splitInventory.getSaveQuantity() - saveQuantity); + surplus_redundant += 100; + splitInventory.setSaveQuantity(splitInfoById.getQuantity() * 100 + splitInventory.getSaveQuantity() - saveQuantity); } else { // 如果不大于 splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - saveQuantity); @@ -1326,7 +1330,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 如果是库存转移订单 Map map = new HashMap<>(); if (record.getIstransfer() == 1) { - map.put("quantity", String.valueOf(surplus_redundant)); + map.put("quantity", String.valueOf((double)surplus_redundant / 100)); map.put("applicantId", record.getApplicantId()); map.put("minRecordId", applicationOutMinById.getId()); // 出库订单编号 transferMaterial(map); @@ -1346,33 +1350,34 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { } } - } else { + } + else { // 如果拆单库存处理记录不存在 int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); - if (inventory.getQuantity() * scale > trueOut) { + if (inventory.getQuantity() * scale >= trueOut) { // 如果当前库存数量满足要求 // 获取当前出库的具体数目 int residue = (int) Math.ceil(trueOut / (double) splitInfo.getQuantity()); // 获取剩余数目 - int residue_realQuantity = residue * scale - trueOut; + double residue_realQuantity = residue * scale - trueOut; // 设置新库存 - inventory.setQuantity(inventory.getQuantity() - residue); + inventory.setQuantity(inventory.getQuantity() - residue * 100); //更新库存 materialMapper.updateInventory(inventory); // 更新对应库位的库存 // 修改当前库位存放物料的数量 - placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue); + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue * 100); placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); // 修改库位数量 Place placeById = placeMapper.findPlaceById(placeId); - placeById.setQuantity(placeById.getQuantity() - residue); + placeById.setQuantity(placeById.getQuantity() - residue * 100); placeMapper.UpdatePlace(placeById); @@ -1434,7 +1439,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { * @param realSplitInfo 实际出库的拆单记录 * @return */ - public RestResponse updateOutSplitInventoryInfo(SplitInfo splitInfo, MaterialAndPlace materialAndPlace, int quantity, int nowQuantity, SplitInfo realSplitInfo) { + public RestResponse updateOutSplitInventoryInfo(SplitInfo splitInfo, MaterialAndPlace materialAndPlace, double quantity, double nowQuantity, SplitInfo realSplitInfo) { // 定义返回值 RestResponse restResponse = new RestResponse(); // 用于获取当前拆单记录对应的拆单库存记录 @@ -1444,15 +1449,15 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { SplitInventory splitInventoryForSplitInfo = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); // 获取当前拆单记录与实际出库拆单之间的进制 int parentScale = splitUnitService.findSplitInfoScaleQuantity(realSplitInfo, splitInfo.getId()); - if (splitInventoryForSplitInfo.getSaveQuantity() * parentScale >= nowQuantity) { + if (splitInventoryForSplitInfo.getSaveQuantity() * parentScale >= nowQuantity * 100) { // 如果当前库存拆单记录的库存可以满足需要 // 计算当前拆单库存具体减少的数量 int realSaveQuantity = (int) Math.ceil(nowQuantity / (double) parentScale); // 设置当前拆单库存 - splitInventoryForSplitInfo.setSaveQuantity(splitInventoryForSplitInfo.getSaveQuantity() - realSaveQuantity); + splitInventoryForSplitInfo.setSaveQuantity(splitInventoryForSplitInfo.getSaveQuantity() - realSaveQuantity * 100); // 设置当前拆单出库库存数 - splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + realSaveQuantity); + splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + realSaveQuantity * 100); // 修改库存记录 splitUnitMapper.updateSplitInventory(splitInventoryForSplitInfo); @@ -1462,7 +1467,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { paramForSplitInventory.put("sid", splitInfoByParentId.getId()); // 获取对应子类的库存 SplitInventory splitInventoryBySplitInfoByParentId = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); - splitInventoryBySplitInfoByParentId.setSaveQuantity(realSaveQuantity * parentScale - nowQuantity); + splitInventoryBySplitInfoByParentId.setSaveQuantity((int) (realSaveQuantity * parentScale - nowQuantity) * 100); splitUnitMapper.updateSplitInventory(splitInventoryBySplitInfoByParentId); } restResponse.setStatus(200); @@ -1517,7 +1522,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 设置当前库存数量 splitInventoryForSplitInfo.setSaveQuantity(scale * splitInfo.getQuantity() - splitInventoryForSplitInfo.getSaveQuantity()); // 设置当前出库数量 - splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + ((quantity - splitInventoryForSplitInfo.getSaveQuantity()))); + splitInventoryForSplitInfo.setOutQuantity((int) (splitInventoryForSplitInfo.getOutQuantity() + ((quantity * 100 - splitInventoryForSplitInfo.getSaveQuantity())))); // 修改当前拆单库存处理记录 } else { @@ -1531,9 +1536,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { splitUnitMapper.updateSplitInventory(parentSplitInventoryForSplitInfo); // 设置当前拆单库存数 - splitInventoryForSplitInfo.setSaveQuantity(splitInventoryForSplitInfo.getSaveQuantity() - quantity); + splitInventoryForSplitInfo.setSaveQuantity(splitInventoryForSplitInfo.getSaveQuantity() - (int) (quantity * 100)); // 设置当前拆单库存出库数 - splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + quantity); + splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + (int) (quantity * 100)); // 修改当前拆单库存处理记录 } @@ -1566,7 +1571,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { splitInfoScaleQuantity *= splitUnitService.findSplitInfoScaleQuantity(realSplitInfo, parentSplitInfo.getId()); } if (data != null && !"".equals(data.toString())) { - int surplus_redundant = ObjectFormatUtil.toInteger(data) * (int) splitInfoScaleQuantity; + double surplus_redundant = ObjectFormatUtil.toDouble(data) * splitInfoScaleQuantity; if (surplus_redundant - nowQuantity == 0) { // 如果刚好完成出库且没有剩余 restResponse.setStatus(200); @@ -1602,7 +1607,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 如果可以出库 // 计算当前不足的数量 - int residue_quantity = realQuantity - nowQuantity; + double residue_quantity = realQuantity - nowQuantity; // 计算库存需要减少的数量 int inventory_quantity = (int) Math.ceil((double) residue_quantity / splitInfoQuantity); @@ -1673,7 +1678,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { * @param userAgent user-agent */ @Transactional(rollbackFor = Exception.class) - void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Integer trueOut, UserByPort userByPort, Integer placeId, String userAgent) { + void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Double trueOut, UserByPort userByPort, Integer placeId, String userAgent) { String redisMinRecordKey = "minRecord:" + id; // 设置redis中子订单键值 // 修改redis中本子订单状态 // redisTemplate.opsForHash().put(redisMinRecordKey,"state","2"); @@ -1681,7 +1686,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // redisTemplate.opsForHash().put(redisMinRecordKey,"manager",userByPort.getId().toString()); // 修改当前已经出库的数量 - applicationOutMinById.setTrueOut(trueOut + applicationOutMinById.getTrueOut()); + applicationOutMinById.setTrueOut((int) (trueOut * 100) + applicationOutMinById.getTrueOut()); if (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut() > 0) { // 如果当前子订单中的物料并未完全出库 depositoryRecordMapper.updateApplicationOutRecordMin(applicationOutMinById); @@ -2631,7 +2636,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 用于调用入库方法而创建的 Map paramForUpdateInventory = new HashMap<>(); paramForUpdateInventory.put("mid", recordP.getMid()); - paramForUpdateInventory.put("quantity", (double)recordP.getQuantity() / 100); + paramForUpdateInventory.put("quantity", (double) recordP.getQuantity() / 100); paramForUpdateInventory.put("depositoryId", recordP.getDepositoryId()); paramForUpdateInventory.put("placeId", recordP.getPlaceId()); if (materialById.getUnit().equals(recordP.getAirUnit())) { @@ -3630,8 +3635,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { public List findApplicationOutRecordByDepository(String depositoryId) { List recordList = depositoryRecordMapper.findApplicationOutRecordByDepository(depositoryId); List result = new ArrayList<>(); - for (ApplicationOutRecord record:recordList - ) { + for (ApplicationOutRecord record : recordList + ) { ApplicationOutRecordP recordP = new ApplicationOutRecordP(record); result.add(recordP); } @@ -3890,7 +3895,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { Material materialById = materialMapper.findMaterialById(mid); if (materialById.getPrice() != null) { - sum += (materialById.getPrice() / 100) * ((double)applicationOutRecordMin.getQuantity() / 100); + sum += (materialById.getPrice() / 100) * ((double) applicationOutRecordMin.getQuantity() / 100); } else { sum += 0; } @@ -4592,8 +4597,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 数量 double count = 0; for (ApplicationOutRecordMin recordMin : minList) { - double quantity =(double) recordMin.getQuantity() / 100; - count += quantity ; + double quantity = (double) recordMin.getQuantity() / 100; + count += quantity; // 获取当前出库物料 Inventory materialById = materialMapper.findInventoryById(recordMin.getMid()); // 计算当前出库金额 diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java index b6b01680..66e7cd4b 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java @@ -775,7 +775,7 @@ public class QyWxOperationService { unit = materialById.getUnit(); } content.append(">- 物料名称:").append(materialById.getMname()).append("%n"); - content.append(">- 申请数量:").append(recordMin.getQuantity()).append("%n"); + content.append(">- 申请数量:").append(recordMin.getQuantity() / 100).append("%n"); content.append(">- 出库单位:").append(unit).append("%n"); content.append(">- 所处仓库:").append(depositoryRecordById.getDname()).append("%n"); content.append(">- 出库人员:").append(userByPort.getName()).append("%n"); @@ -1233,7 +1233,7 @@ public class QyWxOperationService { TemplateCard_horizontal_content horizontal_content_quantity = new TemplateCard_horizontal_content(); horizontal_content_quantity.setType(0); horizontal_content_quantity.setKeyname("申请数量:"); - horizontal_content_quantity.setValue(recordMin.getQuantity().toString()); + horizontal_content_quantity.setValue(String.valueOf(recordMin.getQuantity() / 100)); // 申请单位 TemplateCard_horizontal_content horizontal_content_unit = new TemplateCard_horizontal_content(); diff --git a/src/main/resources/templates/pages/depository/table-in.html b/src/main/resources/templates/pages/depository/table-in.html index 19de5e5c..da0f1e7e 100644 --- a/src/main/resources/templates/pages/depository/table-in.html +++ b/src/main/resources/templates/pages/depository/table-in.html @@ -169,7 +169,6 @@ {field: 'airUnit', width: 100, title: '计量单位'}, {field: 'mcode', width: 150, title: '存货编码'}, {field: 'quantity', width: 150, title: '数量', sort: true}, - {field: 'price', title: '金额', minWidth: 150, sort: true}, {field: 'depositoryName', width: 150, title: '仓库名称'}, {field: 'applicantName', width: 200, title: '提交人'}, {field: 'applicantTime', width: 200, title: '提交时间', sort: true}, diff --git a/src/main/resources/templates/pages/place/materialForPlace.html b/src/main/resources/templates/pages/place/materialForPlace.html index 81538a3e..5f6dea81 100644 --- a/src/main/resources/templates/pages/place/materialForPlace.html +++ b/src/main/resources/templates/pages/place/materialForPlace.html @@ -34,11 +34,15 @@ 库存 - 409 + + 409 + 库存 - 409 + + 409 + diff --git a/src/main/resources/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html b/src/main/resources/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html index 751af5fc..0f9efed6 100644 --- a/src/main/resources/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html +++ b/src/main/resources/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html @@ -63,7 +63,12 @@ } else { wxScan = wxScan.parent.wx; } - wxScan.scanQRCode({ + + var result = "1635078996227301376";//当needResult为1时返回处理结果 + var req = {}; + req.qrCode = result; + outboundLogic(req); + /* wxScan.scanQRCode({ desc: 'scanQRCode desc', needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, scanType: ["barCode", "qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 @@ -82,7 +87,7 @@ } - }); + });*/ }); diff --git a/src/test/java/com/dreamchaser/depository_manage/TestForOther.java b/src/test/java/com/dreamchaser/depository_manage/TestForOther.java index 5770a3ef..2da4c036 100644 --- a/src/test/java/com/dreamchaser/depository_manage/TestForOther.java +++ b/src/test/java/com/dreamchaser/depository_manage/TestForOther.java @@ -47,7 +47,7 @@ public class TestForOther { ApprovalInfo_Details_Approver approver = new ApprovalInfo_Details_Approver(); approver.setUserId("PangFuZhen"); approvalInfo.setApprover(approver); - depositoryRecordService.reviewByQyWxApprovalOut("1",approvalInfo,"460f46eaefb46bb0c171029f62e2cea6","2","202303170033", false,2); + depositoryRecordService.reviewByQyWxApprovalOut("5",approvalInfo,"460f46eaefb46bb0c171029f62e2cea6","2","202303180009", false,2); } diff --git a/target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml b/target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml index c7bb3ede..02ac3d96 100644 --- a/target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml +++ b/target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml @@ -1341,13 +1341,14 @@ trueOut = #{trueOut}, - - adminorgid = #{adminorgid}, + + constructionunitid = #{constructionUnitId}, - - constructionunitid = #{constructionunitid} + + adminorgid = #{adminorgId} + where id = #{id} diff --git a/target/classes/templates/pages/depository/table-in.html b/target/classes/templates/pages/depository/table-in.html index 19de5e5c..da0f1e7e 100644 --- a/target/classes/templates/pages/depository/table-in.html +++ b/target/classes/templates/pages/depository/table-in.html @@ -169,7 +169,6 @@ {field: 'airUnit', width: 100, title: '计量单位'}, {field: 'mcode', width: 150, title: '存货编码'}, {field: 'quantity', width: 150, title: '数量', sort: true}, - {field: 'price', title: '金额', minWidth: 150, sort: true}, {field: 'depositoryName', width: 150, title: '仓库名称'}, {field: 'applicantName', width: 200, title: '提交人'}, {field: 'applicantTime', width: 200, title: '提交时间', sort: true}, diff --git a/target/classes/templates/pages/place/materialForPlace.html b/target/classes/templates/pages/place/materialForPlace.html index 81538a3e..5f6dea81 100644 --- a/target/classes/templates/pages/place/materialForPlace.html +++ b/target/classes/templates/pages/place/materialForPlace.html @@ -34,11 +34,15 @@ 库存 - 409 + + 409 + 库存 - 409 + + 409 + diff --git a/target/classes/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html b/target/classes/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html index 751af5fc..0f9efed6 100644 --- a/target/classes/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html +++ b/target/classes/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html @@ -63,7 +63,12 @@ } else { wxScan = wxScan.parent.wx; } - wxScan.scanQRCode({ + + var result = "1635078996227301376";//当needResult为1时返回处理结果 + var req = {}; + req.qrCode = result; + outboundLogic(req); + /* wxScan.scanQRCode({ desc: 'scanQRCode desc', needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, scanType: ["barCode", "qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 @@ -82,7 +87,7 @@ } - }); + });*/ });