Browse Source

完成出库申请与展示页面修改

lwx_dev
erdanergou 3 years ago
parent
commit
abf47c944c
  1. 14
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  2. 49
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  3. 70
      src/main/java/com/dreamchaser/depository_manage/entity/ApplicationOutRecord.java
  4. 16
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java
  5. 2
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  6. 9
      src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java
  7. 38
      src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordP.java
  8. 4
      src/main/java/com/dreamchaser/depository_manage/pojo/SimpleApplicationOutMinRecordP.java
  9. 2
      src/main/java/com/dreamchaser/depository_manage/pojo/SimpleTaskP.java
  10. 8
      src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java
  11. 160
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  12. 12
      src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java
  13. 8
      src/main/resources/templates/pages/application/application-out.html
  14. 3
      src/test/java/com/dreamchaser/depository_manage/TestForOther.java
  15. 2
      target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  16. 8
      target/classes/templates/pages/application/application-out.html

14
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

@ -153,7 +153,7 @@ public class DepositoryRecordController {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("checkId", userToken.getId()); params.put("checkId", userToken.getId());
// 获取当前用户所有已完成的订单 // 获取当前用户所有已完成的订单
List<ApplicationOutRecordMin> applicationOutMinByCondition = depositoryRecordService.findApplicationOutMinByCondition(params); List<ApplicationOutRecordMinP> applicationOutMinByCondition = depositoryRecordService.findApplicationOutMinByCondition(params);
split = new String[applicationOutMinByCondition.size()]; split = new String[applicationOutMinByCondition.size()];
for (int i = 0; i < applicationOutMinByCondition.size(); i++) { for (int i = 0; i < applicationOutMinByCondition.size(); i++) {
String tempSplit = "minRecord:" + applicationOutMinByCondition.get(i).getId(); String tempSplit = "minRecord:" + applicationOutMinByCondition.get(i).getId();
@ -175,7 +175,7 @@ public class DepositoryRecordController {
continue; continue;
} }
// 获取数据库中子订单信息 // 获取数据库中子订单信息
ApplicationOutRecordMin applicationOutMinById = depositoryRecordService.findApplicationOutMinById(ObjectFormatUtil.toInteger(minRecordId.trim())); ApplicationOutRecordMinP applicationOutMinById = depositoryRecordService.findApplicationOutMinById(ObjectFormatUtil.toInteger(minRecordId.trim()));
// 获取仓库信息 // 获取仓库信息
Depository depositoryRecordById = depositoryService.findDepositoryById(applicationOutMinById.getDepositoryId()); Depository depositoryRecordById = depositoryService.findDepositoryById(applicationOutMinById.getDepositoryId());
// 获取子订单对应主订单 // 获取子订单对应主订单
@ -690,7 +690,7 @@ public class DepositoryRecordController {
param.put("depositoryId", depositoryId); param.put("depositoryId", depositoryId);
param.put("checkId", userToken.getId()); param.put("checkId", userToken.getId());
// 获取所有发送请求用户处理完成的子订单 // 获取所有发送请求用户处理完成的子订单
List<ApplicationOutRecordMin> applicationOutMinByCondition = depositoryRecordService.findApplicationOutMinByCondition(param); List<ApplicationOutRecordMinP> applicationOutMinByCondition = depositoryRecordService.findApplicationOutMinByCondition(param);
split = new String[applicationOutMinByCondition.size()]; split = new String[applicationOutMinByCondition.size()];
for (int i = 0; i < applicationOutMinByCondition.size(); i++) { for (int i = 0; i < applicationOutMinByCondition.size(); i++) {
split[i] = "minRecord:" + applicationOutMinByCondition.get(i).getId(); split[i] = "minRecord:" + applicationOutMinByCondition.get(i).getId();
@ -711,7 +711,7 @@ public class DepositoryRecordController {
// 获取子订单编码 // 获取子订单编码
String minRecordId = split[i].split(":")[1]; String minRecordId = split[i].split(":")[1];
// 获取数据库中子订单信息 // 获取数据库中子订单信息
ApplicationOutRecordMin applicationOutMinById = depositoryRecordService.findApplicationOutMinById(ObjectFormatUtil.toInteger(minRecordId)); ApplicationOutRecordMinP applicationOutMinById = depositoryRecordService.findApplicationOutMinById(ObjectFormatUtil.toInteger(minRecordId));
// 如果该子订单仓库是当前仓库 // 如果该子订单仓库是当前仓库
if (Integer.compare(applicationOutMinById.getDepositoryId(), depositoryId) == 0) { if (Integer.compare(applicationOutMinById.getDepositoryId(), depositoryId) == 0) {
// 获取子订单对应主订单 // 获取子订单对应主订单
@ -811,13 +811,13 @@ public class DepositoryRecordController {
for (ApplicationOutRecordP outRecordP : list) { for (ApplicationOutRecordP outRecordP : list) {
// 根据主订单获取所有子订单 // 根据主订单获取所有子订单
List<ApplicationOutRecordMin> applicationOutMinByParentId = depositoryRecordService.findApplicationOutMinByParentId(outRecordP.getId()); List<ApplicationOutRecordMinP> applicationOutMinByParentId = depositoryRecordService.findApplicationOutMinByParentId(outRecordP.getId());
StringBuilder mname = new StringBuilder(); StringBuilder mname = new StringBuilder();
StringBuilder mcode = new StringBuilder(); StringBuilder mcode = new StringBuilder();
StringBuilder depositoryName = new StringBuilder(); StringBuilder depositoryName = new StringBuilder();
Integer sumQuantity = 0; double sumQuantity = 0;
double sumPrice = 0.0; double sumPrice = 0.0;
for (ApplicationOutRecordMin applicationOutRecordMin : applicationOutMinByParentId) { for (ApplicationOutRecordMinP applicationOutRecordMin : applicationOutMinByParentId) {
// 获取子订单信息 // 获取子订单信息
// 获取出库物料信息 // 获取出库物料信息
Inventory inventory = materialService.findInventoryById(applicationOutRecordMin.getMid()); Inventory inventory = materialService.findInventoryById(applicationOutRecordMin.getMid());

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

@ -385,7 +385,7 @@ public class PageController {
continue; continue;
} }
Integer minRecordId = ObjectFormatUtil.toInteger(s.split(":")[1].trim()); Integer minRecordId = ObjectFormatUtil.toInteger(s.split(":")[1].trim());
ApplicationOutRecordMin applicationOutMinById = depositoryRecordService.findApplicationOutMinById(minRecordId); ApplicationOutRecordMinP applicationOutMinById = depositoryRecordService.findApplicationOutMinById(minRecordId);
ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(applicationOutMinById.getParentId()); ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(applicationOutMinById.getParentId());
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationOutRecordPById.getApplicantId(), userToken); UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationOutRecordPById.getApplicantId(), userToken);
applicationOutRecordPById.setApplicantName(userByPort.getName()); applicationOutRecordPById.setApplicantName(userByPort.getName());
@ -1558,19 +1558,19 @@ public class PageController {
ApplicationOutRecordP recordP = depositoryRecordService.findApplicationOutRecordPById(id); ApplicationOutRecordP recordP = depositoryRecordService.findApplicationOutRecordPById(id);
// 获取所有子订单 // 获取所有子订单
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordService.findApplicationOutRecordMinByParent(recordP.getId()); List<ApplicationOutRecordMinP> applicationOutRecordMinByParent = depositoryRecordService.findApplicationOutRecordMinByParent(recordP.getId());
// 展示出库的仓库名 // 展示出库的仓库名
StringBuilder depositoryName = new StringBuilder(); StringBuilder depositoryName = new StringBuilder();
// 展示出库的库位编码 // 展示出库的库位编码
StringBuilder placeCode = new StringBuilder(); StringBuilder placeCode = new StringBuilder();
// 当前订单总数 // 当前订单总数
Integer sumQuantity = 0; Double sumQuantity = 0.0;
// 当前总额 // 当前总额
Double sumPrice = 0.0; Double sumPrice = 0.0;
// 计量单位 // 计量单位
StringBuffer sumUnit = new StringBuffer(); StringBuffer sumUnit = new StringBuffer();
for (ApplicationOutRecordMin applicationOutRecordMin : applicationOutRecordMinByParent) { for (ApplicationOutRecordMinP applicationOutRecordMin : applicationOutRecordMinByParent) {
// 获取子订单信息 // 获取子订单信息
// 获取出库物料信息 // 获取出库物料信息
Inventory inventoryById = materialService.findInventoryById(applicationOutRecordMin.getMid()); Inventory inventoryById = materialService.findInventoryById(applicationOutRecordMin.getMid());
@ -1809,17 +1809,16 @@ public class PageController {
mv.setViewName("pages/application/form-step-look_minRecordOut"); mv.setViewName("pages/application/form-step-look_minRecordOut");
if (id != null) { if (id != null) {
// 获取当前子订单 // 获取当前子订单
ApplicationOutRecordMin recordMin = depositoryRecordService.findApplicationOutMinById(id); ApplicationOutRecordMinP recordMinP = depositoryRecordService.findApplicationOutMinById(id);
ApplicationOutRecordMinP recordMinP = new ApplicationOutRecordMinP(recordMin);
// 获取出库物料信息 // 获取出库物料信息
Inventory inventoryById = materialService.findInventoryById(recordMin.getMid()); Inventory inventoryById = materialService.findInventoryById(recordMinP.getMid());
// 获取出库物料仓库信息 // 获取出库物料仓库信息
Depository depository = depositoryService.findDepositoryById(recordMin.getDepositoryId()); Depository depository = depositoryService.findDepositoryById(recordMinP.getDepositoryId());
// 获取出库库位 // 获取出库库位
Place placeById = placeService.findPlaceById(recordMin.getPlaceId()); Place placeById = placeService.findPlaceById(recordMinP.getPlaceId());
// 获取处理人 // 获取处理人
UserByPort userByPort = LinkInterfaceUtil.FindUserById(recordMin.getCheckId(), userToken); UserByPort userByPort = LinkInterfaceUtil.FindUserById(recordMinP.getCheckId(), userToken);
if(recordMinP.getAdminorgId() != null){ if(recordMinP.getAdminorgId() != null){
Administration company = LinkInterfaceUtil.getCompany(recordMinP.getAdminorgId(), userToken); Administration company = LinkInterfaceUtil.getCompany(recordMinP.getAdminorgId(), userToken);
@ -1875,7 +1874,7 @@ public class PageController {
// 如果是转移订单 // 如果是转移订单
mv.addObject("display", "table-row"); mv.addObject("display", "table-row");
// 获取订单详情 // 获取订单详情
TransferRecord transferRecord = depositoryRecordService.findTransferRecordById(recordMin.getTransferId()); TransferRecord transferRecord = depositoryRecordService.findTransferRecordById(recordMinP.getTransferId());
Place place = placeService.findPlaceById(transferRecord.getToPlaceId()); Place place = placeService.findPlaceById(transferRecord.getToPlaceId());
Depository depositoryById = depositoryService.findDepositoryById(transferRecord.getToId()); Depository depositoryById = depositoryService.findDepositoryById(transferRecord.getToId());
mv.addObject("toLocation", depositoryById.getDname() + "-" + place.getCode()); mv.addObject("toLocation", depositoryById.getDname() + "-" + place.getCode());
@ -1902,7 +1901,7 @@ public class PageController {
// 获取出库主单 // 获取出库主单
ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(id); ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(id);
// 获取出库子单 // 获取出库子单
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordService.findApplicationOutRecordMinByParent(applicationOutRecordPById.getId()); List<ApplicationOutRecordMinP> applicationOutRecordMinByParent = depositoryRecordService.findApplicationOutRecordMinByParent(applicationOutRecordPById.getId());
// 展示物料名 // 展示物料名
StringBuilder mname = new StringBuilder(); StringBuilder mname = new StringBuilder();
// 展示物料编码 // 展示物料编码
@ -1914,31 +1913,29 @@ public class PageController {
// 展示当前子订单的处理人 // 展示当前子订单的处理人
StringBuilder outDisposer = new StringBuilder(); StringBuilder outDisposer = new StringBuilder();
// 当前订单总数 // 当前订单总数
Integer sumQuantity = 0; Double sumQuantity = 0.0;
// 每个物料数量 // 每个物料数量
StringBuilder quantityByMaterial = new StringBuilder(); StringBuilder quantityByMaterial = new StringBuilder();
List<ApplicationOutRecordMinP> recordMinPList = new ArrayList<>(); List<ApplicationOutRecordMinP> recordMinPList = new ArrayList<>();
// 当前总额 // 当前总额
double sumPrice = 0.0; double sumPrice = 0.0;
for (ApplicationOutRecordMin applicationOutRecordMin : applicationOutRecordMinByParent) { for (ApplicationOutRecordMinP recordMinP : applicationOutRecordMinByParent) {
// 获取子订单信息 // 获取子订单信息
// 获取输出子订单信息
ApplicationOutRecordMinP recordMinP = new ApplicationOutRecordMinP(applicationOutRecordMin);
// 获取出库物料信息 // 获取出库物料信息
Inventory inventoryById = materialService.findInventoryById(applicationOutRecordMin.getMid()); Inventory inventoryById = materialService.findInventoryById(recordMinP.getMid());
// 获取出库物料仓库信息 // 获取出库物料仓库信息
Depository depository = depositoryService.findDepositoryById(applicationOutRecordMin.getDepositoryId()); Depository depository = depositoryService.findDepositoryById(recordMinP.getDepositoryId());
// 获取出库库位 // 获取出库库位
Place placeById = placeService.findPlaceById(applicationOutRecordMin.getPlaceId()); Place placeById = placeService.findPlaceById(recordMinP.getPlaceId());
if (placeById != null) { if (placeById != null) {
placeCode.append(placeById.getCode()).append(","); placeCode.append(placeById.getCode()).append(",");
} }
recordMinP.setMname(inventoryById.getMname()); recordMinP.setMname(inventoryById.getMname());
recordMinP.setDepositoryName(depository.getDname()); recordMinP.setDepositoryName(depository.getDname());
recordMinP.setPlaceCode(placeById.getCode()); recordMinP.setPlaceCode(placeById.getCode());
Integer checkId = applicationOutRecordMin.getCheckId(); Integer checkId = recordMinP.getCheckId();
if (checkId != null) { if (checkId != null) {
// 如果当前子订单已经处理 // 如果当前子订单已经处理
// 获取当前处理人 // 获取当前处理人
@ -1953,14 +1950,14 @@ public class PageController {
mname.append(inventoryById.getMname()).append(","); mname.append(inventoryById.getMname()).append(",");
mcode.append(inventoryById.getCode()).append(","); mcode.append(inventoryById.getCode()).append(",");
depositoryName.append(depository.getDname()).append(","); depositoryName.append(depository.getDname()).append(",");
quantityByMaterial.append(applicationOutRecordMin.getQuantity()).append(","); quantityByMaterial.append(recordMinP.getQuantity()).append(",");
sumQuantity += applicationOutRecordMin.getQuantity(); sumQuantity += recordMinP.getQuantity();
// 获取当前计量单位 // 获取当前计量单位
String unit = recordMinP.getUnit(); String unit = recordMinP.getUnit();
if ("-1".equals(unit)) { if ("-1".equals(unit)) {
// 如果是基础单位 // 如果是基础单位
if (inventoryById.getPrice() != null) { if (inventoryById.getPrice() != null) {
sumPrice += (inventoryById.getPrice() * applicationOutRecordMin.getQuantity()); sumPrice += (inventoryById.getPrice() * recordMinP.getQuantity());
} else { } else {
sumPrice += 0.0; sumPrice += 0.0;
} }
@ -1977,7 +1974,7 @@ public class PageController {
// 获取当前拆单记录与基础单位的进制 // 获取当前拆单记录与基础单位的进制
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
if (inventoryById.getPrice() != null) { if (inventoryById.getPrice() != null) {
sumPrice += (inventoryById.getPrice() / scale * applicationOutRecordMin.getQuantity()); sumPrice += (inventoryById.getPrice() / scale * recordMinP.getQuantity());
} else { } else {
sumPrice += 0.0; sumPrice += 0.0;
} }
@ -2497,7 +2494,7 @@ public class PageController {
public ModelAndView scanQrCodeByOut(Integer id, HttpServletRequest request) { public ModelAndView scanQrCodeByOut(Integer id, HttpServletRequest request) {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
// 获取当前要处理的子订单 // 获取当前要处理的子订单
ApplicationOutRecordMin applicationOutMinById = depositoryRecordService.findApplicationOutMinById(id); ApplicationOutRecordMinP applicationOutMinById = depositoryRecordService.findApplicationOutMinById(id);
mv.setViewName("pages/scanQrCode/scanQrCodeOut"); mv.setViewName("pages/scanQrCode/scanQrCodeOut");
Material materialById = materialService.findMaterialById(applicationOutMinById.getMid()); Material materialById = materialService.findMaterialById(applicationOutMinById.getMid());
mv.addObject("materialById", materialById); mv.addObject("materialById", materialById);
@ -2510,7 +2507,7 @@ public class PageController {
public ModelAndView scanBarOrQrCodeOut(Integer id, HttpServletRequest request) { public ModelAndView scanBarOrQrCodeOut(Integer id, HttpServletRequest request) {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
// 获取当前要处理的子订单 // 获取当前要处理的子订单
ApplicationOutRecordMin applicationOutMinById = depositoryRecordService.findApplicationOutMinById(id); ApplicationOutRecordMinP applicationOutMinById = depositoryRecordService.findApplicationOutMinById(id);
mv.setViewName("pages/scanQrCode/ScanBarOrQrCodeOut"); mv.setViewName("pages/scanQrCode/ScanBarOrQrCodeOut");
Inventory materialById = materialService.findInventoryById(applicationOutMinById.getMid()); Inventory materialById = materialService.findInventoryById(applicationOutMinById.getMid());
mv.addObject("materialById", materialById); mv.addObject("materialById", materialById);

70
src/main/java/com/dreamchaser/depository_manage/entity/ApplicationOutRecord.java

@ -14,20 +14,35 @@ public class ApplicationOutRecord {
*/ */
private Integer mid; private Integer mid;
/**
* 物料名称
*/
private String mname;
/** /**
* 仓库id * 仓库id
*/ */
private Integer depositoryId; private Integer depositoryId;
/**
* 仓库名称
*/
private String depositoryName;
/** /**
* 申请人id * 申请人id
*/ */
private Integer applicantId; private Integer applicantId;
/**
* 申请人名称
*/
private String applicantName;
/** /**
* 申请时间 * 申请时间
*/ */
private Long applicantTime; private String applicantTime;
/** /**
@ -43,7 +58,7 @@ public class ApplicationOutRecord {
/** /**
* 金额 * 金额
*/ */
private Integer price; private Double price;
/** /**
* 数量 * 数量
@ -51,19 +66,24 @@ public class ApplicationOutRecord {
private Integer quantity; private Integer quantity;
/** /**
* 部门负责人 * 部门负责人编号
*/ */
private String departmenthead; private String departmenthead;
/**
* 部门负责人姓名
*/
private String departmentheadName;
/** /**
* 部门负责人意见1通过2退回 * 部门负责人意见1通过2退回
*/ */
private Integer departmentheadPass; private String departmentheadPass;
/** /**
* 部门负责人处理时间 * 部门负责人处理时间
*/ */
private Long departmentheadTime; private String departmentheadTime;
/** /**
* 部门负责人审核备注 * 部门负责人审核备注
@ -73,17 +93,21 @@ public class ApplicationOutRecord {
/** /**
* 仓库管理员 * 仓库管理员
*/ */
private Integer depositoryManager; private String depositoryManager;
/**
* 仓库管理员名称
*/
private String depositoryManagerName;
/** /**
* 仓库管理员意见1通过2退回 * 仓库管理员意见1通过2退回3待处理4不需其处理
*/ */
private Integer depositoryManagerPass; private String depositoryManagerPass;
/** /**
* 仓库管理员处理时间 * 仓库管理员处理时间
*/ */
private Long depositoryManagerTime; private String depositoryManagerTime;
/** /**
* 仓库管理员审核备注 * 仓库管理员审核备注
@ -100,21 +124,45 @@ public class ApplicationOutRecord {
*/ */
private Integer istransfer; private Integer istransfer;
/** /**
* 转移申请编号 * 物料存货编码
*/ */
private String transferId; private String mcode;
/** /**
* 对应库位id * 对应库位id
*/ */
private Integer placeId; private Integer placeId;
/**
* 对应库位编码
*/
private String pCode;
/** /**
* 订单状态 * 订单状态
*/ */
private Integer pass; private Integer pass;
/**
* 出库单位
*/
private String unit;
/**
* 施工单位id
*/
private Integer constructionUnitId;
/**
* 施工单位名称
*/
private String constructionUnitName;
/**
* 部门id
*/
private Integer adminorgId;
} }

16
src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java

@ -1,8 +1,6 @@
package com.dreamchaser.depository_manage.mapper; package com.dreamchaser.depository_manage.mapper;
import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.pojo.ApplicationOutRecordMinP;
import com.dreamchaser.depository_manage.pojo.ApplicationOutRecordP;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -97,14 +95,14 @@ public interface DepositoryRecordMapper {
* 查找所有出库记录 * 查找所有出库记录
* @return * @return
*/ */
List<ApplicationOutRecordP> findApplicationOutRecordPAll(); List<ApplicationOutRecord> findApplicationOutRecordPAll();
/** /**
* 查询一段时间内的出库记录 * 查询一段时间内的出库记录
* @param map 条件起止时间 * @param map 条件起止时间
* @return * @return
*/ */
List<ApplicationOutRecordP> findApplicationOutRecordPForAPeriodOfTime(Map<String,Object> map); List<ApplicationOutRecord> findApplicationOutRecordPForAPeriodOfTime(Map<String,Object> map);
/** /**
* 根据条件查询仓库调度记录同时支持分页查询需要begin和size参数 * 根据条件查询仓库调度记录同时支持分页查询需要begin和size参数
@ -271,7 +269,7 @@ public interface DepositoryRecordMapper {
* @param depositoryId 待查询仓库id * @param depositoryId 待查询仓库id
* @return * @return
*/ */
List<ApplicationOutRecordP> findApplicationOutRecordByDepository(String depositoryId); List<ApplicationOutRecord> findApplicationOutRecordByDepository(String depositoryId);
/** /**
@ -279,14 +277,14 @@ public interface DepositoryRecordMapper {
* @param map * @param map
* @return * @return
*/ */
List<ApplicationOutRecordP> findApplicationOutRecordPByCondition(Map<String,Object> map); List<ApplicationOutRecord> findApplicationOutRecordPByCondition(Map<String,Object> map);
/** /**
* 查询当前用户出库记录及其管理仓库的出库记录 * 查询当前用户出库记录及其管理仓库的出库记录
* @param map 查询条件 * @param map 查询条件
* @return * @return
*/ */
List<ApplicationOutRecordP> findApplicationOutRecordPByUser(Map<String,Object> map); List<ApplicationOutRecord> findApplicationOutRecordPByUser(Map<String,Object> map);
/** /**
* 查询当前用户出库记录及其管理仓库的出库记录数目 * 查询当前用户出库记录及其管理仓库的出库记录数目
@ -334,7 +332,7 @@ public interface DepositoryRecordMapper {
* @param id * @param id
* @return * @return
*/ */
ApplicationOutRecordP findApplicationOutRecordPById(Integer id); ApplicationOutRecord findApplicationOutRecordPById(Integer id);
/** /**
@ -342,7 +340,7 @@ public interface DepositoryRecordMapper {
* @param list * @param list
* @return * @return
*/ */
List<ApplicationOutRecordP> findApplicationOutRecordPByIds(List<Integer> list); List<ApplicationOutRecord> findApplicationOutRecordPByIds(List<Integer> list);
/** /**
* 根据id删除入库记录 * 根据id删除入库记录

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

@ -87,7 +87,7 @@
</resultMap> </resultMap>
<!-- 插入出库记录--> <!-- 插入出库记录-->
<resultMap id="applicationOutRecord" type="com.dreamchaser.depository_manage.pojo.ApplicationOutRecordP"> <resultMap id="applicationOutRecord" type="com.dreamchaser.depository_manage.entity.ApplicationOutRecord">
<id property="id" column="aorid" jdbcType="INTEGER"/> <id property="id" column="aorid" jdbcType="INTEGER"/>
<result column="mid" property="mid" jdbcType="INTEGER"/> <result column="mid" property="mid" jdbcType="INTEGER"/>
<result column="mname" property="mname" jdbcType="VARCHAR"/> <result column="mname" property="mname" jdbcType="VARCHAR"/>

9
src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java

@ -50,7 +50,7 @@ public class ApplicationOutRecordMinP {
/** /**
* 数量 * 数量
*/ */
private Integer quantity; private Double quantity;
/** /**
* 出库单号 * 出库单号
*/ */
@ -121,6 +121,10 @@ public class ApplicationOutRecordMinP {
* 部门名称 * 部门名称
*/ */
private String adminorgName; private String adminorgName;
/**
* 已经出库的数量
*/
private Integer trueOut;
@ -130,7 +134,7 @@ public class ApplicationOutRecordMinP {
this.depositoryId = recordMin.getDepositoryId(); this.depositoryId = recordMin.getDepositoryId();
this.checkId = recordMin.getCheckId(); this.checkId = recordMin.getCheckId();
this.code = recordMin.getCode(); this.code = recordMin.getCode();
this.quantity = recordMin.getQuantity(); this.quantity = (double)(recordMin.getQuantity() / 100);
this.state = recordMin.getState(); this.state = recordMin.getState();
this.parentId = recordMin.getParentId(); this.parentId = recordMin.getParentId();
this.placeId = recordMin.getPlaceId(); this.placeId = recordMin.getPlaceId();
@ -138,5 +142,6 @@ public class ApplicationOutRecordMinP {
this.transferId = recordMin.getTransferId(); this.transferId = recordMin.getTransferId();
this.constructionUnitId = recordMin.getConstructionUnitId(); this.constructionUnitId = recordMin.getConstructionUnitId();
this.adminorgId = recordMin.getAdminorgId(); this.adminorgId = recordMin.getAdminorgId();
this.trueOut = recordMin.getTrueOut();
} }
} }

38
src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordP.java

@ -1,5 +1,6 @@
package com.dreamchaser.depository_manage.pojo; package com.dreamchaser.depository_manage.pojo;
import com.dreamchaser.depository_manage.entity.ApplicationOutRecord;
import lombok.Data; import lombok.Data;
@Data @Data
@ -63,7 +64,7 @@ public class ApplicationOutRecordP {
/** /**
* 数量 * 数量
*/ */
private Integer quantity; private Double quantity;
/** /**
* 部门负责人编号 * 部门负责人编号
@ -162,4 +163,39 @@ public class ApplicationOutRecordP {
* 部门id * 部门id
*/ */
private Integer adminorgId; private Integer adminorgId;
public ApplicationOutRecordP(ApplicationOutRecord aor) {
this.id = aor.getId();
this.mid = aor.getMid();
this.mname = aor.getMname();
this.depositoryId = aor.getDepositoryId();
this.depositoryName = aor.getDepositoryName();
this.applicantId = aor.getApplicantId();
this.applicantName = aor.getApplicantName();
this.applicantTime = aor.getApplicantTime();
this.applyRemark = aor.getApplyRemark();
this.code = aor.getCode();
this.price = aor.getPrice();
this.quantity = (double)aor.getQuantity() / 100;
this.departmenthead = aor.getDepartmenthead();
this.departmentheadName = aor.getDepartmentheadName();
this.departmentheadPass = aor.getDepartmentheadPass();
this.departmentheadTime = aor.getDepartmentheadTime();
this.departmentheadMessage = aor.getDepartmentheadMessage();
this.depositoryManager = aor.getDepositoryManager();
this.depositoryManagerName = aor.getDepositoryManagerName();
this.depositoryManagerPass = aor.getDepositoryManagerPass();
this.depositoryManagerTime = aor.getDepositoryManagerTime();
this.depositoryManagerMessage = aor.getDepositoryManagerMessage();
this.state = aor.getState();
this.istransfer = aor.getIstransfer();
this.mcode = aor.getMcode();
this.placeId = aor.getPlaceId();
this.pCode = aor.getPCode();
this.pass = aor.getPass();
this.unit = aor.getUnit();
this.constructionUnitId = aor.getConstructionUnitId();
this.constructionUnitName = aor.getConstructionUnitName();
this.adminorgId = aor.getAdminorgId();
}
} }

4
src/main/java/com/dreamchaser/depository_manage/pojo/SimpleApplicationOutMinRecordP.java

@ -43,7 +43,7 @@ public class SimpleApplicationOutMinRecordP {
/** /**
* 申请数目 * 申请数目
*/ */
private Integer quantity; private Double quantity;
/** /**
* 仓库编号 * 仓库编号
*/ */
@ -92,7 +92,7 @@ public class SimpleApplicationOutMinRecordP {
*/ */
private String version; private String version;
public SimpleApplicationOutMinRecordP(ApplicationOutRecordMin applicationOutRecordMin) { public SimpleApplicationOutMinRecordP(ApplicationOutRecordMinP applicationOutRecordMin) {
this.id = applicationOutRecordMin.getId(); this.id = applicationOutRecordMin.getId();
this.parentId = applicationOutRecordMin.getParentId(); this.parentId = applicationOutRecordMin.getParentId();
this.quantity = applicationOutRecordMin.getQuantity(); this.quantity = applicationOutRecordMin.getQuantity();

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

@ -65,7 +65,7 @@ public class SimpleTaskP {
this.type = "库存盘点请求"; this.type = "库存盘点请求";
} }
public SimpleTaskP(ApplicationOutRecordP aor,ApplicationOutRecordMin aorm){ public SimpleTaskP(ApplicationOutRecordP aor,ApplicationOutRecordMinP aorm){
this.id = Long.valueOf(aorm.getDepositoryId().toString()); this.id = Long.valueOf(aorm.getDepositoryId().toString());
this.code = aorm.getCode(); this.code = aorm.getCode();
this.applicantTime = DateUtil.TimeStampToDateTime(Long.valueOf(aor.getApplicantTime())); this.applicantTime = DateUtil.TimeStampToDateTime(Long.valueOf(aor.getApplicantTime()));

8
src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java

@ -469,7 +469,7 @@ public interface DepositoryRecordService {
* @param id * @param id
* @return * @return
*/ */
List<ApplicationOutRecordMin> findApplicationOutRecordMinByParent(Integer id); List<ApplicationOutRecordMinP> findApplicationOutRecordMinByParent(Integer id);
/** /**
* 根据主键获取子表信息 * 根据主键获取子表信息
@ -477,7 +477,7 @@ public interface DepositoryRecordService {
* @param id * @param id
* @return * @return
*/ */
ApplicationOutRecordMin findApplicationOutMinById(Integer id); ApplicationOutRecordMinP findApplicationOutMinById(Integer id);
/** /**
* 根据条件获取子订单 * 根据条件获取子订单
@ -485,7 +485,7 @@ public interface DepositoryRecordService {
* @param map * @param map
* @return * @return
*/ */
List<ApplicationOutRecordMin> findApplicationOutMinByCondition(Map<String, Object> map); List<ApplicationOutRecordMinP> findApplicationOutMinByCondition(Map<String, Object> map);
/** /**
* 根据主订单获取子订单 * 根据主订单获取子订单
@ -493,7 +493,7 @@ public interface DepositoryRecordService {
* @param parentId * @param parentId
* @return * @return
*/ */
List<ApplicationOutRecordMin> findApplicationOutMinByParentId(Integer parentId); List<ApplicationOutRecordMinP> findApplicationOutMinByParentId(Integer parentId);
/** /**

160
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -276,7 +276,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
@Override @Override
public Integer deleteApplicationOutRecordById(Integer id, UserByPort userByPort) { public Integer deleteApplicationOutRecordById(Integer id, UserByPort userByPort) {
// 获取主单 // 获取主单
ApplicationOutRecordP recordP = depositoryRecordMapper.findApplicationOutRecordPById(id); ApplicationOutRecord recordP = depositoryRecordMapper.findApplicationOutRecordPById(id);
// 删除主单 // 删除主单
Integer integer = depositoryRecordMapper.deleteApplicationOutRecordById(id); Integer integer = depositoryRecordMapper.deleteApplicationOutRecordById(id);
@ -329,7 +329,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
@Override @Override
public Integer deleteApplicationOutRecordByIds(List<Integer> list, UserByPort userByPort) { public Integer deleteApplicationOutRecordByIds(List<Integer> list, UserByPort userByPort) {
// 获取出库单列表 // 获取出库单列表
List<ApplicationOutRecordP> recordPList = depositoryRecordMapper.findApplicationOutRecordPByIds(list); List<ApplicationOutRecord> recordPList = depositoryRecordMapper.findApplicationOutRecordPByIds(list);
Integer integer = depositoryRecordMapper.deleteApplicationOutRecordByIds(list); Integer integer = depositoryRecordMapper.deleteApplicationOutRecordByIds(list);
@ -339,7 +339,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
public void run() { public void run() {
for (ApplicationOutRecordP recordP : recordPList for (ApplicationOutRecord recordP : recordPList
) { ) {
// 获取该用户在redis中的订单记录 // 获取该用户在redis中的订单记录
String key = "user:" + recordP.getApplicantId(); String key = "user:" + recordP.getApplicantId();
@ -493,22 +493,22 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
// 获取今天的额度 // 获取今天的额度
Double priceForToday = 0.0; double priceForToday = 0.0;
// 获取今天的总数 // 获取今天的总数
Integer countForToday = 0; Double countForToday = 0.0;
// 获取昨天的额度 // 获取昨天的额度
Double priceForYesterday = 0.0; double priceForYesterday = 0.0;
// 获取昨天的总数 // 获取昨天的总数
Integer countForYesterday = 0; Double countForYesterday = 0.0;
if (state.isEmpty()) { if (state.isEmpty()) {
// 获取今天为止的出库记录 // 获取今天为止的出库记录
List<ApplicationOutRecordP> applicationOutRecordPForToday = depositoryRecordMapper.findApplicationOutRecordPForAPeriodOfTime(mapForToday); List<ApplicationOutRecord> applicationOutRecordPForToday = depositoryRecordMapper.findApplicationOutRecordPForAPeriodOfTime(mapForToday);
// 今天的出库记录数 // 今天的出库记录数
int todaySize = applicationOutRecordPForToday.size(); int todaySize = applicationOutRecordPForToday.size();
// 获取昨天的出库记录 // 获取昨天的出库记录
List<ApplicationOutRecordP> applicationOutRecordPForYesterday = depositoryRecordMapper.findApplicationOutRecordPForAPeriodOfTime(mapForYesterday); List<ApplicationOutRecord> applicationOutRecordPForYesterday = depositoryRecordMapper.findApplicationOutRecordPForAPeriodOfTime(mapForYesterday);
// 昨天的出库记录数 // 昨天的出库记录数
int yesterdaySize = applicationOutRecordPForYesterday.size(); int yesterdaySize = applicationOutRecordPForYesterday.size();
@ -521,9 +521,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
CompletionService<Object> completionServiceForToday = new ExecutorCompletionService<Object>(exsForToday); CompletionService<Object> completionServiceForToday = new ExecutorCompletionService<Object>(exsForToday);
// 开启线程计算今天的额度 // 开启线程计算今天的额度
for (int i = 0; i < todaySize; i++) { for (ApplicationOutRecord recordP : applicationOutRecordPForToday) {
// 获取当前主记录 // 获取当前主记录
ApplicationOutRecordP recordP = applicationOutRecordPForToday.get(i);
Future<Object> submit = completionServiceForToday.submit(new CalcApplicationOutInfo(recordP)); Future<Object> submit = completionServiceForToday.submit(new CalcApplicationOutInfo(recordP));
futureListForToday.add(submit); futureListForToday.add(submit);
} }
@ -549,8 +548,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 1.定义CompletionService // 1.定义CompletionService
CompletionService<Object> completionServiceForYesterday = new ExecutorCompletionService<Object>(exsForYesterday); CompletionService<Object> completionServiceForYesterday = new ExecutorCompletionService<Object>(exsForYesterday);
// 开启线程计算昨天的额度 // 开启线程计算昨天的额度
for (int i = 0; i < yesterdaySize; i++) { for (ApplicationOutRecord recordP : applicationOutRecordPForYesterday) {
ApplicationOutRecordP recordP = applicationOutRecordPForYesterday.get(i);
Future<Object> submit = completionServiceForYesterday.submit(new CalcApplicationOutInfo(recordP)); Future<Object> submit = completionServiceForYesterday.submit(new CalcApplicationOutInfo(recordP));
futureListForYesterday.add(submit); futureListForYesterday.add(submit);
} }
@ -576,10 +574,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Double ratioForCount = 0.0; Double ratioForCount = 0.0;
Double ratioForPrice = 0.0; Double ratioForPrice = 0.0;
if (Double.compare(countForYesterday, 0.0) != 0) { if (Double.compare(countForYesterday, 0.0) != 0) {
ratioForCount = ((countForToday - countForYesterday) / Double.parseDouble(countForYesterday.toString())); ratioForCount = ((countForToday - countForYesterday) / countForYesterday);
} }
if (Double.compare(priceForYesterday, 0.0) != 0) { if (Double.compare(priceForYesterday, 0.0) != 0) {
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(priceForYesterday.toString()); ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(Double.toString(priceForYesterday));
} }
BigDecimal bgForSum = new BigDecimal(ratioForCount); BigDecimal bgForSum = new BigDecimal(ratioForCount);
BigDecimal bgForPrice = new BigDecimal(ratioForPrice); BigDecimal bgForPrice = new BigDecimal(ratioForPrice);
@ -623,10 +621,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Double ratioForCount = 0.0; Double ratioForCount = 0.0;
Double ratioForPrice = 0.0; Double ratioForPrice = 0.0;
if (Double.compare(countForYesterday, 0.0) != 0) { if (Double.compare(countForYesterday, 0.0) != 0) {
ratioForCount = ((countForToday - countForYesterday) / Double.parseDouble(countForYesterday.toString())); ratioForCount = ((countForToday - countForYesterday) / countForYesterday);
} }
if (Double.compare(priceForYesterday, 0.0) != 0) { if (Double.compare(priceForYesterday, 0.0) != 0) {
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(priceForYesterday.toString()); ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(Double.toString(priceForYesterday));
} }
BigDecimal bgForSum = new BigDecimal(ratioForCount); BigDecimal bgForSum = new BigDecimal(ratioForCount);
BigDecimal bgForPrice = new BigDecimal(ratioForPrice); BigDecimal bgForPrice = new BigDecimal(ratioForPrice);
@ -848,13 +846,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
String unit = (String) map.get("unit"); String unit = (String) map.get("unit");
if ("-1".equals(unit)) { if ("-1".equals(unit)) {
// 获取出库数量 // 获取出库数量
Integer quantity = ObjectFormatUtil.toInteger(map.get("quantity")); Double quantity = ObjectFormatUtil.toDouble(map.get("quantity"));
// 设置当前暂时出库数量 // 设置当前暂时出库数量
inventoryById.setNumberOfTemporary(inventoryById.getNumberOfTemporary() + quantity); inventoryById.setNumberOfTemporary(inventoryById.getNumberOfTemporary() + quantity.intValue());
// 修改库存记录 // 修改库存记录
materialMapper.updateInventory(inventoryById); materialMapper.updateInventory(inventoryById);
} }
map.put("quantity",ObjectFormatUtil.toDouble(map.get("quantity")) * 100);
return depositoryRecordMapper.insertApplicationOutRecordMin(map); return depositoryRecordMapper.insertApplicationOutRecordMin(map);
} }
@ -865,8 +862,15 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
* @return * @return
*/ */
@Override @Override
public List<ApplicationOutRecordMin> findApplicationOutRecordMinByParent(Integer id) { public List<ApplicationOutRecordMinP> findApplicationOutRecordMinByParent(Integer id) {
return depositoryRecordMapper.findApplicationOutRecordMinByParent(id); List<ApplicationOutRecordMin> outRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(id);
List<ApplicationOutRecordMinP> recordMinPList = new ArrayList<>();
for (ApplicationOutRecordMin aorm:outRecordMinByParent
) {
ApplicationOutRecordMinP aormP = new ApplicationOutRecordMinP(aorm);
recordMinPList.add(aormP);
}
return recordMinPList;
} }
/** /**
@ -876,8 +880,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
* @return * @return
*/ */
@Override @Override
public ApplicationOutRecordMin findApplicationOutMinById(Integer id) { public ApplicationOutRecordMinP findApplicationOutMinById(Integer id) {
return depositoryRecordMapper.findApplicationOutMinById(id); return new ApplicationOutRecordMinP(depositoryRecordMapper.findApplicationOutMinById(id));
} }
/** /**
@ -887,8 +891,14 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
* @return * @return
*/ */
@Override @Override
public List<ApplicationOutRecordMin> findApplicationOutMinByCondition(Map<String, Object> map) { public List<ApplicationOutRecordMinP> findApplicationOutMinByCondition(Map<String, Object> map) {
return depositoryRecordMapper.findApplicationOutMinByCondition(map); List<ApplicationOutRecordMin> condition = depositoryRecordMapper.findApplicationOutMinByCondition(map);
List<ApplicationOutRecordMinP> result = new ArrayList<>();
for (ApplicationOutRecordMin aorm:condition
) {
result.add(new ApplicationOutRecordMinP(aorm));
}
return result;
} }
/** /**
@ -898,10 +908,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
* @return * @return
*/ */
@Override @Override
public List<ApplicationOutRecordMin> findApplicationOutMinByParentId(Integer parentId) { public List<ApplicationOutRecordMinP> findApplicationOutMinByParentId(Integer parentId) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("parentId", parentId); map.put("parentId", parentId);
return depositoryRecordMapper.findApplicationOutMinByCondition(map); List<ApplicationOutRecordMin> applicationOutMinByCondition = depositoryRecordMapper.findApplicationOutMinByCondition(map);
List<ApplicationOutRecordMinP> applicationOutRecordMinPList = new ArrayList<>();
for (ApplicationOutRecordMin recordMin:applicationOutMinByCondition
) {
ApplicationOutRecordMinP recordMinP = new ApplicationOutRecordMinP(recordMin);
applicationOutRecordMinPList.add(recordMinP);
}
return applicationOutRecordMinPList;
} }
/** /**
@ -927,7 +944,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取库存信息 // 获取库存信息
Inventory inventory = materialMapper.findInventoryById(mid); Inventory inventory = materialMapper.findInventoryById(mid);
// 获取子订单对应的主订单 // 获取子订单对应的主订单
ApplicationOutRecordP record = depositoryRecordMapper.findApplicationOutRecordPById(applicationOutMinById.getParentId()); ApplicationOutRecord record = depositoryRecordMapper.findApplicationOutRecordPById(applicationOutMinById.getParentId());
// 设置标志位 // 设置标志位
boolean flag = true; boolean flag = true;
// 设置最终返回值 // 设置最终返回值
@ -1656,7 +1673,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
* @param userAgent user-agent * @param userAgent user-agent
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecordP record, Integer trueOut, UserByPort userByPort, Integer placeId, String userAgent) { void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Integer trueOut, UserByPort userByPort, Integer placeId, String userAgent) {
String redisMinRecordKey = "minRecord:" + id; // 设置redis中子订单键值 String redisMinRecordKey = "minRecord:" + id; // 设置redis中子订单键值
// 修改redis中本子订单状态 // 修改redis中本子订单状态
// redisTemplate.opsForHash().put(redisMinRecordKey,"state","2"); // redisTemplate.opsForHash().put(redisMinRecordKey,"state","2");
@ -1822,7 +1839,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取审核订单 // 获取审核订单
Integer outId = ObjectFormatUtil.toInteger(mainId); Integer outId = ObjectFormatUtil.toInteger(mainId);
// 获取对应的出库订单 // 获取对应的出库订单
ApplicationOutRecordP recordP = depositoryRecordMapper.findApplicationOutRecordPById(outId); ApplicationOutRecord recordP = depositoryRecordMapper.findApplicationOutRecordPById(outId);
// 获取当前审批所在部门 // 获取当前审批所在部门
// Integer maindeparment = userByPort.getMaindeparment(); // Integer maindeparment = userByPort.getMaindeparment();
@ -2016,7 +2033,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
@Override @Override
public boolean judgeApplicationOutRecordStatus(Integer id) { public boolean judgeApplicationOutRecordStatus(Integer id) {
// 获取当前出库记录 // 获取当前出库记录
ApplicationOutRecordP recordPById = depositoryRecordMapper.findApplicationOutRecordPById(id); ApplicationOutRecord recordPById = depositoryRecordMapper.findApplicationOutRecordPById(id);
Integer pass = recordPById.getPass(); Integer pass = recordPById.getPass();
if (Integer.compare(pass, 2) == 0) { if (Integer.compare(pass, 2) == 0) {
// 如果审核未通过 // 如果审核未通过
@ -2278,7 +2295,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
* *
* @param recordP 拒绝的订单 * @param recordP 拒绝的订单
*/ */
private void updateInventoryForOutRefused(ApplicationOutRecordP recordP) { private void updateInventoryForOutRefused(ApplicationOutRecord recordP) {
// 获取该订单下的子订单 // 获取该订单下的子订单
List<ApplicationOutRecordMin> recordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(recordP.getId()); List<ApplicationOutRecordMin> recordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(recordP.getId());
// 循环该记录 // 循环该记录
@ -2314,7 +2331,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Integer review(Map<String, Object> map, Integer userid, UserByPort userToken, String userAgent) { public Integer review(Map<String, Object> map, Integer userid, UserByPort userToken, String userAgent) {
Object id = map.get("id"); // 主订单编号 Object id = map.get("id"); // 主订单编号
ApplicationOutRecordP record = depositoryRecordMapper.findApplicationOutRecordPById(ObjectFormatUtil.toInteger(id)); ApplicationOutRecord record = depositoryRecordMapper.findApplicationOutRecordPById(ObjectFormatUtil.toInteger(id));
map.remove("id"); map.remove("id");
List<ApplicationOutRecordMin> minByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(record.getId()); List<ApplicationOutRecordMin> minByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(record.getId());
@ -2718,7 +2735,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取审核订单 // 获取审核订单
Integer outId = ObjectFormatUtil.toInteger(clickKeys[2].split("outId")[1]); Integer outId = ObjectFormatUtil.toInteger(clickKeys[2].split("outId")[1]);
// 获取对应的出库订单 // 获取对应的出库订单
ApplicationOutRecordP recordP = depositoryRecordMapper.findApplicationOutRecordPById(outId); ApplicationOutRecord recordP = depositoryRecordMapper.findApplicationOutRecordPById(outId);
// 获取当前用户的身份 // 获取当前用户的身份
String optionId = templateCard.getSelectedItems().getSelectedItem().getOptionIds().getOptionId(); String optionId = templateCard.getSelectedItems().getSelectedItem().getOptionIds().getOptionId();
String[] optionsKey = optionId.split("_"); String[] optionsKey = optionId.split("_");
@ -3397,7 +3414,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
applicationInRecord.setMcode(group.getCode()); applicationInRecord.setMcode(group.getCode());
applicationInRecord.setMversion("组合"); applicationInRecord.setMversion("组合");
} }
ApplicationInRecordP ap = new ApplicationInRecordP(); ApplicationInRecordP ap = new ApplicationInRecordP(applicationInRecord);
result.add(ap);
} }
return result; return result;
} }
@ -3508,15 +3526,18 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} }
map.put("depositoryIdList", depositoryIdList); map.put("depositoryIdList", depositoryIdList);
map.put("applicantId", userByPort.getId()); map.put("applicantId", userByPort.getId());
List<ApplicationOutRecordP> list = depositoryRecordMapper.findApplicationOutRecordPByUser(map); List<ApplicationOutRecord> list = depositoryRecordMapper.findApplicationOutRecordPByUser(map);
for (ApplicationOutRecordP recordP : list) { List<ApplicationOutRecordP> result = new ArrayList<>();
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(recordP.getApplicantId(), userByPort); for (ApplicationOutRecord record : list) {
String time = DateUtil.TimeStampToDateTime(Long.valueOf(recordP.getApplicantTime())); UserByPort userByPortById = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userByPort);
recordP.setApplicantName(userByPortById.getName()); String time = DateUtil.TimeStampToDateTime(Long.valueOf(record.getApplicantTime()));
recordP.setApplicantTime(time); record.setApplicantName(userByPortById.getName());
recordP.setApplyRemark(recordP.getApplyRemark() == null ? "" : recordP.getApplyRemark()); record.setApplicantTime(time);
record.setApplyRemark(record.getApplyRemark() == null ? "" : record.getApplyRemark());
ApplicationOutRecordP recordP = new ApplicationOutRecordP(record);
result.add(recordP);
} }
return list; return result;
} }
/** /**
@ -3567,15 +3588,18 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
String applyTime = (String) map.get("applyTime"); String applyTime = (String) map.get("applyTime");
map.put("applicantTime", DateUtil.DateTimeByDayToTimeStamp(applyTime)); map.put("applicantTime", DateUtil.DateTimeByDayToTimeStamp(applyTime));
} }
List<ApplicationOutRecordP> list = depositoryRecordMapper.findApplicationOutRecordPByCondition(map); List<ApplicationOutRecord> list = depositoryRecordMapper.findApplicationOutRecordPByCondition(map);
for (int i = 0; i < list.size(); i++) { List<ApplicationOutRecordP> result = new ArrayList<>();
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(list.get(i).getApplicantId(), userToken); for (ApplicationOutRecord recordP : list) {
String time = DateUtil.TimeStampToDateTime(Long.valueOf(list.get(i).getApplicantTime())); UserByPort userByPortById = LinkInterfaceUtil.FindUserById(recordP.getApplicantId(), userToken);
list.get(i).setApplicantName(userByPortById.getName()); String time = DateUtil.TimeStampToDateTime(Long.valueOf(recordP.getApplicantTime()));
list.get(i).setApplicantTime(time); recordP.setApplicantName(userByPortById.getName());
list.get(i).setApplyRemark(list.get(i).getApplyRemark() == null ? "" : list.get(i).getApplyRemark()); recordP.setApplicantTime(time);
recordP.setApplyRemark(recordP.getApplyRemark() == null ? "" : recordP.getApplyRemark());
ApplicationOutRecordP aorp = new ApplicationOutRecordP(recordP);
result.add(aorp);
} }
return list; return result;
} }
/** /**
@ -3604,7 +3628,14 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
*/ */
@Override @Override
public List<ApplicationOutRecordP> findApplicationOutRecordByDepository(String depositoryId) { public List<ApplicationOutRecordP> findApplicationOutRecordByDepository(String depositoryId) {
return depositoryRecordMapper.findApplicationOutRecordByDepository(depositoryId); List<ApplicationOutRecord> recordList = depositoryRecordMapper.findApplicationOutRecordByDepository(depositoryId);
List<ApplicationOutRecordP> result = new ArrayList<>();
for (ApplicationOutRecord record:recordList
) {
ApplicationOutRecordP recordP = new ApplicationOutRecordP(record);
result.add(recordP);
}
return result;
} }
/** /**
@ -3626,7 +3657,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
*/ */
@Override @Override
public ApplicationOutRecordP findApplicationOutRecordPById(Integer id) { public ApplicationOutRecordP findApplicationOutRecordPById(Integer id) {
return depositoryRecordMapper.findApplicationOutRecordPById(id); ApplicationOutRecord record = depositoryRecordMapper.findApplicationOutRecordPById(id);
ApplicationOutRecordP recordP = new ApplicationOutRecordP(record);
return recordP;
} }
/** /**
@ -3843,11 +3876,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
*/ */
@Override @Override
public Double CalculateAllApplicationOutPrice(String state) { public Double CalculateAllApplicationOutPrice(String state) {
List<ApplicationOutRecordP> applicationOutRecordPAll = depositoryRecordMapper.findApplicationOutRecordPAll(); List<ApplicationOutRecord> applicationOutRecordPAll = depositoryRecordMapper.findApplicationOutRecordPAll();
double sum = 0.0; double sum = 0.0;
if (state.isEmpty()) { if (state.isEmpty()) {
// 如果要获取所有待出库的金额 // 如果要获取所有待出库的金额
for (ApplicationOutRecordP applicationOutRecordP : applicationOutRecordPAll) { for (ApplicationOutRecord applicationOutRecordP : applicationOutRecordPAll) {
// 获取所有子物料 // 获取所有子物料
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("parentId", applicationOutRecordP.getId()); map.put("parentId", applicationOutRecordP.getId());
@ -3857,7 +3890,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Material materialById = materialMapper.findMaterialById(mid); Material materialById = materialMapper.findMaterialById(mid);
if (materialById.getPrice() != null) { if (materialById.getPrice() != null) {
sum += (materialById.getPrice() / 100) * applicationOutRecordMin.getQuantity(); sum += (materialById.getPrice() / 100) * ((double)applicationOutRecordMin.getQuantity() / 100);
} else { } else {
sum += 0; sum += 0;
} }
@ -4543,9 +4576,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
*/ */
class CalcApplicationOutInfo implements Callable<Object> { class CalcApplicationOutInfo implements Callable<Object> {
ApplicationOutRecordP mainRecord; ApplicationOutRecord mainRecord;
CalcApplicationOutInfo(ApplicationOutRecordP mainRecord) { CalcApplicationOutInfo(ApplicationOutRecord mainRecord) {
this.mainRecord = mainRecord; this.mainRecord = mainRecord;
} }
@ -4555,17 +4588,18 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取当前订单的子订单 // 获取当前订单的子订单
List<ApplicationOutRecordMin> minList = depositoryRecordMapper.findApplicationOutRecordMinByParent(mainRecord.getId()); List<ApplicationOutRecordMin> minList = depositoryRecordMapper.findApplicationOutRecordMinByParent(mainRecord.getId());
// 额度 // 额度
Double price = 0.0; double price = 0.0;
// 数量 // 数量
Integer count = 0; double count = 0;
for (ApplicationOutRecordMin recordMin : minList) { for (ApplicationOutRecordMin recordMin : minList) {
count += recordMin.getQuantity(); double quantity =(double) recordMin.getQuantity() / 100;
count += quantity ;
// 获取当前出库物料 // 获取当前出库物料
Inventory materialById = materialMapper.findInventoryById(recordMin.getMid()); Inventory materialById = materialMapper.findInventoryById(recordMin.getMid());
// 计算当前出库金额 // 计算当前出库金额
double price_out = 0.0; double price_out = 0.0;
if (materialById.getPrice() != null) { if (materialById.getPrice() != null) {
price_out = materialById.getPrice() * recordMin.getQuantity(); price_out = materialById.getPrice() * quantity;
} }
BigDecimal bg = new BigDecimal(price_out / 100); BigDecimal bg = new BigDecimal(price_out / 100);
price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();

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

@ -69,7 +69,7 @@ public class QyWxOperationService {
public JSONObject sendQyWxToApplicationOutMessage(String uid, Integer outId, Boolean flag, String userAgent) { public JSONObject sendQyWxToApplicationOutMessage(String uid, Integer outId, Boolean flag, String userAgent) {
// 获取将要发送申请的订单记录 // 获取将要发送申请的订单记录
ApplicationOutRecordP applicationOutRecordPById = depositoryRecordMapper.findApplicationOutRecordPById(outId); ApplicationOutRecord applicationOutRecordPById = depositoryRecordMapper.findApplicationOutRecordPById(outId);
// 申请人id // 申请人id
Integer applicantId = applicationOutRecordPById.getApplicantId(); Integer applicantId = applicationOutRecordPById.getApplicantId();
// 申请人 // 申请人
@ -729,7 +729,7 @@ public class QyWxOperationService {
*/ */
public JSONObject sendCcMessageToUsers(String uid, Integer outId, String userAgent) { public JSONObject sendCcMessageToUsers(String uid, Integer outId, String userAgent) {
// 获取已经完成的订单 // 获取已经完成的订单
ApplicationOutRecordP recordP = depositoryRecordMapper.findApplicationOutRecordPById(outId); ApplicationOutRecord recordP = depositoryRecordMapper.findApplicationOutRecordPById(outId);
// 申请人id // 申请人id
Integer applicantId = recordP.getApplicantId(); Integer applicantId = recordP.getApplicantId();
// 申请人 // 申请人
@ -1156,7 +1156,7 @@ public class QyWxOperationService {
// 需要出库的子订单 // 需要出库的子订单
ApplicationOutRecordMin recordMin = depositoryRecordMapper.findApplicationOutMinById(outMinId); ApplicationOutRecordMin recordMin = depositoryRecordMapper.findApplicationOutMinById(outMinId);
// 获取其主订单 // 获取其主订单
ApplicationOutRecordP outRecordP = depositoryRecordMapper.findApplicationOutRecordPById(recordMin.getParentId()); ApplicationOutRecord outRecordP = depositoryRecordMapper.findApplicationOutRecordPById(recordMin.getParentId());
// 申请人id // 申请人id
Integer applicantId = outRecordP.getApplicantId(); Integer applicantId = outRecordP.getApplicantId();
// 申请人 // 申请人
@ -1374,7 +1374,7 @@ public class QyWxOperationService {
public JSONObject sendOutApprovalTemplate(String userAgent, UserByPort userToken, Integer mainId) { public JSONObject sendOutApprovalTemplate(String userAgent, UserByPort userToken, Integer mainId) {
// 获取当前出库主订单 // 获取当前出库主订单
ApplicationOutRecordP mainRecord = depositoryRecordMapper.findApplicationOutRecordPById(mainId); ApplicationOutRecord mainRecord = depositoryRecordMapper.findApplicationOutRecordPById(mainId);
// 获取当前出库明细 // 获取当前出库明细
List<ApplicationOutRecordMin> minRecordList = depositoryRecordMapper.findApplicationOutRecordMinByParent(mainId); List<ApplicationOutRecordMin> minRecordList = depositoryRecordMapper.findApplicationOutRecordMinByParent(mainId);
// 定义审批模板 // 定义审批模板
@ -1575,7 +1575,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", recordMin.getQuantity().toString()); detail_list_control_info_value_outNumber.put("new_number", String.valueOf(recordMin.getQuantity() / 100));
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);
// 请求单位 // 请求单位
@ -2610,7 +2610,7 @@ public class QyWxOperationService {
public JSONObject sendMessageForOtherUserByCard(Integer mainId, String uid, String userAgent, Integer flag) { public JSONObject sendMessageForOtherUserByCard(Integer mainId, String uid, String userAgent, Integer flag) {
// 获取当前申请主订单 // 获取当前申请主订单
ApplicationOutRecordP aorp = null; ApplicationOutRecord aorp = null;
StockTaking stockTaking = null; StockTaking stockTaking = null;
// 用于暂存申请人id // 用于暂存申请人id
Integer applicantId = null; Integer applicantId = null;

8
src/main/resources/templates/pages/application/application-out.html

@ -418,7 +418,9 @@
success: function (data) { success: function (data) {
layer.close(this.layerIndex); layer.close(this.layerIndex);
if (data.status >= 300) { if (data.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情 layer.msg(data.statusInfo.message,{icon:0,time:500},function () {
flagForForm = false;
});//失败的表情
} else { } else {
layer.msg("申请提交成功", { layer.msg("申请提交成功", {
@ -480,7 +482,9 @@
success: function (d) { success: function (d) {
layer.close(this.layerIndex); layer.close(this.layerIndex);
if (d.status >= 300) { if (d.status >= 300) {
layer.msg(d.statusInfo.detail);//失败的表情 layer.msg(data.statusInfo.message,{icon:0,time:500},function () {
flagForForm = false;
});//失败的表情
} else { } else {
layer.msg("申请提交成功", { layer.msg("申请提交成功", {

3
src/test/java/com/dreamchaser/depository_manage/TestForOther.java

@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.jsf.FacesContextUtils;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -46,7 +47,7 @@ public class TestForOther {
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("[12]",approvalInfo,"460f46eaefb46bb0c171029f62e2cea6","2","202303170025"); depositoryRecordService.reviewByQyWxApprovalOut("1",approvalInfo,"460f46eaefb46bb0c171029f62e2cea6","2","202303170033", false,2);
} }

2
target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml

@ -87,7 +87,7 @@
</resultMap> </resultMap>
<!-- 插入出库记录--> <!-- 插入出库记录-->
<resultMap id="applicationOutRecord" type="com.dreamchaser.depository_manage.pojo.ApplicationOutRecordP"> <resultMap id="applicationOutRecord" type="com.dreamchaser.depository_manage.entity.ApplicationOutRecord">
<id property="id" column="aorid" jdbcType="INTEGER"/> <id property="id" column="aorid" jdbcType="INTEGER"/>
<result column="mid" property="mid" jdbcType="INTEGER"/> <result column="mid" property="mid" jdbcType="INTEGER"/>
<result column="mname" property="mname" jdbcType="VARCHAR"/> <result column="mname" property="mname" jdbcType="VARCHAR"/>

8
target/classes/templates/pages/application/application-out.html

@ -418,7 +418,9 @@
success: function (data) { success: function (data) {
layer.close(this.layerIndex); layer.close(this.layerIndex);
if (data.status >= 300) { if (data.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情 layer.msg(data.statusInfo.message,{icon:0,time:500},function () {
flagForForm = false;
});//失败的表情
} else { } else {
layer.msg("申请提交成功", { layer.msg("申请提交成功", {
@ -480,7 +482,9 @@
success: function (d) { success: function (d) {
layer.close(this.layerIndex); layer.close(this.layerIndex);
if (d.status >= 300) { if (d.status >= 300) {
layer.msg(d.statusInfo.detail);//失败的表情 layer.msg(data.statusInfo.message,{icon:0,time:500},function () {
flagForForm = false;
});//失败的表情
} else { } else {
layer.msg("申请提交成功", { layer.msg("申请提交成功", {

Loading…
Cancel
Save