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 fdebcf74..9915a513 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java @@ -2853,10 +2853,10 @@ public class PageController { MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(placeId, stcp.getMid()); // 获取盈亏数量 - Integer newInventory = stcp.getInventory(); + Double newInventory = stcp.getInventory(); // 获取当前盘点后超出的数量 - Integer inventory = newInventory + placeById.getQuantity() - placeById.getMax(); + Double inventory = newInventory + placeById.getQuantity() - placeById.getMax(); // 将计算后的数量赋值(最少转移量) stcp.setInventory(inventory); diff --git a/src/main/java/com/dreamchaser/depository_manage/entity/StockTakingChild.java b/src/main/java/com/dreamchaser/depository_manage/entity/StockTakingChild.java index 347a9f11..00090dc7 100644 --- a/src/main/java/com/dreamchaser/depository_manage/entity/StockTakingChild.java +++ b/src/main/java/com/dreamchaser/depository_manage/entity/StockTakingChild.java @@ -2,6 +2,8 @@ package com.dreamchaser.depository_manage.entity; import lombok.Data; +import java.util.List; + /** * 盘点子类 */ @@ -10,11 +12,17 @@ public class StockTakingChild { /** * id */ - private Integer id; + private Long id; /** * 物料id */ private Integer mid; + + + /** + * 盘点库位id + */ + private Integer pid; /** * 库存容量 */ @@ -27,12 +35,79 @@ public class StockTakingChild { * 盘点结果 */ private String takingResult; + + /** + * 盘点结果(展示) + */ + private String takingResultShow; /** * 盈亏数量 */ private Integer inventory; + + /** + * 盘点单号 + */ + private String code; + + /** + * 物料名称 + */ + private String mname; + + /** + * 物料编码 + */ + private String mcode; + + /** + * 物料与条形码的对应关系 + */ + private List materialAndBarCodeList; + + /** + * 类型id + */ + private Long mtId; + + /** + * 类型名称 + */ + private String tname; + + /** + * 物料材质 + */ + private String mtexture; + + /** + * 物料规格型号 + */ + private String mversion; + + /** + * 物料计量单位 + */ + private String munit; + /** * 主表id */ private Long mainId; + + /** + * 当前盘点物料选择的生产日期 + */ + private Long producedDate; + + /** + * 当前盘点的计量单位 + */ + private String unit; + + /** + * 用于展示当前盘点的计量单位 + */ + private String showUnit; + } diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.java b/src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.java index c82c30c8..98a8c8c7 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.java +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.java @@ -107,7 +107,7 @@ public interface StockTakingMapper { * @param mainId * @return */ - List selectStockTakingChildByMainId(Integer mainId); + List selectStockTakingChildByMainId(Integer mainId); /** @@ -115,7 +115,7 @@ public interface StockTakingMapper { * @param list * @return */ - List selectStockTakingChildByIds(List list); + List selectStockTakingChildByIds(List list); /** @@ -131,7 +131,7 @@ public interface StockTakingMapper { * @param map * @return */ - List selectStockTakingChildPByCondition(Map map); + List selectStockTakingChildPByCondition(Map map); /** * 根据主键查找主表 @@ -153,14 +153,14 @@ public interface StockTakingMapper { * @param id * @return */ - StockTakingChildP selectStockTakingChildPById(Integer id); + StockTakingChild selectStockTakingChildPById(Integer id); /** * 根据主键查找盘点详情 * @param id * @return */ - StockTakingChildP selectStockTakingChildPById(Long id); + StockTakingChild selectStockTakingChildPById(Long id); /** diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.xml b/src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.xml index 9f64557e..404fa81b 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.xml +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.xml @@ -19,7 +19,7 @@ - + diff --git a/src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForViewP.java b/src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForViewP.java index de39fa4d..364f4ce8 100644 --- a/src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForViewP.java +++ b/src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForViewP.java @@ -94,7 +94,7 @@ public class MaterialAndPlaceForViewP { /** * 盘点数量 */ - private Integer stockTakingQuantity; + private Double stockTakingQuantity; /** * 盘点结果 diff --git a/src/main/java/com/dreamchaser/depository_manage/pojo/StockTakingChildP.java b/src/main/java/com/dreamchaser/depository_manage/pojo/StockTakingChildP.java index c187293b..d167adbd 100644 --- a/src/main/java/com/dreamchaser/depository_manage/pojo/StockTakingChildP.java +++ b/src/main/java/com/dreamchaser/depository_manage/pojo/StockTakingChildP.java @@ -28,11 +28,11 @@ public class StockTakingChildP { /** * 库存容量 */ - private Integer oldInventory; + private Double oldInventory; /** * 盘点数量 */ - private Integer newInventory; + private Double newInventory; /** * 盘点结果 */ @@ -45,7 +45,7 @@ public class StockTakingChildP { /** * 盈亏数量 */ - private Integer inventory; + private Double inventory; /** * 盘点单号 @@ -113,7 +113,52 @@ public class StockTakingChildP { private String showUnit; - - - + public StockTakingChildP(StockTakingChild record) { + + this.id = record.getId(); + this.mid = record.getMid(); + this.pid = record.getPid(); + this.oldInventory = record.getOldInventory() / 100.0; + this.newInventory = record.getNewInventory() / 100.0; + this.takingResult = record.getTakingResult(); + this.takingResultShow = record.getTakingResultShow(); + this.inventory = record.getInventory() / 100.0; + this.code = record.getCode(); + this.mname = record.getMname(); + this.mcode = record.getMcode(); + this.materialAndBarCodeList = record.getMaterialAndBarCodeList(); + this.mtId = record.getMtId(); + this.tname = record.getTname(); + this.mtexture = record.getMtexture(); + this.mversion = record.getMversion(); + this.munit = record.getMunit(); + this.mainId = record.getMainId(); + this.producedDate = record.getProducedDate(); + this.unit = record.getUnit(); + this.showUnit = record.getShowUnit(); + } + + public StockTakingChildP(Long id, Integer mid, Integer pid, Double oldInventory, Double newInventory, String takingResult, String takingResultShow, Double inventory, String code, String mname, String mcode, List materialAndBarCodeList, Long mtId, String tname, String mtexture, String mversion, String munit, Long mainId, Long producedDate, String unit, String showUnit) { + this.id = id; + this.mid = mid; + this.pid = pid; + this.oldInventory = oldInventory; + this.newInventory = newInventory; + this.takingResult = takingResult; + this.takingResultShow = takingResultShow; + this.inventory = inventory; + this.code = code; + this.mname = mname; + this.mcode = mcode; + this.materialAndBarCodeList = materialAndBarCodeList; + this.mtId = mtId; + this.tname = tname; + this.mtexture = mtexture; + this.mversion = mversion; + this.munit = munit; + this.mainId = mainId; + this.producedDate = producedDate; + this.unit = unit; + this.showUnit = showUnit; + } } diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java index b729efc3..4596c86d 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java @@ -2766,13 +2766,13 @@ public class MaterialServiceImpl implements MaterialService { mpv.setTakingInventory(number); if ("Inventory_down".equals(takingResult)) { // 如果盘亏 - mpv.setStockTakingQuantity((int) (splitInventory.get(unit) - ObjectFormatUtil.toDouble(number))); + mpv.setStockTakingQuantity((splitInventory.get(unit) - ObjectFormatUtil.toDouble(number))); } else if ("Inventory_up".equals(takingResult)) { // 如果盘盈 - mpv.setStockTakingQuantity((int) (splitInventory.get(unit) + ObjectFormatUtil.toDouble(number))); + mpv.setStockTakingQuantity((splitInventory.get(unit) + ObjectFormatUtil.toDouble(number))); } else { // 如果正常 - mpv.setStockTakingQuantity(splitInventory.get(unit).intValue()); + mpv.setStockTakingQuantity(splitInventory.get(unit)); } } 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 d9b268ad..e0f4cf77 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 @@ -263,7 +263,7 @@ public class QyWxOperationService { StockTaking mainRecord = stockTakingMapper.selectStockTakingById(mainId); // 获取所有子记录 - List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); + List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); // 申请人id Integer getOriginator = mainRecord.getOriginator(); @@ -287,7 +287,7 @@ public class QyWxOperationService { Location.append(depository.getDname()); - for (StockTakingChildP childP : minRecordList) { + for (StockTakingChild childP : minRecordList) { // 获取子订单信息 // 获取当前申请物料 Inventory materialById = materialMapper.findInventoryById(childP.getMid()); @@ -500,7 +500,7 @@ public class QyWxOperationService { } // 获取所有子记录 - List minRecordList = stockTakingMapper.selectStockTakingChildByIds(normalMinId); + List minRecordList = stockTakingMapper.selectStockTakingChildByIds(normalMinId); // 申请人id Integer getOriginator = mainRecord.getOriginator(); @@ -524,14 +524,14 @@ public class QyWxOperationService { Location.append(depository.getDname()); - for (StockTakingChildP childP : minRecordList) { + for (StockTakingChild childP : minRecordList) { // 获取子订单信息 // 获取当前申请物料 Inventory materialById = materialMapper.findInventoryById(childP.getMid()); // 设置物料名称 mname.append(materialById.getMname()).append(","); // 设置盘点数量 - stockTakingQuantity.append(childP.getNewInventory()).append(","); + stockTakingQuantity.append((int)(childP.getNewInventory() / 100.0)).append(","); // 设置盘点结果 String takingResult = childP.getTakingResult(); if ("Inventory_up".equals(takingResult)) { @@ -543,7 +543,7 @@ public class QyWxOperationService { } stockTakingResult.append(takingResult).append(","); // 设置盈亏数量 - stockTakingInventory.append(childP.getInventory()).append(","); + stockTakingInventory.append((int)(childP.getInventory() / 100.0)).append(","); } // 1.获取access_token:根据企业id和应用密钥获取access_token,并拼接请求url @@ -619,7 +619,7 @@ public class QyWxOperationService { horizontal_content_quantity.setType(0); // 二级标题 horizontal_content_quantity.setKeyname("盘点数量"); - horizontal_content_quantity.setValue(stockTakingQuantity.toString()); + horizontal_content_quantity.setValue(String.valueOf(stockTakingQuantity)); // 二级标题+文本列表,用于设置盘点结果 TemplateCard_horizontal_content horizontal_content_result = new TemplateCard_horizontal_content(); @@ -847,7 +847,7 @@ public class QyWxOperationService { for (Long minId : minIds) { // 获取对应子订单 - StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId); + StockTakingChild minRecord = stockTakingMapper.selectStockTakingChildPById(minId); // 获取当前物料 Inventory material = materialMapper.findInventoryById(minRecord.getMid()); @@ -887,10 +887,10 @@ public class QyWxOperationService { } content.append(">- 物料名称:").append(material.getMname()).append("%n"); content.append(">- 盘点位置:").append(fromLocation).append("%n"); - content.append(">- 原库存数量:").append(minRecord.getOldInventory()).append("%n"); - content.append(">- 盘点数量:").append(minRecord.getNewInventory()).append("%n"); + content.append(">- 原库存数量:").append((int)(minRecord.getOldInventory() / 100.0)).append("%n"); + content.append(">- 盘点数量:").append((int)(minRecord.getNewInventory() / 100.0)).append("%n"); content.append(">- 盘点单位:").append(unit).append("%n"); - content.append(">- 盈亏数量:").append(minRecord.getInventory()).append("%n"); + content.append(">- 盈亏数量:").append((int)(minRecord.getInventory()/ 100.0)).append("%n"); content.append(">- 盘点结果:").append(takingResult).append("%n"); content.append("%n---%n"); } @@ -956,7 +956,7 @@ public class QyWxOperationService { for (Long minId : errIds) { // 获取错误的子订单 - StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId); + StockTakingChild minRecord = stockTakingMapper.selectStockTakingChildPById(minId); // 获取当前物料 Inventory material = materialMapper.findInventoryById(minRecord.getMid()); @@ -1053,7 +1053,7 @@ public class QyWxOperationService { for (Long minId : minIds) { // 获取对应子订单 - StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId); + StockTakingChild minRecord = stockTakingMapper.selectStockTakingChildPById(minId); // 获取当前物料 Inventory material = materialMapper.findInventoryById(minRecord.getMid()); @@ -1438,10 +1438,10 @@ public class QyWxOperationService { List userIdList = new ArrayList<>(); List departmentHeadForUserToken = PortConfig.findDepartmentHeadByUser(userToken.getMaindeparment(), userToken); - for (UserByPort departmentHead:departmentHeadForUserToken - ) { + for (UserByPort departmentHead : departmentHeadForUserToken + ) { String departmentHeadWorkwechat = departmentHead.getWorkwechat(); - if(departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)){ + if (departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)) { departmentHeadWorkwechat = departmentHead.getWechat(); } userIdList.add(departmentHeadWorkwechat); @@ -1780,10 +1780,10 @@ public class QyWxOperationService { String adminorg = depositoryById.getAdminorg(); List departmentHeadByUser = PortConfig.findDepartmentHeadByUser(ObjectFormatUtil.toInteger(adminorg), userToken); - for (UserByPort departmentHead:departmentHeadByUser - ) { + for (UserByPort departmentHead : departmentHeadByUser + ) { String departmentHeadWorkwechat = departmentHead.getWorkwechat(); - if(departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)){ + if (departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)) { departmentHeadWorkwechat = departmentHead.getWechat(); } otherDepartmentIdList.add(departmentHeadWorkwechat); @@ -2188,7 +2188,7 @@ public class QyWxOperationService { // 获取当前盘点主表 StockTaking mainRecord = stockTakingMapper.selectStockTakingById(mainId); // 获取当前主表下的子表 - List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); + List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); // 获取当前盘点位置 Depository depository = depositoryMapper.findDepositoryById(mainRecord.getDepositoryId()); @@ -2346,10 +2346,8 @@ public class QyWxOperationService { approval_template_apply_data_contents_info.setId("Table-1668152830942"); // 定义明细列表 List contents_detail = new ArrayList<>(); - for (int i = 0; i < minRecordList.size(); i++) { + for (StockTakingChild minRecord : minRecordList) { // 获取盘点明细详情 - StockTakingChildP minRecord = minRecordList.get(i); - // 获取当前盘点物料信息 Inventory materialById = materialMapper.findInventoryById(minRecord.getMid()); @@ -2478,7 +2476,7 @@ public class QyWxOperationService { detail_list_control_info_outNumber.put("title", detail_list_control_info_title_list_outNumber); Map detail_list_control_info_value_outNumber = new HashMap<>(); - detail_list_control_info_value_outNumber.put("new_number", minRecord.getOldInventory().toString()); + detail_list_control_info_value_outNumber.put("new_number", String.valueOf((minRecord.getOldInventory() / 100.0))); detail_list_control_info_outNumber.put("value", detail_list_control_info_value_outNumber); // 盘点数量 @@ -2494,7 +2492,7 @@ public class QyWxOperationService { detail_list_control_info_stockTakingNumber.put("title", detail_list_control_info_title_list_stockTakingNumber); Map detail_list_control_info_value_stockTakingNumber = new HashMap<>(); - detail_list_control_info_value_stockTakingNumber.put("new_number", minRecord.getNewInventory().toString()); + detail_list_control_info_value_stockTakingNumber.put("new_number", String.valueOf(minRecord.getNewInventory() / 100.0)); detail_list_control_info_stockTakingNumber.put("value", detail_list_control_info_value_stockTakingNumber); @@ -2536,7 +2534,7 @@ public class QyWxOperationService { detail_list_control_info_stockTakingInventory.put("title", detail_list_control_info_title_list_stockTakingInventory); Map detail_list_control_info_value_stockTakingInventory = new HashMap<>(); - detail_list_control_info_value_stockTakingInventory.put("new_number", minRecord.getInventory().toString()); + detail_list_control_info_value_stockTakingInventory.put("new_number", String.valueOf(minRecord.getInventory() / 100.0)); detail_list_control_info_stockTakingInventory.put("value", detail_list_control_info_value_stockTakingInventory); diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java index 78fe0015..e74cb1e5 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java @@ -126,6 +126,14 @@ public class StockTakingServiceImpl implements StockTakingService { map.remove("producedDate"); } } + // 将输入的值扩大100倍存入数据库 + Double oldInventory = ObjectFormatUtil.toDouble(map.get("oldInventory")); + Double newInventory = ObjectFormatUtil.toDouble(map.get("newInventory")); + Double inventory = ObjectFormatUtil.toDouble(map.get("inventory")); + map.put("oldInventory", (int) (oldInventory * 100)); + map.put("newInventory", (int) (newInventory * 100)); + map.put("inventory", (int) (inventory * 100)); + return stockTakingMapper.insertStockTakingChild(map); } @@ -184,14 +192,14 @@ public class StockTakingServiceImpl implements StockTakingService { String takingResult = (String) redisTemplate.opsForHash().get(key, "takingResult"); Object number = redisTemplate.opsForHash().get(key, "number"); Object oldInventory = redisTemplate.opsForHash().get(key, "oldInventory"); - Integer newInventory = ObjectFormatUtil.toInteger(oldInventory); + Double newInventory = ObjectFormatUtil.toDouble(oldInventory); if ("Inventory_down".equals(takingResult)) { // 如果盘亏 - newInventory -= ObjectFormatUtil.toInteger(number); + newInventory -= ObjectFormatUtil.toDouble(number); } else if ("Inventory_up".equals(takingResult)) { // 如果盘盈 - newInventory += ObjectFormatUtil.toInteger(number); + newInventory += ObjectFormatUtil.toDouble(number); } param.put("newInventory", newInventory); param.put("depositoryId", mpv.getDepository_id().toString()); @@ -239,7 +247,7 @@ public class StockTakingServiceImpl implements StockTakingService { * @return 我的任务 */ @Override - public List findMyTask(Map map,UserByPort userToken) { + public List findMyTask(Map map, UserByPort userToken) { Integer size = 10, page = 1; if (map.containsKey("size")) { size = ObjectFormatUtil.toInteger(map.get("size")); @@ -346,22 +354,24 @@ public class StockTakingServiceImpl implements StockTakingService { */ @Override public List findStockTakingChildPByMainId(Integer mainId) { - List stockTakingChildPS = stockTakingMapper.selectStockTakingChildByMainId(mainId); - for (StockTakingChildP stockTakingChildP : stockTakingChildPS) { - if ("Inventory_up".equals(stockTakingChildP.getTakingResult())) { - stockTakingChildP.setTakingResultShow("盘盈"); - } else if ("Inventory_down".equals(stockTakingChildP.getTakingResult())) { - stockTakingChildP.setTakingResultShow("盘亏"); + List stockTakingChildS = stockTakingMapper.selectStockTakingChildByMainId(mainId); + List stockTakingChildPS = new ArrayList<>(); + for (StockTakingChild stockTakingChild : stockTakingChildS) { + if ("Inventory_up".equals(stockTakingChild.getTakingResult())) { + stockTakingChild.setTakingResultShow("盘盈"); + } else if ("Inventory_down".equals(stockTakingChild.getTakingResult())) { + stockTakingChild.setTakingResultShow("盘亏"); } else { - stockTakingChildP.setTakingResultShow("正常"); + stockTakingChild.setTakingResultShow("正常"); } - stockTakingChildP.setShowUnit(stockTakingChildP.getUnit()); - if ("-1".equals(stockTakingChildP.getShowUnit())) { - Inventory inventoryById = materialMapper.findInventoryById(stockTakingChildP.getMid()); - stockTakingChildP.setShowUnit(inventoryById.getUnit()); + stockTakingChild.setShowUnit(stockTakingChild.getUnit()); + if ("-1".equals(stockTakingChild.getShowUnit())) { + Inventory inventoryById = materialMapper.findInventoryById(stockTakingChild.getMid()); + stockTakingChild.setShowUnit(inventoryById.getUnit()); } - List materialByBarCodeByMcode = materialMapper.findMaterialByBarCodeByMcode(stockTakingChildP.getMcode()); - stockTakingChildP.setMaterialAndBarCodeList(materialByBarCodeByMcode); + List materialByBarCodeByMcode = materialMapper.findMaterialByBarCodeByMcode(stockTakingChild.getMcode()); + stockTakingChild.setMaterialAndBarCodeList(materialByBarCodeByMcode); + stockTakingChildPS.add(new StockTakingChildP(stockTakingChild)); } return stockTakingChildPS; } @@ -374,7 +384,7 @@ public class StockTakingServiceImpl implements StockTakingService { */ @Override public StockTakingChildP findStockTakingChildPById(Integer id) { - return stockTakingMapper.selectStockTakingChildPById(id); + return new StockTakingChildP(stockTakingMapper.selectStockTakingChildPById(id)); } @@ -430,7 +440,7 @@ public class StockTakingServiceImpl implements StockTakingService { } UserByPort userByPort = PortConfig.findUserByPortByNumber(s); String workwechat = userByPort.getWorkwechat(); - if(workwechat == null || "".equals(workwechat)){ + if (workwechat == null || "".equals(workwechat)) { workwechat = userByPort.getWechat(); } QyWxUid.append(workwechat).append(","); @@ -452,8 +462,8 @@ public class StockTakingServiceImpl implements StockTakingService { Integer depositoryId = mainRecord.getDepositoryId(); // 获取所有子单 - List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); - for (StockTakingChildP minRecord : minRecordList) { + List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); + for (StockTakingChild minRecord : minRecordList) { // 获取子单详情 // 获取盘点的物料详情 @@ -469,7 +479,7 @@ public class StockTakingServiceImpl implements StockTakingService { } // 获取盈亏数量 - Integer inventory = minRecord.getInventory(); + double inventory = minRecord.getInventory() / 100.0; Inventory inventoryById = materialMapper.findInventoryById(minRecord.getMid()); @@ -484,12 +494,12 @@ public class StockTakingServiceImpl implements StockTakingService { // 根据盘点结果重新计算物料的单价 - Integer newInventory = minRecord.getNewInventory(); + double newInventory = minRecord.getNewInventory() / 100.0; // 获取当前库位上物料数量 int oldQuantity = inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); - inventoryById.setQuantity(oldQuantity + newInventory * 100); + inventoryById.setQuantity(oldQuantity + (int) (newInventory * 100)); // 用于计算新的库位数量 @@ -500,7 +510,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果盘盈 // 更新当前库位数量 - newNumberForPlace = placeById.getQuantity() + inventory * 100; + newNumberForPlace = placeById.getQuantity() + (int) (inventory * 100); if (newNumberForPlace < placeById.getMax()) { @@ -516,14 +526,14 @@ public class StockTakingServiceImpl implements StockTakingService { continue; } - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory * 100; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int) (inventory * 100); // 更新物料与库位对应关系的数量 placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); } else { // 如果盘亏 - newNumberForPlace = placeById.getQuantity() - inventory * 100; + newNumberForPlace = placeById.getQuantity() - (int) (inventory * 100); if (newNumberForPlace > placeById.getMin()) { //如果更新后的库位数量没有下溢 @@ -532,7 +542,7 @@ public class StockTakingServiceImpl implements StockTakingService { placeById.setQuantity(newNumberForPlace); // 更新物料与库位对应关系的数量 - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory * 100; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int) (inventory * 100); } else { placeById.setQuantity(0); @@ -623,7 +633,7 @@ public class StockTakingServiceImpl implements StockTakingService { } UserByPort userByPort = PortConfig.findUserByPortByNumber(s); String workwechat = userByPort.getWorkwechat(); - if(workwechat == null || "".equals(workwechat)){ + if (workwechat == null || "".equals(workwechat)) { workwechat = userByPort.getWechat(); } QyWxUid.append(workwechat).append(","); @@ -675,7 +685,7 @@ public class StockTakingServiceImpl implements StockTakingService { } UserByPort userByPort = PortConfig.findUserByPortByNumber(s); String workwechat = userByPort.getWorkwechat(); - if(workwechat == null || "".equals(workwechat)){ + if (workwechat == null || "".equals(workwechat)) { workwechat = userByPort.getWechat(); } QyWxUid.append(workwechat).append(","); @@ -689,9 +699,9 @@ public class StockTakingServiceImpl implements StockTakingService { List err = new ArrayList<>(); // 获取所有子单 - List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); + List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); // 遍历当前拆单的子单详情 - for (StockTakingChildP minRecord : minRecordList) { + for (StockTakingChild minRecord : minRecordList) { // 获取子单详情 @@ -727,7 +737,7 @@ public class StockTakingServiceImpl implements StockTakingService { } // 获取盈亏数量 - Integer inventory = minRecord.getInventory(); + double inventory = minRecord.getInventory() / 100.0; // 获取判断对应的生产日期 @@ -735,7 +745,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 当前盘点数目 - Integer newInventory = minRecord.getNewInventory(); + double newInventory = minRecord.getNewInventory() / 100.0; if (producedDate != null) { @@ -752,24 +762,24 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果当前盘点数量大于库存数量 // 修改当前库存 - materialAndProducedDate.setInventory(newInventory * 100); + materialAndProducedDate.setInventory((int)(newInventory * 100)); // 修改使用数量 - materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory * 100); + materialAndProducedDate.setExpendnum((int)(materialAndProducedDate.getQuantity() - newInventory * 100)); // 修改物料对应数量 - inventoryById.setQuantity(inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100); + inventoryById.setQuantity((int)(inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100)); } else { // 如果当前盘点数量小于库存数量 // 修改当前库存 - materialAndProducedDate.setInventory(newInventory * 100); + materialAndProducedDate.setInventory((int)(newInventory * 100)); // 修改使用数量 - materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory * 100); + materialAndProducedDate.setExpendnum((int)(materialAndProducedDate.getQuantity() - newInventory * 100)); // 修改物料对应数量 - inventoryById.setQuantity(inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100); + inventoryById.setQuantity((int)(inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100)); } materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); @@ -787,7 +797,7 @@ public class StockTakingServiceImpl implements StockTakingService { if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { // 更新当前库位数量 - newNumberForPlace = placeById.getQuantity() + inventory * 100; + newNumberForPlace = placeById.getQuantity() +(int)( inventory * 100); if (newNumberForPlace <= placeById.getMax()) { // 如果更新后的库位数量没有上溢 @@ -801,9 +811,9 @@ public class StockTakingServiceImpl implements StockTakingService { continue; } - inventoryById.setQuantity(inventoryById.getQuantity() + inventory * 100); + inventoryById.setQuantity(inventoryById.getQuantity() +(int)( inventory * 100)); - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory * 100; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() +(int)( inventory * 100); // 更新物料与库位对应关系的数量 placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); @@ -833,7 +843,7 @@ public class StockTakingServiceImpl implements StockTakingService { int disposeQuantity = (int) (Math.round(Math.floor((double) inventory / scale))); // 计算要进的数目 - int quantity_in = (int)(realQuantity / (scale)); + int quantity_in = (int) (realQuantity / (scale)); // 更新处理数量 disposeQuantity += quantity_in; @@ -885,7 +895,7 @@ public class StockTakingServiceImpl implements StockTakingService { if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { // 如果盘点的是基础单位 - newNumberForPlace = placeById.getQuantity() - inventory * 100; + newNumberForPlace = placeById.getQuantity() - (int)(inventory * 100); if (newNumberForPlace > placeById.getMin()) { //如果更新后的库位数量没有下溢 @@ -894,19 +904,18 @@ public class StockTakingServiceImpl implements StockTakingService { placeById.setQuantity(newNumberForPlace); // 更新物料与库位对应关系的数量 - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory * 100; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int)(inventory * 100); } else { placeById.setQuantity(0); newNumberForMatrialAndPlace = 0; } - inventoryById.setQuantity(inventoryById.getQuantity() - inventory * 100); + inventoryById.setQuantity(inventoryById.getQuantity() - (int)(inventory * 100)); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); - } - else { + } else { // 如果是拆单单位 // 用于查找对应的拆单记录 Map paramForSplitInfo = new HashMap<>(); @@ -924,7 +933,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果单纯的拆单库存满足数量 // 设置当前拆单库存的数量 - splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - inventory * 100); + splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - (int)(inventory * 100)); // 修改拆单库存 splitUnitMapper.updateSplitInventory(splitInventory); } else { @@ -981,8 +990,8 @@ public class StockTakingServiceImpl implements StockTakingService { // 设置剩余拆单库存处理数量 - splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - inventory * 100); - splitInventory.setOutQuantity(splitInventory.getOutQuantity() + inventory * 100); + splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - (int)(inventory * 100)); + splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int)(inventory * 100)); splitUnitMapper.updateSplitInventory(splitInventory); } } else { @@ -1027,8 +1036,7 @@ public class StockTakingServiceImpl implements StockTakingService { } - } - else { + } else { // 如果盘点后的库存数非法 placeById.setQuantity(placeById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity()); @@ -1067,7 +1075,7 @@ public class StockTakingServiceImpl implements StockTakingService { int residue = (int) (Math.ceil(inventory / (double) scale)); // 获取剩余数目 - int residue_realQuantity = residue * scale - inventory; + int residue_realQuantity = residue * scale - (int)(inventory); // 更新库存数量 @@ -1209,9 +1217,9 @@ public class StockTakingServiceImpl implements StockTakingService { Depository depositoryById = depositoryMapper.findDepositoryById(depositoryId); // 获取所有子单 - List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); + List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); // 遍历当前拆单的子单详情 - for (StockTakingChildP minRecord : minRecordList) { + for (StockTakingChild minRecord : minRecordList) { // 获取子单详情 @@ -1247,7 +1255,7 @@ public class StockTakingServiceImpl implements StockTakingService { } // 获取盈亏数量 - Integer inventory = minRecord.getInventory(); + double inventory = minRecord.getInventory() / 100.0; // 获取判断对应的生产日期 @@ -1255,7 +1263,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 当前盘点数目 - Integer newInventory = minRecord.getNewInventory(); + double newInventory = minRecord.getNewInventory() / 100.0; if (producedDate != null) { @@ -1272,24 +1280,24 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果当前盘点数量大于库存数量 // 修改当前库存 - materialAndProducedDate.setInventory(newInventory * 100); + materialAndProducedDate.setInventory((int)(newInventory * 100)); // 修改使用数量 - materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory * 100); + materialAndProducedDate.setExpendnum((int)(materialAndProducedDate.getQuantity() - newInventory * 100)); // 修改物料对应数量 - inventoryById.setQuantity(inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100); + inventoryById.setQuantity((int)(inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100)); } else { // 如果当前盘点数量小于库存数量 // 修改当前库存 - materialAndProducedDate.setInventory(newInventory * 100); + materialAndProducedDate.setInventory((int)(newInventory * 100)); // 修改使用数量 - materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory * 100); + materialAndProducedDate.setExpendnum((int)(materialAndProducedDate.getQuantity() - newInventory * 100)); // 修改物料对应数量 - inventoryById.setQuantity(inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100); + inventoryById.setQuantity((int)(inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100)); } materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); @@ -1307,7 +1315,7 @@ public class StockTakingServiceImpl implements StockTakingService { if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { // 更新当前库位数量 - newNumberForPlace = placeById.getQuantity() + inventory * 100; + newNumberForPlace = placeById.getQuantity() +(int)( inventory * 100); if (newNumberForPlace <= placeById.getMax()) { // 如果更新后的库位数量没有上溢 @@ -1321,9 +1329,9 @@ public class StockTakingServiceImpl implements StockTakingService { continue; } - inventoryById.setQuantity(inventoryById.getQuantity() + inventory * 100); + inventoryById.setQuantity(inventoryById.getQuantity() +(int)( inventory * 100)); - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory * 100; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() +(int)( inventory * 100); // 更新物料与库位对应关系的数量 placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); @@ -1353,7 +1361,7 @@ public class StockTakingServiceImpl implements StockTakingService { int disposeQuantity = (int) (Math.round(Math.floor((double) inventory / scale))); // 计算要进的数目 - int quantity_in = (int)(realQuantity / (scale)); + int quantity_in = (int) (realQuantity / (scale)); // 更新处理数量 disposeQuantity += quantity_in; @@ -1405,7 +1413,7 @@ public class StockTakingServiceImpl implements StockTakingService { if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { // 如果盘点的是基础单位 - newNumberForPlace = placeById.getQuantity() - inventory * 100; + newNumberForPlace = placeById.getQuantity() - (int)(inventory * 100); if (newNumberForPlace > placeById.getMin()) { //如果更新后的库位数量没有下溢 @@ -1414,14 +1422,14 @@ public class StockTakingServiceImpl implements StockTakingService { placeById.setQuantity(newNumberForPlace); // 更新物料与库位对应关系的数量 - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory * 100; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int)(inventory * 100); } else { placeById.setQuantity(0); newNumberForMatrialAndPlace = 0; } - inventoryById.setQuantity(inventoryById.getQuantity() - inventory * 100); + inventoryById.setQuantity(inventoryById.getQuantity() - (int)(inventory * 100)); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); @@ -1443,7 +1451,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果单纯的拆单库存满足数量 // 设置当前拆单库存的数量 - splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - inventory * 100); + splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - (int)(inventory * 100)); // 修改拆单库存 splitUnitMapper.updateSplitInventory(splitInventory); } else { @@ -1500,8 +1508,8 @@ public class StockTakingServiceImpl implements StockTakingService { // 设置剩余拆单库存处理数量 - splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - inventory * 100); - splitInventory.setOutQuantity(splitInventory.getOutQuantity() + inventory * 100); + splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - (int)(inventory * 100)); + splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int)(inventory * 100)); splitUnitMapper.updateSplitInventory(splitInventory); } } else { @@ -1532,7 +1540,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 修改当前库位存放物料的数量 - placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - (int)( surplus_redundant * 100)); + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - (int) (surplus_redundant * 100)); placeById.setQuantity(placeById.getQuantity() - (int) (surplus_redundant * 100)); @@ -1582,10 +1590,10 @@ public class StockTakingServiceImpl implements StockTakingService { int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); // 获取当前盘点对应基础单位的数量 - int residue = (int)( Math.ceil(inventory / (double) scale)); + int residue = (int) (Math.ceil(inventory / (double) scale)); // 获取剩余数目 - int residue_realQuantity = residue * scale - inventory; + int residue_realQuantity = residue * scale - (int)(inventory); // 更新库存数量 @@ -1676,7 +1684,7 @@ public class StockTakingServiceImpl implements StockTakingService { } UserByPort userByPort1 = PortConfig.findUserByPortByNumber(s); String workwechat = userByPort1.getWorkwechat(); - if(workwechat == null || "".equals(workwechat)){ + if (workwechat == null || "".equals(workwechat)) { workwechat = userByPort1.getWechat(); } QyWxUid.append(workwechat).append(","); @@ -1744,7 +1752,7 @@ public class StockTakingServiceImpl implements StockTakingService { } UserByPort userByPort = PortConfig.findUserByPortByNumber(s); String workwechat = userByPort.getWorkwechat(); - if(workwechat == null || "".equals(workwechat)){ + if (workwechat == null || "".equals(workwechat)) { workwechat = userByPort.getWechat(); } QyWxUid.append(workwechat).append(","); @@ -1768,8 +1776,8 @@ public class StockTakingServiceImpl implements StockTakingService { Integer depositoryId = mainRecord.getDepositoryId(); // 获取所有子单 - List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(ObjectFormatUtil.toInteger(mainId)); - for (StockTakingChildP minRecord : minRecordList) { + List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(ObjectFormatUtil.toInteger(mainId)); + for (StockTakingChild minRecord : minRecordList) { // 获取子单详情 Integer placeId = minRecord.getPid(); // 获取库位详情 @@ -1786,7 +1794,7 @@ public class StockTakingServiceImpl implements StockTakingService { } // 获取盈亏数量 - Integer inventory = minRecord.getInventory(); + double inventory = minRecord.getInventory() / 100.0; Inventory inventoryById = materialMapper.findInventoryById(minRecord.getMid()); @@ -1800,23 +1808,23 @@ public class StockTakingServiceImpl implements StockTakingService { // 根据盘点结果重新计算物料的单价 - Integer newInventory = minRecord.getNewInventory(); + double newInventory = minRecord.getNewInventory() / 100.0; // 获取当前库位上物料数量 - Integer oldQuantity = inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); + int oldQuantity = inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); - inventoryById.setQuantity(oldQuantity + newInventory); + inventoryById.setQuantity(oldQuantity + (int)(newInventory * 100)); // 用于计算新的库位数量 - Integer newNumberForPlace = 0; + int newNumberForPlace = 0; // 用于计算新的库位与物料对应关系的数量 - Integer newNumberForMatrialAndPlace = 0; + int newNumberForMatrialAndPlace = 0; if ("Inventory_up".equals(takingResult)) { // 如果盘盈 // 更新当前库位数量 - newNumberForPlace = placeById.getQuantity() + inventory; + newNumberForPlace = placeById.getQuantity() +(int)( inventory * 100); if (newNumberForPlace < placeById.getMax()) { @@ -1832,14 +1840,14 @@ public class StockTakingServiceImpl implements StockTakingService { continue; } - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int)(inventory*100); // 更新物料与库位对应关系的数量 placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); } else { // 如果盘亏 - newNumberForPlace = placeById.getQuantity() - inventory; + newNumberForPlace = placeById.getQuantity() - (int)(inventory*100); if (newNumberForPlace > placeById.getMin()) { //如果更新后的库位数量没有下溢 @@ -1848,7 +1856,7 @@ public class StockTakingServiceImpl implements StockTakingService { placeById.setQuantity(newNumberForPlace); // 更新物料与库位对应关系的数量 - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int)(inventory*100); } else { placeById.setQuantity(0); @@ -1958,7 +1966,7 @@ public class StockTakingServiceImpl implements StockTakingService { for (Integer minId : minIds) { // 获取对应子订单 - StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId); + StockTakingChild minRecord = stockTakingMapper.selectStockTakingChildPById(minId); // 获取当前物料库存记录 @@ -2007,7 +2015,7 @@ public class StockTakingServiceImpl implements StockTakingService { if (Integer.compare(newPlace.getDid(), oldPlace.getDid()) != 0) { // 转移前后不在同一仓库 - inventoryById.setQuantity((int)( newInventory * 100)); + inventoryById.setQuantity((int) (newInventory * 100)); // 用于获取转移后仓库的物料信息 Map paramForMaterialToDepository = new HashMap<>(); @@ -2036,7 +2044,7 @@ public class StockTakingServiceImpl implements StockTakingService { if (newPlaceAndMaterial == null) { // 如果转移之后的库位没有该物料 - paramForMaterialAndPlace.put("quantity", (int)(inventory_transfer * 100)); + paramForMaterialAndPlace.put("quantity", (int) (inventory_transfer * 100)); // 添加物料记录 placeMapper.addMaterialOnPlace(paramForMaterialAndPlace); } else { @@ -2079,8 +2087,8 @@ public class StockTakingServiceImpl implements StockTakingService { // 最终存储到拆单处理的数量 double saveQuantity = inventory_transfer - disposeQuantity * splitInfo.getQuantity(); - insertForSplitInventory.put("saveQuantity",(int) (saveQuantity * 100)); - insertForSplitInventory.put("inQuantity",(int) (saveQuantity * 100)); + insertForSplitInventory.put("saveQuantity", (int) (saveQuantity * 100)); + insertForSplitInventory.put("inQuantity", (int) (saveQuantity * 100)); // 添加一条拆单库存记录 res += splitUnitMapper.addSplitInventory(insertForSplitInventory); @@ -2110,8 +2118,8 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果不大于 - insertForSplitInventory.put("saveQuantity", (int)(inventory_transfer * 100)); - insertForSplitInventory.put("inQuantity", (int)(inventory_transfer * 100)); + insertForSplitInventory.put("saveQuantity", (int) (inventory_transfer * 100)); + insertForSplitInventory.put("inQuantity", (int) (inventory_transfer * 100)); // 添加一条拆单库存记录 res += splitUnitMapper.addSplitInventory(insertForSplitInventory); @@ -2155,7 +2163,7 @@ public class StockTakingServiceImpl implements StockTakingService { flag = true; // 计算要进制的数目 - int quantity_in = (int)(realQuantity / scale); + int quantity_in = (int) (realQuantity / scale); // 更新处理数量 disposeQuantity += quantity_in; @@ -2217,15 +2225,15 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果当前处理的数量大于进制数 // 计算要进的数目 - int quantity_in = (int)(inventory_transfer / scale); + int quantity_in = (int) (inventory_transfer / scale); // 更新处理数量 disposeQuantity += quantity_in; // 拆单库存实际入库的数量 realQuantity = realQuantity - quantity_in * scale; - insertForSplitInventory.put("saveQuantity", (int)(realQuantity * 100)); - insertForSplitInventory.put("inQuantity", (int)(realQuantity * 100)); + insertForSplitInventory.put("saveQuantity", (int) (realQuantity * 100)); + insertForSplitInventory.put("inQuantity", (int) (realQuantity * 100)); splitUnitMapper.addSplitInventory(insertForSplitInventory); @@ -2351,7 +2359,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果当前处理的数量大于进制数 // 计算要进的数目 - int quantity_in = (int)(inventory_transfer / scale); + int quantity_in = (int) (inventory_transfer / scale); // 更新处理数量 disposeQuantity += quantity_in; // 拆单库存实际入库的数量 @@ -2544,7 +2552,7 @@ public class StockTakingServiceImpl implements StockTakingService { flag = true; // 计算要进制的数目 - int quantity_in = (int)(realQuantity / scale); + int quantity_in = (int) (realQuantity / scale); // 更新处理数量 disposeQuantity += quantity_in; @@ -2606,7 +2614,7 @@ public class StockTakingServiceImpl implements StockTakingService { // 如果当前处理的数量大于进制数 // 计算要进的数目 - int quantity_in = (int)(inventory_transfer / scale); + int quantity_in = (int) (inventory_transfer / scale); // 更新处理数量 disposeQuantity += quantity_in; // 拆单库存实际入库的数量 @@ -2755,9 +2763,9 @@ public class StockTakingServiceImpl implements StockTakingService { StringBuilder departMentHeadQyWxName = new StringBuilder(); UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(originator), userToken); String workwechat = userByPort.getWorkwechat(); - if(workwechat == null || "".equals(workwechat)){ - workwechat = userByPort.getWechat(); - } + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } // departMentHeadQyWxName.append(workwechat+","); departMentHeadQyWxName.append("PangFuZhen,"); JSONObject jsonObject = qyWxOperationService.sendCcStockTakingTransferMessageToHead(departMentHeadQyWxName.toString(), map, userToken, finalMainRecord, userAgent); @@ -2812,11 +2820,11 @@ public class StockTakingServiceImpl implements StockTakingService { // 用于标识是否向盘点人员发送卡片 - Boolean flag = true; + boolean flag = true; // 获取主单 StockTaking mainRecord = stockTakingMapper.selectStockTakingById(mainId); - Integer departmentManagerState = 2; + int departmentManagerState = 2; // 获取当前处理时间 String simpleTime = DateUtil.getSimpleTime(new Date()); @@ -2833,11 +2841,9 @@ public class StockTakingServiceImpl implements StockTakingService { // 获取所有子单 - List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); - for (int i = 0; i < minRecordList.size(); i++) { + List minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); + for (StockTakingChild minRecord : minRecordList) { // 获取子单详情 - StockTakingChildP minRecord = minRecordList.get(i); - Integer placeId = minRecord.getPid(); // 获取库位详情 Place placeById = placeMapper.findPlaceById(placeId); @@ -2850,7 +2856,7 @@ public class StockTakingServiceImpl implements StockTakingService { } // 获取盈亏数量 - Integer inventory = minRecord.getInventory(); + double inventory = minRecord.getInventory() / 100.0; Material materialById = materialMapper.findMaterialById(minRecord.getMid()); @@ -2864,24 +2870,24 @@ public class StockTakingServiceImpl implements StockTakingService { // 根据盘点结果重新计算物料的单价 - Integer newInventory = minRecord.getNewInventory(); + double newInventory = minRecord.getNewInventory() / 100.0; // 获取当前库位上物料数量 - Integer oldQuantity = materialById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); + int oldQuantity = materialById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); - materialById.setQuantity(oldQuantity + newInventory); + materialById.setQuantity(oldQuantity + (int)(newInventory*100)); // 用于计算新的库位数量 - Integer newNumberForPlace = 0; + int newNumberForPlace = 0; // 用于计算新的库位与物料对应关系的数量 - Integer newNumberForMatrialAndPlace = 0; + int newNumberForMatrialAndPlace = 0; if ("Inventory_up".equals(takingResult)) { // 如果盘盈 // 更新当前库位数量 - newNumberForPlace = placeById.getQuantity() + inventory; + newNumberForPlace = placeById.getQuantity() +(int)(inventory*100); if (newNumberForPlace < placeById.getMax()) { @@ -2897,14 +2903,14 @@ public class StockTakingServiceImpl implements StockTakingService { continue; } - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int)(inventory*100); // 更新物料与库位对应关系的数量 placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); } else { // 如果盘亏 - newNumberForPlace = placeById.getQuantity() - inventory; + newNumberForPlace = placeById.getQuantity() - (int)(inventory*100); if (newNumberForPlace > placeById.getMin()) { //如果更新后的库位数量没有下溢 @@ -2913,7 +2919,7 @@ public class StockTakingServiceImpl implements StockTakingService { placeById.setQuantity(newNumberForPlace); // 更新物料与库位对应关系的数量 - newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory; + newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() -(int)( inventory*100); } else { placeById.setQuantity(0); diff --git a/src/main/resources/templates/pages/stockTaking/stockTaking.html b/src/main/resources/templates/pages/stockTaking/stockTaking.html index 8ce16a67..380dacc0 100644 --- a/src/main/resources/templates/pages/stockTaking/stockTaking.html +++ b/src/main/resources/templates/pages/stockTaking/stockTaking.html @@ -488,7 +488,7 @@ // 用于提交盘点情况 form.on('submit(formStep)', function (data) { - if(!flagForForm){ + if (!flagForForm) { flagForForm = true; data = data.field; data.depositoryId = depositoryId; @@ -532,7 +532,7 @@ // 用于提交盘点情况 form.on('submit(formStep3)', function (data) { - if(!flagForForm1){ + if (!flagForForm1) { flagForForm1 = true; data = data.field; data.params = params; diff --git a/src/main/resources/templates/pages/stockTaking/stockTakingView.html b/src/main/resources/templates/pages/stockTaking/stockTakingView.html index 4ca1859e..c97ecfac 100644 --- a/src/main/resources/templates/pages/stockTaking/stockTakingView.html +++ b/src/main/resources/templates/pages/stockTaking/stockTakingView.html @@ -278,32 +278,6 @@ element = layui.element, form = layui.form; - /* var position = 0, states = {}, number = 2; - - var ifShow1 = ($("#reviewTime").val() === ""); - var ifShow = ($("#completeTime").val() === ""); - - if (ifShow1) { - // 如果还未处理 - states = [{title: "待审核"}]; - } else{ - $("#takingFooter").show(); - states = [{title: "已审核"}] - } - - - if(ifShow){ - var state = $("#departmentManagerState").val(); - if(state === "1"){ - states = [{title: "待处理"}] - }else if(state === "2"){ - states = [{title: "已驳回"}] - } - }else{ - $("#takingFooter1").show(); - states = [{title: "已处理"}] - }*/ - // 用于分步表单加载 diff --git a/src/test/java/com/dreamchaser/depository_manage/OtherTest.java b/src/test/java/com/dreamchaser/depository_manage/OtherTest.java index 590404a2..869a931c 100644 --- a/src/test/java/com/dreamchaser/depository_manage/OtherTest.java +++ b/src/test/java/com/dreamchaser/depository_manage/OtherTest.java @@ -49,49 +49,15 @@ public class OtherTest { @Test public void main() { // UserByPort userByPort = LinkInterfaceUtil.FindUserById(87, null); -// ApprovalInfo_Details approvalInfo = new ApprovalInfo_Details(); -// ApprovalInfo_Details_Approver approver = new ApprovalInfo_Details_Approver(); -// approver.setUserId("PangFuZhen"); -// approvalInfo.setApprover(approver); -// depositoryRecordService.reviewByQyWxApprovalIn("[10, 11]",approvalInfo,"42156e781cdc727e7d5deac872be45a9","2","202304240015"); + ApprovalInfo_Details approvalInfo = new ApprovalInfo_Details(); + ApprovalInfo_Details_Approver approver = new ApprovalInfo_Details_Approver(); + approver.setUserId("PangFuZhen"); + approvalInfo.setApprover(approver); + depositoryRecordService.reviewByQyWxApprovalIn("[2]",approvalInfo,"634c7f15fe74b4ba6c857df4032ed21e","2","202304260024"); // stockTakingService.reviewByQyWxApproval("4",approvalInfo,"42156e781cdc727e7d5deac872be45a9","2","202304240042"); - UserByPort userByPort = LinkInterfaceUtil.FindUserById(119, null); - List departmentHeadByUser = findDepartmentHeadByUser(userByPort.getMaindeparment(),userByPort); - System.out.println(departmentHeadByUser); } - public static List findDepartmentHeadByUser(Integer maindeparment,UserByPort userToken){ - List userByPortList = new ArrayList<>(); - String url = PortConfig.external_url + "/staff/archiveslist"; - Map map = new HashMap<>(); - map.put("adminorg",maindeparment); - map.put("role",""); - String jsonString = JSONObject.toJSONString(map); - JSONObject paramObject = JSONObject.parseObject(jsonString); - String post = null; - try { - post = HttpUtils.send(url, paramObject, HTTP.UTF_8,userToken); - } catch (IOException e) { - e.printStackTrace(); - } - JSONObject jsonObject = JSONObject.parseObject(post); - JSONObject data = (JSONObject) jsonObject.get("data"); - JSONArray list = (JSONArray) data.get("list"); - if(list == null){ - list = new JSONArray(); - } - - for (Object obj:list - ) { - JSONObject jsonObject1 = (JSONObject) obj; - int personincharge = jsonObject1.getInteger("personincharge"); - if(1 == personincharge){ - userByPortList.add(JSONObject.toJavaObject(jsonObject1, UserByPort.class)); - } - } - return userByPortList; - }