Browse Source

修改入库审批功能

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

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

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

Loading…
Cancel
Save