Browse Source

库存盘点功能修改

lwx_dev
erdanergou 3 years ago
parent
commit
632aa98a71
  1. 4
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  2. 77
      src/main/java/com/dreamchaser/depository_manage/entity/StockTakingChild.java
  3. 10
      src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.java
  4. 2
      src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.xml
  5. 2
      src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForViewP.java
  6. 55
      src/main/java/com/dreamchaser/depository_manage/pojo/StockTakingChildP.java
  7. 6
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  8. 38
      src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java
  9. 204
      src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java
  10. 26
      src/main/resources/templates/pages/stockTaking/stockTakingView.html
  11. 44
      src/test/java/com/dreamchaser/depository_manage/OtherTest.java

4
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -2853,10 +2853,10 @@ public class PageController {
MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(placeId, stcp.getMid()); 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); stcp.setInventory(inventory);

77
src/main/java/com/dreamchaser/depository_manage/entity/StockTakingChild.java

@ -2,6 +2,8 @@ package com.dreamchaser.depository_manage.entity;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* 盘点子类 * 盘点子类
*/ */
@ -10,11 +12,17 @@ public class StockTakingChild {
/** /**
* id * id
*/ */
private Integer id; private Long id;
/** /**
* 物料id * 物料id
*/ */
private Integer mid; private Integer mid;
/**
* 盘点库位id
*/
private Integer pid;
/** /**
* 库存容量 * 库存容量
*/ */
@ -27,12 +35,79 @@ public class StockTakingChild {
* 盘点结果 * 盘点结果
*/ */
private String takingResult; private String takingResult;
/**
* 盘点结果展示
*/
private String takingResultShow;
/** /**
* 盈亏数量 * 盈亏数量
*/ */
private Integer inventory; private Integer inventory;
/**
* 盘点单号
*/
private String code;
/**
* 物料名称
*/
private String mname;
/**
* 物料编码
*/
private String mcode;
/**
* 物料与条形码的对应关系
*/
private List<MaterialAndBarCode> materialAndBarCodeList;
/**
* 类型id
*/
private Long mtId;
/**
* 类型名称
*/
private String tname;
/**
* 物料材质
*/
private String mtexture;
/**
* 物料规格型号
*/
private String mversion;
/**
* 物料计量单位
*/
private String munit;
/** /**
* 主表id * 主表id
*/ */
private Long mainId; private Long mainId;
/**
* 当前盘点物料选择的生产日期
*/
private Long producedDate;
/**
* 当前盘点的计量单位
*/
private String unit;
/**
* 用于展示当前盘点的计量单位
*/
private String showUnit;
} }

10
src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.java

@ -107,7 +107,7 @@ public interface StockTakingMapper {
* @param mainId * @param mainId
* @return * @return
*/ */
List<StockTakingChildP> selectStockTakingChildByMainId(Integer mainId); List<StockTakingChild> selectStockTakingChildByMainId(Integer mainId);
/** /**
@ -115,7 +115,7 @@ public interface StockTakingMapper {
* @param list * @param list
* @return * @return
*/ */
List<StockTakingChildP> selectStockTakingChildByIds(List<Long> list); List<StockTakingChild> selectStockTakingChildByIds(List<Long> list);
/** /**
@ -131,7 +131,7 @@ public interface StockTakingMapper {
* @param map * @param map
* @return * @return
*/ */
List<StockTakingChildP> selectStockTakingChildPByCondition(Map<String,Object> map); List<StockTakingChild> selectStockTakingChildPByCondition(Map<String,Object> map);
/** /**
* 根据主键查找主表 * 根据主键查找主表
@ -153,14 +153,14 @@ public interface StockTakingMapper {
* @param id * @param id
* @return * @return
*/ */
StockTakingChildP selectStockTakingChildPById(Integer id); StockTakingChild selectStockTakingChildPById(Integer id);
/** /**
* 根据主键查找盘点详情 * 根据主键查找盘点详情
* @param id * @param id
* @return * @return
*/ */
StockTakingChildP selectStockTakingChildPById(Long id); StockTakingChild selectStockTakingChildPById(Long id);
/** /**

2
src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.xml

@ -19,7 +19,7 @@
<result column="auditOpinion" property="auditOpinion" jdbcType="VARCHAR" /> <result column="auditOpinion" property="auditOpinion" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<resultMap id="StockTakingChildMap" type="com.dreamchaser.depository_manage.pojo.StockTakingChildP"> <resultMap id="StockTakingChildMap" type="com.dreamchaser.depository_manage.entity.StockTakingChild">
<id column="id" property="id" jdbcType="INTEGER" /> <id column="id" property="id" jdbcType="INTEGER" />
<result column="mid" property="mid" jdbcType="INTEGER" /> <result column="mid" property="mid" jdbcType="INTEGER" />
<result column="oldInventory" property="oldInventory" jdbcType="INTEGER" /> <result column="oldInventory" property="oldInventory" jdbcType="INTEGER" />

2
src/main/java/com/dreamchaser/depository_manage/pojo/MaterialAndPlaceForViewP.java

@ -94,7 +94,7 @@ public class MaterialAndPlaceForViewP {
/** /**
* 盘点数量 * 盘点数量
*/ */
private Integer stockTakingQuantity; private Double stockTakingQuantity;
/** /**
* 盘点结果 * 盘点结果

55
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; 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<MaterialAndBarCode> 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;
}
} }

6
src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java

@ -2766,13 +2766,13 @@ public class MaterialServiceImpl implements MaterialService {
mpv.setTakingInventory(number); mpv.setTakingInventory(number);
if ("Inventory_down".equals(takingResult)) { 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)) { } else if ("Inventory_up".equals(takingResult)) {
// 如果盘盈 // 如果盘盈
mpv.setStockTakingQuantity((int) (splitInventory.get(unit) + ObjectFormatUtil.toDouble(number))); mpv.setStockTakingQuantity((splitInventory.get(unit) + ObjectFormatUtil.toDouble(number)));
} else { } else {
// 如果正常 // 如果正常
mpv.setStockTakingQuantity(splitInventory.get(unit).intValue()); mpv.setStockTakingQuantity(splitInventory.get(unit));
} }
} }

38
src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java

@ -263,7 +263,7 @@ public class QyWxOperationService {
StockTaking mainRecord = stockTakingMapper.selectStockTakingById(mainId); StockTaking mainRecord = stockTakingMapper.selectStockTakingById(mainId);
// 获取所有子记录 // 获取所有子记录
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); List<StockTakingChild> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId);
// 申请人id // 申请人id
Integer getOriginator = mainRecord.getOriginator(); Integer getOriginator = mainRecord.getOriginator();
@ -287,7 +287,7 @@ public class QyWxOperationService {
Location.append(depository.getDname()); Location.append(depository.getDname());
for (StockTakingChildP childP : minRecordList) { for (StockTakingChild childP : minRecordList) {
// 获取子订单信息 // 获取子订单信息
// 获取当前申请物料 // 获取当前申请物料
Inventory materialById = materialMapper.findInventoryById(childP.getMid()); Inventory materialById = materialMapper.findInventoryById(childP.getMid());
@ -500,7 +500,7 @@ public class QyWxOperationService {
} }
// 获取所有子记录 // 获取所有子记录
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByIds(normalMinId); List<StockTakingChild> minRecordList = stockTakingMapper.selectStockTakingChildByIds(normalMinId);
// 申请人id // 申请人id
Integer getOriginator = mainRecord.getOriginator(); Integer getOriginator = mainRecord.getOriginator();
@ -524,14 +524,14 @@ public class QyWxOperationService {
Location.append(depository.getDname()); Location.append(depository.getDname());
for (StockTakingChildP childP : minRecordList) { for (StockTakingChild childP : minRecordList) {
// 获取子订单信息 // 获取子订单信息
// 获取当前申请物料 // 获取当前申请物料
Inventory materialById = materialMapper.findInventoryById(childP.getMid()); Inventory materialById = materialMapper.findInventoryById(childP.getMid());
// 设置物料名称 // 设置物料名称
mname.append(materialById.getMname()).append(","); mname.append(materialById.getMname()).append(",");
// 设置盘点数量 // 设置盘点数量
stockTakingQuantity.append(childP.getNewInventory()).append(","); stockTakingQuantity.append((int)(childP.getNewInventory() / 100.0)).append(",");
// 设置盘点结果 // 设置盘点结果
String takingResult = childP.getTakingResult(); String takingResult = childP.getTakingResult();
if ("Inventory_up".equals(takingResult)) { if ("Inventory_up".equals(takingResult)) {
@ -543,7 +543,7 @@ public class QyWxOperationService {
} }
stockTakingResult.append(takingResult).append(","); stockTakingResult.append(takingResult).append(",");
// 设置盈亏数量 // 设置盈亏数量
stockTakingInventory.append(childP.getInventory()).append(","); stockTakingInventory.append((int)(childP.getInventory() / 100.0)).append(",");
} }
// 1.获取access_token:根据企业id和应用密钥获取access_token,并拼接请求url // 1.获取access_token:根据企业id和应用密钥获取access_token,并拼接请求url
@ -619,7 +619,7 @@ public class QyWxOperationService {
horizontal_content_quantity.setType(0); horizontal_content_quantity.setType(0);
// 二级标题 // 二级标题
horizontal_content_quantity.setKeyname("盘点数量"); 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(); TemplateCard_horizontal_content horizontal_content_result = new TemplateCard_horizontal_content();
@ -847,7 +847,7 @@ public class QyWxOperationService {
for (Long minId : minIds) { for (Long minId : minIds) {
// 获取对应子订单 // 获取对应子订单
StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId); StockTakingChild minRecord = stockTakingMapper.selectStockTakingChildPById(minId);
// 获取当前物料 // 获取当前物料
Inventory material = materialMapper.findInventoryById(minRecord.getMid()); Inventory material = materialMapper.findInventoryById(minRecord.getMid());
@ -887,10 +887,10 @@ public class QyWxOperationService {
} }
content.append(">- 物料名称:").append(material.getMname()).append("%n"); content.append(">- 物料名称:").append(material.getMname()).append("%n");
content.append(">- 盘点位置:").append(fromLocation).append("%n"); content.append(">- 盘点位置:").append(fromLocation).append("%n");
content.append(">- 原库存数量:").append(minRecord.getOldInventory()).append("%n"); content.append(">- 原库存数量:").append((int)(minRecord.getOldInventory() / 100.0)).append("%n");
content.append(">- 盘点数量:").append(minRecord.getNewInventory()).append("%n"); content.append(">- 盘点数量:").append((int)(minRecord.getNewInventory() / 100.0)).append("%n");
content.append(">- 盘点单位:").append(unit).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(">- 盘点结果:").append(takingResult).append("%n");
content.append("%n---%n"); content.append("%n---%n");
} }
@ -956,7 +956,7 @@ public class QyWxOperationService {
for (Long minId : errIds) { for (Long minId : errIds) {
// 获取错误的子订单 // 获取错误的子订单
StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId); StockTakingChild minRecord = stockTakingMapper.selectStockTakingChildPById(minId);
// 获取当前物料 // 获取当前物料
Inventory material = materialMapper.findInventoryById(minRecord.getMid()); Inventory material = materialMapper.findInventoryById(minRecord.getMid());
@ -1053,7 +1053,7 @@ public class QyWxOperationService {
for (Long minId : minIds) { for (Long minId : minIds) {
// 获取对应子订单 // 获取对应子订单
StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId); StockTakingChild minRecord = stockTakingMapper.selectStockTakingChildPById(minId);
// 获取当前物料 // 获取当前物料
Inventory material = materialMapper.findInventoryById(minRecord.getMid()); Inventory material = materialMapper.findInventoryById(minRecord.getMid());
@ -2188,7 +2188,7 @@ public class QyWxOperationService {
// 获取当前盘点主表 // 获取当前盘点主表
StockTaking mainRecord = stockTakingMapper.selectStockTakingById(mainId); StockTaking mainRecord = stockTakingMapper.selectStockTakingById(mainId);
// 获取当前主表下的子表 // 获取当前主表下的子表
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); List<StockTakingChild> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId);
// 获取当前盘点位置 // 获取当前盘点位置
Depository depository = depositoryMapper.findDepositoryById(mainRecord.getDepositoryId()); Depository depository = depositoryMapper.findDepositoryById(mainRecord.getDepositoryId());
@ -2346,10 +2346,8 @@ public class QyWxOperationService {
approval_template_apply_data_contents_info.setId("Table-1668152830942"); approval_template_apply_data_contents_info.setId("Table-1668152830942");
// 定义明细列表 // 定义明细列表
List<Object> contents_detail = new ArrayList<>(); List<Object> 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()); 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); detail_list_control_info_outNumber.put("title", detail_list_control_info_title_list_outNumber);
Map<String, String> detail_list_control_info_value_outNumber = new HashMap<>(); Map<String, String> 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); 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); detail_list_control_info_stockTakingNumber.put("title", detail_list_control_info_title_list_stockTakingNumber);
Map<String, String> detail_list_control_info_value_stockTakingNumber = new HashMap<>(); Map<String, String> 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); 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); detail_list_control_info_stockTakingInventory.put("title", detail_list_control_info_title_list_stockTakingInventory);
Map<String, String> detail_list_control_info_value_stockTakingInventory = new HashMap<>(); Map<String, String> 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); detail_list_control_info_stockTakingInventory.put("value", detail_list_control_info_value_stockTakingInventory);

204
src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java

@ -126,6 +126,14 @@ public class StockTakingServiceImpl implements StockTakingService {
map.remove("producedDate"); 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); return stockTakingMapper.insertStockTakingChild(map);
} }
@ -184,14 +192,14 @@ public class StockTakingServiceImpl implements StockTakingService {
String takingResult = (String) redisTemplate.opsForHash().get(key, "takingResult"); String takingResult = (String) redisTemplate.opsForHash().get(key, "takingResult");
Object number = redisTemplate.opsForHash().get(key, "number"); Object number = redisTemplate.opsForHash().get(key, "number");
Object oldInventory = redisTemplate.opsForHash().get(key, "oldInventory"); Object oldInventory = redisTemplate.opsForHash().get(key, "oldInventory");
Integer newInventory = ObjectFormatUtil.toInteger(oldInventory); Double newInventory = ObjectFormatUtil.toDouble(oldInventory);
if ("Inventory_down".equals(takingResult)) { if ("Inventory_down".equals(takingResult)) {
// 如果盘亏 // 如果盘亏
newInventory -= ObjectFormatUtil.toInteger(number); newInventory -= ObjectFormatUtil.toDouble(number);
} else if ("Inventory_up".equals(takingResult)) { } else if ("Inventory_up".equals(takingResult)) {
// 如果盘盈 // 如果盘盈
newInventory += ObjectFormatUtil.toInteger(number); newInventory += ObjectFormatUtil.toDouble(number);
} }
param.put("newInventory", newInventory); param.put("newInventory", newInventory);
param.put("depositoryId", mpv.getDepository_id().toString()); param.put("depositoryId", mpv.getDepository_id().toString());
@ -346,22 +354,24 @@ public class StockTakingServiceImpl implements StockTakingService {
*/ */
@Override @Override
public List<StockTakingChildP> findStockTakingChildPByMainId(Integer mainId) { public List<StockTakingChildP> findStockTakingChildPByMainId(Integer mainId) {
List<StockTakingChildP> stockTakingChildPS = stockTakingMapper.selectStockTakingChildByMainId(mainId); List<StockTakingChild> stockTakingChildS = stockTakingMapper.selectStockTakingChildByMainId(mainId);
for (StockTakingChildP stockTakingChildP : stockTakingChildPS) { List<StockTakingChildP> stockTakingChildPS = new ArrayList<>();
if ("Inventory_up".equals(stockTakingChildP.getTakingResult())) { for (StockTakingChild stockTakingChild : stockTakingChildS) {
stockTakingChildP.setTakingResultShow("盘盈"); if ("Inventory_up".equals(stockTakingChild.getTakingResult())) {
} else if ("Inventory_down".equals(stockTakingChildP.getTakingResult())) { stockTakingChild.setTakingResultShow("盘盈");
stockTakingChildP.setTakingResultShow("盘亏"); } else if ("Inventory_down".equals(stockTakingChild.getTakingResult())) {
stockTakingChild.setTakingResultShow("盘亏");
} else { } else {
stockTakingChildP.setTakingResultShow("正常"); stockTakingChild.setTakingResultShow("正常");
} }
stockTakingChildP.setShowUnit(stockTakingChildP.getUnit()); stockTakingChild.setShowUnit(stockTakingChild.getUnit());
if ("-1".equals(stockTakingChildP.getShowUnit())) { if ("-1".equals(stockTakingChild.getShowUnit())) {
Inventory inventoryById = materialMapper.findInventoryById(stockTakingChildP.getMid()); Inventory inventoryById = materialMapper.findInventoryById(stockTakingChild.getMid());
stockTakingChildP.setShowUnit(inventoryById.getUnit()); stockTakingChild.setShowUnit(inventoryById.getUnit());
} }
List<MaterialAndBarCode> materialByBarCodeByMcode = materialMapper.findMaterialByBarCodeByMcode(stockTakingChildP.getMcode()); List<MaterialAndBarCode> materialByBarCodeByMcode = materialMapper.findMaterialByBarCodeByMcode(stockTakingChild.getMcode());
stockTakingChildP.setMaterialAndBarCodeList(materialByBarCodeByMcode); stockTakingChild.setMaterialAndBarCodeList(materialByBarCodeByMcode);
stockTakingChildPS.add(new StockTakingChildP(stockTakingChild));
} }
return stockTakingChildPS; return stockTakingChildPS;
} }
@ -374,7 +384,7 @@ public class StockTakingServiceImpl implements StockTakingService {
*/ */
@Override @Override
public StockTakingChildP findStockTakingChildPById(Integer id) { public StockTakingChildP findStockTakingChildPById(Integer id) {
return stockTakingMapper.selectStockTakingChildPById(id); return new StockTakingChildP(stockTakingMapper.selectStockTakingChildPById(id));
} }
@ -452,8 +462,8 @@ public class StockTakingServiceImpl implements StockTakingService {
Integer depositoryId = mainRecord.getDepositoryId(); Integer depositoryId = mainRecord.getDepositoryId();
// 获取所有子单 // 获取所有子单
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); List<StockTakingChild> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId);
for (StockTakingChildP minRecord : minRecordList) { 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()); 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(); 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()) { if (newNumberForPlace < placeById.getMax()) {
@ -516,14 +526,14 @@ public class StockTakingServiceImpl implements StockTakingService {
continue; continue;
} }
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory * 100; newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int) (inventory * 100);
// 更新物料与库位对应关系的数量 // 更新物料与库位对应关系的数量
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace);
} else { } else {
// 如果盘亏 // 如果盘亏
newNumberForPlace = placeById.getQuantity() - inventory * 100; newNumberForPlace = placeById.getQuantity() - (int) (inventory * 100);
if (newNumberForPlace > placeById.getMin()) { if (newNumberForPlace > placeById.getMin()) {
//如果更新后的库位数量没有下溢 //如果更新后的库位数量没有下溢
@ -532,7 +542,7 @@ public class StockTakingServiceImpl implements StockTakingService {
placeById.setQuantity(newNumberForPlace); placeById.setQuantity(newNumberForPlace);
// 更新物料与库位对应关系的数量 // 更新物料与库位对应关系的数量
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory * 100; newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int) (inventory * 100);
} else { } else {
placeById.setQuantity(0); placeById.setQuantity(0);
@ -689,9 +699,9 @@ public class StockTakingServiceImpl implements StockTakingService {
List<String> err = new ArrayList<>(); List<String> err = new ArrayList<>();
// 获取所有子单 // 获取所有子单
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); List<StockTakingChild> 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) { 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 { } 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); materialMapper.updateMaterialAndProducedDate(materialAndProducedDate);
@ -787,7 +797,7 @@ public class StockTakingServiceImpl implements StockTakingService {
if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) {
// 更新当前库位数量 // 更新当前库位数量
newNumberForPlace = placeById.getQuantity() + inventory * 100; newNumberForPlace = placeById.getQuantity() +(int)( inventory * 100);
if (newNumberForPlace <= placeById.getMax()) { if (newNumberForPlace <= placeById.getMax()) {
// 如果更新后的库位数量没有上溢 // 如果更新后的库位数量没有上溢
@ -801,9 +811,9 @@ public class StockTakingServiceImpl implements StockTakingService {
continue; 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); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace);
@ -885,7 +895,7 @@ public class StockTakingServiceImpl implements StockTakingService {
if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) {
// 如果盘点的是基础单位 // 如果盘点的是基础单位
newNumberForPlace = placeById.getQuantity() - inventory * 100; newNumberForPlace = placeById.getQuantity() - (int)(inventory * 100);
if (newNumberForPlace > placeById.getMin()) { if (newNumberForPlace > placeById.getMin()) {
//如果更新后的库位数量没有下溢 //如果更新后的库位数量没有下溢
@ -894,19 +904,18 @@ public class StockTakingServiceImpl implements StockTakingService {
placeById.setQuantity(newNumberForPlace); placeById.setQuantity(newNumberForPlace);
// 更新物料与库位对应关系的数量 // 更新物料与库位对应关系的数量
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory * 100; newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int)(inventory * 100);
} else { } else {
placeById.setQuantity(0); placeById.setQuantity(0);
newNumberForMatrialAndPlace = 0; newNumberForMatrialAndPlace = 0;
} }
inventoryById.setQuantity(inventoryById.getQuantity() - inventory * 100); inventoryById.setQuantity(inventoryById.getQuantity() - (int)(inventory * 100));
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace);
} } else {
else {
// 如果是拆单单位 // 如果是拆单单位
// 用于查找对应的拆单记录 // 用于查找对应的拆单记录
Map<String, Object> paramForSplitInfo = new HashMap<>(); Map<String, Object> 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); splitUnitMapper.updateSplitInventory(splitInventory);
} else { } else {
@ -981,8 +990,8 @@ public class StockTakingServiceImpl implements StockTakingService {
// 设置剩余拆单库存处理数量 // 设置剩余拆单库存处理数量
splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - inventory * 100); splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - (int)(inventory * 100));
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + inventory * 100); splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int)(inventory * 100));
splitUnitMapper.updateSplitInventory(splitInventory); splitUnitMapper.updateSplitInventory(splitInventory);
} }
} else { } else {
@ -1027,8 +1036,7 @@ public class StockTakingServiceImpl implements StockTakingService {
} }
} } else {
else {
// 如果盘点后的库存数非法 // 如果盘点后的库存数非法
placeById.setQuantity(placeById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity()); 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 = (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); Depository depositoryById = depositoryMapper.findDepositoryById(depositoryId);
// 获取所有子单 // 获取所有子单
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); List<StockTakingChild> 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) { 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 { } 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); materialMapper.updateMaterialAndProducedDate(materialAndProducedDate);
@ -1307,7 +1315,7 @@ public class StockTakingServiceImpl implements StockTakingService {
if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) {
// 更新当前库位数量 // 更新当前库位数量
newNumberForPlace = placeById.getQuantity() + inventory * 100; newNumberForPlace = placeById.getQuantity() +(int)( inventory * 100);
if (newNumberForPlace <= placeById.getMax()) { if (newNumberForPlace <= placeById.getMax()) {
// 如果更新后的库位数量没有上溢 // 如果更新后的库位数量没有上溢
@ -1321,9 +1329,9 @@ public class StockTakingServiceImpl implements StockTakingService {
continue; 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); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace);
@ -1405,7 +1413,7 @@ public class StockTakingServiceImpl implements StockTakingService {
if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) {
// 如果盘点的是基础单位 // 如果盘点的是基础单位
newNumberForPlace = placeById.getQuantity() - inventory * 100; newNumberForPlace = placeById.getQuantity() - (int)(inventory * 100);
if (newNumberForPlace > placeById.getMin()) { if (newNumberForPlace > placeById.getMin()) {
//如果更新后的库位数量没有下溢 //如果更新后的库位数量没有下溢
@ -1414,14 +1422,14 @@ public class StockTakingServiceImpl implements StockTakingService {
placeById.setQuantity(newNumberForPlace); placeById.setQuantity(newNumberForPlace);
// 更新物料与库位对应关系的数量 // 更新物料与库位对应关系的数量
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory * 100; newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int)(inventory * 100);
} else { } else {
placeById.setQuantity(0); placeById.setQuantity(0);
newNumberForMatrialAndPlace = 0; newNumberForMatrialAndPlace = 0;
} }
inventoryById.setQuantity(inventoryById.getQuantity() - inventory * 100); inventoryById.setQuantity(inventoryById.getQuantity() - (int)(inventory * 100));
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); 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); splitUnitMapper.updateSplitInventory(splitInventory);
} else { } else {
@ -1500,8 +1508,8 @@ public class StockTakingServiceImpl implements StockTakingService {
// 设置剩余拆单库存处理数量 // 设置剩余拆单库存处理数量
splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - inventory * 100); splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - (int)(inventory * 100));
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + inventory * 100); splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int)(inventory * 100));
splitUnitMapper.updateSplitInventory(splitInventory); splitUnitMapper.updateSplitInventory(splitInventory);
} }
} else { } else {
@ -1585,7 +1593,7 @@ public class StockTakingServiceImpl implements StockTakingService {
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);
// 更新库存数量 // 更新库存数量
@ -1768,8 +1776,8 @@ public class StockTakingServiceImpl implements StockTakingService {
Integer depositoryId = mainRecord.getDepositoryId(); Integer depositoryId = mainRecord.getDepositoryId();
// 获取所有子单 // 获取所有子单
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(ObjectFormatUtil.toInteger(mainId)); List<StockTakingChild> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(ObjectFormatUtil.toInteger(mainId));
for (StockTakingChildP minRecord : minRecordList) { for (StockTakingChild minRecord : minRecordList) {
// 获取子单详情 // 获取子单详情
Integer placeId = minRecord.getPid(); 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()); 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)) { if ("Inventory_up".equals(takingResult)) {
// 如果盘盈 // 如果盘盈
// 更新当前库位数量 // 更新当前库位数量
newNumberForPlace = placeById.getQuantity() + inventory; newNumberForPlace = placeById.getQuantity() +(int)( inventory * 100);
if (newNumberForPlace < placeById.getMax()) { if (newNumberForPlace < placeById.getMax()) {
@ -1832,14 +1840,14 @@ public class StockTakingServiceImpl implements StockTakingService {
continue; continue;
} }
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory; newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int)(inventory*100);
// 更新物料与库位对应关系的数量 // 更新物料与库位对应关系的数量
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace);
} else { } else {
// 如果盘亏 // 如果盘亏
newNumberForPlace = placeById.getQuantity() - inventory; newNumberForPlace = placeById.getQuantity() - (int)(inventory*100);
if (newNumberForPlace > placeById.getMin()) { if (newNumberForPlace > placeById.getMin()) {
//如果更新后的库位数量没有下溢 //如果更新后的库位数量没有下溢
@ -1848,7 +1856,7 @@ public class StockTakingServiceImpl implements StockTakingService {
placeById.setQuantity(newNumberForPlace); placeById.setQuantity(newNumberForPlace);
// 更新物料与库位对应关系的数量 // 更新物料与库位对应关系的数量
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory; newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int)(inventory*100);
} else { } else {
placeById.setQuantity(0); placeById.setQuantity(0);
@ -1958,7 +1966,7 @@ public class StockTakingServiceImpl implements StockTakingService {
for (Integer minId : minIds) { for (Integer minId : minIds) {
// 获取对应子订单 // 获取对应子订单
StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId); StockTakingChild minRecord = stockTakingMapper.selectStockTakingChildPById(minId);
// 获取当前物料库存记录 // 获取当前物料库存记录
@ -2812,11 +2820,11 @@ public class StockTakingServiceImpl implements StockTakingService {
// 用于标识是否向盘点人员发送卡片 // 用于标识是否向盘点人员发送卡片
Boolean flag = true; boolean flag = true;
// 获取主单 // 获取主单
StockTaking mainRecord = stockTakingMapper.selectStockTakingById(mainId); StockTaking mainRecord = stockTakingMapper.selectStockTakingById(mainId);
Integer departmentManagerState = 2; int departmentManagerState = 2;
// 获取当前处理时间 // 获取当前处理时间
String simpleTime = DateUtil.getSimpleTime(new Date()); String simpleTime = DateUtil.getSimpleTime(new Date());
@ -2833,11 +2841,9 @@ public class StockTakingServiceImpl implements StockTakingService {
// 获取所有子单 // 获取所有子单
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); List<StockTakingChild> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId);
for (int i = 0; i < minRecordList.size(); i++) { for (StockTakingChild minRecord : minRecordList) {
// 获取子单详情 // 获取子单详情
StockTakingChildP minRecord = minRecordList.get(i);
Integer placeId = minRecord.getPid(); Integer placeId = minRecord.getPid();
// 获取库位详情 // 获取库位详情
Place placeById = placeMapper.findPlaceById(placeId); 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()); 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)) { if ("Inventory_up".equals(takingResult)) {
// 如果盘盈 // 如果盘盈
// 更新当前库位数量 // 更新当前库位数量
newNumberForPlace = placeById.getQuantity() + inventory; newNumberForPlace = placeById.getQuantity() +(int)(inventory*100);
if (newNumberForPlace < placeById.getMax()) { if (newNumberForPlace < placeById.getMax()) {
@ -2897,14 +2903,14 @@ public class StockTakingServiceImpl implements StockTakingService {
continue; continue;
} }
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory; newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int)(inventory*100);
// 更新物料与库位对应关系的数量 // 更新物料与库位对应关系的数量
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace);
} else { } else {
// 如果盘亏 // 如果盘亏
newNumberForPlace = placeById.getQuantity() - inventory; newNumberForPlace = placeById.getQuantity() - (int)(inventory*100);
if (newNumberForPlace > placeById.getMin()) { if (newNumberForPlace > placeById.getMin()) {
//如果更新后的库位数量没有下溢 //如果更新后的库位数量没有下溢
@ -2913,7 +2919,7 @@ public class StockTakingServiceImpl implements StockTakingService {
placeById.setQuantity(newNumberForPlace); placeById.setQuantity(newNumberForPlace);
// 更新物料与库位对应关系的数量 // 更新物料与库位对应关系的数量
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory; newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() -(int)( inventory*100);
} else { } else {
placeById.setQuantity(0); placeById.setQuantity(0);

26
src/main/resources/templates/pages/stockTaking/stockTakingView.html

@ -278,32 +278,6 @@
element = layui.element, element = layui.element,
form = layui.form; 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: "已处理"}]
}*/
// 用于分步表单加载 // 用于分步表单加载

44
src/test/java/com/dreamchaser/depository_manage/OtherTest.java

@ -49,49 +49,15 @@ public class OtherTest {
@Test @Test
public void main() { public void main() {
// UserByPort userByPort = LinkInterfaceUtil.FindUserById(87, null); // UserByPort userByPort = LinkInterfaceUtil.FindUserById(87, null);
// ApprovalInfo_Details approvalInfo = new ApprovalInfo_Details(); ApprovalInfo_Details approvalInfo = new ApprovalInfo_Details();
// ApprovalInfo_Details_Approver approver = new ApprovalInfo_Details_Approver(); ApprovalInfo_Details_Approver approver = new ApprovalInfo_Details_Approver();
// approver.setUserId("PangFuZhen"); approver.setUserId("PangFuZhen");
// approvalInfo.setApprover(approver); approvalInfo.setApprover(approver);
// depositoryRecordService.reviewByQyWxApprovalIn("[10, 11]",approvalInfo,"42156e781cdc727e7d5deac872be45a9","2","202304240015"); depositoryRecordService.reviewByQyWxApprovalIn("[2]",approvalInfo,"634c7f15fe74b4ba6c857df4032ed21e","2","202304260024");
// stockTakingService.reviewByQyWxApproval("4",approvalInfo,"42156e781cdc727e7d5deac872be45a9","2","202304240042"); // stockTakingService.reviewByQyWxApproval("4",approvalInfo,"42156e781cdc727e7d5deac872be45a9","2","202304240042");
UserByPort userByPort = LinkInterfaceUtil.FindUserById(119, null);
List<UserByPort> departmentHeadByUser = findDepartmentHeadByUser(userByPort.getMaindeparment(),userByPort);
System.out.println(departmentHeadByUser);
} }
public static List<UserByPort> findDepartmentHeadByUser(Integer maindeparment,UserByPort userToken){
List<UserByPort> userByPortList = new ArrayList<>();
String url = PortConfig.external_url + "/staff/archiveslist";
Map<String,Object> 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;
}

Loading…
Cancel
Save