Browse Source

修改入库审批功能

lwx_dev
erdanergou 3 years ago
parent
commit
32c866f149
  1. 72
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

72
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

@ -453,14 +453,36 @@ public class DepositoryRecordController {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (RoleAndMaterialType mt : materialTypeIdForIn for (RoleAndMaterialType mt : materialTypeIdForIn
) { ) {
int classes = mt.getClasses();
Integer uid = mt.getUid();
if (classes == 1) {
// 如果是个人
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), finalUserKey, finalToken); UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserKey, finalToken);
String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat();
}
sb.append(workwechat).append(",");
} else {
// 如果是岗位
// 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", uid);
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, null, null);
for (UserByPort userByPort : userByPortList) {
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
} }
sb.append(workwechat).append(","); sb.append(workwechat).append(",");
} }
}
}
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserKey, finalToken); JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserKey, finalToken);
String sp_no = jsonObject.getString("sp_no"); String sp_no = jsonObject.getString("sp_no");
Map<String, Object> QyWxApprovalMap = new HashMap<>(); Map<String, Object> QyWxApprovalMap = new HashMap<>();
@ -484,14 +506,36 @@ public class DepositoryRecordController {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (RoleAndDepository mt : materialTypeIdForIn for (RoleAndDepository mt : materialTypeIdForIn
) { ) {
int classes = mt.getClasses();
Integer uid = mt.getUserId();
if (classes == 1) {
// 如果是个人
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), finalUserKey, finalToken); UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserKey, finalToken);
String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat();
}
sb.append(workwechat).append(",");
} else {
// 如果是岗位
// 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", uid);
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, finalUserKey, finalToken);
for (UserByPort userByPort : userByPortList) {
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
} }
sb.append(workwechat).append(","); sb.append(workwechat).append(",");
} }
}
}
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserKey, finalToken); JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserKey, finalToken);
String sp_no = jsonObject.getString("sp_no"); String sp_no = jsonObject.getString("sp_no");
Map<String, Object> QyWxApprovalMap = new HashMap<>(); Map<String, Object> QyWxApprovalMap = new HashMap<>();
@ -677,16 +721,16 @@ public class DepositoryRecordController {
Object userId = map.get("userId"); Object userId = map.get("userId");
if (userId != null) { if (userId != null) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(userId), userkey, usertoken); UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(userId), userkey, usertoken);
map.put("departmenthead",userByPort.getId()); map.put("departmenthead", userByPort.getId());
map.put("depositoryManager",userToken.getId()); map.put("depositoryManager", userToken.getId());
} else { } else {
List<UserByPort> departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toInteger(map.get("adminorgId")), userkey, usertoken); List<UserByPort> departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toInteger(map.get("adminorgId")), userkey, usertoken);
StringBuilder departmentHeadId = new StringBuilder(); StringBuilder departmentHeadId = new StringBuilder();
for (UserByPort departmentHeadByUser : departmentHeadByUsers) { for (UserByPort departmentHeadByUser : departmentHeadByUsers) {
departmentHeadId.append(departmentHeadByUser.getId()).append(","); departmentHeadId.append(departmentHeadByUser.getId()).append(",");
} }
map.put("departmenthead",userToken.getId()); map.put("departmenthead", userToken.getId());
map.put("depositoryManager",departmentHeadId.toString()); map.put("depositoryManager", departmentHeadId.toString());
} }
List<Integer> params = (List<Integer>) map.get("params"); List<Integer> params = (List<Integer>) map.get("params");
Integer integer = 0; Integer integer = 0;
@ -995,26 +1039,26 @@ public class DepositoryRecordController {
inventory.setBrand(""); inventory.setBrand("");
brand = ""; brand = "";
} }
if(version == null){ if (version == null) {
inventory.setVersion(""); inventory.setVersion("");
version = ""; version = "";
} }
// 获取出库物料仓库Id // 获取出库物料仓库Id
Integer depositoryId = applicationOutRecordMin.getDepositoryId(); Integer depositoryId = applicationOutRecordMin.getDepositoryId();
if(!depositoryIdList.contains(depositoryId)){ if (!depositoryIdList.contains(depositoryId)) {
depositoryIdList.add(depositoryId); depositoryIdList.add(depositoryId);
} }
String inventoryMname = inventory.getMname(); String inventoryMname = inventory.getMname();
mname.append(inventoryMname).append(","); mname.append(inventoryMname).append(",");
mcode.append(inventory.getCode()).append(","); mcode.append(inventory.getCode()).append(",");
String mversionItem = brand + " "+version; String mversionItem = brand + " " + version;
mversion.append(mversionItem).append(","); mversion.append(mversionItem).append(",");
mnameForMobiles.add(inventoryMname+":"+mversionItem); mnameForMobiles.add(inventoryMname + ":" + mversionItem);
sumQuantity += applicationOutRecordMin.getQuantity(); sumQuantity += applicationOutRecordMin.getQuantity();
String unit = applicationOutRecordMin.getUnit(); String unit = applicationOutRecordMin.getUnit();
if ("-1".equals(unit)) { if ("-1".equals(unit)) {
double amounts = ObjectFormatUtil.multiply(inventory.getPrice(),applicationOutRecordMin.getQuantity()); double amounts = ObjectFormatUtil.multiply(inventory.getPrice(), applicationOutRecordMin.getQuantity());
sumPrice = ObjectFormatUtil.sum(sumPrice,amounts); sumPrice = ObjectFormatUtil.sum(sumPrice, amounts);
} else { } else {
// 获取当前对应的拆单记录 // 获取当前对应的拆单记录
Map<String, Object> paramForSplitInfo = new HashMap<>(); Map<String, Object> paramForSplitInfo = new HashMap<>();
@ -1025,14 +1069,14 @@ public class DepositoryRecordController {
int splitInfoScaleQuantity = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); int splitInfoScaleQuantity = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
BigDecimal bg = new BigDecimal(inventory.getPrice() / splitInfoScaleQuantity * applicationOutRecordMin.getQuantity()); BigDecimal bg = new BigDecimal(inventory.getPrice() / splitInfoScaleQuantity * applicationOutRecordMin.getQuantity());
double newprice = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); double newprice = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
sumPrice = ObjectFormatUtil.sum(sumPrice,newprice); sumPrice = ObjectFormatUtil.sum(sumPrice, newprice);
} }
} }
outRecordP.setMcode(mcode.toString()); outRecordP.setMcode(mcode.toString());
outRecordP.setMname(mname.toString()); outRecordP.setMname(mname.toString());
outRecordP.setMversion(mversion.toString()); outRecordP.setMversion(mversion.toString());
List<Depository> depositoryList = depositoryService.findDepositoryByIds(depositoryIdList); List<Depository> depositoryList = depositoryService.findDepositoryByIds(depositoryIdList);
for (Depository depository:depositoryList for (Depository depository : depositoryList
) { ) {
depositoryName.append(depository.getDname()).append(","); depositoryName.append(depository.getDname()).append(",");
} }

Loading…
Cancel
Save