|
|
@ -237,9 +237,40 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
*/ |
|
|
*/ |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Override |
|
|
@Override |
|
|
public Integer deleteApplicationOutRecordById(Integer id) { |
|
|
public Integer deleteApplicationOutRecordById(Integer id,UserByPort userByPort) { |
|
|
// 删除主单
|
|
|
// 删除主单
|
|
|
Integer integer = depositoryRecordMapper.deleteApplicationOutRecordById(id); |
|
|
Integer integer = depositoryRecordMapper.deleteApplicationOutRecordById(id); |
|
|
|
|
|
|
|
|
|
|
|
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(id); |
|
|
|
|
|
|
|
|
|
|
|
// 开启一个线程去删除redis中的数据
|
|
|
|
|
|
new Thread(new Runnable() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
// 获取该用户在redis中的订单记录
|
|
|
|
|
|
String key = "user:" + userByPort.getId().toString(); |
|
|
|
|
|
// 获取当前用户所有订单
|
|
|
|
|
|
String minRecord = (String) redisTemplate.opsForHash().get(key, "minRecord"); |
|
|
|
|
|
for (ApplicationOutRecordMin recordMin : |
|
|
|
|
|
applicationOutRecordMinByParent) { |
|
|
|
|
|
String redisMinRecordKey = "minRecord:" + recordMin.getId(); |
|
|
|
|
|
minRecord = minRecord.replace(redisMinRecordKey + ",", ""); |
|
|
|
|
|
if (minRecord.length() == 2) { |
|
|
|
|
|
// []
|
|
|
|
|
|
// 如果当前用户已经没有剩余订单,则删除
|
|
|
|
|
|
redisTemplate.delete("user:" + userByPort.getId()); |
|
|
|
|
|
} else { |
|
|
|
|
|
redisTemplate.opsForHash().put(key, "minRecord", minRecord); |
|
|
|
|
|
} |
|
|
|
|
|
redisTemplate.delete(redisMinRecordKey); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
String redisMainRecordKey = "record:" + id; // 设置redis中主订单键值
|
|
|
|
|
|
redisTemplate.delete(redisMainRecordKey); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
|
|
|
// 开启一个线程去删除子订单
|
|
|
// 开启一个线程去删除子订单
|
|
|
new Thread(new Runnable() { |
|
|
new Thread(new Runnable() { |
|
|
@Override |
|
|
@Override |
|
|
@ -247,19 +278,57 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
depositoryRecordMapper.deleteApplicationOutRecordMinById(id); |
|
|
depositoryRecordMapper.deleteApplicationOutRecordMinById(id); |
|
|
} |
|
|
} |
|
|
}).start(); |
|
|
}).start(); |
|
|
|
|
|
|
|
|
return integer; |
|
|
return integer; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Override |
|
|
@Override |
|
|
public Integer deleteApplicationOutRecordByIds(List<Integer> list) { |
|
|
public Integer deleteApplicationOutRecordByIds(List<Integer> list,UserByPort userByPort) { |
|
|
Integer integer = depositoryRecordMapper.deleteApplicationOutRecordByIds(list); |
|
|
Integer integer = depositoryRecordMapper.deleteApplicationOutRecordByIds(list); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParents(list); |
|
|
|
|
|
// 开启一个线程去删除redis中的数据
|
|
|
|
|
|
new Thread(new Runnable() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
// 获取该用户在redis中的订单记录
|
|
|
|
|
|
String key = "user:" + userByPort.getId().toString(); |
|
|
|
|
|
// 获取当前用户所有订单
|
|
|
|
|
|
String minRecord = (String) redisTemplate.opsForHash().get(key, "minRecord"); |
|
|
|
|
|
for (ApplicationOutRecordMin recordMin : |
|
|
|
|
|
applicationOutRecordMinByParent) { |
|
|
|
|
|
String redisMinRecordKey = "minRecord:" + recordMin.getId(); |
|
|
|
|
|
minRecord = minRecord.replace(redisMinRecordKey + ",", ""); |
|
|
|
|
|
if (minRecord.length() == 2) { |
|
|
|
|
|
// []
|
|
|
|
|
|
// 如果当前用户已经没有剩余订单,则删除
|
|
|
|
|
|
redisTemplate.delete("user:" + userByPort.getId()); |
|
|
|
|
|
} else { |
|
|
|
|
|
redisTemplate.opsForHash().put(key, "minRecord", minRecord); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
redisTemplate.delete(redisMinRecordKey); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Integer value : list) { |
|
|
|
|
|
String redisMainRecordKey = "record:" + value; // 设置redis中主订单键值
|
|
|
|
|
|
redisTemplate.delete(redisMainRecordKey); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
// 开启一个线程用于删除
|
|
|
new Thread(new Runnable() { |
|
|
new Thread(new Runnable() { |
|
|
@Override |
|
|
@Override |
|
|
public void run() { |
|
|
public void run() { |
|
|
depositoryRecordMapper.deleteApplicationOutRecordMinByIds(list); |
|
|
depositoryRecordMapper.deleteApplicationOutRecordMinByIds(list); |
|
|
} |
|
|
} |
|
|
}).start(); |
|
|
}).start(); |
|
|
|
|
|
|
|
|
return integer; |
|
|
return integer; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -894,7 +963,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
restResponse.setData(""); |
|
|
restResponse.setData(""); |
|
|
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); |
|
|
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} |
|
|
|
|
|
else { |
|
|
// 如果是拆单后的出库
|
|
|
// 如果是拆单后的出库
|
|
|
|
|
|
|
|
|
// 用于获取对应的拆单记录
|
|
|
// 用于获取对应的拆单记录
|
|
|
@ -1765,11 +1835,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
for (int j = 0; j < minIdList.size(); j++) { |
|
|
for (int j = 0; j < minIdList.size(); j++) { |
|
|
sb.append(minIdList.get(j)).append(","); |
|
|
sb.append(minIdList.get(j)).append(","); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
QyWxApprovalMap.put("minIdList", sb.toString()); |
|
|
QyWxApprovalMap.put("minIdList", sb.toString()); |
|
|
redisTemplate.opsForHash().putAll(sp_no, QyWxApprovalMap); |
|
|
redisTemplate.opsForHash().putAll("wms_out_"+recordP.getId(), QyWxApprovalMap); |
|
|
// 设置过期时间为7天
|
|
|
// 设置过期时间为7天
|
|
|
redisTemplate.expire(sp_no, 7, TimeUnit.DAYS); |
|
|
redisTemplate.expire("wms_out_"+recordP.getId(), 7, TimeUnit.DAYS); |
|
|
} else { |
|
|
} else { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
@ -1837,13 +1908,33 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 判断当前出库记录运行状态 |
|
|
* 判断当前出库记录运行状态是否可以直接删除 |
|
|
* @param id |
|
|
* @param id |
|
|
* @return |
|
|
* @return true:可以直接删除,false:流程暂未完成 |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public boolean judgeApplicationOutRecordStatus(Integer id) { |
|
|
public boolean judgeApplicationOutRecordStatus(Integer id) { |
|
|
return false; |
|
|
// 获取当前出库记录
|
|
|
|
|
|
ApplicationOutRecordP recordPById = depositoryRecordMapper.findApplicationOutRecordPById(id); |
|
|
|
|
|
Integer pass = recordPById.getPass(); |
|
|
|
|
|
if(Integer.compare(pass,2) == 0){ |
|
|
|
|
|
// 如果审核未通过
|
|
|
|
|
|
|
|
|
|
|
|
// 可以直接删除
|
|
|
|
|
|
return true; |
|
|
|
|
|
}else{ |
|
|
|
|
|
// 获取所有子订单
|
|
|
|
|
|
List<ApplicationOutRecordMin> recordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(id); |
|
|
|
|
|
for (ApplicationOutRecordMin recordMin : |
|
|
|
|
|
recordMinByParent) { |
|
|
|
|
|
if(Integer.compare(recordMin.getTrueOut(),0) != 0){ |
|
|
|
|
|
// 如果已经出库数量不为0
|
|
|
|
|
|
return false; // 不允许删除
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 可以删除
|
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -2149,9 +2240,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
QyWxApprovalMap.put("minIdList", sb.toString()); |
|
|
QyWxApprovalMap.put("minIdList", sb.toString()); |
|
|
redisTemplate.opsForHash().putAll(sp_no, QyWxApprovalMap); |
|
|
redisTemplate.opsForHash().putAll("wms_out_"+record.getId(), QyWxApprovalMap); |
|
|
// 设置过期时间为7天
|
|
|
// 设置过期时间为7天
|
|
|
redisTemplate.expire(sp_no, 7, TimeUnit.DAYS); |
|
|
redisTemplate.expire("wms_out_"+record.getId(), 7, TimeUnit.DAYS); |
|
|
} else { |
|
|
} else { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
@ -2383,9 +2474,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
QyWxApprovalMap.put("minIdList", sb.toString()); |
|
|
QyWxApprovalMap.put("minIdList", sb.toString()); |
|
|
redisTemplate.opsForHash().putAll(sp_no, QyWxApprovalMap); |
|
|
redisTemplate.opsForHash().putAll("wms_out_"+recordP.getId(), QyWxApprovalMap); |
|
|
// 设置过期时间为7天
|
|
|
// 设置过期时间为7天
|
|
|
redisTemplate.expire(sp_no, 7, TimeUnit.DAYS); |
|
|
redisTemplate.expire("wms_out_"+recordP.getId(), 7, TimeUnit.DAYS); |
|
|
} else { |
|
|
} else { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
@ -2937,9 +3028,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
page = ObjectFormatUtil.toInteger(map.get("page")); |
|
|
page = ObjectFormatUtil.toInteger(map.get("page")); |
|
|
map.put("begin", (page - 1) * size); |
|
|
map.put("begin", (page - 1) * size); |
|
|
} |
|
|
} |
|
|
if (map.containsKey("applyTime")) { |
|
|
if (map.containsKey("startDate")) { |
|
|
String applyTime = (String) map.get("applyTime"); |
|
|
String applyTime = (String) map.get("startDate"); |
|
|
map.put("applicantTime", DateUtil.DateTimeByDayToTimeStamp(applyTime)); |
|
|
map.put("startDate", DateUtil.DateTimeByDayToTimeStamp(applyTime)); |
|
|
|
|
|
} |
|
|
|
|
|
if (map.containsKey("endDate")) { |
|
|
|
|
|
String applyTime = (String) map.get("endDate"); |
|
|
|
|
|
map.put("endDate", DateUtil.DateTimeByDayToTimeStamp(applyTime)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId()); |
|
|
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId()); |
|
|
|