Browse Source

修改库存导入功能

lwx_dev
erdanergou 3 years ago
parent
commit
61ff93ee23
  1. 1
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java
  2. 62
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  3. 11
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java
  4. 53
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  5. 6
      src/main/java/com/dreamchaser/depository_manage/controller/PlaceController.java
  6. 12
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  7. 2
      src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java
  8. 88
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  9. 64
      src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java
  10. 65
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  11. 4
      src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java
  12. 11
      src/main/resources/templates/pages/application/application-review.html
  13. 60
      src/main/resources/templates/pages/depository/table-in.html
  14. 27
      src/main/resources/templates/pages/depository/table-out.html
  15. 6
      src/main/resources/templates/pages/material/selectMaterial.html
  16. 4
      src/main/resources/templates/pages/scanQrCode/ScanQrCode.html
  17. 23
      src/main/resources/templates/pages/warehouse/warehouseByParentId.html
  18. 9
      src/test/java/com/dreamchaser/depository_manage/Test.java
  19. 12
      target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  20. 11
      target/classes/templates/pages/application/application-review.html
  21. 60
      target/classes/templates/pages/depository/table-in.html
  22. 27
      target/classes/templates/pages/depository/table-out.html
  23. 6
      target/classes/templates/pages/material/selectMaterial.html
  24. 4
      target/classes/templates/pages/scanQrCode/ScanQrCode.html
  25. 23
      target/classes/templates/pages/warehouse/warehouseByParentId.html

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

@ -1022,7 +1022,6 @@ public class DepositoryController {
parm.put("end", months.get(num)); parm.put("end", months.get(num));
parm.put("tname", materialTypeAll.get(j).getTname()); parm.put("tname", materialTypeAll.get(j).getTname());
//根据条件获取月份中物料的总额 //根据条件获取月份中物料的总额
Double materialCountByMonth = depositoryRecordService.findMaterialCountByMonth(parm);
// 测试 // 测试
Double materialCountByMonth1 = depositoryRecordService.findMaterialCountByMonth1(parm); Double materialCountByMonth1 = depositoryRecordService.findMaterialCountByMonth1(parm);
((Map<String, Object>) sourceList.get(num)).put(materialTypeAll.get(j).getTname(), materialCountByMonth1); ((Map<String, Object>) sourceList.get(num)).put(materialTypeAll.get(j).getTname(), materialCountByMonth1);

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

@ -102,11 +102,14 @@ public class DepositoryRecordController {
// isDone 为0为未完成,1为已完成 // isDone 为0为未完成,1为已完成
String isDone = (String) (map.get("isDone")); String isDone = (String) (map.get("isDone"));
UserByPort userToken= (UserByPort) request.getAttribute("userToken"); UserByPort userToken= (UserByPort) request.getAttribute("userToken");
// 获取当前用户下所有扫码出库订单 // 获取当前用户下所有未完成的扫码出库订单
String key = "user:"+userToken.getId().toString(); String key = "user:"+userToken.getId().toString();
String minRecord = (String) redisTemplateForHash.opsForHash().get(key, "minRecord"); String minRecord = (String) redisTemplateForHash.opsForHash().get(key, "minRecord");
if(minRecord == null){
if(minRecord == null && "0".equals(isDone)){
return new RestResponse(result,result.size(),200); return new RestResponse(result,result.size(),200);
}else if(minRecord == null && "1".equals(isDone)){
minRecord = "[]";
} }
// 获取子订单键值 // 获取子订单键值
String[] split = minRecord.replace("[","").replace("]","").split(","); String[] split = minRecord.replace("[","").replace("]","").split(",");
@ -117,17 +120,27 @@ public class DepositoryRecordController {
String state = (String) redisTemplateForHash.opsForHash().get(split[i],"state"); String state = (String) redisTemplateForHash.opsForHash().get(split[i],"state");
if("1".equals(state)){ if("1".equals(state)){
// 如果当前订单未完成 // 如果当前订单未完成
ongoingSplit+= split[i]+","; ongoingSplit += split[i]+",";
}else if ("2".equals(state)){ }else if ("2".equals(state)){
// 如果当前订单已完成 // 如果当前订单已完成
completeSplit+= split[i]+","; completeSplit += split[i]+",";
} }
} }
// 用户管理仓库 // 用户管理仓库
Map<String,Object> userManageHouse = new HashMap<>(); Map<String,Object> userManageHouse = new HashMap<>();
if("1".equals(isDone)){ if("1".equals(isDone)){
// 如果要获取已完成 // 如果要获取已完成
split = completeSplit.split(","); // split = completeSplit.split(",");
Map<String,Object> params = new HashMap<>();
params.put("checkId",userToken.getId());
// 获取当前用户所有已完成的订单
List<ApplicationOutRecordMin> applicationOutMinByCondition = depositoryRecordService.findApplicationOutMinByCondition(params);
split = new String[applicationOutMinByCondition.size()];
for (int i = 0; i < applicationOutMinByCondition.size(); i++) {
String tempSplit = "minRecord:"+applicationOutMinByCondition.get(i).getId();
split[i] = tempSplit;
}
}else{ }else{
// 如果获取未完成 // 如果获取未完成
split = ongoingSplit.split(","); split = ongoingSplit.split(",");
@ -336,6 +349,7 @@ public class DepositoryRecordController {
// 当前仓库中该用户的子订单详情 // 当前仓库中该用户的子订单详情
@GetMapping("/ApplicationOutMinByDid") @GetMapping("/ApplicationOutMinByDid")
public RestResponse ApplicationOutMinByDid(@RequestParam Map<String,Object> map, HttpServletRequest request){ public RestResponse ApplicationOutMinByDid(@RequestParam Map<String,Object> map, HttpServletRequest request){
List<SimpleApplicationOutMinRecordP> applicationOutRecordMinList = new ArrayList<>();
Integer depositoryId =ObjectFormatUtil.toInteger(map.get("depositoryId")); Integer depositoryId =ObjectFormatUtil.toInteger(map.get("depositoryId"));
// 0未完成1已完成 // 0未完成1已完成
Integer stateOnView =ObjectFormatUtil.toInteger(map.get("state")); Integer stateOnView =ObjectFormatUtil.toInteger(map.get("state"));
@ -345,19 +359,29 @@ public class DepositoryRecordController {
// 获取当前用户要处理的记录信息 // 获取当前用户要处理的记录信息
String minRecord = (String) redisTemplateForHash.opsForHash().get("user:"+userToken.getId(),"minRecord"); String minRecord = (String) redisTemplateForHash.opsForHash().get("user:"+userToken.getId(),"minRecord");
// 获取子订单键值 // 获取子订单键值
String[] split = minRecord.replace("[","").replace("]","").split(","); if(minRecord == null && Integer.compare(stateOnView,0) == 0){
List<SimpleApplicationOutMinRecordP> applicationOutRecordMinList = new ArrayList<>(); return new RestResponse(applicationOutRecordMinList,applicationOutRecordMinList.size(),200);
}
else if(minRecord == null && Integer.compare(stateOnView,1) == 0){
minRecord = "[]";
}
String[] split = minRecord.replace("[", "").replace("]", "").split(",");
if(Integer.compare(stateOnView,1) == 0){
// 如果要获取已完成的任务
Map<String,Object> param = new HashMap<>();
param.put("depositoryId",depositoryId);
param.put("checkId",userToken.getId());
// 获取所有发送请求用户处理完成的子订单
List<ApplicationOutRecordMin> applicationOutMinByCondition = depositoryRecordService.findApplicationOutMinByCondition(param);
split = new String[applicationOutMinByCondition.size()];
for (int i = 0; i < applicationOutMinByCondition.size(); i++) {
split[i] = "minRecord:"+applicationOutMinByCondition.get(i).getId();
}
}
for (int i = 0; i < split.length; i++) { for (int i = 0; i < split.length; i++) {
//获取当前订单状态 //获取当前订单状态
String state = (String) redisTemplateForHash.opsForHash().get(split[i], "state"); String state = (String) redisTemplateForHash.opsForHash().get(split[i], "state");
if(Integer.compare(stateOnView,0) == 0 && !"1".equals(state)){
// 如果当前要查看的是未完成的并且当前订单不是未完成
continue;
}
if(Integer.compare(stateOnView,1) == 0 && !"2".equals(state)){
// 如果当前要查看的是已完成的并且当前订单不是已完成
continue;
}
if("1".equals(state)){ if("1".equals(state)){
// 如果当前订单未完成 // 如果当前订单未完成
state = "进行中"; state = "进行中";
@ -831,12 +855,8 @@ public class DepositoryRecordController {
// 如果是仓库,则使用默认库位 // 如果是仓库,则使用默认库位
map.put("placeId",0); map.put("placeId",0);
} }
Integer integer = depositoryRecordService.completeApplicationOutMinRecord(map, userToken); RestResponse restResponse = depositoryRecordService.completeApplicationOutMinRecord(map, userToken);
if(integer == 1){ return restResponse;
return new RestResponse("",200,new StatusInfo("出库成功","出库成功"));
}else{
return new RestResponse("",500,new StatusInfo("出库失败","出库失败,请联系开发人员"));
}
} }

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

@ -75,6 +75,9 @@ public class MaterialController {
List<MaterialP> list = new ArrayList<>(); List<MaterialP> list = new ArrayList<>();
Integer total = 0; Integer total = 0;
Integer size = 10,page = 1; // 定义每页展示数量 Integer size = 10,page = 1; // 定义每页展示数量
if (map.containsKey("size")) {
size = ObjectFormatUtil.toInteger(map.get("size"));
}
if(!(map.containsKey("depositoryId")||map.containsKey("code")||map.containsKey("mname"))){ if(!(map.containsKey("depositoryId")||map.containsKey("code")||map.containsKey("mname"))){
for (int i = 0; i < depositoryByAdminorg.size(); i++) { for (int i = 0; i < depositoryByAdminorg.size(); i++) {
Integer did = depositoryByAdminorg.get(i).getId(); Integer did = depositoryByAdminorg.get(i).getId();
@ -83,10 +86,11 @@ public class MaterialController {
List<MaterialP> inventory = materialService.findInventory(map); List<MaterialP> inventory = materialService.findInventory(map);
list.addAll(inventory); list.addAll(inventory);
total += materialService.findInventoryCount(map); total += materialService.findInventoryCount(map);
if(list.size() >= size){
break;
}
} }
if (map.containsKey("size")) {
size = ObjectFormatUtil.toInteger(map.get("size"));
}
for (RoleAndDepository roleAndDepository : depositoryAndRole) { for (RoleAndDepository roleAndDepository : depositoryAndRole) {
Integer depositoryId = roleAndDepository.getDepositoryId(); Integer depositoryId = roleAndDepository.getDepositoryId();
if(didList.contains(depositoryId)){ if(didList.contains(depositoryId)){
@ -101,7 +105,6 @@ public class MaterialController {
page=ObjectFormatUtil.toInteger(map.get("page")); page=ObjectFormatUtil.toInteger(map.get("page"));
} }
// 计算所有页数 // 计算所有页数
Double pageAll = Math.ceil(total / size);
// 判断当前是在全新一页还是包含上述内容 // 判断当前是在全新一页还是包含上述内容
if(size - list.size() != size){ if(size - list.size() != size){
// 如果当前不是崭新一页 // 如果当前不是崭新一页

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

@ -200,46 +200,6 @@ public class PageController {
menu.put("child", menu_childs); menu.put("child", menu_childs);
allMenus.add(menu); allMenus.add(menu);
} }
/*for (int i = 0; i < menusByNoParent.size(); i++) {
Map<String,Object> menu = new HashMap<>();
menu.put("title",menusByNoParent.get(i).getName());
menu.put("href",menusByNoParent.get(i).getUrl());
menu.put("icon",menusByNoParent.get(i).getIcon());
menu.put("target",menusByNoParent.get(i).getTarget());
Map<String,Object> map = new HashMap<>();
map.put("roleId",role);
map.put("menuparent",menusByNoParent.get(i).getId());
List<AccesstoAddress> accessstoAddressByParent = accessAddressService.findAccessToAddressByUser(map);
List<Object> menu_childs = new ArrayList<>();
for (int j = 0; j < accessstoAddressByParent.size(); j++) {
Map<String,Object> menu_child = new HashMap<>();
menu_child.put("title",accessstoAddressByParent.get(j).getName());
menu_child.put("href",accessstoAddressByParent.get(j).getUrl());
menu_child.put("icon",accessstoAddressByParent.get(j).getIcon());
menu_child.put("target",accessstoAddressByParent.get(j).getTarget());
List<Object> menu_childs1 = new ArrayList<>();
if(accessstoAddressByParent.get(j).getIschild() == 1){
Map<String,Object> map1 = new HashMap<>();
map1.put("roleId",role);
map1.put("menuparent",accessstoAddressByParent.get(j).getId());
List<AccesstoAddress> accessstoAddressByParent1 = accessAddressService.findAccessToAddressByUser(map1);
for (int k = 0; k < accessstoAddressByParent1.size(); k++) {
Map<String, Object> menu_child1 = new HashMap<>();
menu_child1.put("title", accessstoAddressByParent1.get(k).getName());
menu_child1.put("href", accessstoAddressByParent1.get(k).getUrl());
menu_child1.put("icon", accessstoAddressByParent1.get(k).getIcon());
menu_child1.put("target", accessstoAddressByParent1.get(k).getTarget());
menu_childs1.add(((HashMap<String, Object>) menu_child1).clone());
menu_child1.clear();
}
}
menu_child.put("child", ((ArrayList<Object>) menu_childs1).clone());
menu_childs.add(((HashMap<String, Object>) menu_child).clone());
menu_child.clear();
}
menu.put("child",menu_childs);
allMenus.add(menu);
}*/
Map<String, Object> menuInfo = new HashMap<>(); Map<String, Object> menuInfo = new HashMap<>();
menuInfo.put("menuInfo", allMenus); menuInfo.put("menuInfo", allMenus);
menuInfo.put("homeInfo", homeInfo); menuInfo.put("homeInfo", homeInfo);
@ -510,9 +470,6 @@ public class PageController {
public ModelAndView application_in() { public ModelAndView application_in() {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/application/application-in"); mv.setViewName("pages/application/application-in");
mv.addObject("depositories", depositoryService.findDepositoryAll());
mv.addObject("reviewers", userService.findReviewers());
mv.addObject("materials", materialService.findMaterialAll());
return mv; return mv;
} }
@ -552,9 +509,6 @@ public class PageController {
public ModelAndView application_out() { public ModelAndView application_out() {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/application/application-out"); mv.setViewName("pages/application/application-out");
mv.addObject("depositories", depositoryService.findDepositoryAll());
mv.addObject("reviewers", userService.findReviewers());
mv.addObject("materials", materialService.findMaterialAll());
return mv; return mv;
} }
@ -583,9 +537,6 @@ public class PageController {
public ModelAndView application_transfer() { public ModelAndView application_transfer() {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/application/application-transfer"); mv.setViewName("pages/application/application-transfer");
mv.addObject("depositories", depositoryService.findDepositoryAll());
mv.addObject("reviewers", userService.findReviewers());
mv.addObject("materials", materialService.findMaterialAll());
return mv; return mv;
} }
@ -593,8 +544,6 @@ public class PageController {
public ModelAndView table_in() { public ModelAndView table_in() {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/depository/table-in"); mv.setViewName("pages/depository/table-in");
mv.addObject("depositories", depositoryService.findDepositoryAll());
mv.addObject("materials", materialService.findMaterialAll());
return mv; return mv;
} }
@ -602,8 +551,6 @@ public class PageController {
public ModelAndView table_out() { public ModelAndView table_out() {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/depository/table-out"); mv.setViewName("pages/depository/table-out");
mv.addObject("depositories", depositoryService.findDepositoryAll());
mv.addObject("materials", materialService.findMaterialAll());
return mv; return mv;
} }

6
src/main/java/com/dreamchaser/depository_manage/controller/PlaceController.java

@ -60,8 +60,10 @@ public class PlaceController {
mname.append(materialById.getMname()+","); mname.append(materialById.getMname()+",");
} }
placeP.setMname(mname.toString()); placeP.setMname(mname.toString());
placeP.setDepositoryName(depositoryById.getDname()); if(depositoryById != null) {
placeP.setDepositoryCode(depositoryById.getCode()); placeP.setDepositoryName(depositoryById.getDname());
placeP.setDepositoryCode(depositoryById.getCode());
}
placePList.add(placeP); placePList.add(placeP);
} }
return new RestResponse(placePList, placeService.findPlaceCountByCondition(map), 200); return new RestResponse(placePList, placeService.findPlaceCountByCondition(map), 200);

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

@ -283,6 +283,7 @@
and (departmentHeadTime != 0 and departmenthead=#{userId} and DepartmentheadPass != 3) and (departmentHeadTime != 0 and departmenthead=#{userId} and DepartmentheadPass != 3)
or (depositoryManagerTime != 0 and FIND_IN_SET(#{userId},depositoryManager) != 0 and depositoryManagerPass != 3) or (depositoryManagerTime != 0 and FIND_IN_SET(#{userId},depositoryManager) != 0 and depositoryManagerPass != 3)
</if> </if>
group by aorid
<if test="begin != null and size != null"> <if test="begin != null and size != null">
LIMIT #{begin},#{size} LIMIT #{begin},#{size}
</if> </if>
@ -375,9 +376,11 @@
<if test="placeId != null"> <if test="placeId != null">
and placeId = #{placeId} and placeId = #{placeId}
</if> </if>
GROUP BY aorid
<if test="begin != null and size != null"> <if test="begin != null and size != null">
LIMIT #{begin},#{size} LIMIT #{begin},#{size}
</if> </if>
</select> </select>
<!-- 查询所有入库记录--> <!-- 查询所有入库记录-->
<select id="findApplicationInRecordPAll" resultMap="applicationInRecord"> <select id="findApplicationInRecordPAll" resultMap="applicationInRecord">
@ -397,6 +400,7 @@
<include refid="ApplicationOutRecordInfo"/> <include refid="ApplicationOutRecordInfo"/>
from applicationOutRecordInfo from applicationOutRecordInfo
where aorid = #{id} where aorid = #{id}
group by aorid
</select> </select>
<select id="findApplicationOutByCode" parameterType="string" resultMap="applicationOutRecord"> <select id="findApplicationOutByCode" parameterType="string" resultMap="applicationOutRecord">
@ -447,7 +451,7 @@
<!-- 根据条件查询出库记录数--> <!-- 根据条件查询出库记录数-->
<select id="findApplicationOutRecordPCountByCondition" parameterType="map" resultType="int"> <select id="findApplicationOutRecordPCountByCondition" parameterType="map" resultType="int">
select select
count(*) count(DISTINCT aorid)
from applicationOutRecordInfo from applicationOutRecordInfo
where 1 = 1 where 1 = 1
<if test="id != '' and id != null"> <if test="id != '' and id != null">
@ -504,6 +508,7 @@
<if test="istransfer != null and istransfer != ''"> <if test="istransfer != null and istransfer != ''">
and istransfer = #{istransfer} and istransfer = #{istransfer}
</if> </if>
</select> </select>
@ -695,6 +700,9 @@
<if test="checkId != null"> <if test="checkId != null">
and aorm.checkId = #{checkId} and aorm.checkId = #{checkId}
</if> </if>
<if test="depositoryId != null">
and aorm.depositoryId = #{depositoryId}
</if>
<if test="parentId != null"> <if test="parentId != null">
and aorm.parentId = #{parentId} and aorm.parentId = #{parentId}
</if> </if>
@ -1055,7 +1063,7 @@
<!--获取一段时间内的出库额度--> <!--获取一段时间内的出库额度-->
<select id="findApplicationOutRecordByDate" parameterType="map" resultType="double"> <select id="findApplicationOutRecordByDate" parameterType="map" resultType="double">
SELECT SELECT
ifnull(sum(aorquantity),0) ifnull(sum(aormquantity),0)
FROM applicationoutrecordinfo FROM applicationoutrecordinfo
where 1 = 1 where 1 = 1
<if test="depositoryId != null"> <if test="depositoryId != null">

2
src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java

@ -342,5 +342,5 @@ public interface DepositoryRecordService {
* @param userByPort * @param userByPort
* @return * @return
*/ */
Integer completeApplicationOutMinRecord(Map<String,Object> map,UserByPort userByPort); RestResponse completeApplicationOutMinRecord(Map<String,Object> map,UserByPort userByPort);
} }

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

@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.log.Log; import cn.hutool.log.Log;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.api.R;
import com.dreamchaser.depository_manage.config.PortConfig; import com.dreamchaser.depository_manage.config.PortConfig;
import com.dreamchaser.depository_manage.controller.PageController; import com.dreamchaser.depository_manage.controller.PageController;
import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.entity.*;
@ -234,7 +235,19 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} else { } else {
for (int i = 0; i < applicationOutRecordPAll.size(); i++) { for (int i = 0; i < applicationOutRecordPAll.size(); i++) {
if (state.equals(applicationOutRecordPAll.get(i).getState())) { if (state.equals(applicationOutRecordPAll.get(i).getState())) {
sum += (double) applicationOutRecordPAll.get(i).getQuantity(); for (int j = 0; j < applicationOutRecordPAll.size(); j++) {
ApplicationOutRecordP applicationOutRecordP = applicationOutRecordPAll.get(j);
// 获取所有子物料
Map<String,Object> map = new HashMap<>();
map.put("parentId",applicationOutRecordP.getId());
List<ApplicationOutRecordMin> minByCondition = depositoryRecordMapper.findApplicationOutMinByCondition(map);
for (int k = 0; k < minByCondition.size(); k++) {
ApplicationOutRecordMin applicationOutRecordMin = minByCondition.get(k);
Integer mid = applicationOutRecordMin.getMid();
Material materialById = materialMapper.findMaterialById(mid);
sum += (double) materialById.getQuantity();
}
}
} }
} }
} }
@ -414,7 +427,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
* @return * @return
*/ */
@Override @Override
public Integer completeApplicationOutMinRecord(Map<String,Object> param, UserByPort userByPort) { public RestResponse completeApplicationOutMinRecord(Map<String,Object> param, UserByPort userByPort) {
// 最终返回值
RestResponse restResponse = new RestResponse();
Integer id = ObjectFormatUtil.toInteger(param.get("id")); Integer id = ObjectFormatUtil.toInteger(param.get("id"));
// 获取要完成的子订单 // 获取要完成的子订单
@ -482,9 +498,25 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
String redisMinRecordKey = "minRecord:"+id; // 设置redis中子订单键值 String redisMinRecordKey = "minRecord:"+id; // 设置redis中子订单键值
// 修改redis中本子订单状态 // 修改redis中本子订单状态
redisTemplate.opsForHash().put(redisMinRecordKey,"state","2"); // redisTemplate.opsForHash().put(redisMinRecordKey,"state","2");
// 修改redis中本子订单完成人 // 修改redis中本子订单完成人
redisTemplate.opsForHash().put(redisMinRecordKey,"manager",userByPort.getId().toString()); // redisTemplate.opsForHash().put(redisMinRecordKey,"manager",userByPort.getId().toString());
// 删除已完成的订单
redisTemplate.delete(redisMinRecordKey);
// 获取该用户在redis中的订单记录
String key = "user:"+userByPort.getId().toString();
// 获取当前用户所有订单
String minRecord = (String) redisTemplate.opsForHash().get(key, "minRecord");
// 删除用户中当前已完成的订单
minRecord = minRecord.replace(redisMinRecordKey+",","");
redisTemplate.opsForHash().put(key,"minRecord",minRecord);
if(minRecord.length() == 2){
// []
// 如果当前用户已经没有剩余订单,则删除
redisTemplate.delete("user:"+userByPort.getId());
}
// 获取出库仓库信息 // 获取出库仓库信息
Depository depositoryRecordById = depositoryMapper.findDepositoryRecordById(applicationOutMinById.getDepositoryId()); Depository depositoryRecordById = depositoryMapper.findDepositoryRecordById(applicationOutMinById.getDepositoryId());
// 设置子订单新编码 // 设置子订单新编码
@ -533,6 +565,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("id",record.getId()); map.put("id",record.getId());
// 修改状态为完成 // 修改状态为完成
depositoryRecordMapper.updateApplicationOutRecord(map); depositoryRecordMapper.updateApplicationOutRecord(map);
// 删除redis中本订单
redisTemplate.delete("record:"+record.getId());
} }
// 如果是库存转移订单 // 如果是库存转移订单
@ -544,11 +578,16 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("recordId",record.getId()); // 出库订单编号 map.put("recordId",record.getId()); // 出库订单编号
transferMaterial(map); transferMaterial(map);
} }
restResponse.setStatus(200);
}else{ restResponse.setData("");
restResponse.setStatusInfo(new StatusInfo("出库成功","出库成功"));
} }
return result; else{
restResponse.setStatus(508);
restResponse.setData("");
restResponse.setStatusInfo(new StatusInfo("出库失败","出库失败,库存不足"));
}
return restResponse;
} }
/** /**
@ -675,7 +714,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 用户当前子订单 // 用户当前子订单
String userMinRecord = (String) redisTemplate.opsForHash().get("user:" + userIdByDid.get(j), "minRecord"); String userMinRecord = (String) redisTemplate.opsForHash().get("user:" + userIdByDid.get(j), "minRecord");
if (userMinRecord == null) { // 如果当前用户没有子订单 if (userMinRecord == null) { // 如果当前用户没有子订单
userRecord.put("minRecord", "[" + minRecordKey + "]"); // 插入一条子订单 userRecord.put("minRecord", "[" + minRecordKey+"," + "]"); // 插入一条子订单
} else { // 如果当前用户已经有子订单 } else { // 如果当前用户已经有子订单
StringBuilder minRecordList = new StringBuilder(userMinRecord); // 转为stringbuilder类型 StringBuilder minRecordList = new StringBuilder(userMinRecord); // 转为stringbuilder类型
minRecordList.insert(1, minRecordKey + ",");// 将当前子订单插入头部 minRecordList.insert(1, minRecordKey + ",");// 将当前子订单插入头部
@ -1083,7 +1122,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Double sum = 0.0; Double sum = 0.0;
for (int i = 0; i < applicationInRecordPAll.size(); i++) { for (int i = 0; i < applicationInRecordPAll.size(); i++) {
double price = applicationInRecordPAll.get(i).getPrice(); double price = applicationInRecordPAll.get(i).getPrice();
sum += price / 100; sum += price * applicationInRecordPAll.get(i).getQuantity() / 100;
} }
BigDecimal bg = new BigDecimal(sum); BigDecimal bg = new BigDecimal(sum);
sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
@ -1102,15 +1141,33 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Double sum = 0.0; Double sum = 0.0;
if (state.isEmpty()) { if (state.isEmpty()) {
for (int i = 0; i < applicationOutRecordPAll.size(); i++) { for (int i = 0; i < applicationOutRecordPAll.size(); i++) {
Double price = applicationOutRecordPAll.get(i).getPrice(); ApplicationOutRecordP applicationOutRecordP = applicationOutRecordPAll.get(i);
sum += (double) (price / 100); // 获取所有子物料
Map<String,Object> map = new HashMap<>();
map.put("parentId",applicationOutRecordP.getId());
List<ApplicationOutRecordMin> minByCondition = depositoryRecordMapper.findApplicationOutMinByCondition(map);
for (int k = 0; k < minByCondition.size(); k++) {
ApplicationOutRecordMin applicationOutRecordMin = minByCondition.get(k);
Integer mid = applicationOutRecordMin.getMid();
Material materialById = materialMapper.findMaterialById(mid);
sum += ((double) materialById.getPrice() / 100) * applicationOutRecordMin.getQuantity();
}
} }
} else { } else {
for (int i = 0; i < applicationOutRecordPAll.size(); i++) { for (int i = 0; i < applicationOutRecordPAll.size(); i++) {
if (state.equals(applicationOutRecordPAll.get(i).getState())) { if (state.equals(applicationOutRecordPAll.get(i).getState())) {
Double price = applicationOutRecordPAll.get(i).getPrice(); ApplicationOutRecordP applicationOutRecordP = applicationOutRecordPAll.get(i);
sum += (double) (price / 100); // 获取所有子物料
Map<String,Object> map = new HashMap<>();
map.put("parentId",applicationOutRecordP.getId());
List<ApplicationOutRecordMin> minByCondition = depositoryRecordMapper.findApplicationOutMinByCondition(map);
for (int k = 0; k < minByCondition.size(); k++) {
ApplicationOutRecordMin applicationOutRecordMin = minByCondition.get(k);
Integer mid = applicationOutRecordMin.getMid();
Material materialById = materialMapper.findMaterialById(mid);
sum += ((double) materialById.getPrice() / 100) * applicationOutRecordMin.getQuantity();
}
} }
} }
} }
@ -1162,6 +1219,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
return depositoryRecordMapper.findApplicationInRecordByDate(map); return depositoryRecordMapper.findApplicationInRecordByDate(map);
} else { } else {
map.put("state", "已出库"); map.put("state", "已出库");
return depositoryRecordMapper.findApplicationOutRecordByDate(map); return depositoryRecordMapper.findApplicationOutRecordByDate(map);
} }
} }

64
src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java

@ -226,6 +226,10 @@ public class ExcelServiceImpl implements ExcelService {
// 判断当前库位码是否正确,并存入库位中 // 判断当前库位码是否正确,并存入库位中
for (int i = 0; i < excelInfoByInventories.size(); i++) { for (int i = 0; i < excelInfoByInventories.size(); i++) {
Material materialByCode = materialService.findMaterialByCode(excelInfoByInventories.get(i).getCode()); Material materialByCode = materialService.findMaterialByCode(excelInfoByInventories.get(i).getCode());
Map<String,Object> map = new HashMap<>();
map.put("code",materialByCode.getCode());
// 获取当前编码的库存 如果有库存,则跳过
materialService.findInventory(map);
String placeCode = excelInfoByInventories.get(i).getDepositoryCode(); String placeCode = excelInfoByInventories.get(i).getDepositoryCode();
Integer depositoryId = excelInfoByInventories.get(i).getDepositoryId(); Integer depositoryId = excelInfoByInventories.get(i).getDepositoryId();
// 如果导入时输入库位信息 // 如果导入时输入库位信息
@ -247,17 +251,8 @@ public class ExcelServiceImpl implements ExcelService {
errMsg.add(msg); errMsg.add(msg);
continue; continue;
} else { } else {
// 修改当前库位库存 excelInfoByInventories.get(i).setDepositoryCode(place.getCode());
Map<String, Object> updatePlace = new HashMap<>();
updatePlace.put("id", place.getId());
updatePlace.put("quantity", quantity + place.getQuantity());
placeService.UpdatePlace(updatePlace);
excelVos.add(excelInfoByInventories.get(i)); excelVos.add(excelInfoByInventories.get(i));
// 添加库位与物料记录
updatePlace.remove("id");
updatePlace.put("mid", materialByCode.getId());
updatePlace.put("pid", place.getId());
placeService.addMaterialOnPlace(updatePlace);
} }
} else { } else {
String s = dataIndex.get(i); String s = dataIndex.get(i);
@ -266,6 +261,7 @@ public class ExcelServiceImpl implements ExcelService {
continue; continue;
} }
} else { // 否则直接加入 } else { // 否则直接加入
excelInfoByInventories.get(i).setDepositoryCode("0"); // 设置默认库位
excelVos.add(excelInfoByInventories.get(i)); excelVos.add(excelInfoByInventories.get(i));
} }
} }
@ -289,6 +285,7 @@ public class ExcelServiceImpl implements ExcelService {
insert.put("code", materialByCode.getCode()); insert.put("code", materialByCode.getCode());
insert.put("unit", materialByCode.getUnit()); insert.put("unit", materialByCode.getUnit());
insert.put("texture", materialByCode.getTexture()); insert.put("texture", materialByCode.getTexture());
insert.put("tempPlaceCode",excelVos.get(i).getDepositoryCode());
insert.put("quantity", String.valueOf(ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity()) + materialByCode.getQuantity())); insert.put("quantity", String.valueOf(ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity()) + materialByCode.getQuantity()));
// 如果模板中总金额未填写 // 如果模板中总金额未填写
if (excelVos.get(i).getAmounts() == null || "".equals(excelVos.get(i).getAmounts())) { if (excelVos.get(i).getAmounts() == null || "".equals(excelVos.get(i).getAmounts())) {
@ -312,21 +309,46 @@ public class ExcelServiceImpl implements ExcelService {
} }
insert.put("depositoryId", depositoryId); insert.put("depositoryId", depositoryId);
insert.put("depositoryCode", excelVos.get(i).getDepositoryCode()); insert.put("depositoryCode", excelVos.get(i).getDepositoryCode());
// 插入库存记录
materialService.insertMaterialForImport(insert); materialService.insertMaterialForImport(insert);
// 将该物料同时放入默认库位中 // 将该物料同时放入默认库位中
Map<String,Object> param = new HashMap<>(); String placeCode = excelInfoByInventories.get(i).getDepositoryCode();
// 获取默认库位 Boolean isNew = (Boolean) insert.get("isNew");
Place placeById = placeService.findPlaceById(0); if(isNew) {
// 修改默认库位库存 // 如果是新插入物料
placeById.setQuantity(placeById.getQuantity() + ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity())); if (placeCode == null || placeCode.isEmpty() || "0".equals(placeCode)) { // 如果没有输入库位
placeService.UpdatePlace(placeById); Map<String, Object> param = new HashMap<>();
// 添加库位与物料的映射 // 获取默认库位
param.put("mid",insert.get("id")); Place placeById = placeService.findPlaceById(0);
param.put("pid",0); // 修改默认库位库存
param.put("quantity",ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity())); placeById.setQuantity(placeById.getQuantity() + ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity()));
placeService.addMaterialOnPlace(param); placeService.UpdatePlace(placeById);
// 添加库位与物料的映射
param.put("mid", insert.get("id"));
param.put("pid", 0);
param.put("quantity", ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity()));
placeService.addMaterialOnPlace(param);
} else {
// 如果输入的库位不是默认库位
Map<String,Object> param = new HashMap<>();
param.put("did",depositoryId);
param.put("code",placeCode);
// 获取要导入的库位
Place placeByCondition = placeService.findPlaceByCondition(param).get(0);
// 修改库位物料数量
placeByCondition.setQuantity(placeByCondition.getQuantity() + ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity()));
placeService.UpdatePlace(placeByCondition);
// 如果没有对应关系
param.put("pid",placeByCondition.getId());
param.put("mid",insert.get("id"));
param.put("quantity",ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity()));
// 添加对应关系
placeService.addMaterialOnPlace(param);
}
}
success.add(excelVos.get(i)); success.add(excelVos.get(i));
} }
log.info("【批量添加】批量添加数据:{}", JSON.toJSONString(excelVos)); log.info("【批量添加】批量添加数据:{}", JSON.toJSONString(excelVos));

65
src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java

@ -307,7 +307,7 @@ public class MaterialServiceImpl implements MaterialService {
@Override @Override
public Double findAllPriceNoDelete() { public Double findAllPriceNoDelete() {
Double sum = 0.0; Double sum = 0.0;
List<Material> materialAll = materialMapper.findMaterialByCondition(new HashMap<String,Object>()); List<Material> materialAll = materialMapper.findInventory(new HashMap<String,Object>());
for (int i = 0; i < materialAll.size(); i++) { for (int i = 0; i < materialAll.size(); i++) {
sum += materialAll.get(i).getAmounts() / 100; sum += materialAll.get(i).getAmounts() / 100;
} }
@ -411,6 +411,9 @@ public class MaterialServiceImpl implements MaterialService {
params.put("depositoryId",map.get("depositoryId")); params.put("depositoryId",map.get("depositoryId"));
List<Material> inventory = materialMapper.findInventory(params); List<Material> inventory = materialMapper.findInventory(params);
if(inventory.size() >= 1){ if(inventory.size() >= 1){
// 用于标志是新插入的物料
map.put("isNew",false);
// 如果该物料存在 // 如果该物料存在
Material material = inventory.get(0); Material material = inventory.get(0);
Double price = (Double.parseDouble(map.get("price").toString())) / 100; Double price = (Double.parseDouble(map.get("price").toString())) / 100;
@ -423,19 +426,61 @@ public class MaterialServiceImpl implements MaterialService {
material.setAmounts(material.getAmounts() + amounts); material.setAmounts(material.getAmounts() + amounts);
material.setQuantity(material.getQuantity() + quantity); material.setQuantity(material.getQuantity() + quantity);
// 获取当前物料在当前仓库的库位 // 获取当前物料要存入的库位
MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(0, material.getId()); String tempPlaceCode = (String) map.get("tempPlaceCode");
// 修改当前库位数目 if("0".equals(tempPlaceCode)) {
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() + quantity); // 如果当前导入库位是默认库位
placeService.updateMaterialAndPlace(placeAndMaterialByMidAndPid); MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(0, material.getId());
// 修改库位存放数量 if(placeAndMaterialByMidAndPid != null) {
Place placeById = placeService.findPlaceById(0); // 修改当前库位数目
placeById.setQuantity(placeById.getQuantity() + quantity); placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() + quantity);
placeService.UpdatePlace(placeById); placeService.updateMaterialAndPlace(placeAndMaterialByMidAndPid);
}else{
// 如果没有对应关系
Map<String,Object> param = new HashMap<>();
param.put("pid",0);
param.put("mid",material.getId());
param.put("quantity",quantity);
// 添加对应关系
placeService.addMaterialOnPlace(param);
}
// 修改库位存放数量
Place placeById = placeService.findPlaceById(0);
placeById.setQuantity(placeById.getQuantity() + quantity);
placeService.UpdatePlace(placeById);
}else{
// 如果要导入的不是默认库位
Map<String,Object> param = new HashMap<>();
param.put("depositoryId",material.getDepositoryId());
param.put("code",tempPlaceCode);
// 获取要导入的库位
Place placeByCondition = placeService.findPlaceByCondition(param).get(0);
// 修改库位物料数量
placeByCondition.setQuantity(placeByCondition.getQuantity() + quantity);
placeService.UpdatePlace(placeByCondition);
// 获取库位与物料的对应关系
MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(placeByCondition.getId(), material.getId());
if(placeAndMaterialByMidAndPid == null){
// 如果没有对应关系
param.put("pid",placeByCondition.getId());
param.put("mid",material.getId());
param.put("quantity",quantity);
// 添加对应关系
placeService.addMaterialOnPlace(param);
}else{
// 如果有对应关系
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() + quantity);
// 修改数量
placeService.updateMaterialAndPlace(placeAndMaterialByMidAndPid);
}
}
return materialMapper.updateMaterial(material); return materialMapper.updateMaterial(material);
}else { }else {
// 用于标志是新插入的物料
map.put("isNew",true);
return materialMapper.insertMaterial(map); return materialMapper.insertMaterial(map);
} }
} }

4
src/main/java/com/dreamchaser/depository_manage/service/impl/PlaceServiceImpl.java

@ -61,6 +61,10 @@ public class PlaceServiceImpl implements PlaceService {
page = ObjectFormatUtil.toInteger(map.get("page")); page = ObjectFormatUtil.toInteger(map.get("page"));
map.put("begin", (page - 1) * size); map.put("begin", (page - 1) * size);
} }
if(map.containsKey("depositoryId")){
map.put("did",map.get("depositoryId"));
map.remove("depositoryId");
}
return placeMapper.findPlaceByCondition(map); return placeMapper.findPlaceByCondition(map);
} }
/** /**

11
src/main/resources/templates/pages/application/application-review.html

@ -29,7 +29,8 @@
<tbody> <tbody>
<tr> <tr>
<td>申请编号</td> <td>申请编号</td>
<td id="id" th:text="${record.getId()}">123456</td> <td id="id" style="display: none" th:text="${record.getId()}">123456</td>
<td id="code" th:text="${record.getCode()}">123456</td>
</tr> </tr>
<tr> <tr>
<td>物料名称</td> <td>物料名称</td>
@ -137,12 +138,6 @@
</div> </div>
<div class="layui-card-body" style="padding-top: 40px;">
<div style="color: #666;margin-top: 30px;margin-bottom: 40px;padding-left: 30px;">
<h3>说明</h3><br>
申请提交后,24小时内审核完毕
</div>
</div>
</div> </div>
</div> </div>
@ -189,7 +184,7 @@
filter: 'stepForm', filter: 'stepForm',
width: '100%', //设置容器宽度 width: '100%', //设置容器宽度
stepWidth: '750px', stepWidth: '750px',
height: '650px', height: '100%',
position: position, position: position,
number:number, number:number,
stepItems: states stepItems: states

60
src/main/resources/templates/pages/depository/table-in.html

@ -25,24 +25,24 @@
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">仓库</label> <label class="layui-form-label">仓库:</label>
<div class="layui-input-inline"> <div class="layui-input-block">
<!--<select name="depositoryId"> <input type="text" placeholder="请选择仓库" class="layui-input"
<option value="" selected>请选择仓库</option> id="openSonByDepository" readonly onclick="openDepositoryTree(this)"
<option th:each="depository,iterStar:${depositories}" th:value="${depository?.getId()}" th:text="${depository?.getDname()}" >外芯仓库</option> />
</select>--> <input type="text" name="depositoryId" class="layui-input" id="depositoryId"
<input type="text" placeholder="请选择仓库" class="layui-input" id="openSonByDepository" readonly /> style="display: none" />
<input type="text" name="depositoryId" class="layui-input" id="depositoryId" style="display: none" />
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">物料名称:</label> <label class="layui-form-label">物料名称:</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<!-- <input name="mname" type="text" placeholder="请填写物料名称" class="layui-input" lay-verify="required" />--> <input id="openSonByMaterial" readonly type="text" placeholder="请填写物料名称" class="layui-input" onclick="selectMaterialByName(this)" />
<select name="mid"> <input id="mid" name="mid" readonly type="text" placeholder="请填写物料名称" class="layui-input" style="display:none;" />
<option value="" selected>请选择物料名称</option> <!-- <select name="mid">-->
<option th:each="Material,iterStar:${materials}" th:value="${Material?.getId()}" th:text="${Material?.getMname()}">天玑1000</option> <!-- <option value="" selected>请选择物料名称</option>-->
</select> <!-- <option th:each="Material,iterStar:${materials}" th:value="${Material?.getId()}" th:text="${Material?.getMname()}">天玑1000</option>-->
<!-- </select>-->
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
@ -73,14 +73,19 @@
</div> </div>
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> <script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script> <script>
// 用于加载仓库菜单
function openDepositoryTree(obj){}
function selectMaterialByName(obj){}
layui.use(['form', 'table','laydate'], function () { layui.use(['form', 'table','laydate'], function () {
var $ = layui.jquery, var $ = layui.jquery,
form = layui.form, form = layui.form,
table = layui.table, table = layui.table,
laydate=layui.laydate; laydate=layui.laydate;
// 用于打开仓库树形菜单
$('#openSonByDepository').on('click', function(){ openDepositoryTree = function (obj) {
var parent = obj.parentNode.parentNode.parentNode;
var parentId = parent.id;
layer.open({ layer.open({
type: 2, type: 2,
title: '弹窗内容', title: '弹窗内容',
@ -90,9 +95,11 @@
area: ['70%', '70%'], area: ['70%', '70%'],
move : '.layui-layer-title', move : '.layui-layer-title',
fixed:false, fixed:false,
content: '/selectDepository?type=2', content: '/selectDepository?type=1&clickObj='+parentId,
}); });
}); }
//日期 //日期
laydate.render({ laydate.render({
@ -289,6 +296,25 @@
}); });
} }
}); });
//用于实现物料名称搜索
selectMaterialByName = function (obj) {
// 输入code
var data = obj.value;
// 获取对应元素
var req = {};
layer.open({
type: 2,
title: '弹窗内容',
skin: 'layui-layer-rim',
maxmin: true,
shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'],
content: '/selectMaterial?mname=""&type=1',
move : '.layui-layer-title',
fixed:false
});
};
}); });
</script> </script>

27
src/main/resources/templates/pages/depository/table-out.html

@ -38,10 +38,12 @@
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">物料名称:</label> <label class="layui-form-label">物料名称:</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="mid"> <!--<select name="mid">
<option value="" selected>请选择物料名称</option> <option value="" selected>请选择物料名称</option>
<option th:each="Material,iterStar:${materials}" th:value="${Material?.getId()}" th:text="${Material?.getMname()}">天玑1000</option> <option th:each="Material,iterStar:${materials}" th:value="${Material?.getId()}" th:text="${Material?.getMname()}">天玑1000</option>
</select> </select>-->
<input id="openSonByMaterial" readonly type="text" placeholder="请填写物料名称" class="layui-input" onclick="selectMaterialByName(this)" />
<input id="mid" name="mid" readonly type="text" placeholder="请填写物料名称" class="layui-input" style="display:none;" />
</div> </div>
</div> </div>
@ -74,6 +76,8 @@
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> <script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script> <script>
var data; var data;
// 用于加载仓库菜单
function selectMaterialByName(obj){}
layui.use(['form', 'table','laydate'], function () { layui.use(['form', 'table','laydate'], function () {
var $ = layui.jquery, var $ = layui.jquery,
form = layui.form, form = layui.form,
@ -93,6 +97,25 @@
content: '/selectDepository?type=2', content: '/selectDepository?type=2',
}); });
}); });
//用于实现物料名称搜索
selectMaterialByName = function (obj) {
// 输入code
var data = obj.value;
// 获取对应元素
var req = {};
layer.open({
type: 2,
title: '弹窗内容',
skin: 'layui-layer-rim',
maxmin: true,
shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'],
content: '/selectMaterial?mname=""&type=1',
move : '.layui-layer-title',
fixed:false
});
};
//日期 //日期
laydate.render({ laydate.render({

6
src/main/resources/templates/pages/material/selectMaterial.html

@ -43,8 +43,12 @@
type: 'post', type: 'post',
dataType: 'json', dataType: 'json',
contentType: "application/json;charset=utf-8", contentType: "application/json;charset=utf-8",
beforeSend:function () {
this.layerIndex = layer.load(0, { shade: [0.5, '#393D49'] });
},
success: function (d) { success: function (d) {
var data2 = d.data layer.close(this.layerIndex);
var data2 = d.data;
test.reload({ test.reload({
data: data2 data: data2
}); });

4
src/main/resources/templates/pages/scanQrCode/ScanQrCode.html

@ -147,7 +147,9 @@
params.depository = vue.depository; params.depository = vue.depository;
params.place = vue.place; params.place = vue.place;
vue.temporaryScanValue(params); // 将物料暂存 vue.temporaryScanValue(params); // 将物料暂存
if (vue.depository !== '' || vue.place !== '') { console.log(vue.place)
console.log(vue.depository)
if ( vue.depository !== null || vue.place !== null) {
// 如果已经扫描了仓库或库位 // 如果已经扫描了仓库或库位
// 弹出选择框 // 弹出选择框
vue.chooseInOrOut(); vue.chooseInOrOut();

23
src/main/resources/templates/pages/warehouse/warehouseByParentId.html

@ -25,12 +25,12 @@
<input type="text" name="place_x" autocomplete="off" class="layui-input"> <input type="text" name="place_x" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-inline"> <!-- <div class="layui-inline">-->
<label class="layui-form-label">库位列</label> <!-- <label class="layui-form-label">库位列</label>-->
<div class="layui-input-inline"> <!-- <div class="layui-input-inline">-->
<input type="text" name="place_x" autocomplete="off" class="layui-input"> <!-- <input type="text" name="place_x" autocomplete="off" class="layui-input">-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">库位层</label> <label class="layui-form-label">库位层</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
@ -142,17 +142,16 @@
form.on('submit(data-search-btn)', function (data) { form.on('submit(data-search-btn)', function (data) {
var req={}; var req={};
data=data.field; data=data.field;
req.type=1; if (data.place_x!==''){
if (data.address!==''){ req.place_x=data.place_x;
req.address=data.address;
} }
if(data.depositoryId!== ''){ if(data.place_z!== ''){
req.depositoryId = data.depositoryId; req.place_x = data.place_z;
} }
if(data.state != ''){ if(data.state != ''){
req.state = data.state; req.state = data.state;
} }
req.parentId = parentId req.did = parentId;
//执行搜索重载 //执行搜索重载
table.reload('currentTableId', { table.reload('currentTableId', {
url: '/place/findPlace', url: '/place/findPlace',

9
src/test/java/com/dreamchaser/depository_manage/Test.java

@ -36,10 +36,11 @@ public class Test {
@org.junit.Test @org.junit.Test
public void test1(){ public void test1(){
StringBuilder code = new StringBuilder("GKQGB20221013000000004"); // String minRecord = (String) redisTemplate.opsForHash().get("user:78", "minRecord");
int qgb = code.indexOf("QGB"); String minRecord = "[minRecord:2,]";
String key = "minRecord:2";
System.out.println(code.replace(qgb,qgb+"QGB".length(),"CS")); minRecord = minRecord.replace("minRecord:2"+",","");
System.out.println(minRecord);
} }

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

@ -283,6 +283,7 @@
and (departmentHeadTime != 0 and departmenthead=#{userId} and DepartmentheadPass != 3) and (departmentHeadTime != 0 and departmenthead=#{userId} and DepartmentheadPass != 3)
or (depositoryManagerTime != 0 and FIND_IN_SET(#{userId},depositoryManager) != 0 and depositoryManagerPass != 3) or (depositoryManagerTime != 0 and FIND_IN_SET(#{userId},depositoryManager) != 0 and depositoryManagerPass != 3)
</if> </if>
group by aorid
<if test="begin != null and size != null"> <if test="begin != null and size != null">
LIMIT #{begin},#{size} LIMIT #{begin},#{size}
</if> </if>
@ -375,9 +376,11 @@
<if test="placeId != null"> <if test="placeId != null">
and placeId = #{placeId} and placeId = #{placeId}
</if> </if>
GROUP BY aorid
<if test="begin != null and size != null"> <if test="begin != null and size != null">
LIMIT #{begin},#{size} LIMIT #{begin},#{size}
</if> </if>
</select> </select>
<!-- 查询所有入库记录--> <!-- 查询所有入库记录-->
<select id="findApplicationInRecordPAll" resultMap="applicationInRecord"> <select id="findApplicationInRecordPAll" resultMap="applicationInRecord">
@ -397,6 +400,7 @@
<include refid="ApplicationOutRecordInfo"/> <include refid="ApplicationOutRecordInfo"/>
from applicationOutRecordInfo from applicationOutRecordInfo
where aorid = #{id} where aorid = #{id}
group by aorid
</select> </select>
<select id="findApplicationOutByCode" parameterType="string" resultMap="applicationOutRecord"> <select id="findApplicationOutByCode" parameterType="string" resultMap="applicationOutRecord">
@ -447,7 +451,7 @@
<!-- 根据条件查询出库记录数--> <!-- 根据条件查询出库记录数-->
<select id="findApplicationOutRecordPCountByCondition" parameterType="map" resultType="int"> <select id="findApplicationOutRecordPCountByCondition" parameterType="map" resultType="int">
select select
count(*) count(DISTINCT aorid)
from applicationOutRecordInfo from applicationOutRecordInfo
where 1 = 1 where 1 = 1
<if test="id != '' and id != null"> <if test="id != '' and id != null">
@ -504,6 +508,7 @@
<if test="istransfer != null and istransfer != ''"> <if test="istransfer != null and istransfer != ''">
and istransfer = #{istransfer} and istransfer = #{istransfer}
</if> </if>
</select> </select>
@ -695,6 +700,9 @@
<if test="checkId != null"> <if test="checkId != null">
and aorm.checkId = #{checkId} and aorm.checkId = #{checkId}
</if> </if>
<if test="depositoryId != null">
and aorm.depositoryId = #{depositoryId}
</if>
<if test="parentId != null"> <if test="parentId != null">
and aorm.parentId = #{parentId} and aorm.parentId = #{parentId}
</if> </if>
@ -1055,7 +1063,7 @@
<!--获取一段时间内的出库额度--> <!--获取一段时间内的出库额度-->
<select id="findApplicationOutRecordByDate" parameterType="map" resultType="double"> <select id="findApplicationOutRecordByDate" parameterType="map" resultType="double">
SELECT SELECT
ifnull(sum(aorquantity),0) ifnull(sum(aormquantity),0)
FROM applicationoutrecordinfo FROM applicationoutrecordinfo
where 1 = 1 where 1 = 1
<if test="depositoryId != null"> <if test="depositoryId != null">

11
target/classes/templates/pages/application/application-review.html

@ -29,7 +29,8 @@
<tbody> <tbody>
<tr> <tr>
<td>申请编号</td> <td>申请编号</td>
<td id="id" th:text="${record.getId()}">123456</td> <td id="id" style="display: none" th:text="${record.getId()}">123456</td>
<td id="code" th:text="${record.getCode()}">123456</td>
</tr> </tr>
<tr> <tr>
<td>物料名称</td> <td>物料名称</td>
@ -137,12 +138,6 @@
</div> </div>
<div class="layui-card-body" style="padding-top: 40px;">
<div style="color: #666;margin-top: 30px;margin-bottom: 40px;padding-left: 30px;">
<h3>说明</h3><br>
申请提交后,24小时内审核完毕
</div>
</div>
</div> </div>
</div> </div>
@ -189,7 +184,7 @@
filter: 'stepForm', filter: 'stepForm',
width: '100%', //设置容器宽度 width: '100%', //设置容器宽度
stepWidth: '750px', stepWidth: '750px',
height: '650px', height: '100%',
position: position, position: position,
number:number, number:number,
stepItems: states stepItems: states

60
target/classes/templates/pages/depository/table-in.html

@ -25,24 +25,24 @@
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">仓库</label> <label class="layui-form-label">仓库:</label>
<div class="layui-input-inline"> <div class="layui-input-block">
<!--<select name="depositoryId"> <input type="text" placeholder="请选择仓库" class="layui-input"
<option value="" selected>请选择仓库</option> id="openSonByDepository" readonly onclick="openDepositoryTree(this)"
<option th:each="depository,iterStar:${depositories}" th:value="${depository?.getId()}" th:text="${depository?.getDname()}" >外芯仓库</option> />
</select>--> <input type="text" name="depositoryId" class="layui-input" id="depositoryId"
<input type="text" placeholder="请选择仓库" class="layui-input" id="openSonByDepository" readonly /> style="display: none" />
<input type="text" name="depositoryId" class="layui-input" id="depositoryId" style="display: none" />
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">物料名称:</label> <label class="layui-form-label">物料名称:</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<!-- <input name="mname" type="text" placeholder="请填写物料名称" class="layui-input" lay-verify="required" />--> <input id="openSonByMaterial" readonly type="text" placeholder="请填写物料名称" class="layui-input" onclick="selectMaterialByName(this)" />
<select name="mid"> <input id="mid" name="mid" readonly type="text" placeholder="请填写物料名称" class="layui-input" style="display:none;" />
<option value="" selected>请选择物料名称</option> <!-- <select name="mid">-->
<option th:each="Material,iterStar:${materials}" th:value="${Material?.getId()}" th:text="${Material?.getMname()}">天玑1000</option> <!-- <option value="" selected>请选择物料名称</option>-->
</select> <!-- <option th:each="Material,iterStar:${materials}" th:value="${Material?.getId()}" th:text="${Material?.getMname()}">天玑1000</option>-->
<!-- </select>-->
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
@ -73,14 +73,19 @@
</div> </div>
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> <script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script> <script>
// 用于加载仓库菜单
function openDepositoryTree(obj){}
function selectMaterialByName(obj){}
layui.use(['form', 'table','laydate'], function () { layui.use(['form', 'table','laydate'], function () {
var $ = layui.jquery, var $ = layui.jquery,
form = layui.form, form = layui.form,
table = layui.table, table = layui.table,
laydate=layui.laydate; laydate=layui.laydate;
// 用于打开仓库树形菜单
$('#openSonByDepository').on('click', function(){ openDepositoryTree = function (obj) {
var parent = obj.parentNode.parentNode.parentNode;
var parentId = parent.id;
layer.open({ layer.open({
type: 2, type: 2,
title: '弹窗内容', title: '弹窗内容',
@ -90,9 +95,11 @@
area: ['70%', '70%'], area: ['70%', '70%'],
move : '.layui-layer-title', move : '.layui-layer-title',
fixed:false, fixed:false,
content: '/selectDepository?type=2', content: '/selectDepository?type=1&clickObj='+parentId,
}); });
}); }
//日期 //日期
laydate.render({ laydate.render({
@ -289,6 +296,25 @@
}); });
} }
}); });
//用于实现物料名称搜索
selectMaterialByName = function (obj) {
// 输入code
var data = obj.value;
// 获取对应元素
var req = {};
layer.open({
type: 2,
title: '弹窗内容',
skin: 'layui-layer-rim',
maxmin: true,
shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'],
content: '/selectMaterial?mname=""&type=1',
move : '.layui-layer-title',
fixed:false
});
};
}); });
</script> </script>

27
target/classes/templates/pages/depository/table-out.html

@ -38,10 +38,12 @@
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">物料名称:</label> <label class="layui-form-label">物料名称:</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="mid"> <!--<select name="mid">
<option value="" selected>请选择物料名称</option> <option value="" selected>请选择物料名称</option>
<option th:each="Material,iterStar:${materials}" th:value="${Material?.getId()}" th:text="${Material?.getMname()}">天玑1000</option> <option th:each="Material,iterStar:${materials}" th:value="${Material?.getId()}" th:text="${Material?.getMname()}">天玑1000</option>
</select> </select>-->
<input id="openSonByMaterial" readonly type="text" placeholder="请填写物料名称" class="layui-input" onclick="selectMaterialByName(this)" />
<input id="mid" name="mid" readonly type="text" placeholder="请填写物料名称" class="layui-input" style="display:none;" />
</div> </div>
</div> </div>
@ -74,6 +76,8 @@
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> <script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script> <script>
var data; var data;
// 用于加载仓库菜单
function selectMaterialByName(obj){}
layui.use(['form', 'table','laydate'], function () { layui.use(['form', 'table','laydate'], function () {
var $ = layui.jquery, var $ = layui.jquery,
form = layui.form, form = layui.form,
@ -93,6 +97,25 @@
content: '/selectDepository?type=2', content: '/selectDepository?type=2',
}); });
}); });
//用于实现物料名称搜索
selectMaterialByName = function (obj) {
// 输入code
var data = obj.value;
// 获取对应元素
var req = {};
layer.open({
type: 2,
title: '弹窗内容',
skin: 'layui-layer-rim',
maxmin: true,
shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'],
content: '/selectMaterial?mname=""&type=1',
move : '.layui-layer-title',
fixed:false
});
};
//日期 //日期
laydate.render({ laydate.render({

6
target/classes/templates/pages/material/selectMaterial.html

@ -43,8 +43,12 @@
type: 'post', type: 'post',
dataType: 'json', dataType: 'json',
contentType: "application/json;charset=utf-8", contentType: "application/json;charset=utf-8",
beforeSend:function () {
this.layerIndex = layer.load(0, { shade: [0.5, '#393D49'] });
},
success: function (d) { success: function (d) {
var data2 = d.data layer.close(this.layerIndex);
var data2 = d.data;
test.reload({ test.reload({
data: data2 data: data2
}); });

4
target/classes/templates/pages/scanQrCode/ScanQrCode.html

@ -147,7 +147,9 @@
params.depository = vue.depository; params.depository = vue.depository;
params.place = vue.place; params.place = vue.place;
vue.temporaryScanValue(params); // 将物料暂存 vue.temporaryScanValue(params); // 将物料暂存
if (vue.depository !== '' || vue.place !== '') { console.log(vue.place)
console.log(vue.depository)
if ( vue.depository !== null || vue.place !== null) {
// 如果已经扫描了仓库或库位 // 如果已经扫描了仓库或库位
// 弹出选择框 // 弹出选择框
vue.chooseInOrOut(); vue.chooseInOrOut();

23
target/classes/templates/pages/warehouse/warehouseByParentId.html

@ -25,12 +25,12 @@
<input type="text" name="place_x" autocomplete="off" class="layui-input"> <input type="text" name="place_x" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-inline"> <!-- <div class="layui-inline">-->
<label class="layui-form-label">库位列</label> <!-- <label class="layui-form-label">库位列</label>-->
<div class="layui-input-inline"> <!-- <div class="layui-input-inline">-->
<input type="text" name="place_x" autocomplete="off" class="layui-input"> <!-- <input type="text" name="place_x" autocomplete="off" class="layui-input">-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">库位层</label> <label class="layui-form-label">库位层</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
@ -142,17 +142,16 @@
form.on('submit(data-search-btn)', function (data) { form.on('submit(data-search-btn)', function (data) {
var req={}; var req={};
data=data.field; data=data.field;
req.type=1; if (data.place_x!==''){
if (data.address!==''){ req.place_x=data.place_x;
req.address=data.address;
} }
if(data.depositoryId!== ''){ if(data.place_z!== ''){
req.depositoryId = data.depositoryId; req.place_x = data.place_z;
} }
if(data.state != ''){ if(data.state != ''){
req.state = data.state; req.state = data.state;
} }
req.parentId = parentId req.did = parentId;
//执行搜索重载 //执行搜索重载
table.reload('currentTableId', { table.reload('currentTableId', {
url: '/place/findPlace', url: '/place/findPlace',

Loading…
Cancel
Save