Browse Source

修改出库申请时仓库名称不正确的问题

lwx_dev
erdanergou 3 years ago
parent
commit
fe21e7b83c
  1. 3
      src/main/java/com/dreamchaser/depository_manage/controller/QyWxOperationController.java
  2. 6
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  3. 9
      src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java
  4. 42
      src/test/java/com/dreamchaser/depository_manage/OtherTest.java

3
src/main/java/com/dreamchaser/depository_manage/controller/QyWxOperationController.java

@ -644,7 +644,8 @@ public class QyWxOperationController {
flagForLabel = false; flagForLabel = false;
} }
} else { }
else {
for (ApprovalInfo_Details ad : details for (ApprovalInfo_Details ad : details
) { ) {
// 获取当前节点审批人userId // 获取当前节点审批人userId

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

@ -270,7 +270,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("code", code); map.put("code", code);
map.put("pass", 3); map.put("pass", 3);
map.put("quantity", quantity); map.put("quantity", quantity);
log.info("插入出库申请主表:"+JSONObject.toJSONString(map));
return depositoryRecordMapper.insertApplicationOutRecord(map); return depositoryRecordMapper.insertApplicationOutRecord(map);
} }
@ -913,6 +913,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 修改库存记录 // 修改库存记录
materialMapper.updateInventory(inventoryById); materialMapper.updateInventory(inventoryById);
} }
log.info("插入出库申请子表"+JSONObject.toJSONString(map));
return depositoryRecordMapper.insertApplicationOutRecordMin(map); return depositoryRecordMapper.insertApplicationOutRecordMin(map);
} }
@ -2203,7 +2204,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取当前出库的仓库是否为开放仓库 // 获取当前出库的仓库是否为开放仓库
int flagForOpenDepository = recordP.getFlagForOpenDepository(); int flagForOpenDepository = recordP.getFlagForOpenDepository();
if (!flagForFirst) { if (!flagForFirst) {
String depositoryManagerTime = recordP.getDepositoryManagerTime(); String depositoryManagerTime = recordP.getDepositoryManagerTime();
if ("0".equals(depositoryManagerTime)) { if ("0".equals(depositoryManagerTime)) {
// 如果当前申请没有处理 // 如果当前申请没有处理
@ -2476,7 +2476,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (flag) { if (flag) {
return 1; return 1;
} }
log.info("出库审批参数 “flagForFirst:"+flagForFirst+"”,“flagForDepository:"+flagForDepository+"”,审批人:"+userByPort.getNumber()+userByPort.getName()); log.info("出库审批参数 “flagForFirst:"+flagForFirst+"”,“flagForDepository:"+flagForDepository+"”,审批人:"+userByPort.getNumber()+userByPort.getName()+"出库审批修改数据:"+JSONObject.toJSONString(map));
map.put("id", outId); map.put("id", outId);
return depositoryRecordMapper.updateApplicationOutRecord(map); return depositoryRecordMapper.updateApplicationOutRecord(map);

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

@ -1551,14 +1551,14 @@ public class QyWxOperationService {
// 获取当前物料所在仓库 // 获取当前物料所在仓库
Integer depositoryId = recordMin.getDepositoryId(); Integer depositoryId = recordMin.getDepositoryId();
Depository depositoryById = depositoryMapper.findDepositoryById(depositoryId); Depository depositoryById = depositoryMapper.findDepositoryById(depositoryId);
Depository depositoryTop = depositoryById;
if (Integer.compare(depositoryById.getParentId(), 0) != 0) { if (Integer.compare(depositoryById.getParentId(), 0) != 0) {
// 如果不是 // 如果不是
List<Depository> depositoryAll = depositoryMapper.findDepositoryAll(); List<Depository> depositoryAll = depositoryMapper.findDepositoryAll();
depositoryById = findParentDepository(depositoryById, depositoryAll); depositoryTop = findParentDepository(depositoryById, depositoryAll);
} }
if (!depositoryById.getDname().contains("前置仓")) { if (!depositoryTop.getDname().contains("前置仓")) {
// 如果不是前置仓下的仓库 // 如果不是前置仓下的仓库
flag = false; flag = false;
} }
@ -1761,9 +1761,6 @@ public class QyWxOperationService {
approval_template_approver_list.add(approval_template_approver_Label); approval_template_approver_list.add(approval_template_approver_Label);
} }
else { else {
// 如果不是中心仓下的仓库 // 如果不是中心仓下的仓库

42
src/test/java/com/dreamchaser/depository_manage/OtherTest.java

@ -3,6 +3,7 @@ package com.dreamchaser.depository_manage;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.PublicConfig; import com.dreamchaser.depository_manage.config.PublicConfig;
import com.dreamchaser.depository_manage.config.QyWxConfig; import com.dreamchaser.depository_manage.config.QyWxConfig;
import com.dreamchaser.depository_manage.entity.Depository;
import com.dreamchaser.depository_manage.entity.MaterialType; import com.dreamchaser.depository_manage.entity.MaterialType;
import com.dreamchaser.depository_manage.entity.UserByPort; import com.dreamchaser.depository_manage.entity.UserByPort;
import com.dreamchaser.depository_manage.pojo.callBackXml.approvalCallBackXml.ApprovalInfo_Details; import com.dreamchaser.depository_manage.pojo.callBackXml.approvalCallBackXml.ApprovalInfo_Details;
@ -98,21 +99,38 @@ public class OtherTest {
return JSONObject.parseObject(JSONObject.toJSONString(map), UserByPort.class); return JSONObject.parseObject(JSONObject.toJSONString(map), UserByPort.class);
} }
Depository findParentDepository(Depository depository, List<Depository> depositoryList) {
for (Depository d : depositoryList
) {
if (Integer.compare(depository.getParentId(), d.getId()) == 0) {
if (Integer.compare(0, d.getParentId()) == 0) {
return d;
} else {
return findParentDepository(d, depositoryList);
}
}
}
return null;
}
@Test @Test
public void someTest(){ public void someTest(){
List<MaterialType> materialTypeByNames = materialTypeService.findMaterialTypeByName("安全阀"); boolean flag = true;
Depository depositoryById = depositoryMapper.findDepositoryById(28);
Long oldId = null; Depository depositoryTop = depositoryById;
List<Long> parentOldIdList = new ArrayList<>(); if (Integer.compare(depositoryById.getParentId(), 0) != 0) {
List<Long> OldIdList = new ArrayList<>(); // 如果不是
for (MaterialType materialType : materialTypeByNames) { List<Depository> depositoryAll = depositoryMapper.findDepositoryAll();
parentOldIdList.add(materialType.getParentId()); depositoryTop = findParentDepository(depositoryById, depositoryAll);
OldIdList.add(materialType.getOldId()); }
}
System.out.println(parentOldIdList); if (!depositoryTop.getDname().contains("前置仓")) {
System.out.println(OldIdList); // 如果不是前置仓下的仓库
System.out.println(CollectionUtils.subtract(OldIdList,parentOldIdList)); flag = false;
}
System.out.println(flag);
System.out.println(depositoryById);
System.out.println(depositoryTop);
} }

Loading…
Cancel
Save