|
|
|
@ -1790,6 +1790,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @param map 待修改数据 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public Integer updateOutMinRecordInfo(Map<String, Object> map, UserByPort userToken, String userAgent) { |
|
|
|
Integer result = 0; |
|
|
|
@ -1837,6 +1838,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
Object applicationInId = null; |
|
|
|
Object mtId = null; |
|
|
|
Object depositoryId = null; |
|
|
|
Object type = null; |
|
|
|
if ("-1".equals(unit)) { |
|
|
|
// 如果是基础单位
|
|
|
|
|
|
|
|
@ -1859,6 +1862,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
Map<String, Object> paramForUpdateSplitInventory = new HashMap<>(); |
|
|
|
paramForUpdateSplitInventory.put("placeId", outRecordMin.getPlaceId()); |
|
|
|
paramForUpdateSplitInventory.put("depositoryId", outRecordMin.getDepositoryId()); |
|
|
|
paramForUpdateSplitInventory.put("applicantId", userToken.getId()); |
|
|
|
paramForUpdateSplitInventory.put("quantity", String.valueOf(returnQuantity)); |
|
|
|
paramForUpdateSplitInventory.put("mid", inventoryById.getMid()); |
|
|
|
paramForUpdateSplitInventory.put("unit", unit); |
|
|
|
@ -1869,7 +1873,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
paramForUpdateSplitInventory.put("applyRemark", "退库"); |
|
|
|
applicationInPlace(paramForUpdateSplitInventory, false); |
|
|
|
applicationInId = paramForUpdateSplitInventory.get("applicationInId"); |
|
|
|
mtId = map.get("mtId"); |
|
|
|
mtId = paramForUpdateSplitInventory.get("mtId"); |
|
|
|
depositoryId = paramForUpdateSplitInventory.get("depositoryId"); |
|
|
|
type = paramForUpdateSplitInventory.get("inType"); |
|
|
|
|
|
|
|
} else { |
|
|
|
// 如果是拆单
|
|
|
|
@ -1899,6 +1905,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
}*/ |
|
|
|
Map<String, Object> paramForUpdateSplitInventory = new HashMap<>(); |
|
|
|
paramForUpdateSplitInventory.put("placeId", outRecordMin.getPlaceId()); |
|
|
|
paramForUpdateSplitInventory.put("applicantId", userToken.getId()); |
|
|
|
paramForUpdateSplitInventory.put("depositoryId", outRecordMin.getDepositoryId()); |
|
|
|
paramForUpdateSplitInventory.put("quantity", String.valueOf(returnQuantity)); |
|
|
|
paramForUpdateSplitInventory.put("mid", inventoryById.getMid()); |
|
|
|
@ -1908,14 +1915,16 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
paramForUpdateSplitInventory.put("applyRemark", "退库"); |
|
|
|
splitUnitService.addSplitInventory(paramForUpdateSplitInventory); |
|
|
|
applicationInId = paramForUpdateSplitInventory.get("applicationInId"); |
|
|
|
mtId = map.get("mtId"); |
|
|
|
mtId = paramForUpdateSplitInventory.get("mtId"); |
|
|
|
depositoryId = paramForUpdateSplitInventory.get("depositoryId"); |
|
|
|
type = paramForUpdateSplitInventory.get("inType"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 修改子单数据
|
|
|
|
outRecordMin.setQuantity((int) (quantity * 100)); |
|
|
|
outRecordMin.setTrueOut((int) (quantity * 100)); |
|
|
|
depositoryRecordMapper.updateApplicationOutRecordMin(outRecordMin); |
|
|
|
result = depositoryRecordMapper.updateApplicationOutRecordMin(outRecordMin); |
|
|
|
|
|
|
|
if (Integer.compare(trueOut, outQuantity) != 0) { |
|
|
|
//如果没有完成出库
|
|
|
|
@ -1933,16 +1942,19 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(outRecordMin.getCheckId(), userToken); |
|
|
|
|
|
|
|
outRecord.setPass(1); |
|
|
|
updateApplicationMinOutInfo(id, outRecordMin, outRecord, (double) (quantity / 100), userByPort, placeById.getId(), userAgent); |
|
|
|
updateApplicationMinOutInfo(id, outRecordMin, outRecord, (double) (quantity), userByPort, placeById.getId(), userAgent); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (applicationInId != null && mtId != null) { |
|
|
|
if (applicationInId != null) { |
|
|
|
// 如果成功
|
|
|
|
// 获取当前类型的管理员
|
|
|
|
List<RoleAndMaterialType> materialTypeIdForIn = roleService.findRoleAndMaterialTypeByMtId(Long.valueOf(mtId.toString())); |
|
|
|
|
|
|
|
// 用于存储当前仓库的管理员企业微信userId
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
if("mt".equals(type.toString())){ |
|
|
|
// 获取当前类型的管理员
|
|
|
|
List<RoleAndMaterialType> materialTypeIdForIn = roleService.findRoleAndMaterialTypeByMtId(Long.valueOf(mtId.toString())); |
|
|
|
|
|
|
|
for (RoleAndMaterialType mt : materialTypeIdForIn |
|
|
|
) { |
|
|
|
// 获取管理员数据
|
|
|
|
@ -1953,6 +1965,21 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} |
|
|
|
sb.append(workwechat).append(","); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
List<RoleAndDepository> materialTypeIdForIn = roleService.findRoleAndDepositoryByDid(ObjectFormatUtil.toInteger(depositoryId)); |
|
|
|
|
|
|
|
for (RoleAndDepository mt : materialTypeIdForIn |
|
|
|
) { |
|
|
|
// 获取管理员数据
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), userToken); |
|
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
workwechat = userByPort.getWechat(); |
|
|
|
} |
|
|
|
sb.append(workwechat).append(","); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
List<Integer> integerList = new ArrayList<>(); |
|
|
|
integerList.add(ObjectFormatUtil.toInteger(applicationInId)); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(userAgent, userToken, integerList, sb.toString()); |
|
|
|
@ -1969,6 +1996,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} else { |
|
|
|
// 如果不大于
|
|
|
|
|
|
|
|
if("-1".equals(unit)){ |
|
|
|
if (inventoryById.getNumberOfTemporary() != null && inventoryById.getNumberOfTemporary() > 0) { |
|
|
|
Integer numberOfTemporary = inventoryById.getNumberOfTemporary() + trueOut - outQuantity + (int) (quantity * 100); |
|
|
|
if (numberOfTemporary < 0) { |
|
|
|
@ -1977,6 +2005,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
inventoryById.setNumberOfTemporary(numberOfTemporary); |
|
|
|
materialMapper.updateInventory(inventoryById); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 设置新数量
|
|
|
|
outRecordMin.setQuantity((int) (quantity * 100)); |
|
|
|
// 修改记录
|
|
|
|
@ -1992,6 +2022,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 修改记录
|
|
|
|
result = depositoryRecordMapper.updateApplicationOutRecordMin(outRecordMin); |
|
|
|
|
|
|
|
if("-1".equals(unit)){ |
|
|
|
if (inventoryById.getNumberOfTemporary() != null && inventoryById.getNumberOfTemporary() > 0) { |
|
|
|
Integer numberOfTemporary = inventoryById.getNumberOfTemporary() - outQuantity + (int) (quantity * 100); |
|
|
|
if (numberOfTemporary < 0) { |
|
|
|
@ -2002,6 +2033,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 修改主记录的出库数量
|
|
|
|
outRecord.setQuantity(outRecord.getQuantity() - outQuantity + (int) (quantity * 100)); |
|
|
|
if ("-1".equals(unit)) { |
|
|
|
@ -2108,6 +2141,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
String key = "user:" + userByPort.getId().toString(); |
|
|
|
// 获取当前用户所有订单
|
|
|
|
String minRecord = (String) redisTemplate.opsForHash().get(key, "minRecord"); |
|
|
|
if(minRecord == null){ |
|
|
|
minRecord = ""; |
|
|
|
} |
|
|
|
// 删除用户中当前已完成的订单
|
|
|
|
minRecord = minRecord.replace(redisMinRecordKey + ",", ""); |
|
|
|
if (minRecord.length() == 2) { |
|
|
|
|