|
|
|
@ -43,27 +43,20 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
RedissonClient redissonClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private RedisPool redisPool; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
MaterialMapper materialMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
DepositoryRecordService depositoryRecordService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
DepositoryRecordMapper depositoryRecordMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
QyWxOperationService qyWxOperationService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
SplitUnitMapper splitUnitMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
SplitUnitService splitUnitService; |
|
|
|
@Autowired |
|
|
|
private RedisPool redisPool; |
|
|
|
|
|
|
|
/** |
|
|
|
* 用于插入盘点记录主表 |
|
|
|
@ -247,7 +240,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
* @return 我的任务 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SimpleStockTakingP> findMyTask(Map<String, Object> map, String userKey,String token) { |
|
|
|
public List<SimpleStockTakingP> findMyTask(Map<String, Object> map, String userKey, String token) { |
|
|
|
Integer size = 10, page = 1; |
|
|
|
if (map.containsKey("size")) { |
|
|
|
size = ObjectFormatUtil.toInteger(map.get("size")); |
|
|
|
@ -264,8 +257,8 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
SimpleStockTakingP ssp = new SimpleStockTakingP(stockTaking); |
|
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(stockTaking.getDepositoryId()); |
|
|
|
ssp.setDepositoryName(depositoryRecordById.getDname()); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userKey,token); |
|
|
|
ssp.setOriginatorName(userByPort.getName()); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userKey, token); |
|
|
|
ssp.setOriginatorName(userByPort.getMaindeparmentname() + "_" + userByPort.getName()); |
|
|
|
stockTakingPS.add(ssp); |
|
|
|
} |
|
|
|
return stockTakingPS; |
|
|
|
@ -290,7 +283,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
* @return 我的任务 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SimpleStockTakingP> findMyApply(Map<String, Object> map, String userKey,String token) { |
|
|
|
public List<SimpleStockTakingP> findMyApply(Map<String, Object> map, String userKey, String token) { |
|
|
|
Integer size = 10, page = 1; |
|
|
|
if (map.containsKey("size")) { |
|
|
|
size = ObjectFormatUtil.toInteger(map.get("size")); |
|
|
|
@ -306,7 +299,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
SimpleStockTakingP ssp = new SimpleStockTakingP(stockTaking); |
|
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(stockTaking.getDepositoryId()); |
|
|
|
ssp.setDepositoryName(depositoryRecordById.getDname()); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userKey,token); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userKey, token); |
|
|
|
ssp.setOriginatorName(userByPort.getName()); |
|
|
|
stockTakingPS.add(ssp); |
|
|
|
} |
|
|
|
@ -408,7 +401,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public Map<String, Object> review(Map<String, Object> map, UserByPort userToken, String userAgent,String userKey,String token) { |
|
|
|
public Map<String, Object> review(Map<String, Object> map, UserByPort userToken, String userAgent, String userKey, String token) { |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
@ -575,7 +568,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// if(workwechat == null || "".equals(workwechat)){
|
|
|
|
// workwechat = originator.getWechat();
|
|
|
|
// }
|
|
|
|
JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage("PangFuZhen,", mainId, normalMinId, userAgent,userKey,token); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage("PangFuZhen,", mainId, normalMinId, userAgent, userKey, token); |
|
|
|
// JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage(workwechat, mainId, normalMinId, userAgent,userKey,token);
|
|
|
|
// 将当前返回结果保存到redis中
|
|
|
|
if (jsonObject != null) { |
|
|
|
@ -621,7 +614,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
} |
|
|
|
String s = QyWxUid1.toString(); |
|
|
|
s = "PangFuZhen,"; |
|
|
|
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(mainId), s, userAgent, 2,userKey,token); |
|
|
|
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(mainId), s, userAgent, 2, userKey, token); |
|
|
|
}); |
|
|
|
|
|
|
|
return result; |
|
|
|
@ -637,7 +630,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public Map<String, Object> completeStockTaking(Map<String, Object> map, UserByPort userToken, String userAgent,String userKey,String token) { |
|
|
|
public Map<String, Object> completeStockTaking(Map<String, Object> map, UserByPort userToken, String userAgent, String userKey, String token) { |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
@ -742,24 +735,24 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 如果当前盘点数量大于库存数量
|
|
|
|
|
|
|
|
// 修改当前库存
|
|
|
|
materialAndProducedDate.setInventory((int)(newInventory * 100)); |
|
|
|
materialAndProducedDate.setInventory((int) (newInventory * 100)); |
|
|
|
// 修改使用数量
|
|
|
|
materialAndProducedDate.setExpendnum((int)(materialAndProducedDate.getQuantity() - newInventory * 100)); |
|
|
|
materialAndProducedDate.setExpendnum((int) (materialAndProducedDate.getQuantity() - newInventory * 100)); |
|
|
|
|
|
|
|
// 修改物料对应数量
|
|
|
|
inventoryById.setQuantity((int)(inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100)); |
|
|
|
inventoryById.setQuantity((int) (inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100)); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
// 如果当前盘点数量小于库存数量
|
|
|
|
|
|
|
|
// 修改当前库存
|
|
|
|
materialAndProducedDate.setInventory((int)(newInventory * 100)); |
|
|
|
materialAndProducedDate.setInventory((int) (newInventory * 100)); |
|
|
|
// 修改使用数量
|
|
|
|
materialAndProducedDate.setExpendnum((int)(materialAndProducedDate.getQuantity() - newInventory * 100)); |
|
|
|
materialAndProducedDate.setExpendnum((int) (materialAndProducedDate.getQuantity() - newInventory * 100)); |
|
|
|
|
|
|
|
// 修改物料对应数量
|
|
|
|
inventoryById.setQuantity((int)(inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100)); |
|
|
|
inventoryById.setQuantity((int) (inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100)); |
|
|
|
} |
|
|
|
|
|
|
|
materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); |
|
|
|
@ -777,7 +770,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { |
|
|
|
|
|
|
|
// 更新当前库位数量
|
|
|
|
newNumberForPlace = placeById.getQuantity() +(int)( inventory * 100); |
|
|
|
newNumberForPlace = placeById.getQuantity() + (int) (inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace <= placeById.getMax()) { |
|
|
|
// 如果更新后的库位数量没有上溢
|
|
|
|
@ -791,9 +784,9 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
|
|
|
|
continue; |
|
|
|
} |
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() +(int)( inventory * 100)); |
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() + (int) (inventory * 100)); |
|
|
|
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() +(int)( inventory * 100); |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int) (inventory * 100); |
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); |
|
|
|
|
|
|
|
@ -875,7 +868,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { |
|
|
|
// 如果盘点的是基础单位
|
|
|
|
|
|
|
|
newNumberForPlace = placeById.getQuantity() - (int)(inventory * 100); |
|
|
|
newNumberForPlace = placeById.getQuantity() - (int) (inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace > placeById.getMin()) { |
|
|
|
//如果更新后的库位数量没有下溢
|
|
|
|
@ -884,14 +877,14 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
placeById.setQuantity(newNumberForPlace); |
|
|
|
|
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int)(inventory * 100); |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int) (inventory * 100); |
|
|
|
|
|
|
|
} else { |
|
|
|
placeById.setQuantity(0); |
|
|
|
newNumberForMatrialAndPlace = 0; |
|
|
|
} |
|
|
|
|
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() - (int)(inventory * 100)); |
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() - (int) (inventory * 100)); |
|
|
|
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); |
|
|
|
|
|
|
|
@ -913,7 +906,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 如果单纯的拆单库存满足数量
|
|
|
|
|
|
|
|
// 设置当前拆单库存的数量
|
|
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - (int)(inventory * 100)); |
|
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - (int) (inventory * 100)); |
|
|
|
// 修改拆单库存
|
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
|
} else { |
|
|
|
@ -970,8 +963,8 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
|
|
|
|
|
|
|
|
// 设置剩余拆单库存处理数量
|
|
|
|
splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - (int)(inventory * 100)); |
|
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int)(inventory * 100)); |
|
|
|
splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - (int) (inventory * 100)); |
|
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int) (inventory * 100)); |
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
|
} |
|
|
|
} else { |
|
|
|
@ -1055,7 +1048,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
int residue = (int) (Math.ceil(inventory / (double) scale)); |
|
|
|
|
|
|
|
// 获取剩余数目
|
|
|
|
int residue_realQuantity = residue * scale - (int)(inventory); |
|
|
|
int residue_realQuantity = residue * scale - (int) (inventory); |
|
|
|
|
|
|
|
|
|
|
|
// 更新库存数量
|
|
|
|
@ -1124,14 +1117,14 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
String s = QyWxUid.toString(); |
|
|
|
s = "PangFuZhen,"; |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendCcStockTakingMessageToHead(s, map, userToken, mainRecord, userAgent,userKey,token); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendCcStockTakingMessageToHead(s, map, userToken, mainRecord, userAgent, userKey, token); |
|
|
|
}); |
|
|
|
|
|
|
|
// 更新其他卡片
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
// 获取responseCode(key为申请人number)
|
|
|
|
Integer originator = mainRecord.getOriginator(); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(originator,userKey,token); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(originator, userKey, token); |
|
|
|
//获取申请人信息
|
|
|
|
String key = "user:" + userByPort.getNumber() + ":QyWxStockTakingCompleteId:" + mainId; |
|
|
|
String responseCode = (String) redisPool.getRedisTemplateByDb(14).opsForHash().get(key, "responseCode"); |
|
|
|
@ -1253,24 +1246,24 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 如果当前盘点数量大于库存数量
|
|
|
|
|
|
|
|
// 修改当前库存
|
|
|
|
materialAndProducedDate.setInventory((int)(newInventory * 100)); |
|
|
|
materialAndProducedDate.setInventory((int) (newInventory * 100)); |
|
|
|
// 修改使用数量
|
|
|
|
materialAndProducedDate.setExpendnum((int)(materialAndProducedDate.getQuantity() - newInventory * 100)); |
|
|
|
materialAndProducedDate.setExpendnum((int) (materialAndProducedDate.getQuantity() - newInventory * 100)); |
|
|
|
|
|
|
|
// 修改物料对应数量
|
|
|
|
inventoryById.setQuantity((int)(inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100)); |
|
|
|
inventoryById.setQuantity((int) (inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100)); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
// 如果当前盘点数量小于库存数量
|
|
|
|
|
|
|
|
// 修改当前库存
|
|
|
|
materialAndProducedDate.setInventory((int)(newInventory * 100)); |
|
|
|
materialAndProducedDate.setInventory((int) (newInventory * 100)); |
|
|
|
// 修改使用数量
|
|
|
|
materialAndProducedDate.setExpendnum((int)(materialAndProducedDate.getQuantity() - newInventory * 100)); |
|
|
|
materialAndProducedDate.setExpendnum((int) (materialAndProducedDate.getQuantity() - newInventory * 100)); |
|
|
|
|
|
|
|
// 修改物料对应数量
|
|
|
|
inventoryById.setQuantity((int)(inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100)); |
|
|
|
inventoryById.setQuantity((int) (inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100)); |
|
|
|
} |
|
|
|
|
|
|
|
materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); |
|
|
|
@ -1288,7 +1281,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { |
|
|
|
|
|
|
|
// 更新当前库位数量
|
|
|
|
newNumberForPlace = placeById.getQuantity() +(int)( inventory * 100); |
|
|
|
newNumberForPlace = placeById.getQuantity() + (int) (inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace <= placeById.getMax()) { |
|
|
|
// 如果更新后的库位数量没有上溢
|
|
|
|
@ -1302,9 +1295,9 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
|
|
|
|
continue; |
|
|
|
} |
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() +(int)( inventory * 100)); |
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() + (int) (inventory * 100)); |
|
|
|
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() +(int)( inventory * 100); |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int) (inventory * 100); |
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); |
|
|
|
|
|
|
|
@ -1386,7 +1379,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { |
|
|
|
// 如果盘点的是基础单位
|
|
|
|
|
|
|
|
newNumberForPlace = placeById.getQuantity() - (int)(inventory * 100); |
|
|
|
newNumberForPlace = placeById.getQuantity() - (int) (inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace > placeById.getMin()) { |
|
|
|
//如果更新后的库位数量没有下溢
|
|
|
|
@ -1395,14 +1388,14 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
placeById.setQuantity(newNumberForPlace); |
|
|
|
|
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int)(inventory * 100); |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int) (inventory * 100); |
|
|
|
|
|
|
|
} else { |
|
|
|
placeById.setQuantity(0); |
|
|
|
newNumberForMatrialAndPlace = 0; |
|
|
|
} |
|
|
|
|
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() - (int)(inventory * 100)); |
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() - (int) (inventory * 100)); |
|
|
|
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); |
|
|
|
|
|
|
|
@ -1424,7 +1417,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 如果单纯的拆单库存满足数量
|
|
|
|
|
|
|
|
// 设置当前拆单库存的数量
|
|
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - (int)(inventory * 100)); |
|
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - (int) (inventory * 100)); |
|
|
|
// 修改拆单库存
|
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
|
} else { |
|
|
|
@ -1481,8 +1474,8 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
|
|
|
|
|
|
|
|
// 设置剩余拆单库存处理数量
|
|
|
|
splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - (int)(inventory * 100)); |
|
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int)(inventory * 100)); |
|
|
|
splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - (int) (inventory * 100)); |
|
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int) (inventory * 100)); |
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
|
} |
|
|
|
} else { |
|
|
|
@ -1566,7 +1559,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
int residue = (int) (Math.ceil(inventory / (double) scale)); |
|
|
|
|
|
|
|
// 获取剩余数目
|
|
|
|
int residue_realQuantity = residue * scale - (int)(inventory); |
|
|
|
int residue_realQuantity = residue * scale - (int) (inventory); |
|
|
|
|
|
|
|
|
|
|
|
// 更新库存数量
|
|
|
|
@ -1661,7 +1654,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
} |
|
|
|
String s = QyWxUid.toString(); |
|
|
|
s = "PangFuZhen,"; |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendCcStockTakingMessageToHead(s, map, null, finalMainRecord, userAgent,userKey,token); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendCcStockTakingMessageToHead(s, map, null, finalMainRecord, userAgent, userKey, token); |
|
|
|
}); |
|
|
|
|
|
|
|
return 1; |
|
|
|
@ -1783,7 +1776,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 获取当前库位上物料数量
|
|
|
|
int oldQuantity = inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); |
|
|
|
|
|
|
|
inventoryById.setQuantity(oldQuantity + (int)(newInventory * 100)); |
|
|
|
inventoryById.setQuantity(oldQuantity + (int) (newInventory * 100)); |
|
|
|
|
|
|
|
|
|
|
|
// 用于计算新的库位数量
|
|
|
|
@ -1794,7 +1787,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 如果盘盈
|
|
|
|
|
|
|
|
// 更新当前库位数量
|
|
|
|
newNumberForPlace = placeById.getQuantity() +(int)( inventory * 100); |
|
|
|
newNumberForPlace = placeById.getQuantity() + (int) (inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace < placeById.getMax()) { |
|
|
|
|
|
|
|
@ -1810,14 +1803,14 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int)(inventory*100); |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int) (inventory * 100); |
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 如果盘亏
|
|
|
|
newNumberForPlace = placeById.getQuantity() - (int)(inventory*100); |
|
|
|
newNumberForPlace = placeById.getQuantity() - (int) (inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace > placeById.getMin()) { |
|
|
|
//如果更新后的库位数量没有下溢
|
|
|
|
@ -1826,7 +1819,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
placeById.setQuantity(newNumberForPlace); |
|
|
|
|
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int)(inventory*100); |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int) (inventory * 100); |
|
|
|
|
|
|
|
} else { |
|
|
|
placeById.setQuantity(0); |
|
|
|
@ -1860,7 +1853,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// if(workwechat == null || "".equals(workwechat)){
|
|
|
|
// workwechat = originator.getWechat();
|
|
|
|
// }
|
|
|
|
JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage("PangFuZhen,", ObjectFormatUtil.toInteger(mainId), normalMinId, userAgent,userKey,token); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage("PangFuZhen,", ObjectFormatUtil.toInteger(mainId), normalMinId, userAgent, userKey, token); |
|
|
|
// JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage(workwechat, ObjectFormatUtil.toInteger(mainId), normalMinId,userAgent,userKey,token);
|
|
|
|
// 将当前返回结果保存到redis中
|
|
|
|
if (jsonObject != null) { |
|
|
|
@ -1878,8 +1871,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
map.put("state", 1); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
map.put("departmentManagerState", 2); |
|
|
|
map.put("completeTime", DateUtil.DateTimeToTimeStamp(simpleTime)); |
|
|
|
map.put("state", 2); |
|
|
|
@ -1890,8 +1882,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
map.put("departmentManager", approver_user.getNumber()); |
|
|
|
stockTakingMapper.updateStockTaking(map); |
|
|
|
return result; |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
// 如果当前盘点记录已经审核过
|
|
|
|
|
|
|
|
// 不做任何处理
|
|
|
|
@ -1909,7 +1900,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public Integer stockTakingTransfer(Map<String, Object> map, UserByPort userToken, String userAgent,String userKey,String token) { |
|
|
|
public Integer stockTakingTransfer(Map<String, Object> map, UserByPort userToken, String userAgent, String userKey, String token) { |
|
|
|
// 获取当前转移的id
|
|
|
|
List<Integer> minIds = (List<Integer>) map.get("minIds"); |
|
|
|
|
|
|
|
@ -2728,14 +2719,14 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
Integer originator = finalMainRecord.getOriginator(); |
|
|
|
map.put("minIds", minIds); |
|
|
|
StringBuilder departMentHeadQyWxName = new StringBuilder(); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(originator),userKey,token); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(originator), userKey, token); |
|
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
workwechat = userByPort.getWechat(); |
|
|
|
} |
|
|
|
// departMentHeadQyWxName.append(workwechat+",");
|
|
|
|
departMentHeadQyWxName.append("PangFuZhen,"); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendCcStockTakingTransferMessageToHead(departMentHeadQyWxName.toString(), map, userToken, finalMainRecord, userAgent,userKey,token); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendCcStockTakingTransferMessageToHead(departMentHeadQyWxName.toString(), map, userToken, finalMainRecord, userAgent, userKey, token); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
@ -2844,7 +2835,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 获取当前库位上物料数量
|
|
|
|
int oldQuantity = materialById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); |
|
|
|
|
|
|
|
materialById.setQuantity(oldQuantity + (int)(newInventory*100)); |
|
|
|
materialById.setQuantity(oldQuantity + (int) (newInventory * 100)); |
|
|
|
|
|
|
|
|
|
|
|
// 用于计算新的库位数量
|
|
|
|
@ -2855,7 +2846,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 如果盘盈
|
|
|
|
|
|
|
|
// 更新当前库位数量
|
|
|
|
newNumberForPlace = placeById.getQuantity() +(int)(inventory*100); |
|
|
|
newNumberForPlace = placeById.getQuantity() + (int) (inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace < placeById.getMax()) { |
|
|
|
|
|
|
|
@ -2871,14 +2862,14 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int)(inventory*100); |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int) (inventory * 100); |
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 如果盘亏
|
|
|
|
newNumberForPlace = placeById.getQuantity() - (int)(inventory*100); |
|
|
|
newNumberForPlace = placeById.getQuantity() - (int) (inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace > placeById.getMin()) { |
|
|
|
//如果更新后的库位数量没有下溢
|
|
|
|
@ -2887,7 +2878,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
placeById.setQuantity(newNumberForPlace); |
|
|
|
|
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() -(int)( inventory*100); |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int) (inventory * 100); |
|
|
|
|
|
|
|
} else { |
|
|
|
placeById.setQuantity(0); |
|
|
|
@ -2916,12 +2907,12 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 抄送盘点调账记录给盘点人员
|
|
|
|
SendQyWxMessageThreadPool.execute((Runnable) () -> { |
|
|
|
// 获取盘点人员
|
|
|
|
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), userkey,token); |
|
|
|
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), userkey, token); |
|
|
|
// String workwechat = originator.getWorkwechat();
|
|
|
|
// if(workwechat == null || "".equals(workwechat)){
|
|
|
|
// workwechat = originator.getWechat();
|
|
|
|
// }
|
|
|
|
JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage("PangFuZhen,", mainId, normalMinIds, userAgent,userkey,token); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage("PangFuZhen,", mainId, normalMinIds, userAgent, userkey, token); |
|
|
|
// JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage(workwechat, mainId, normalMinIds, userAgent,userkey,token);
|
|
|
|
if (jsonObject != null) { |
|
|
|
// 将当前返回结果保存到redis中
|
|
|
|
@ -2940,12 +2931,12 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 发送错误消息提醒负责人
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
// 获取盘点人员
|
|
|
|
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), userkey,token); |
|
|
|
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), userkey, token); |
|
|
|
// String workwechat = originator.getWorkwechat();
|
|
|
|
// if(workwechat == null || "".equals(workwechat)){
|
|
|
|
// workwechat = originator.getWechat();
|
|
|
|
// }
|
|
|
|
qyWxOperationService.sendStockTakingErrMessageToHead("PangFuZhen,", errIds, mainRecord, null, userAgent,userkey,token); |
|
|
|
qyWxOperationService.sendStockTakingErrMessageToHead("PangFuZhen,", errIds, mainRecord, null, userAgent, userkey, token); |
|
|
|
// qyWxOperationService.sendStockTakingErrMessageToHead(workwechat, errIds, mainRecord, null, userAgent,userkey,token);
|
|
|
|
}); |
|
|
|
} |
|
|
|
|