Browse Source

修改出库后退库功能

lwx_dev
erdanergou 3 years ago
parent
commit
ad48e22d46
  1. 90
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  2. 2
      src/main/resources/templates/pages/application/form-step-look_minRecordOut.html
  3. 1
      src/main/resources/templates/pages/depository/table-stock.html
  4. 8
      src/main/resources/templates/pages/place/materialForPlace.html
  5. 1
      target/classes/templates/pages/depository/table-stock.html
  6. 8
      target/classes/templates/pages/place/materialForPlace.html

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

@ -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,26 +1942,44 @@ 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();
for (RoleAndMaterialType mt : materialTypeIdForIn
) {
// 获取管理员数据
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), userToken);
String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat();
if("mt".equals(type.toString())){
// 获取当前类型的管理员
List<RoleAndMaterialType> materialTypeIdForIn = roleService.findRoleAndMaterialTypeByMtId(Long.valueOf(mtId.toString()));
for (RoleAndMaterialType mt : materialTypeIdForIn
) {
// 获取管理员数据
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), userToken);
String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat();
}
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(",");
}
sb.append(workwechat).append(",");
}
List<Integer> integerList = new ArrayList<>();
integerList.add(ObjectFormatUtil.toInteger(applicationInId));
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(userAgent, userToken, integerList, sb.toString());
@ -1969,14 +1996,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} else {
// 如果不大于
if (inventoryById.getNumberOfTemporary() != null && inventoryById.getNumberOfTemporary() > 0) {
Integer numberOfTemporary = inventoryById.getNumberOfTemporary() + trueOut - outQuantity + (int) (quantity * 100);
if (numberOfTemporary < 0) {
numberOfTemporary = 0;
if("-1".equals(unit)){
if (inventoryById.getNumberOfTemporary() != null && inventoryById.getNumberOfTemporary() > 0) {
Integer numberOfTemporary = inventoryById.getNumberOfTemporary() + trueOut - outQuantity + (int) (quantity * 100);
if (numberOfTemporary < 0) {
numberOfTemporary = 0;
}
inventoryById.setNumberOfTemporary(numberOfTemporary);
materialMapper.updateInventory(inventoryById);
}
inventoryById.setNumberOfTemporary(numberOfTemporary);
materialMapper.updateInventory(inventoryById);
}
// 设置新数量
outRecordMin.setQuantity((int) (quantity * 100));
// 修改记录
@ -1992,14 +2022,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 修改记录
result = depositoryRecordMapper.updateApplicationOutRecordMin(outRecordMin);
if (inventoryById.getNumberOfTemporary() != null && inventoryById.getNumberOfTemporary() > 0) {
Integer numberOfTemporary = inventoryById.getNumberOfTemporary() - outQuantity + (int) (quantity * 100);
if (numberOfTemporary < 0) {
numberOfTemporary = 0;
if("-1".equals(unit)){
if (inventoryById.getNumberOfTemporary() != null && inventoryById.getNumberOfTemporary() > 0) {
Integer numberOfTemporary = inventoryById.getNumberOfTemporary() - outQuantity + (int) (quantity * 100);
if (numberOfTemporary < 0) {
numberOfTemporary = 0;
}
inventoryById.setNumberOfTemporary(numberOfTemporary);
materialMapper.updateInventory(inventoryById);
}
inventoryById.setNumberOfTemporary(numberOfTemporary);
materialMapper.updateInventory(inventoryById);
}
}
// 修改主记录的出库数量
@ -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) {

2
src/main/resources/templates/pages/application/form-step-look_minRecordOut.html

@ -209,7 +209,7 @@
req.id = id;
let newQuantity = $("#quantity").val();
if (Number(newQuantity) >= Number(quantity)) {
layer.msg("请申请!", {
layer.msg("数据非法,请申请!", {
icon: 0,
time: 1000
}, function () {

1
src/main/resources/templates/pages/depository/table-stock.html

@ -156,6 +156,7 @@
[
{type: "checkbox", width: 50},
{field: 'mname', width: 200, title: '物料名称'},
{field: 'brand', width: 200, title: '品牌'},
{field: 'version', width: 200, title: '规格型号'},
{field: 'code', width: 200, title: '存货编码'},
{field: 'typeName', width: 200, title: '物料类型'},

8
src/main/resources/templates/pages/place/materialForPlace.html

@ -28,6 +28,14 @@
<td>物料名称</td>
<td id="materialName" th:text="${inventory.getMname()}">骁龙888芯片</td>
</tr>
<tr>
<td>物料品牌</td>
<td id="brand" th:text="${inventory.getBrand()}">骁龙888芯片</td>
</tr>
<tr>
<td>物料型号</td>
<td id="version" th:text="${inventory.getVersion()}">骁龙888芯片</td>
</tr>
<tr>
<td>存货编码</td>
<td id="mcode" th:text="${inventory.getCode()}"></td>

1
target/classes/templates/pages/depository/table-stock.html

@ -156,6 +156,7 @@
[
{type: "checkbox", width: 50},
{field: 'mname', width: 200, title: '物料名称'},
{field: 'brand', width: 200, title: '品牌'},
{field: 'version', width: 200, title: '规格型号'},
{field: 'code', width: 200, title: '存货编码'},
{field: 'typeName', width: 200, title: '物料类型'},

8
target/classes/templates/pages/place/materialForPlace.html

@ -28,6 +28,14 @@
<td>物料名称</td>
<td id="materialName" th:text="${inventory.getMname()}">骁龙888芯片</td>
</tr>
<tr>
<td>物料品牌</td>
<td id="brand" th:text="${inventory.getBrand()}">骁龙888芯片</td>
</tr>
<tr>
<td>物料型号</td>
<td id="version" th:text="${inventory.getVersion()}">骁龙888芯片</td>
</tr>
<tr>
<td>存货编码</td>
<td id="mcode" th:text="${inventory.getCode()}"></td>

Loading…
Cancel
Save