Browse Source

更新出库申请处理

lwx_dev
erdanergou 3 years ago
parent
commit
c51af0a6c4
  1. 3
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java
  2. 100
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java
  3. 17
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  4. 1
      src/main/java/com/dreamchaser/depository_manage/controller/QyWxOperationController.java
  5. 5
      src/main/java/com/dreamchaser/depository_manage/entity/ApplicationOutRecord.java
  6. 5
      src/main/java/com/dreamchaser/depository_manage/entity/Inventory.java
  7. 6
      src/main/java/com/dreamchaser/depository_manage/entity/Material.java
  8. 17
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  9. 11
      src/main/java/com/dreamchaser/depository_manage/mapper/RoleMapper.xml
  10. 7
      src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordP.java
  11. 7
      src/main/java/com/dreamchaser/depository_manage/service/RoleService.java
  12. 69
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  13. 1
      src/main/java/com/dreamchaser/depository_manage/service/impl/NoticeServiceImpl.java
  14. 34
      src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java
  15. 23
      src/main/java/com/dreamchaser/depository_manage/service/impl/RoleServiceImpl.java
  16. 164
      src/main/resources/templates/pages/application/application-out.html
  17. 31
      src/main/resources/templates/pages/applicationForStorageCenter/application-out.html
  18. 94
      src/main/resources/templates/pages/applicationForStorageCenter/application-out_back.html
  19. 159
      src/main/resources/templates/pages/applicationForStorageCenter/application-out_temporaryValue.html
  20. 10
      src/test/java/com/dreamchaser/depository_manage/OtherTest.java
  21. 17
      target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  22. 11
      target/classes/com/dreamchaser/depository_manage/mapper/RoleMapper.xml
  23. 164
      target/classes/templates/pages/application/application-out.html
  24. 103
      target/classes/templates/pages/applicationForStorageCenter/application-out.html
  25. 94
      target/classes/templates/pages/applicationForStorageCenter/application-out_back.html
  26. 159
      target/classes/templates/pages/applicationForStorageCenter/application-out_temporaryValue.html

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

@ -1552,6 +1552,9 @@ public class DepositoryController {
Integer integer = 0;
if (count == 0) {
// 如果要删除
map.put("depositoryIds",new ArrayList<>());
integer = roleService.delWarehouseVisiblePermission(map);
count = integer;
} else {
// 如果不是删除
integer = roleService.setWarehouseVisiblePermission(map);

100
src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java

@ -160,18 +160,7 @@ public class MaterialController {
isadmin = 1;
}
if (isadmin != 4 && Integer.compare(userToken.getMaindeparment(), 361) != 0) {
// 查询当前用户管理的仓库
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userToken.getId());
// 查询当前用户部门拥有的仓库
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userToken.getMaindeparment().toString());
// 定义仓库编号列表
List<Integer> didList = new ArrayList<>();
for (RoleAndDepository andDepository : depositoryAndRole) {
didList.add(andDepository.getId());
}
for (Depository value : depositoryByAdminorg) {
didList.add(value.getId());
}
List<Integer> didList = roleService.findDepositoryIdForUserHas(userToken);
map.put("depositoryIds", didList);
@ -423,10 +412,6 @@ public class MaterialController {
token = (String) request.getSession().getAttribute("userToken");
}
UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
// 获取当前部门仓库
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userToken.getMaindeparment().toString());
// 查询当前用户管理的仓库
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userToken.getId());
Map<String, Object> param = new HashMap<>();
String code = map.get("code").toString();
@ -439,17 +424,8 @@ public class MaterialController {
List<InventoryP> inventoryPByCondition = new ArrayList<>();
param.put("mcode", code);
List<Integer> depositoryIdList = new ArrayList<>();
for (Depository depository : depositoryByAdminorg
) {
depositoryIdList.add(depository.getId());
}
for (RoleAndDepository rad : depositoryAndRole
) {
if (!depositoryIdList.contains(rad.getDepositoryId())) {
depositoryIdList.add(rad.getDepositoryId());
}
}
List<Integer> depositoryIdList = roleService.findDepositoryIdForUserHas(userToken);
// 获取该用户额外可见的仓库
List<Integer> tempDepositoryIdlist = roleService.findDepositoryIdForWareHouseVisiblePermissionByUser(userToken);
depositoryIdList= (List<Integer>) CollectionUtils.union(tempDepositoryIdlist,depositoryIdList);
@ -534,20 +510,9 @@ public class MaterialController {
UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
// 查询当前用于部门的仓库
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userToken.getMaindeparment().toString());
// 查询当前用户管理的仓库
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userToken.getId());
List<InventoryP> inventoryPList = new ArrayList<>();
List<Integer> depositoryIdList = new ArrayList<>();
for (Depository depository : depositoryByAdminorg
) {
depositoryIdList.add(depository.getId());
}
for (RoleAndDepository rad : depositoryAndRole
) {
if (!depositoryIdList.contains(rad.getDepositoryId())) {
depositoryIdList.add(rad.getDepositoryId());
}
}
List<Integer> depositoryIdList = roleService.findDepositoryIdForUserHas(userToken);
List<Integer> tempDepositoryIDList = roleService.findDepositoryIdForWareHouseVisiblePermissionByUser(userToken);
depositoryIdList = (List<Integer>) CollectionUtils.union(tempDepositoryIDList,depositoryIdList);
@ -650,15 +615,23 @@ public class MaterialController {
String key = "WMS_temporaryValue_" + type + userByPort.getNumber();
List<String> range = redisTemplate.opsForList().range(key, 0, -1);
List<Inventory> result = new ArrayList<>();
if (range != null && range.size() > 0) {
for (String value :
range) {
if ("".equals(value)) {
continue;
}
// 获取当前用户可见的仓库
List<Depository> depositoryList = new ArrayList<>();
Inventory inventoryById = materialService.findInventoryById(ObjectFormatUtil.toInteger(value));
Depository depository = new Depository();
depository.setId(inventoryById.getDepositoryId());
depository.setDname(inventoryById.getDepositoryName());
depositoryList.add(depository);
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryById.getMid());
inventoryById.setSplitInfoList(splitInfoByMid);
inventoryById.setDepositoryList(depositoryList);
result.add(inventoryById);
}
}
@ -908,10 +881,6 @@ public class MaterialController {
token = (String) request.getSession().getAttribute("userToken");
}
UserByPort userByPort = AuthenticationTokenPool.getUserToken(token);
// 获取当前用户所在部门拥有的仓库
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString());
// 查询当前用户管理的仓库
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId());
// 获取当前扫描的二维码
String qrCode = (String) map.get("qrCode");
// 根据扫描的二维码获取对应的物料编码
@ -931,15 +900,7 @@ public class MaterialController {
// 获取物料与条形码的对应关系
List<MaterialAndBarCode> materialByBarCodeByCondition = materialService.findMaterialByBarCodeByCondition(param);
boolean flag = false;
List<Integer> depositoryIdList = new ArrayList<>();
for (Depository depository : depositoryByAdminorg) {
depositoryIdList.add(depository.getId());
}
for (RoleAndDepository depository : depositoryAndRole) {
if (!depositoryIdList.contains(depository.getDepositoryId())) {
depositoryIdList.add(depository.getDepositoryId());
}
}
List<Integer> depositoryIdList = roleService.findDepositoryIdForUserHas(userByPort);
List<Integer> tempDepositoryIdList = roleService.findDepositoryIdForWareHouseVisiblePermissionByUser(userByPort);
depositoryIdList = (List<Integer>) CollectionUtils.union(depositoryIdList,tempDepositoryIdList);
@ -1101,19 +1062,7 @@ public class MaterialController {
// 获取条形码与物料的映射
MaterialAndBarCode materialByBarCode = materialService.findMaterialByBarCode(barCode);
if (materialByBarCode != null) {
// 获取当前用户部门所拥有仓库
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userByPort.getMaindeparment().toString());
// 查询当前用户管理的仓库
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId());
List<Integer> depositoryIdList = new ArrayList<>();
for (Depository depository : depositoryByAdminorg) {
depositoryIdList.add(depository.getId());
}
for (RoleAndDepository depository : depositoryAndRole) {
if (!depositoryIdList.contains(depository.getDepositoryId())) {
depositoryIdList.add(depository.getDepositoryId());
}
}
List<Integer> depositoryIdList = roleService.findDepositoryIdForUserHas(userByPort);
List<Integer> tempDepositoryIdList = roleService.findDepositoryIdForWareHouseVisiblePermissionByUser(userByPort);
depositoryIdList = (List<Integer>) CollectionUtils.union(depositoryIdList,tempDepositoryIdList);
List<PlaceP> placePList = new ArrayList<>();
@ -1684,23 +1633,8 @@ public class MaterialController {
token = (String) request.getSession().getAttribute("userToken");
}
UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
// 获取当前部门所拥有的仓库
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userToken.getMaindeparment().toString());
// 查询当前用户管理的仓库
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userToken.getId());
// 获取用户可见的仓库
List<Integer> depositoryIdList = new ArrayList<>();
for (Depository depository : depositoryByAdminorg
) {
depositoryIdList.add(depository.getId());
}
for (RoleAndDepository rad : depositoryAndRole
) {
if (!depositoryIdList.contains(rad.getDepositoryId())) {
depositoryIdList.add(rad.getDepositoryId());
}
}
List<Integer> depositoryIdList = roleService.findDepositoryIdForUserHas(userToken);
map.put("userTokenId", userToken.getId());
List<MaterialAndPlaceForViewP> materialAndPlaceForViews = materialService.findInventoryByMidAndDepository(map, depositoryIdList);
Integer count = placeService.findPlaceAndMaterialCountByDidsAndMid(depositoryIdList, map);

17
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -756,6 +756,13 @@ public class PageController {
if (role == null) {
role = 1;
}
// 获取当前用户是否存在可见仓库
List<Integer> union = roleService.findDepositoryIdForWareHouseVisiblePermissionByUser(userToken);
if(union.size() > 0){
mv.addObject("display","block");
}else{
mv.addObject("display","none");
}
if (Integer.compare(userToken.getMaindeparment(), 361) == 0 || Integer.compare(4, role) == 0) {
mv.setViewName("pages/applicationForStorageCenter/application-out_back");
}
@ -772,6 +779,9 @@ public class PageController {
inventoryP = inventory.get(0);
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryP.getMid());
inventoryP.setSplitInfoList(splitInfoByMid);
List<Depository> depositoryList = new ArrayList<>();
depositoryList.add(depositoryByCode);
inventoryP.setDepositoryList(depositoryList);
mv.addObject("materialById", inventoryP);
}
}
@ -2791,6 +2801,13 @@ public class PageController {
}
UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
List<String> range = redisTemplateForHash.boundListOps("WMS_temporaryValue_Out" + userToken.getNumber()).range(0, -1);
// 获取当前用户是否存在可见仓库
List<Integer> union = roleService.findDepositoryIdForWareHouseVisiblePermissionByUser(userToken);
if(union.size() > 0){
mv.addObject("display","block");
}else{
mv.addObject("display","none");
}
if (range != null && range.size() > 0) {
mv.setViewName("pages/application/application-out_temporaryValue");
Integer role = userToken.getIsadmin();

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

@ -627,6 +627,7 @@ public class QyWxOperationController {
List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserList(crypt);
// 定义当前是否为标签
boolean flagForLabel = true; // 默认为标签
if (details.size() != qyWxLabelUserList.size()) {
// 如果节点数目不等于标签人员数
flagForLabel = false;

5
src/main/java/com/dreamchaser/depository_manage/entity/ApplicationOutRecord.java

@ -196,6 +196,11 @@ public class ApplicationOutRecord {
*/
private String editUser;
/**
* 2代表是通过开放仓库申请1代表不是
*/
private Integer flagForOpenDepository;

5
src/main/java/com/dreamchaser/depository_manage/entity/Inventory.java

@ -167,6 +167,11 @@ public class Inventory {
*/
private List<SplitInfo> splitInfoList;
/**
* 用于暂存该物料所在的仓库
*/
private List<Depository> depositoryList;
public Inventory() {
}

6
src/main/java/com/dreamchaser/depository_manage/entity/Material.java

@ -155,4 +155,10 @@ public class Material {
*/
private List<SplitInfo> splitInfoList;
/**
* 用于暂存该物料所在的仓库
*/
private List<Depository> depositoryList;
}

17
src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml

@ -24,8 +24,8 @@
<resultMap id="simpleApplicationInRecordMap"
type="com.dreamchaser.depository_manage.entity.SimpleApplicationInRecord">
<id property="id" column="airid" jdbcType="INTEGER"/>
<result column="applicantId" property="applicant_id" jdbcType="INTEGER"/>
<result column="applicantTime" property="applicant_time" jdbcType="INTEGER"/>
<result column="applicantId" property="applicantId" jdbcType="INTEGER"/>
<result column="applicantTime" property="applicantTime" jdbcType="INTEGER"/>
<result column="applyRemark" property="applyRemark" jdbcType="VARCHAR"/>
</resultMap>
<!-- 字段映射 -->
@ -121,6 +121,7 @@
<result column="aorconstructionunitid" property="constructionUnitId" jdbcType="INTEGER"/>
<result column="aoradminorgid" property="adminorgId" jdbcType="INTEGER"/>
<result column="outTime" property="outTime" jdbcType="INTEGER"/>
<result column="flagForOpenDepository" property="flagForOpenDepository" jdbcType="INTEGER"/>
<result column="editUser" property="editUser" jdbcType="VARCHAR"/>
<result column="mbrand" property="mbrand" jdbcType="VARCHAR"/>
</resultMap>
@ -176,7 +177,7 @@
<sql id="ApplicationOutRecordInfo">
aorid,mid,mname,depositoryId,dname,applicantId,applicantTime,applyRemark,aorcode,aorpirce,aorquantity,departmenthead,departmentheadPass,departmentHeadTime,departmentheadMessage,
depositoryManager,depositoryManagerPass,depositoryManagerTime,depositoryManagerMessage,aorstate,istransfer,mcode,placeId,pass,aormUnit,aorconstructionunitid,aoradminorgid,cuname,
cuintroduce,cuaddress,outTime,abstract,outType,editUser,mbrand,mversion
cuintroduce,cuaddress,outTime,abstract,outType,editUser,mbrand,mversion,flagForOpenDepository
</sql>
<sql id="ApplicationOutRecordMinInfo">
@ -1025,13 +1026,16 @@
<!-- 插入一条出库记录-->
<insert id="insertApplicationOutRecord" parameterType="map" useGeneratedKeys="true" keyProperty="id">
insert into application_out_record
(id,applicant_id,applicant_time,code,price,quantity,departmenthead,departmenthead_pass,departmenthead_time,
departmenthead_messgae,depository_manager,depository_manager_pass,depository_manager_time,depository_manager_message,apply_remark,state,istransfer,placeId,pass,constructionunitid,adminorgid,outType,abstract)
(id,applicant_id,applicant_time,code,depository_id,price,quantity,departmenthead,departmenthead_pass,departmenthead_time,
departmenthead_messgae,depository_manager,depository_manager_pass,depository_manager_time,
depository_manager_message,apply_remark,state,istransfer,placeId,pass,constructionunitid,
adminorgid,outType,abstract,flagForOpenDepository)
values(
#{id},
#{applicantId},
#{applicantTime},
#{code},
#{depositoryId},
#{price},
#{quantity},
#{departmenthead},
@ -1071,7 +1075,8 @@
#{constructionUnitId},
#{adminorgId},
#{outType},
#{abstract}
#{abstract},
#{flagForOpenDepository}
)
</insert>

11
src/main/java/com/dreamchaser/depository_manage/mapper/RoleMapper.xml

@ -313,10 +313,13 @@
<if test="uid != null and uid != ''">
and uid = #{uid}
</if>
and did in
<foreach collection="depositoryIdList" index="index" item="did" open="(" separator="," close=")">
#{did}
</foreach>
<if test="depositoryIdList != null and depositoryIdList != ''">
and did in
<foreach collection="depositoryIdList" index="index" item="did" open="(" separator="," close=")">
#{did}
</foreach>
</if>
</delete>

7
src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordP.java

@ -197,6 +197,12 @@ public class ApplicationOutRecordP {
*/
private String mversion;
/**
* 2代表是通过开放仓库申请1代表不是
*/
private Integer flagForOpenDepository;
public ApplicationOutRecordP(ApplicationOutRecord aor) {
this.id = aor.getId();
this.mid = aor.getMid();
@ -235,6 +241,7 @@ public class ApplicationOutRecordP {
this.outType = aor.getOutType();
this.mbrand = aor.getMbrand() == null ? "" : aor.getMbrand();
this.mversion = aor.getMversion() == null ? "" : aor.getMversion();
this.flagForOpenDepository = aor.getFlagForOpenDepository();
}
}

7
src/main/java/com/dreamchaser/depository_manage/service/RoleService.java

@ -185,6 +185,11 @@ public interface RoleService {
*/
List<Integer> findDepositoryIdForWareHouseVisiblePermissionByUser(UserByPort userToken);
/**
* 用于查询当前用户所拥有及所管理的仓库
* @param userToken 待查询用户
* @return
*/
List<Integer> findDepositoryIdForUserHas(UserByPort userToken);
}

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

@ -2,6 +2,7 @@ package com.dreamchaser.depository_manage.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.PortConfig;
import com.dreamchaser.depository_manage.config.QyWxConfig;
import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.entity.MaterialAndPlace;
import com.dreamchaser.depository_manage.exception.MyException;
@ -14,6 +15,7 @@ import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.RoleService;
import com.dreamchaser.depository_manage.service.SplitUnitService;
import com.dreamchaser.depository_manage.utils.*;
import org.apache.commons.collections4.CollectionUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
@ -225,6 +227,18 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
public Integer insertApplicationOutRecord(Map<String, Object> map, UserByPort userToken) {
String placeId = "";
Object temp = map.get("placeId");
String depositoryId = (String) map.get("depositoryId");
if (depositoryId ==null || "".equals(depositoryId)) {
map.put("flagForOpenDepository", 1);
map.remove("depositoryId");
} else {
List<Integer> depositoryIdForUserHas = roleService.findDepositoryIdForUserHas(userToken);
map.put("flagForOpenDepository", 2);
if (depositoryIdForUserHas.contains(ObjectFormatUtil.toInteger(depositoryId))) {
map.put("flagForOpenDepository", 1);
}
}
if (temp != null) {
placeId = temp.toString();
}
@ -254,6 +268,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("code", code);
map.put("pass", 3);
map.put("quantity", quantity);
return depositoryRecordMapper.insertApplicationOutRecord(map);
}
@ -884,9 +899,19 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
public Integer insertApplicationOutMin(Map<String, Object> map) {
// 获取当前出库库存id
Integer mid = ObjectFormatUtil.toInteger(map.get("mid"));
String depositoryId = (String) map.get("depositoryId");
// 获取当前出库库存记录
Inventory inventoryById = materialMapper.findInventoryById(mid);
map.put("depositoryId", inventoryById.getDepositoryId());
if (depositoryId == null || "".equals(depositoryId)) {
map.put("depositoryId", inventoryById.getDepositoryId());
} else {
// 如果选择了仓库
Map<String, Object> paramForInventory = new HashMap<>();
paramForInventory.put("mid", inventoryById.getMid());
paramForInventory.put("did", depositoryId);
inventoryById = materialMapper.findInventoryByMidAndDid(paramForInventory);
}
map.put("trueOut", 0);
String unit = (String) map.get("unit");
@ -2458,21 +2483,15 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 如果点击的是通过
map.put("departmentheadPass", 1);
map.put("state", "待仓储中心负责人审核");
// 获取仓储中心详情
Administration company = LinkInterfaceUtil.getCompany(361, null);
// 获取仓储中心负责人
List<UserByPort> departmentHeadByUser = PortConfig.findDepartmentHeadByUser(company, null);
// 获取仓储中心负责人标签的用户userId
List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserList(userAgent);
StringBuilder depositoryManager = new StringBuilder();
StringBuilder QyWxUid = new StringBuilder();
for (int i = 0; i < departmentHeadByUser.size(); i++) {
depositoryManager.append(departmentHeadByUser.get(i).getId() + ",");
String workwechat = departmentHeadByUser.get(i).getWorkwechat();
if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat();
}
// QyWxUid.append(workwechat+",");
for (String s : qyWxLabelUserList) {
Map<String, Object> userByQyWxUserId = PortConfig.findUserByQyWxUserId(s);
UserByPort user = (UserByPort) userByQyWxUserId.get("user");
depositoryManager.append(user.getId()).append(",");
}
QyWxUid.append("PangFuZhen" + ",");
map.put("depositoryManager", depositoryManager.toString());
} else {
// 如果点击的是驳回
@ -2842,7 +2861,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (int i = 0; i < departmentHeadByUser.size(); i++) {
depositoryManager.append(departmentHeadByUser.get(i).getId() + ",");
String workwechat = departmentHeadByUser.get(i).getWorkwechat();
if(workwechat == null || "".equals(workwechat)){
if (workwechat == null || "".equals(workwechat)) {
workwechat = departmentHeadByUser.get(i).getWechat();
}
QyWxUid.append(workwechat + ",");
@ -3074,7 +3093,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
redisTemplate.opsForHash().putAll("user:" + integer, userRecord);
minRecordManage.append(integer).append(",");
String workwechat = manager.getWorkwechat();
if(workwechat == null || "".equals(workwechat)){
if (workwechat == null || "".equals(workwechat)) {
workwechat = manager.getWechat();
}
// QyWxUid.append(workwechat+",");
@ -3108,7 +3127,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
}
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null);
String workwechat = userByPort.getWorkwechat();
if(workwechat == null || "".equals(workwechat)){
if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat();
}
QyWxUid.append(workwechat).append(",");
@ -3320,7 +3339,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (int i = 0; i < departmentHeadByUser.size(); i++) {
depositoryManager.append(departmentHeadByUser.get(i).getId() + ",");
String workwechat = departmentHeadByUser.get(i).getWorkwechat();
if(workwechat == null || "".equals(workwechat)){
if (workwechat == null || "".equals(workwechat)) {
workwechat = departmentHeadByUser.get(i).getWechat();
}
// QyWxUid.append(workwechat+",");
@ -3416,8 +3435,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 更新redis中用户记录
redisTemplate.opsForHash().putAll("user:" + userIdByDid.get(j), userRecord);
minRecordManage.append(userIdByDid.get(j)).append(",");
String workwechat =manager.getWorkwechat();
if(workwechat == null || "".equals(workwechat)){
String workwechat = manager.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) {
workwechat = manager.getWechat();
}
// QyWxUid.append(workwechat+",");
@ -4084,13 +4103,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("applicantTime", DateUtil.DateTimeByDayToTimeStamp(applyTime));
}
List<Integer> depositoryIdList = new ArrayList<>();
if(map.size() <= 2){
if (map.size() <= 2) {
map.put("applicantId", userByPort.getId());
}
if (map.containsKey("depositoryId")) {
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId")));
}
else {
} else {
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId());
for (RoleAndDepository depository : depositoryAndRole
@ -4131,13 +4149,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("applicantTime", DateUtil.DateTimeByDayToTimeStamp(applyTime));
}
List<Integer> depositoryIdList = new ArrayList<>();
if(map.size() <= 2){
if (map.size() <= 2) {
map.put("applicantId", userByPort.getId());
}
if (map.containsKey("depositoryId")) {
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId")));
}
else {
} else {
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId());
for (RoleAndDepository depository : depositoryAndRole

1
src/main/java/com/dreamchaser/depository_manage/service/impl/NoticeServiceImpl.java

@ -43,7 +43,6 @@ public class NoticeServiceImpl implements NoticeService {
String[] split = viewRangeIdString.split(",");
List<String> list = new ArrayList<>();
for (int i = 0; i < split.length; i++) {
Integer viewRangeId = ObjectFormatUtil.toInteger(split[i]);
List<String> qyWxDepartmentUserList = QyWxConfig.getQyWxDepartmentUserList(userAgent, viewRangeId);
list.addAll(qyWxDepartmentUserList);

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

@ -1406,6 +1406,9 @@ public class QyWxOperationService {
// 获取当前出库主订单
ApplicationOutRecord mainRecord = depositoryRecordMapper.findApplicationOutRecordPById(mainId);
// 获取当前出库单是2代表是通过开放仓库申请1代表不是
Integer flagForOpenDepository = mainRecord.getFlagForOpenDepository();
// 获取当前出库明细
List<ApplicationOutRecordMin> minRecordList = depositoryRecordMapper.findApplicationOutRecordMinByParent(mainId);
// 定义审批模板
@ -1745,7 +1748,7 @@ public class QyWxOperationService {
approvalTemplate.setNotify_type(2);
if (!flag) {
// 如果有其他仓库且不是仓储中心人
// 如果是中心仓下的仓库
// 获取仓储中心负责人标签的用户userId
List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserList(userAgent);
@ -1756,8 +1759,37 @@ public class QyWxOperationService {
approval_template_approver_list.add(approval_template_approver_Label);
}else{
// 如果不是中心仓下的仓库
if(Integer.compare(2,flagForOpenDepository) == 0){
// 如果该仓库是通过开放仓库获取到的
// 获取当前选中的仓库
Depository depositoryById = depositoryMapper.findDepositoryById(mainRecord.getDepositoryId());
// 获取当前仓库所属的部门
String adminorg = depositoryById.getAdminorg();
// 获取当前部门id对应的企业微信id
JSONObject portByQyWx = PortConfig.getUserPortByQyWx(ObjectFormatUtil.toInteger(adminorg));
Integer wechatorganizationid = portByQyWx.getInteger("wechatorganizationid");
// 获取当前部门信息
qywxDepartment wxDepartment = QyWxConfig.getQyWxDepartment(userAgent, wechatorganizationid);
// 获取部门负责人id列表
List<String> otherDepartmentIdList = new ArrayList<>(wxDepartment.getDepartment_leader());
otherDepartmentIdList = new ArrayList<String>(Collections.singleton("PangFuZhen"));
// 用于设置其他部门负责人审批
Approval_template_approver approval_template_approver_Label = new Approval_template_approver();
approval_template_approver_Label.setAttr(1);
approval_template_approver_Label.setUserid(otherDepartmentIdList);
approval_template_approver_list.add(approval_template_approver_Label);
}
}
for (Integer depositoryId : depositoryIdList
) {

23
src/main/java/com/dreamchaser/depository_manage/service/impl/RoleServiceImpl.java

@ -414,6 +414,29 @@ public class RoleServiceImpl implements RoleService {
return (List<Integer>) CollectionUtils.union(depositoryIdListForPerson, depositoryIdListForPost);
}
/**
* 用于查询当前用户所拥有及所管理的仓库
* @param userToken 待查询用户
* @return
*/
@Override
public List<Integer> findDepositoryIdForUserHas(UserByPort userToken) {
// 获取当前用户所在部门拥有的仓库
List<Depository> depositoryByAdminorg = depositoryMapper.findDepositoryByAdminorg(userToken.getMaindeparment().toString());
// 查询当前用户管理的仓库
List<RoleAndDepository> depositoryAndRole = roleMapper.findDepositoryAndRole(userToken.getId());
List<Integer> depositoryIdList = new ArrayList<>();
for (Depository depository : depositoryByAdminorg) {
depositoryIdList.add(depository.getId());
}
for (RoleAndDepository depository : depositoryAndRole) {
if (!depositoryIdList.contains(depository.getDepositoryId())) {
depositoryIdList.add(depository.getDepositoryId());
}
}
return depositoryIdList;
}
/**
* 获取当前仓库的子仓库

164
src/main/resources/templates/pages/application/application-out.html

@ -128,6 +128,15 @@
</select>
</div>
</div>
<div class="layui-form-item" id="depositoryId"
th:style="'display:'+${display}">
<label class="layui-form-label">仓库:</label>
<div class="layui-input-block">
<select name="depositoryId" id="showDepository">
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">备注说明:</label>
<div class="layui-input-block">
@ -341,8 +350,8 @@
var params = [];
// 用于标志当前表单是否第一次提交
let flagForForm = false;
let GroupflagForForm = false;
let flagForForm = false;
let GroupflagForForm = false;
// 用于暂存卡片个数(组合)
var params2 = [];
@ -355,6 +364,9 @@
step = layui.step;
let depositoryDisplay = $("#depositoryId").css("display");
// 用于分步表单加载
step.render({
elem: '#stepForm',
@ -382,7 +394,7 @@
// 提交(物料出库)
form.on('submit(formStep)', function (data) {
if(!flagForForm){
if (!flagForForm) {
flagForForm = true;
data = data.field;
data.params = params;
@ -408,6 +420,7 @@
}
data.params = remove(data.params, Number(keyNumber));
}
$.ajax({
url: "/depositoryRecord/applicationOut",
type: 'post',
@ -420,7 +433,7 @@
success: function (data) {
layer.close(this.layerIndex);
if (data.status >= 300) {
layer.msg(data.statusInfo.message,{icon:0,time:500},function () {
layer.msg(data.statusInfo.message, {icon: 0, time: 500}, function () {
flagForForm = false;
});//失败的表情
@ -445,7 +458,7 @@
// 提交(组合出库)
form.on('submit(formStep2)', function (data) {
if(!GroupflagForForm){
if (!GroupflagForForm) {
GroupflagForForm = true;
data = data.field;
data.params = params2;
@ -484,7 +497,7 @@
success: function (d) {
layer.close(this.layerIndex);
if (d.status >= 300) {
layer.msg(data.statusInfo.message,{icon:0,time:500},function () {
layer.msg(data.statusInfo.message, {icon: 0, time: 500}, function () {
flagForForm = false;
});//失败的表情
@ -577,6 +590,15 @@
<div class="layui-input-block">
<select id=` + "unit" + NewIdNumber + ` name=` + "unit" + NewIdNumber + `>
</select>
</div>
</div>
<div class="layui-form-item" id=` + "depositoryId" + NewIdNumber + `
style="display:` + depositoryDisplay + `">
<label class="layui-form-label">仓库:</label>
<div class="layui-input-block">
<select name=` + "depositoryId" + NewIdNumber + ` id=` + "showDepository" + NewIdNumber + `>
</select>
</div>
</div>
@ -592,7 +614,14 @@
// 获取当前高度
var height = parseInt(($("#stepForm").css('height')).split("px")[0]);
params.push(NewIdNumber);
$("#stepForm").css("height", height + 422 + 'px');
if (depositoryDisplay === "none") {
$("#stepForm").css("height", height + 422 + 'px');
} else {
$("#stepForm").css("height", height + 435 + 'px');
}
$("#" + parentId).after(materialItem);
};
@ -734,7 +763,13 @@
// 获取祖父节点
var reparent = parent.parentNode;
var height = parseInt(($("#stepForm").css('height')).split("px")[0]);
$("#stepForm").css("height", height - 422 + 'px');
if (depositoryDisplay === "none") {
$("#stepForm").css("height", height - 422 + 'px');
} else {
$("#stepForm").css("height", height - 435 + 'px');
}
params = remove(params, parentId);
reparent.removeChild(parent);
};
@ -784,7 +819,7 @@
req.code = code;
req.type = "out";
if (code !== "") {
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/findMatrialByCode",
type: "get",
@ -794,7 +829,7 @@
success: function (d) {
var d = d.data;
if (d == null) {
layer.msg("仓库中暂无该物料",{icon:5,time:500},function () {
layer.msg("仓库中暂无该物料", {icon: 5, time: 500}, function () {
materialName.value = "";
materialId.value = "";
obj.value = "";
@ -815,7 +850,7 @@
for (let i = 0; i < unitList.length; i++) {
$("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit));
}
form.render();
if (materialAndBarCodeList.length > 0) {
// 如果有对应的条形码
var barCodeInput = barCodeItem.childNodes[1].childNodes[1];
@ -845,6 +880,16 @@
}
layer.close(loading2)
}
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = d.depositoryList;
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
}
}
});
@ -870,7 +915,7 @@
let req = {};
req.code = code;
if (code !== "") {
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/group/findGroupByCode",
type: "post",
@ -959,7 +1004,7 @@
var mid = materialId.value;
if (mid !== '') {
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/findMatrialById?mid=" + mid + "&type=out",
type: "get",
@ -1009,8 +1054,17 @@
barCode.empty();
}
}
layer.close(loading2);
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = material.depositoryList;
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
}
});
}
@ -1061,7 +1115,7 @@
end: function () {
let gid = gidItem.value;
if (gid !== '') {
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let req = {};
req.gid = gid;
$.ajax({
@ -1131,7 +1185,7 @@
if (gname !== '') {
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
var req = {};
req.gname = gname;
$.ajax({
@ -1231,7 +1285,7 @@
data = data.split(",")[0];
if (data !== "") {
req.mname = data;
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/findInventoryByCondition",
type: "post",
@ -1240,14 +1294,14 @@
contentType: "application/json;charset=utf-8",
success: function (d) {
if (d.count > 1) {
layer.msg("请点击右侧搜索确定物品",{icon:0,time:500},function () {
layer.msg("请点击右侧搜索确定物品", {icon: 0, time: 500}, function () {
layer.close(loading2);
materialId.value = "";
codeValue.value = "";
});
return false;
} else if (d.count === 0) {
layer.msg("没有该物品,请确认输入是否正确",{icon:5,time:500},function() {
layer.msg("没有该物品,请确认输入是否正确", {icon: 5, time: 500}, function () {
materialId.value = "";
codeValue.value = "";
materialName.value = "";
@ -1295,6 +1349,16 @@
barCode.empty();
}
}
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = material.depositoryList;
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
form.render();
}
materialName.value = material.mname;
materialId.value = material.id;
codeValue.value = material.code;
@ -1325,7 +1389,7 @@
var req = {};
req.qrCode = result;
req.codeFlag = 1;
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/qywxApplicationOutScanBarCode",
type: "post",
@ -1366,6 +1430,15 @@
for (let i = 0; i < unitList.length; i++) {
$("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit));
}
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = data.depositoryList;
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
} else {
@ -1403,7 +1476,7 @@
var req = {};
req.qrCode = result;
req.codeFlag = 2;
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/qywxApplicationOutScanQrCode",
type: "post",
@ -1478,6 +1551,15 @@
$.each(data.splitInfoList, function (index, item) {
$("#unit" + idNumber).append(new Option(item.newUnit, item.newUnit));
});
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = data.depositoryList;
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
materialName.value = data.mname;
materialId.value = data.id;
@ -1507,6 +1589,9 @@
req.quantity = val;
req.unit = unit;
req.placeId = -1;
if (depositoryDisplay !== "none") {
req.depositoryId = $("#showDepository" + id).val();
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",
@ -1518,12 +1603,14 @@
var flag = res.data;
if (!flag) { // 如果当前数目不合适
layer.msg("当前单个仓库中物料数量不足", {icon: 0, time: 500}, function () {
$("#quantity" + id).val("");
layer.close(loading2);
});
layer.close(loading2);
$("#quantity" + id).val("");
},
);
} else {
layer.close(loading2);
layer.close(loading2)
}
}
});
}
@ -1544,7 +1631,7 @@
var req = {};
req.gid = gid;
req.quantity = val;
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/group/groupQuantityIsTrue",
type: "post",
@ -1563,7 +1650,7 @@
$("#quantityForGroup" + id).val("");
});
}else{
} else {
layer.close(loading2);
}
}
@ -1573,10 +1660,22 @@
};
form.on('select()', function (data) {
let unit = data.value;
let id = data.elem.id;
let idNum = id.split("unit")[1];
let mcode = $("#code" + idNum).val();
let unit = "";
let mcode = "";
let depositoryId = "-1";
if (id.indexOf('unit') !== -1) {
unit = data.value;
} else {
// 获取当前选中的仓库id
depositoryId = data.value;
idNum = id.split('showDepository')[1];
unit = $("#unit" + idNum).val();
}
mcode = $("#code" + idNum).val();
if (mcode === "" || mcode === undefined || mcode === null) {
layer.msg("请输入物料的正确编码!", {icon: 0, time: 500}, function () {
$("#quantity" + idNum).val("")
@ -1589,6 +1688,9 @@
req.quantity = val;
req.unit = unit;
req.placeId = -1;
if (depositoryId !== "-1") {
req.depositoryId = depositoryId;
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",
@ -1613,10 +1715,8 @@
}
}
});
$('body').on('click', '[data-refresh]', function () {
location.reload();
})
})

31
src/main/resources/templates/pages/applicationForStorageCenter/application-out.html

@ -978,7 +978,7 @@
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = d.depositoryList;
if(depositoryList !== null) {
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
@ -1142,8 +1142,7 @@
$("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素
});
form.render();
}
else {
} else {
var barCode = $("#barCode" + idNumber);
if (barCode.length > 0) {
barCode.empty();
@ -1152,7 +1151,7 @@
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = material.depositoryList;
if(depositoryList !== null) {
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
@ -1436,8 +1435,7 @@
$("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素
});
form.render();
}
else {
} else {
var barCode = $("#barCode" + idNumber);
if (barCode.length > 0) {
barCode.empty();
@ -1449,12 +1447,12 @@
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = material.depositoryList;
if(depositoryList !== null){
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
form.render();
}
layer.close(loading2);
}
@ -1527,7 +1525,7 @@
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = data.depositoryList;
if(depositoryList !== null) {
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
@ -1648,20 +1646,20 @@
$.each(data.splitInfoList, function (index, item) {
$("#unit" + idNumber).append(new Option(item.newUnit, item.newUnit));
});
form.render();
materialName.value = data.mname;
materialId.value = data.id;
materialCode.value = data.code;
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = data.depositoryList;
if(depositoryList !== null) {
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
form.render();
}
}
form.render();
materialName.value = data.mname;
materialId.value = data.id;
materialCode.value = data.code;
layer.close(loading2);
}
}
@ -1687,6 +1685,9 @@
req.quantity = val;
req.unit = unit;
req.placeId = -1;
if (depositoryDisplay !== "none") {
req.depositoryId = $("#showDepository" + id).val();
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",

94
src/main/resources/templates/pages/applicationForStorageCenter/application-out_back.html

@ -139,6 +139,17 @@
</select>
</div>
</div>
<div class="layui-form-item" id="depositoryId"
th:style="'display:'+${display}">
<label class="layui-form-label">仓库:</label>
<div class="layui-input-block">
<select name="depositoryId" id="showDepository">
<option th:each="depository,iterStar:${materialById.getDepositoryList()}"
th:value="${depository?.getId()}"
th:text="${depository?.getDname()}"></option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">项目:</label>
<div class="layui-input-block">
@ -211,6 +222,7 @@
step = layui.step;
var temp = {};
temp.mid = $("#mid").val();
let depositoryDisplay = $("#depositoryId").css("display");
$("#code").blur(function () {
@ -244,6 +256,15 @@
});
$("#mname").val(d.mname);
$("#mid").val(d.id);
if (depositoryDisplay !== "none") {
$("#showDepository").empty();
let depositoryList = d.depositoryList;
if(depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository").append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
}
@ -292,6 +313,16 @@
$.each(material.splitInfoList, function (index, item) {
$("#unit").append(new Option(item.newUnit, item.newUnit));
});
if (depositoryDisplay !== "none") {
$("#showDepository" ).empty();
let depositoryList = material.depositoryList;
if(depositoryList !== null){
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" ).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
}
@ -356,12 +387,22 @@
if (code === undefined) {
code = "";
}
let material = d.data.materialById;
$("#code").val(code);
$("#unit").empty();
$("#unit").append(new Option(d.data.materialById.baseUnit, "-1"));
$.each(d.data.materialById.splitInfoList, function (index, item) {
$("#unit").append(new Option(material.baseUnit, "-1"));
$.each(material.splitInfoList, function (index, item) {
$("#unit").append(new Option(item.newUnit, item.newUnit));
});
if (depositoryDisplay !== "none") {
$("#showDepository").empty();
let depositoryList = material.depositoryList;
if(depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository").append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
@ -436,6 +477,7 @@
step.next('#stepForm');
});
//用于判断当前物料数量是否合适
MaterialQuantityIsTrue = function (obj) {
var mcode = $("#code").val(); // 获取到当前输入的物料编码
@ -452,7 +494,10 @@
req.quantity = val;
req.unit = unit;
req.placeId = -1;
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
if (depositoryDisplay !== "none") {
req.depositoryId = $("#showDepository").val();
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",
type: "post",
@ -462,36 +507,52 @@
success: function (res) {
var flag = res.data;
if (!flag) { // 如果当前数目不合适
layer.msg("当前单仓库中物料数量不足", {icon: 0, time: 500}, function () {
$("#quantity").val("");
layer.close(loading2);
});
}else{
layer.close(loading2);
layer.msg("当前单仓库中物料数量不足", {icon: 0, time: 500}, function () {
layer.close(loading2);
$("#quantity").val("");
},
);
} else {
layer.close(loading2)
}
}
});
}
}
};
form.on('select()', function (data) {
let unit = data.value;
let id = data.elem.id;
let mcode = $("#code").val();
let unit = "";
let mcode = "";
let depositoryId = "-1";
if (id.indexOf('unit') !== -1) {
unit = data.value;
} else {
// 获取当前选中的仓库id
depositoryId = data.value;
unit = $("#unit").val();
}
mcode = $("#code" ).val();
if (mcode === "" || mcode === undefined || mcode === null) {
layer.msg("请输入物料的正确编码!", {icon: 0, time: 500}, function () {
$("#quantity" ).val("")
});
} else {
let val = $("#quantity").val();
let val = $("#quantity" ).val();
if (val !== null && val !== undefined && val !== '') {
var req = {};
req.mcode = mcode;
req.quantity = val;
req.unit = unit;
req.placeId = -1;
if (depositoryId !== "-1") {
req.depositoryId = depositoryId;
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",
@ -504,7 +565,7 @@
if (!flag) { // 如果当前数目不合适
layer.msg("当前单个仓库中物料数量不足", {icon: 0, time: 500}, function () {
layer.close(loading2);
$("#quantity").val("");
$("#quantity" ).val("");
},
);
} else {
@ -516,6 +577,7 @@
}
}
});
@ -563,10 +625,6 @@
});
};
$('body').on('click', '[data-refresh]', function () {
location.reload();
})
})
</script>
</body>

159
src/main/resources/templates/pages/applicationForStorageCenter/application-out_temporaryValue.html

@ -38,7 +38,7 @@
<div class="layuimini-container">
<div class="layuimini-main">
<input th:value="${display}" id="display" style="display: none">
<div class="layui-fluid">
<!-- 出库申请-->
<div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto;">
@ -168,6 +168,9 @@
form = layui.form,
step = layui.step;
let depositoryDisplay = $("#display").val();
// 用于分步表单加载
step.render({
elem: '#stepForm',
@ -213,6 +216,19 @@
let item = '<option value="' + obj.splitInfoList[i].newUnit + '">' + obj.splitInfoList[i].newUnit + '</option>'
splitInfoList += item;
}
let depositoryList = '';
if (depositoryDisplay !== "none") {
depositoryList = `<div class="layui-form-item" id=` + "depositoryId" + NewIdNumber + `>
<label class="layui-form-label">仓库:</label>
<div class="layui-input-block">
<select id=` + "showDepository" + NewIdNumber + ` name=` + "depositoryId" + NewIdNumber + `>`;
for (let i = 0; i < obj.depositoryList.length; i++) {
let item = '<option value="' + obj.depositoryList[i].id + '">' + obj.depositoryList[i].dname + '</option>';
depositoryList += item;
}
depositoryList += `</select></div></div>`
}
var firstItem = `
<div class="layui-card-body" id=` + "cardItem" + NewIdNumber + `>
<hr>
@ -225,7 +241,7 @@
id="openSonByMaterial" lay-verify="required" onblur="selectMaterialByName(this)"/>
<i class="layui-icon layui-icon-search" style="display: inline" id="selectMaterial" onclick="selectMaterial(this)"></i>
</div>
<input type="text" name=` + "mid" + NewIdNumber + ` class="layui-input" id=` + "mid" + NewIdNumber +` value="${obj.id}"
<input type="text" name=` + "mid" + NewIdNumber + ` class="layui-input" id=` + "mid" + NewIdNumber + ` value="${obj.id}"
style="display: none" lay-verify="required" />
</div>
</div>
@ -268,13 +284,14 @@
</div>
<div class="layui-form-item">
<label class="layui-form-label">计量单位:</label>
<div class="layui-input-block">
<div class="layui-input-block">
<select id=` + "unit" + NewIdNumber + ` name=` + "unit" + NewIdNumber + `>
<option value="-1">${obj.unit}</option>` +
splitInfoList +
`</select>
</div>
</div>
</div>` +
depositoryList + `
<div class="layui-form-item">
<label class="layui-form-label">项目:</label>
<div class="layui-input-block">
@ -377,7 +394,7 @@
addItem = function (obj) {
// 获取父元素id
var parentId = obj.parentNode.id;
if(NewIdNumber === ""){
if (NewIdNumber === "") {
NewIdNumber = 0;
}
NewIdNumber = NewIdNumber + 1;
@ -437,6 +454,14 @@
<div class="layui-input-block">
<select id=` + "unit" + NewIdNumber + ` name=` + "unit" + NewIdNumber + `>
</select>
</div>
</div>
<div class="layui-form-item" id=` + "depositoryId" + NewIdNumber + ` style="display:` + depositoryDisplay + `" >
<label class="layui-form-label">仓库:</label>
<div class="layui-input-block">
<select id=` + "showDepository" + NewIdNumber + ` name=` + "depositoryId" + NewIdNumber + `>
</select>
</div>
</div>
@ -453,6 +478,12 @@
var height = parseInt(($("#stepForm").css('height')).split("px")[0]);
params.push(NewIdNumber);
$("#stepForm").css("height", height + 387 + 'px');
if (depositoryDisplay === "none") {
$("#stepForm").css("height", height + 387 + 'px');
} else {
$("#stepForm").css("height", height + 435 + 'px');
}
$("#" + parentId).after(materialItem);
};
@ -465,18 +496,23 @@
// 获取祖父节点
var reparent = parent.parentNode;
var height = parseInt(($("#stepForm").css('height')).split("px")[0]);
$("#stepForm").css("height", height - 387 + 'px');
if (depositoryDisplay === "none") {
$("#stepForm").css("height", height - 387 + 'px');
} else {
$("#stepForm").css("height", height + 435 + 'px');
}
params = remove(params, parentId);
reparent.removeChild(parent);
// 当前节点的id值
let value = parent.childNodes[5].childNodes[3].childNodes[3].value;
$.ajax({
url: "/material/delTemporaryValue",
type: 'post',
data:JSON.stringify({"id":value,"type":"Out"}),
dataType: 'json',
contentType: "application/json;charset=utf-8"
})
let value = parent.childNodes[5].childNodes[3].childNodes[3].value;
$.ajax({
url: "/material/delTemporaryValue",
type: 'post',
data: JSON.stringify({"id": value, "type": "Out"}),
dataType: 'json',
contentType: "application/json;charset=utf-8"
})
};
@ -570,6 +606,17 @@
barCode.empty();
}
}
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = d.depositoryList;
if(depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
form.render();
}
layer.close(loading2);
}
}
@ -667,6 +714,15 @@
barCode.empty();
}
}
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = material.depositoryList;
if(depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
}
@ -762,6 +818,16 @@
materialName.value = material.mname;
materialId.value = material.id;
codeValue.value = material.code;
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = material.depositoryList;
if(depositoryList !== null){
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
form.render();
}
layer.close(loading2);
}
}
@ -830,6 +896,15 @@
for (let i = 0; i < unitList.length; i++) {
$("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit));
}
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = data.depositoryList;
if(depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
} else {
@ -944,10 +1019,20 @@
$.each(data.splitInfoList, function (index, item) {
$("#unit" + idNumber).append(new Option(item.newUnit, item.newUnit));
});
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = data.depositoryList;
if(depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
materialName.value = data.mname;
materialId.value = data.id;
materialCode.value = data.code;
layer.close(loading2);
}
}
@ -973,6 +1058,9 @@
req.quantity = val;
req.unit = unit;
req.placeId = -1;
if (depositoryDisplay !== "none") {
req.depositoryId = $("#showDepository" + id).val();
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",
@ -1039,29 +1127,29 @@
content.css('height', '100%');
iframeChildren.css('height', '100%');
},
end:function () {
let val = $("#"+id).val();
if(val !== ""){
if(id.indexOf("ForGroup") !== -1){
end: function () {
let val = $("#" + id).val();
if (val !== "") {
if (id.indexOf("ForGroup") !== -1) {
// 如果是组合
$("#stepForm2").find('input[id*="project"]').each(function () {
$(this).attr("lay-verify","required")
$(this).attr("lay-verify", "required")
})
}else{
} else {
// 如果是物料
$("#stepForm").find('input[id*="project"]').each(function () {
$(this).attr("lay-verify","required")
$(this).attr("lay-verify", "required")
})
}
}else{
if(id.indexOf("ForGroup") !== -1){
} else {
if (id.indexOf("ForGroup") !== -1) {
// 如果是组合
$("#stepForm2").find('input[id*="project"]').each(function () {
$(this).removeAttr("lay-verify")
})
}else{
} else {
// 如果是物料
$("#stepForm").find('input[id*="project"]').each(function () {
$(this).removeAttr("lay-verify")
@ -1073,10 +1161,22 @@
};
form.on('select()', function (data) {
let unit = data.value;
let id = data.elem.id;
let idNum = id.split("unit")[1];
let mcode = $("#code" + idNum).val();
let unit = "";
let mcode = "";
let depositoryId = "-1";
if (id.indexOf('unit') !== -1) {
unit = data.value;
} else {
// 获取当前选中的仓库id
depositoryId = data.value;
idNum = id.split('showDepository')[1];
unit = $("#unit" + idNum).val();
}
mcode = $("#code" + idNum).val();
if (mcode === "" || mcode === undefined || mcode === null) {
layer.msg("请输入物料的正确编码!", {icon: 0, time: 500}, function () {
$("#quantity" + idNum).val("")
@ -1089,6 +1189,9 @@
req.quantity = val;
req.unit = unit;
req.placeId = -1;
if (depositoryId !== "-1") {
req.depositoryId = depositoryId;
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",
@ -1113,11 +1216,9 @@
}
}
});
$('body').on('click', '[data-refresh]', function () {
location.reload();
})
})
</script>

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

@ -2,10 +2,14 @@ package com.dreamchaser.depository_manage;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.PortConfig;
import com.dreamchaser.depository_manage.config.QyWxConfig;
import com.dreamchaser.depository_manage.entity.Depository;
import com.dreamchaser.depository_manage.entity.UserByPort;
import com.dreamchaser.depository_manage.entity.qywxDepartment;
import com.dreamchaser.depository_manage.mapper.DepositoryMapper;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@ -19,15 +23,9 @@ import java.util.concurrent.*;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class OtherTest {
@Autowired
DepositoryMapper depositoryMapper;
@Test
public void Test(){
UserByPort userByPort = LinkInterfaceUtil.FindUserById(78, null);
JSONArray orgAndPostThree = LinkInterfaceUtil.getOrgAndPostThree(userByPort);
System.out.println(JSONObject.toJSONString(orgAndPostThree).replace("name","title").replace("child","children"));
}

17
target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml

@ -24,8 +24,8 @@
<resultMap id="simpleApplicationInRecordMap"
type="com.dreamchaser.depository_manage.entity.SimpleApplicationInRecord">
<id property="id" column="airid" jdbcType="INTEGER"/>
<result column="applicantId" property="applicant_id" jdbcType="INTEGER"/>
<result column="applicantTime" property="applicant_time" jdbcType="INTEGER"/>
<result column="applicantId" property="applicantId" jdbcType="INTEGER"/>
<result column="applicantTime" property="applicantTime" jdbcType="INTEGER"/>
<result column="applyRemark" property="applyRemark" jdbcType="VARCHAR"/>
</resultMap>
<!-- 字段映射 -->
@ -121,6 +121,7 @@
<result column="aorconstructionunitid" property="constructionUnitId" jdbcType="INTEGER"/>
<result column="aoradminorgid" property="adminorgId" jdbcType="INTEGER"/>
<result column="outTime" property="outTime" jdbcType="INTEGER"/>
<result column="flagForOpenDepository" property="flagForOpenDepository" jdbcType="INTEGER"/>
<result column="editUser" property="editUser" jdbcType="VARCHAR"/>
<result column="mbrand" property="mbrand" jdbcType="VARCHAR"/>
</resultMap>
@ -176,7 +177,7 @@
<sql id="ApplicationOutRecordInfo">
aorid,mid,mname,depositoryId,dname,applicantId,applicantTime,applyRemark,aorcode,aorpirce,aorquantity,departmenthead,departmentheadPass,departmentHeadTime,departmentheadMessage,
depositoryManager,depositoryManagerPass,depositoryManagerTime,depositoryManagerMessage,aorstate,istransfer,mcode,placeId,pass,aormUnit,aorconstructionunitid,aoradminorgid,cuname,
cuintroduce,cuaddress,outTime,abstract,outType,editUser,mbrand,mversion
cuintroduce,cuaddress,outTime,abstract,outType,editUser,mbrand,mversion,flagForOpenDepository
</sql>
<sql id="ApplicationOutRecordMinInfo">
@ -1025,13 +1026,16 @@
<!-- 插入一条出库记录-->
<insert id="insertApplicationOutRecord" parameterType="map" useGeneratedKeys="true" keyProperty="id">
insert into application_out_record
(id,applicant_id,applicant_time,code,price,quantity,departmenthead,departmenthead_pass,departmenthead_time,
departmenthead_messgae,depository_manager,depository_manager_pass,depository_manager_time,depository_manager_message,apply_remark,state,istransfer,placeId,pass,constructionunitid,adminorgid,outType,abstract)
(id,applicant_id,applicant_time,code,depository_id,price,quantity,departmenthead,departmenthead_pass,departmenthead_time,
departmenthead_messgae,depository_manager,depository_manager_pass,depository_manager_time,
depository_manager_message,apply_remark,state,istransfer,placeId,pass,constructionunitid,
adminorgid,outType,abstract,flagForOpenDepository)
values(
#{id},
#{applicantId},
#{applicantTime},
#{code},
#{depositoryId},
#{price},
#{quantity},
#{departmenthead},
@ -1071,7 +1075,8 @@
#{constructionUnitId},
#{adminorgId},
#{outType},
#{abstract}
#{abstract},
#{flagForOpenDepository}
)
</insert>

11
target/classes/com/dreamchaser/depository_manage/mapper/RoleMapper.xml

@ -313,10 +313,13 @@
<if test="uid != null and uid != ''">
and uid = #{uid}
</if>
and did in
<foreach collection="depositoryIdList" index="index" item="did" open="(" separator="," close=")">
#{did}
</foreach>
<if test="depositoryIdList != null and depositoryIdList != ''">
and did in
<foreach collection="depositoryIdList" index="index" item="did" open="(" separator="," close=")">
#{did}
</foreach>
</if>
</delete>

164
target/classes/templates/pages/application/application-out.html

@ -128,6 +128,15 @@
</select>
</div>
</div>
<div class="layui-form-item" id="depositoryId"
th:style="'display:'+${display}">
<label class="layui-form-label">仓库:</label>
<div class="layui-input-block">
<select name="depositoryId" id="showDepository">
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">备注说明:</label>
<div class="layui-input-block">
@ -341,8 +350,8 @@
var params = [];
// 用于标志当前表单是否第一次提交
let flagForForm = false;
let GroupflagForForm = false;
let flagForForm = false;
let GroupflagForForm = false;
// 用于暂存卡片个数(组合)
var params2 = [];
@ -355,6 +364,9 @@
step = layui.step;
let depositoryDisplay = $("#depositoryId").css("display");
// 用于分步表单加载
step.render({
elem: '#stepForm',
@ -382,7 +394,7 @@
// 提交(物料出库)
form.on('submit(formStep)', function (data) {
if(!flagForForm){
if (!flagForForm) {
flagForForm = true;
data = data.field;
data.params = params;
@ -408,6 +420,7 @@
}
data.params = remove(data.params, Number(keyNumber));
}
$.ajax({
url: "/depositoryRecord/applicationOut",
type: 'post',
@ -420,7 +433,7 @@
success: function (data) {
layer.close(this.layerIndex);
if (data.status >= 300) {
layer.msg(data.statusInfo.message,{icon:0,time:500},function () {
layer.msg(data.statusInfo.message, {icon: 0, time: 500}, function () {
flagForForm = false;
});//失败的表情
@ -445,7 +458,7 @@
// 提交(组合出库)
form.on('submit(formStep2)', function (data) {
if(!GroupflagForForm){
if (!GroupflagForForm) {
GroupflagForForm = true;
data = data.field;
data.params = params2;
@ -484,7 +497,7 @@
success: function (d) {
layer.close(this.layerIndex);
if (d.status >= 300) {
layer.msg(data.statusInfo.message,{icon:0,time:500},function () {
layer.msg(data.statusInfo.message, {icon: 0, time: 500}, function () {
flagForForm = false;
});//失败的表情
@ -577,6 +590,15 @@
<div class="layui-input-block">
<select id=` + "unit" + NewIdNumber + ` name=` + "unit" + NewIdNumber + `>
</select>
</div>
</div>
<div class="layui-form-item" id=` + "depositoryId" + NewIdNumber + `
style="display:` + depositoryDisplay + `">
<label class="layui-form-label">仓库:</label>
<div class="layui-input-block">
<select name=` + "depositoryId" + NewIdNumber + ` id=` + "showDepository" + NewIdNumber + `>
</select>
</div>
</div>
@ -592,7 +614,14 @@
// 获取当前高度
var height = parseInt(($("#stepForm").css('height')).split("px")[0]);
params.push(NewIdNumber);
$("#stepForm").css("height", height + 422 + 'px');
if (depositoryDisplay === "none") {
$("#stepForm").css("height", height + 422 + 'px');
} else {
$("#stepForm").css("height", height + 435 + 'px');
}
$("#" + parentId).after(materialItem);
};
@ -734,7 +763,13 @@
// 获取祖父节点
var reparent = parent.parentNode;
var height = parseInt(($("#stepForm").css('height')).split("px")[0]);
$("#stepForm").css("height", height - 422 + 'px');
if (depositoryDisplay === "none") {
$("#stepForm").css("height", height - 422 + 'px');
} else {
$("#stepForm").css("height", height - 435 + 'px');
}
params = remove(params, parentId);
reparent.removeChild(parent);
};
@ -784,7 +819,7 @@
req.code = code;
req.type = "out";
if (code !== "") {
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/findMatrialByCode",
type: "get",
@ -794,7 +829,7 @@
success: function (d) {
var d = d.data;
if (d == null) {
layer.msg("仓库中暂无该物料",{icon:5,time:500},function () {
layer.msg("仓库中暂无该物料", {icon: 5, time: 500}, function () {
materialName.value = "";
materialId.value = "";
obj.value = "";
@ -815,7 +850,7 @@
for (let i = 0; i < unitList.length; i++) {
$("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit));
}
form.render();
if (materialAndBarCodeList.length > 0) {
// 如果有对应的条形码
var barCodeInput = barCodeItem.childNodes[1].childNodes[1];
@ -845,6 +880,16 @@
}
layer.close(loading2)
}
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = d.depositoryList;
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
}
}
});
@ -870,7 +915,7 @@
let req = {};
req.code = code;
if (code !== "") {
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/group/findGroupByCode",
type: "post",
@ -959,7 +1004,7 @@
var mid = materialId.value;
if (mid !== '') {
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/findMatrialById?mid=" + mid + "&type=out",
type: "get",
@ -1009,8 +1054,17 @@
barCode.empty();
}
}
layer.close(loading2);
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = material.depositoryList;
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
}
});
}
@ -1061,7 +1115,7 @@
end: function () {
let gid = gidItem.value;
if (gid !== '') {
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let req = {};
req.gid = gid;
$.ajax({
@ -1131,7 +1185,7 @@
if (gname !== '') {
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
var req = {};
req.gname = gname;
$.ajax({
@ -1231,7 +1285,7 @@
data = data.split(",")[0];
if (data !== "") {
req.mname = data;
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/findInventoryByCondition",
type: "post",
@ -1240,14 +1294,14 @@
contentType: "application/json;charset=utf-8",
success: function (d) {
if (d.count > 1) {
layer.msg("请点击右侧搜索确定物品",{icon:0,time:500},function () {
layer.msg("请点击右侧搜索确定物品", {icon: 0, time: 500}, function () {
layer.close(loading2);
materialId.value = "";
codeValue.value = "";
});
return false;
} else if (d.count === 0) {
layer.msg("没有该物品,请确认输入是否正确",{icon:5,time:500},function() {
layer.msg("没有该物品,请确认输入是否正确", {icon: 5, time: 500}, function () {
materialId.value = "";
codeValue.value = "";
materialName.value = "";
@ -1295,6 +1349,16 @@
barCode.empty();
}
}
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = material.depositoryList;
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
form.render();
}
materialName.value = material.mname;
materialId.value = material.id;
codeValue.value = material.code;
@ -1325,7 +1389,7 @@
var req = {};
req.qrCode = result;
req.codeFlag = 1;
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/qywxApplicationOutScanBarCode",
type: "post",
@ -1366,6 +1430,15 @@
for (let i = 0; i < unitList.length; i++) {
$("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit));
}
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = data.depositoryList;
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
} else {
@ -1403,7 +1476,7 @@
var req = {};
req.qrCode = result;
req.codeFlag = 2;
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/qywxApplicationOutScanQrCode",
type: "post",
@ -1478,6 +1551,15 @@
$.each(data.splitInfoList, function (index, item) {
$("#unit" + idNumber).append(new Option(item.newUnit, item.newUnit));
});
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = data.depositoryList;
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
materialName.value = data.mname;
materialId.value = data.id;
@ -1507,6 +1589,9 @@
req.quantity = val;
req.unit = unit;
req.placeId = -1;
if (depositoryDisplay !== "none") {
req.depositoryId = $("#showDepository" + id).val();
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",
@ -1518,12 +1603,14 @@
var flag = res.data;
if (!flag) { // 如果当前数目不合适
layer.msg("当前单个仓库中物料数量不足", {icon: 0, time: 500}, function () {
$("#quantity" + id).val("");
layer.close(loading2);
});
layer.close(loading2);
$("#quantity" + id).val("");
},
);
} else {
layer.close(loading2);
layer.close(loading2)
}
}
});
}
@ -1544,7 +1631,7 @@
var req = {};
req.gid = gid;
req.quantity = val;
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/group/groupQuantityIsTrue",
type: "post",
@ -1563,7 +1650,7 @@
$("#quantityForGroup" + id).val("");
});
}else{
} else {
layer.close(loading2);
}
}
@ -1573,10 +1660,22 @@
};
form.on('select()', function (data) {
let unit = data.value;
let id = data.elem.id;
let idNum = id.split("unit")[1];
let mcode = $("#code" + idNum).val();
let unit = "";
let mcode = "";
let depositoryId = "-1";
if (id.indexOf('unit') !== -1) {
unit = data.value;
} else {
// 获取当前选中的仓库id
depositoryId = data.value;
idNum = id.split('showDepository')[1];
unit = $("#unit" + idNum).val();
}
mcode = $("#code" + idNum).val();
if (mcode === "" || mcode === undefined || mcode === null) {
layer.msg("请输入物料的正确编码!", {icon: 0, time: 500}, function () {
$("#quantity" + idNum).val("")
@ -1589,6 +1688,9 @@
req.quantity = val;
req.unit = unit;
req.placeId = -1;
if (depositoryId !== "-1") {
req.depositoryId = depositoryId;
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",
@ -1613,10 +1715,8 @@
}
}
});
$('body').on('click', '[data-refresh]', function () {
location.reload();
})
})

103
target/classes/templates/pages/applicationForStorageCenter/application-out.html

@ -978,7 +978,7 @@
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = d.depositoryList;
if(depositoryList !== null) {
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
@ -1142,8 +1142,7 @@
$("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素
});
form.render();
}
else {
} else {
var barCode = $("#barCode" + idNumber);
if (barCode.length > 0) {
barCode.empty();
@ -1152,7 +1151,7 @@
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = material.depositoryList;
if(depositoryList !== null) {
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
@ -1436,8 +1435,7 @@
$("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素
});
form.render();
}
else {
} else {
var barCode = $("#barCode" + idNumber);
if (barCode.length > 0) {
barCode.empty();
@ -1449,12 +1447,12 @@
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = material.depositoryList;
if(depositoryList !== null){
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
form.render();
}
layer.close(loading2);
}
@ -1473,75 +1471,7 @@
} else {
wxScan = wxScan.wx;
}
var result = "1646432177297334272";//当needResult为1时返回处理结果
var req = {};
req.qrCode = result;
req.codeFlag = 1;
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/qywxApplicationOutScanBarCode",
type: "post",
dataType: 'json',
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: function (d) {
// 获取对应元素
var parent = obj.parentNode.parentNode.parentNode.parentNode;
var MaterialChildren = parent.childNodes[5];
var materialItem = MaterialChildren.childNodes[3].childNodes[1].childNodes;
var barCodeChildren = parent.childNodes[9];
var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3];
// 条形码条码
var barCodeItem = barCodeChildren.childNodes[3];
// 物料编码
var materialCodeItem = parent.childNodes[7].childNodes[3].childNodes[1].childNodes;
var materialCode = materialCodeItem[1];
var data = d.data;
if (data !== null) {
materialName.value = data.mname;
materialId.value = data.iid;
materialCode.value = data.mcode;
var barCodeInput = barCodeItem.childNodes[1].childNodes[1];
barCodeInput.value = result;
var idNumber = materialId.name.split("mid")[1];
var unit = $("#unit" + idNumber);
unit.empty();
$("#unit" + idNumber).append(new Option(data.unit, "-1"));
var unitList = data["splitInfoList"];
for (let i = 0; i < unitList.length; i++) {
$("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit));
}
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = data.depositoryList;
if(depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
} else {
// 如果没有对应关系
layer.msg("对于编码:" + result + ",并未发现仓库中存在对应的物料", {
icon: 0,
time: 1000 //0.5秒关闭(如果不配置,默认是3秒)
}, function () {
layer.close(loading2);
})
}
}
})
/* wxScan.scanQRCode({
wxScan.scanQRCode({
desc: 'scanQRCode desc',
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ["barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
@ -1595,7 +1525,7 @@
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = data.depositoryList;
if(depositoryList !== null) {
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
@ -1616,7 +1546,7 @@
}
})
}
})*/
})
};
@ -1716,20 +1646,20 @@
$.each(data.splitInfoList, function (index, item) {
$("#unit" + idNumber).append(new Option(item.newUnit, item.newUnit));
});
form.render();
materialName.value = data.mname;
materialId.value = data.id;
materialCode.value = data.code;
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = data.depositoryList;
if(depositoryList !== null) {
if (depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
form.render();
}
}
form.render();
materialName.value = data.mname;
materialId.value = data.id;
materialCode.value = data.code;
layer.close(loading2);
}
}
@ -1755,6 +1685,9 @@
req.quantity = val;
req.unit = unit;
req.placeId = -1;
if (depositoryDisplay !== "none") {
req.depositoryId = $("#showDepository" + id).val();
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",

94
target/classes/templates/pages/applicationForStorageCenter/application-out_back.html

@ -139,6 +139,17 @@
</select>
</div>
</div>
<div class="layui-form-item" id="depositoryId"
th:style="'display:'+${display}">
<label class="layui-form-label">仓库:</label>
<div class="layui-input-block">
<select name="depositoryId" id="showDepository">
<option th:each="depository,iterStar:${materialById.getDepositoryList()}"
th:value="${depository?.getId()}"
th:text="${depository?.getDname()}"></option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">项目:</label>
<div class="layui-input-block">
@ -211,6 +222,7 @@
step = layui.step;
var temp = {};
temp.mid = $("#mid").val();
let depositoryDisplay = $("#depositoryId").css("display");
$("#code").blur(function () {
@ -244,6 +256,15 @@
});
$("#mname").val(d.mname);
$("#mid").val(d.id);
if (depositoryDisplay !== "none") {
$("#showDepository").empty();
let depositoryList = d.depositoryList;
if(depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository").append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
}
@ -292,6 +313,16 @@
$.each(material.splitInfoList, function (index, item) {
$("#unit").append(new Option(item.newUnit, item.newUnit));
});
if (depositoryDisplay !== "none") {
$("#showDepository" ).empty();
let depositoryList = material.depositoryList;
if(depositoryList !== null){
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" ).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
}
@ -356,12 +387,22 @@
if (code === undefined) {
code = "";
}
let material = d.data.materialById;
$("#code").val(code);
$("#unit").empty();
$("#unit").append(new Option(d.data.materialById.baseUnit, "-1"));
$.each(d.data.materialById.splitInfoList, function (index, item) {
$("#unit").append(new Option(material.baseUnit, "-1"));
$.each(material.splitInfoList, function (index, item) {
$("#unit").append(new Option(item.newUnit, item.newUnit));
});
if (depositoryDisplay !== "none") {
$("#showDepository").empty();
let depositoryList = material.depositoryList;
if(depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository").append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
@ -436,6 +477,7 @@
step.next('#stepForm');
});
//用于判断当前物料数量是否合适
MaterialQuantityIsTrue = function (obj) {
var mcode = $("#code").val(); // 获取到当前输入的物料编码
@ -452,7 +494,10 @@
req.quantity = val;
req.unit = unit;
req.placeId = -1;
let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
if (depositoryDisplay !== "none") {
req.depositoryId = $("#showDepository").val();
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",
type: "post",
@ -462,36 +507,52 @@
success: function (res) {
var flag = res.data;
if (!flag) { // 如果当前数目不合适
layer.msg("当前单仓库中物料数量不足", {icon: 0, time: 500}, function () {
$("#quantity").val("");
layer.close(loading2);
});
}else{
layer.close(loading2);
layer.msg("当前单仓库中物料数量不足", {icon: 0, time: 500}, function () {
layer.close(loading2);
$("#quantity").val("");
},
);
} else {
layer.close(loading2)
}
}
});
}
}
};
form.on('select()', function (data) {
let unit = data.value;
let id = data.elem.id;
let mcode = $("#code").val();
let unit = "";
let mcode = "";
let depositoryId = "-1";
if (id.indexOf('unit') !== -1) {
unit = data.value;
} else {
// 获取当前选中的仓库id
depositoryId = data.value;
unit = $("#unit").val();
}
mcode = $("#code" ).val();
if (mcode === "" || mcode === undefined || mcode === null) {
layer.msg("请输入物料的正确编码!", {icon: 0, time: 500}, function () {
$("#quantity" ).val("")
});
} else {
let val = $("#quantity").val();
let val = $("#quantity" ).val();
if (val !== null && val !== undefined && val !== '') {
var req = {};
req.mcode = mcode;
req.quantity = val;
req.unit = unit;
req.placeId = -1;
if (depositoryId !== "-1") {
req.depositoryId = depositoryId;
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",
@ -504,7 +565,7 @@
if (!flag) { // 如果当前数目不合适
layer.msg("当前单个仓库中物料数量不足", {icon: 0, time: 500}, function () {
layer.close(loading2);
$("#quantity").val("");
$("#quantity" ).val("");
},
);
} else {
@ -516,6 +577,7 @@
}
}
});
@ -563,10 +625,6 @@
});
};
$('body').on('click', '[data-refresh]', function () {
location.reload();
})
})
</script>
</body>

159
target/classes/templates/pages/applicationForStorageCenter/application-out_temporaryValue.html

@ -38,7 +38,7 @@
<div class="layuimini-container">
<div class="layuimini-main">
<input th:value="${display}" id="display" style="display: none">
<div class="layui-fluid">
<!-- 出库申请-->
<div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto;">
@ -168,6 +168,9 @@
form = layui.form,
step = layui.step;
let depositoryDisplay = $("#display").val();
// 用于分步表单加载
step.render({
elem: '#stepForm',
@ -213,6 +216,19 @@
let item = '<option value="' + obj.splitInfoList[i].newUnit + '">' + obj.splitInfoList[i].newUnit + '</option>'
splitInfoList += item;
}
let depositoryList = '';
if (depositoryDisplay !== "none") {
depositoryList = `<div class="layui-form-item" id=` + "depositoryId" + NewIdNumber + `>
<label class="layui-form-label">仓库:</label>
<div class="layui-input-block">
<select id=` + "showDepository" + NewIdNumber + ` name=` + "depositoryId" + NewIdNumber + `>`;
for (let i = 0; i < obj.depositoryList.length; i++) {
let item = '<option value="' + obj.depositoryList[i].id + '">' + obj.depositoryList[i].dname + '</option>';
depositoryList += item;
}
depositoryList += `</select></div></div>`
}
var firstItem = `
<div class="layui-card-body" id=` + "cardItem" + NewIdNumber + `>
<hr>
@ -225,7 +241,7 @@
id="openSonByMaterial" lay-verify="required" onblur="selectMaterialByName(this)"/>
<i class="layui-icon layui-icon-search" style="display: inline" id="selectMaterial" onclick="selectMaterial(this)"></i>
</div>
<input type="text" name=` + "mid" + NewIdNumber + ` class="layui-input" id=` + "mid" + NewIdNumber +` value="${obj.id}"
<input type="text" name=` + "mid" + NewIdNumber + ` class="layui-input" id=` + "mid" + NewIdNumber + ` value="${obj.id}"
style="display: none" lay-verify="required" />
</div>
</div>
@ -268,13 +284,14 @@
</div>
<div class="layui-form-item">
<label class="layui-form-label">计量单位:</label>
<div class="layui-input-block">
<div class="layui-input-block">
<select id=` + "unit" + NewIdNumber + ` name=` + "unit" + NewIdNumber + `>
<option value="-1">${obj.unit}</option>` +
splitInfoList +
`</select>
</div>
</div>
</div>` +
depositoryList + `
<div class="layui-form-item">
<label class="layui-form-label">项目:</label>
<div class="layui-input-block">
@ -377,7 +394,7 @@
addItem = function (obj) {
// 获取父元素id
var parentId = obj.parentNode.id;
if(NewIdNumber === ""){
if (NewIdNumber === "") {
NewIdNumber = 0;
}
NewIdNumber = NewIdNumber + 1;
@ -437,6 +454,14 @@
<div class="layui-input-block">
<select id=` + "unit" + NewIdNumber + ` name=` + "unit" + NewIdNumber + `>
</select>
</div>
</div>
<div class="layui-form-item" id=` + "depositoryId" + NewIdNumber + ` style="display:` + depositoryDisplay + `" >
<label class="layui-form-label">仓库:</label>
<div class="layui-input-block">
<select id=` + "showDepository" + NewIdNumber + ` name=` + "depositoryId" + NewIdNumber + `>
</select>
</div>
</div>
@ -453,6 +478,12 @@
var height = parseInt(($("#stepForm").css('height')).split("px")[0]);
params.push(NewIdNumber);
$("#stepForm").css("height", height + 387 + 'px');
if (depositoryDisplay === "none") {
$("#stepForm").css("height", height + 387 + 'px');
} else {
$("#stepForm").css("height", height + 435 + 'px');
}
$("#" + parentId).after(materialItem);
};
@ -465,18 +496,23 @@
// 获取祖父节点
var reparent = parent.parentNode;
var height = parseInt(($("#stepForm").css('height')).split("px")[0]);
$("#stepForm").css("height", height - 387 + 'px');
if (depositoryDisplay === "none") {
$("#stepForm").css("height", height - 387 + 'px');
} else {
$("#stepForm").css("height", height + 435 + 'px');
}
params = remove(params, parentId);
reparent.removeChild(parent);
// 当前节点的id值
let value = parent.childNodes[5].childNodes[3].childNodes[3].value;
$.ajax({
url: "/material/delTemporaryValue",
type: 'post',
data:JSON.stringify({"id":value,"type":"Out"}),
dataType: 'json',
contentType: "application/json;charset=utf-8"
})
let value = parent.childNodes[5].childNodes[3].childNodes[3].value;
$.ajax({
url: "/material/delTemporaryValue",
type: 'post',
data: JSON.stringify({"id": value, "type": "Out"}),
dataType: 'json',
contentType: "application/json;charset=utf-8"
})
};
@ -570,6 +606,17 @@
barCode.empty();
}
}
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = d.depositoryList;
if(depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
form.render();
}
layer.close(loading2);
}
}
@ -667,6 +714,15 @@
barCode.empty();
}
}
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = material.depositoryList;
if(depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
}
@ -762,6 +818,16 @@
materialName.value = material.mname;
materialId.value = material.id;
codeValue.value = material.code;
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = material.depositoryList;
if(depositoryList !== null){
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
form.render();
}
layer.close(loading2);
}
}
@ -830,6 +896,15 @@
for (let i = 0; i < unitList.length; i++) {
$("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit));
}
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = data.depositoryList;
if(depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
layer.close(loading2);
} else {
@ -944,10 +1019,20 @@
$.each(data.splitInfoList, function (index, item) {
$("#unit" + idNumber).append(new Option(item.newUnit, item.newUnit));
});
if (depositoryDisplay !== "none") {
$("#showDepository" + idNumber).empty();
let depositoryList = data.depositoryList;
if(depositoryList !== null) {
for (let i = 0; i < depositoryList.length; i++) {
$("#showDepository" + idNumber).append(new Option(depositoryList[i].dname, depositoryList[i].id));
}
}
}
form.render();
materialName.value = data.mname;
materialId.value = data.id;
materialCode.value = data.code;
layer.close(loading2);
}
}
@ -973,6 +1058,9 @@
req.quantity = val;
req.unit = unit;
req.placeId = -1;
if (depositoryDisplay !== "none") {
req.depositoryId = $("#showDepository" + id).val();
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",
@ -1039,29 +1127,29 @@
content.css('height', '100%');
iframeChildren.css('height', '100%');
},
end:function () {
let val = $("#"+id).val();
if(val !== ""){
if(id.indexOf("ForGroup") !== -1){
end: function () {
let val = $("#" + id).val();
if (val !== "") {
if (id.indexOf("ForGroup") !== -1) {
// 如果是组合
$("#stepForm2").find('input[id*="project"]').each(function () {
$(this).attr("lay-verify","required")
$(this).attr("lay-verify", "required")
})
}else{
} else {
// 如果是物料
$("#stepForm").find('input[id*="project"]').each(function () {
$(this).attr("lay-verify","required")
$(this).attr("lay-verify", "required")
})
}
}else{
if(id.indexOf("ForGroup") !== -1){
} else {
if (id.indexOf("ForGroup") !== -1) {
// 如果是组合
$("#stepForm2").find('input[id*="project"]').each(function () {
$(this).removeAttr("lay-verify")
})
}else{
} else {
// 如果是物料
$("#stepForm").find('input[id*="project"]').each(function () {
$(this).removeAttr("lay-verify")
@ -1073,10 +1161,22 @@
};
form.on('select()', function (data) {
let unit = data.value;
let id = data.elem.id;
let idNum = id.split("unit")[1];
let mcode = $("#code" + idNum).val();
let unit = "";
let mcode = "";
let depositoryId = "-1";
if (id.indexOf('unit') !== -1) {
unit = data.value;
} else {
// 获取当前选中的仓库id
depositoryId = data.value;
idNum = id.split('showDepository')[1];
unit = $("#unit" + idNum).val();
}
mcode = $("#code" + idNum).val();
if (mcode === "" || mcode === undefined || mcode === null) {
layer.msg("请输入物料的正确编码!", {icon: 0, time: 500}, function () {
$("#quantity" + idNum).val("")
@ -1089,6 +1189,9 @@
req.quantity = val;
req.unit = unit;
req.placeId = -1;
if (depositoryId !== "-1") {
req.depositoryId = depositoryId;
}
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/MaterialQuantityIsTrue",
@ -1113,11 +1216,9 @@
}
}
});
$('body').on('click', '[data-refresh]', function () {
location.reload();
})
})
</script>

Loading…
Cancel
Save