diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java index 94972109..88bfc1da 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java @@ -7,10 +7,7 @@ import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.exception.MyException; import com.dreamchaser.depository_manage.pojo.*; import com.dreamchaser.depository_manage.security.bean.UserToken; -import com.dreamchaser.depository_manage.service.CompanyService; -import com.dreamchaser.depository_manage.service.DepositoryRecordService; -import com.dreamchaser.depository_manage.service.DepositoryService; -import com.dreamchaser.depository_manage.service.MaterialService; +import com.dreamchaser.depository_manage.service.*; import com.dreamchaser.depository_manage.utils.CrudUtil; import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.HttpUtils; @@ -20,6 +17,7 @@ import org.apache.http.protocol.HTTP; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.io.IOException; @@ -45,6 +43,11 @@ public class DepositoryRecordController { private CompanyService companyService; @Autowired private RedisTemplate redisTemplate; + @Autowired + private RedisTemplate redisTemplateForHash; + @Autowired + private PlaceService placeService; + @@ -64,12 +67,16 @@ public class DepositoryRecordController { List applicationInRecordPlist = depositoryRecordService.findApplicationInRecordPByCondition(map); Integer InCount = depositoryRecordService.findApplicationInRecordPCountByCondition(map); for (int i = 0; i < applicationInRecordPlist.size(); i++) { - applicationInRecordPlist.get(i).setPrice(applicationInRecordPlist.get(i).getPrice() / 100); + if(applicationInRecordPlist.get(i).getPrice() != null) { + applicationInRecordPlist.get(i).setPrice(applicationInRecordPlist.get(i).getPrice() / 100); + } } List applicationOutRecordPlist = depositoryRecordService.findApplicationOutRecordPByCondition(map); Integer OutCount = depositoryRecordService.findApplicationOutRecordPCountByCondition(map); for (int i = 0; i < applicationOutRecordPlist.size(); i++) { - applicationOutRecordPlist.get(i).setPrice(applicationOutRecordPlist.get(i).getPrice() / 100); + if(applicationOutRecordPlist.get(i).getPrice() != null) { + applicationOutRecordPlist.get(i).setPrice(applicationOutRecordPlist.get(i).getPrice() / 100); + } } Map result = new HashMap<>(); result.put("applicationIn",applicationInRecordPlist); @@ -87,6 +94,77 @@ public class DepositoryRecordController { return new RestResponse(myTask ,depositoryRecordService.findMyTaskOutCount(map),200); } + + // 查找当前用户所有的扫码出库订单 + @GetMapping("/myTashForScanQrCode") + public RestResponse findAllMinRecordByUser(@RequestParam Map map,HttpServletRequest request){ + List result = new ArrayList<>(); + // isDone 为0为未完成,1为已完成 + String isDone = (String) (map.get("isDone")); + UserByPort userToken= (UserByPort) request.getAttribute("userToken"); + // 获取当前用户下的所有扫码出库订单 + String key = "user:"+userToken.getId().toString(); + String minRecord = (String) redisTemplateForHash.opsForHash().get(key, "minRecord"); + if(minRecord == null){ + return new RestResponse(result,result.size(),200); + } + // 获取子订单键值 + String[] split = minRecord.replace("[","").replace("]","").split(","); + String completeSplit= "";// 已完成 + String ongoingSplit= ""; // 进行中 + for (int i = 0; i < split.length; i++) { + // 获取所有子订单状态 + String state = (String) redisTemplateForHash.opsForHash().get(split[i],"state"); + if("1".equals(state)){ + // 如果当前订单未完成 + ongoingSplit+= split[i]+","; + }else if ("2".equals(state)){ + // 如果当前订单已完成 + completeSplit+= split[i]+","; + } + } + // 用户管理仓库 + Map userManageHouse = new HashMap<>(); + if("1".equals(isDone)){ + // 如果要获取已完成 + split = completeSplit.split(","); + }else{ + // 如果获取未完成 + split = ongoingSplit.split(","); + } + for (int i = 0; i < split.length; i++) { + // 获取子订单编码 + String[] strings = split[i].split(":"); + String minRecordId = ""; + if(strings.length>1) { + minRecordId = strings[1]; + } + if("".equals(minRecordId)){ + continue; + } + // 获取数据库中子订单信息 + ApplicationOutRecordMin applicationOutMinById = depositoryRecordService.findApplicationOutMinById(ObjectFormatUtil.toInteger(minRecordId)); + // 获取仓库信息 + Depository depositoryRecordById = depositoryService.findDepositoryRecordById(applicationOutMinById.getDepositoryId()); + // 获取子订单对应主订单 + ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(applicationOutMinById.getParentId()); + // 创建展示对象 + SimpleApplicationOutMinRecordP simpleApplicationOutMinRecordP = new SimpleApplicationOutMinRecordP(applicationOutMinById); + simpleApplicationOutMinRecordP.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationOutRecordPById.getApplicantTime()))); + simpleApplicationOutMinRecordP.setApplyRemark(applicationOutRecordPById.getApplyRemark()); + simpleApplicationOutMinRecordP.setDepositoryId(depositoryRecordById.getId()); + simpleApplicationOutMinRecordP.setDepositoryName(depositoryRecordById.getDname()); + simpleApplicationOutMinRecordP.setCode(applicationOutRecordPById.getCode()); + List objectList = (List) userManageHouse.get(depositoryRecordById.getCode()); + if(objectList == null){ + objectList = new ArrayList<>(); + } + objectList.add(simpleApplicationOutMinRecordP); + userManageHouse.put(depositoryRecordById.getCode(),objectList); + } + return new RestResponse(userManageHouse); + } + @PostMapping("/depositoryRecord") public RestResponse insertDepositoryRecord(@RequestBody Map map, HttpServletRequest request){ UserByPort userToken= (UserByPort) request.getAttribute("userToken"); @@ -210,7 +288,7 @@ public class DepositoryRecordController { }else{ // 插入主订单 - // map.put("departmenthead",departmentHeadByUser.getId()); +// map.put("departmenthead",departmentHeadByUser.getId()); Integer res = depositoryRecordService.insertApplicationOutRecord(map,userToken); if(res == 1) { for (int i = 0; i < params.size(); i++) { @@ -221,7 +299,7 @@ public class DepositoryRecordController { insert.put("quantity", map.get("quantity" + temp)); insert.put("applyRemark", map.get("applyRemark" + temp)); insert.put("code", map.get("code")); - insert.put("placeId", map.get("placeId" + temp)); + insert.put("placeId", map.get("placeId")); // 获取主订单编号 insert.put("parentId", map.get("id")); // 插入子订单 @@ -254,12 +332,107 @@ public class DepositoryRecordController { return new RestResponse(list,depositoryRecordService.findApplicationInRecordPCountByCondition(map),200); } + // 当前仓库中该用户的子订单详情 + @GetMapping("/ApplicationOutMinByDid") + public RestResponse ApplicationOutMinByDid(@RequestParam Map map, HttpServletRequest request){ + Integer depositoryId =ObjectFormatUtil.toInteger(map.get("depositoryId")); + // 0未完成1已完成 + Integer stateOnView =ObjectFormatUtil.toInteger(map.get("state")); + UserByPort userToken = (UserByPort) request.getAttribute("userToken"); + // 获取当前仓库信息 + Depository depositoryRecordById = depositoryService.findDepositoryRecordById(depositoryId); + // 获取当前用户要处理的记录信息 + String minRecord = (String) redisTemplateForHash.opsForHash().get("user:"+userToken.getId(),"minRecord"); + // 获取子订单键值 + String[] split = minRecord.replace("[","").replace("]","").split(","); + List applicationOutRecordMinList = new ArrayList<>(); + for (int i = 0; i < split.length; i++) { + //获取当前订单状态 + 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)){ + // 如果当前订单未完成 + state = "进行中"; + + }else if("2".equals(state)){ + // 如果当前订单已完成 + state = "已完成"; + } + // 获取子订单编码 + String minRecordId = split[i].split(":")[1]; + // 获取数据库中子订单信息 + ApplicationOutRecordMin applicationOutMinById = depositoryRecordService.findApplicationOutMinById(ObjectFormatUtil.toInteger(minRecordId)); + // 如果该子订单仓库是当前仓库 + if(Integer.compare(applicationOutMinById.getDepositoryId(),depositoryId) == 0){ + // 获取子订单对应主订单 + ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(applicationOutMinById.getParentId()); + // 获取申请人 + UserByPort userByPort = PageController.FindUserById(applicationOutRecordPById.getApplicantId()); + // 创建展示对象 + SimpleApplicationOutMinRecordP simpleApplicationOutMinRecordP = new SimpleApplicationOutMinRecordP(applicationOutMinById); + // 获取申请的物料信息 + Material materialById = materialService.findMaterialById(applicationOutMinById.getMid()); + // 获取当前出库库位 + Place placeByDid = placeService.findPlaceById(applicationOutMinById.getPlaceId()); + simpleApplicationOutMinRecordP.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationOutRecordPById.getApplicantTime()))); + simpleApplicationOutMinRecordP.setApplyRemark(applicationOutRecordPById.getApplyRemark()); + simpleApplicationOutMinRecordP.setDepositoryId(depositoryRecordById.getId()); + simpleApplicationOutMinRecordP.setDepositoryName(depositoryRecordById.getDname()); + simpleApplicationOutMinRecordP.setMname(materialById.getMname()); + simpleApplicationOutMinRecordP.setMcode(materialById.getCode()); + simpleApplicationOutMinRecordP.setApplicantName(userByPort.getName()); + simpleApplicationOutMinRecordP.setCode(applicationOutRecordPById.getCode()); + simpleApplicationOutMinRecordP.setPcode(placeByDid.getCode()); + simpleApplicationOutMinRecordP.setPid(placeByDid.getId()); + simpleApplicationOutMinRecordP.setState(state); + + applicationOutRecordMinList.add(simpleApplicationOutMinRecordP); + } + } + return new RestResponse(applicationOutRecordMinList,applicationOutRecordMinList.size(),200); + } + + // 查看出库申请 @GetMapping("/applicationOutView") public RestResponse findApplicationOutRecordByCondition(@RequestParam Map map){ + // 获取对应主订单 List list = depositoryRecordService.findApplicationOutRecordPByCondition(map); for (int i = 0; i < list.size(); i++) { - list.get(i).setPrice(list.get(i).getPrice() / 100); + ApplicationOutRecordP outRecordP = list.get(i); + // 根据主订单获取所有子订单 + List applicationOutMinByParentId = depositoryRecordService.findApplicationOutMinByParentId(outRecordP.getId()); + StringBuilder mname = new StringBuilder(); + StringBuilder mcode = new StringBuilder(); + StringBuilder depositoryName = new StringBuilder(); + Integer sumQuantity = 0; + Double sumPrice = 0.0; + for (int j = 0; j < applicationOutMinByParentId.size(); j++) { + // 获取子订单信息 + ApplicationOutRecordMin applicationOutRecordMin = applicationOutMinByParentId.get(j); + // 获取出库物料信息 + Material materialById = materialService.findMaterialById(applicationOutRecordMin.getMid()); + // 获取出库物料仓库信息 + Depository depository = depositoryService.findDepositoryRecordById(applicationOutRecordMin.getDepositoryId()); + mname.append(materialById.getMname()).append(","); + mcode.append(materialById.getCode()).append(","); + depositoryName.append(depository.getDname()).append(","); + sumQuantity += applicationOutRecordMin.getQuantity(); + sumPrice += (materialById.getPrice() / 100); + } + list.get(i).setMcode(mcode.toString()); + list.get(i).setMname(mname.toString()); + list.get(i).setDepositoryName(depositoryName.toString()); + list.get(i).setQuantity(sumQuantity); + list.get(i).setPrice(sumPrice); + } return new RestResponse(list,depositoryRecordService.findApplicationOutRecordPCountByCondition(map),200); } @@ -289,18 +462,20 @@ public class DepositoryRecordController { UserByPort userToken= (UserByPort) request.getAttribute("userToken"); List mids = (List) map.get("mids"); List depositoryIds = (List) map.get("depositoryIds"); + List placeCodes = (List) map.get("placeCodes"); List nowmids = redisTemplate.opsForList().range("mids"+userToken.getId(), 0, -1); - List nowdepositoryIds = redisTemplate.opsForList().range("depositoryIds"+userToken.getId(), 0, -1); for (int i = 0; i < mids.size(); i++) { if(nowmids.contains(mids.get(i))){ continue; } redisTemplate.opsForList().leftPush("mids"+userToken.getId(), mids.get(i)); redisTemplate.opsForList().leftPush("depositoryIds"+userToken.getId(), depositoryIds.get(i)); + redisTemplate.opsForList().leftPush("placeCodes"+userToken.getId(), placeCodes.get(i)); } redisTemplate.expire("mids"+userToken.getId(),24 * 60 * 60, TimeUnit.SECONDS); redisTemplate.expire("depositoryIds"+userToken.getId(),24 * 60 * 60, TimeUnit.SECONDS); + redisTemplate.expire("placeCodes"+userToken.getId(),24 * 60 * 60, TimeUnit.SECONDS); return CrudUtil.postHandle(1,1); } @@ -420,14 +595,22 @@ public class DepositoryRecordController { } List list = new ArrayList<>(); for (int i = start; i < end; i++) { + // 获取物料编号 Integer mid =ObjectFormatUtil.toInteger(redisTemplate.opsForList().index("mids"+userToken.getId(),i)); + // 获取仓库编号 Integer depositoryId =ObjectFormatUtil.toInteger(redisTemplate.opsForList().index("depositoryIds"+userToken.getId(),i)); + // 获取库位编码 + String placeCode =(String)(redisTemplate.opsForList().index("placeCodes"+userToken.getId(),i)); + // 获取物料信息 Material materialById = materialService.findMaterialById(mid); + // 获取仓库信息 Depository depositoryRecordById = depositoryService.findDepositoryRecordById(depositoryId); + ApplicationModel ap = new ApplicationModel(); ap.setDepositoryId(depositoryId); ap.setDepositoryName(depositoryRecordById.getDname()); ap.setMid(mid); + ap.setPlaceCode(placeCode); ap.setVersion(materialById.getVersion()); ap.setMname(materialById.getMname()); ap.setCode(materialById.getCode()); @@ -457,9 +640,19 @@ public class DepositoryRecordController { if("in".equals(type)){ success += depositoryRecordService.applicationIn(map); }else if("out".equals(type)){ - UserByPort departmentHeadByUser = findDepartmentHeadByUser(userToken); - map.put("departmenthead",departmentHeadByUser.getId()); - success += depositoryRecordService.insertApplicationOutRecord(map,userToken); + // 获取部门负责人 +// UserByPort departmentHeadByUser = findDepartmentHeadByUser(userToken); +// map.put("departmenthead",departmentHeadByUser.getId()); + Integer res = depositoryRecordService.insertApplicationOutRecord(map,userToken); // 插入主订单 + if(res == 1){ // 如果插入成功 + Object id = map.get("id"); // 获取主订单编号 + if(id != null){ + map.remove("id"); + map.put("parentId",id); + } + success += depositoryRecordService.insertApplicationOutMin(map); + } + } if(success == 0){ return new RestResponse("",666,new StatusInfo("申请失败","超出最大存储容量")); @@ -476,24 +669,53 @@ public class DepositoryRecordController { @PostMapping("/createMultiApplications") public RestResponse createMultiApplications(@RequestBody Map map,HttpServletRequest request){ UserByPort userToken= (UserByPort) request.getAttribute("userToken"); + // 获取要处理的类型 String type = (String) map.get("type"); Integer success = 0; List mids = (List) map.get("mids"); List depositoryIds = (List) map.get("depositoryIds"); List quantitys = (List) map.get("quantitys"); + List placeCodes = (List) map.get("placeCodes"); List applyRemarks = (List) map.get("applyRemarks"); List prices = (List) map.get("prices"); + String errMsg = ""; + Integer id = 0; if("in".equals(type)){ for (int i = 0; i < mids.size(); i++) { - Integer mid = mids.get(i); + // 获取库位 + String placeCode = placeCodes.get(i); + // 获取当前仓库编号 Integer depositoryId = depositoryIds.get(i); - String price = prices.get(i).toString(); + // 获取当前申请数量 Integer integer = ObjectFormatUtil.toInteger(quantitys.get(i)); String quantity = integer.toString(); + // 获取每个库位编码 + String[] s = placeCode.split(" "); + // 先定义最终要使用的库位,默认是默认库位 + Integer place = 0; + if(s.length > 1){ + // 获取当前仓库所有库位 + List placeByDid = placeService.findPlaceByDid(depositoryId); + // 遍历当前物料存储的库位 + for (int j = 0; j < s.length; j++) { + Place place1 = placeByDid.get(j); + if(placeCode.equals(place1.getCode())){ + // 如果当前物料存放在当前库位 + if(place1.getMax() - place1.getQuantity() >= integer){ + // 如果当前库位能够存放当前数量 + place = place1.getId(); + } + } + } + } + + Integer mid = mids.get(i); + String price = prices.get(i).toString(); String applyRemark = applyRemarks.get(i); Map inRecord = new HashMap<>(); inRecord.put("applicantId",userToken.getId()); inRecord.put("mid",mid); + inRecord.put("placeId",place); inRecord.put("depositoryId",depositoryId); inRecord.put("quantity",quantity); inRecord.put("price",price); @@ -501,27 +723,113 @@ public class DepositoryRecordController { success += depositoryRecordService.applicationIn(inRecord); } }else if("out".equals(type)){ + Map mainRecord = new HashMap<>(); + Integer sumQuantity = 0; + for (int i = 0; i < quantitys.size(); i++) { + Integer integer = ObjectFormatUtil.toInteger(quantitys.get(i)); + sumQuantity += integer; + } + // 获取部门负责人 +// UserByPort departmentHeadByUser = findDepartmentHeadByUser(userToken); + mainRecord.put("applicantId",userToken.getId()); + mainRecord.put("applyRemark",""); + mainRecord.put("quantity",sumQuantity.toString()); +// mainRecord.put("departmenthead",departmentHeadByUser.getId()); + // 插入主表 + depositoryRecordService.insertApplicationOutRecord(mainRecord,userToken); + id = ObjectFormatUtil.toInteger(mainRecord.get("id")); for (int i = 0; i < mids.size(); i++) { Integer mid = mids.get(i); Integer integer = ObjectFormatUtil.toInteger(quantitys.get(i)); + // 获取当前仓库编号 + Integer depositoryId = depositoryIds.get(i); String quantity = integer.toString(); - String applyRemark = applyRemarks.get(i); - Map outRecord = new HashMap<>(); - outRecord.put("quantity",quantity); - outRecord.put("mid",mid); - outRecord.put("applicantId",userToken.getId()); - outRecord.put("applyRemark",applyRemark); - UserByPort departmentHeadByUser = findDepartmentHeadByUser(userToken); - outRecord.put("departmenthead",departmentHeadByUser.getId()); - success += depositoryRecordService.insertApplicationOutRecord(outRecord,userToken); + // 获取库位 + String placeCode = placeCodes.get(i); + // 获取每个库位编码 + String[] s = placeCode.split(" "); + Integer place = 0; + // 用于标志该库位是否可以出库 + Boolean flag = false; + if(s.length > 1){ + // 获取当前仓库所有库位 + List placeByDid = placeService.findPlaceByDid(depositoryId); + // 遍历当前物料存储的库位 + for (int j = 1; j < s.length; j++) { + // 获取当前库位 + for (int k = 0; k < placeByDid.size(); k++) { + Place place1 = placeByDid.get(k); + if(s[j].equals(place1.getCode())){ + // 如果当前物料存放在当前库位 + // 获取当前物料在当前库位中的数目 + Integer quantityByMidAndPid = placeService.findQuantityByMidAndPid(mid, place1.getId()); + if(quantityByMidAndPid > integer){ + // 如果可以出库 + place = place1.getId(); + flag = true; + break; + } + } + } + + } + } + if(Integer.compare(0,place) == 0){ + // 如果当前库位是默认库位 + Integer quantityByMidAndPid = placeService.findQuantityByMidAndPid(mid, 0); + if(quantityByMidAndPid > integer){ + // 如果默认库位中该物料数量可以出库 + flag = true; + } + } + if(flag) { + String applyRemark = applyRemarks.get(i); + Map outRecord = new HashMap<>(); + outRecord.put("quantity", quantity); + outRecord.put("mid", mid); + outRecord.put("parentId", mainRecord.get("id")); + outRecord.put("code", mainRecord.get("code")); + outRecord.put("placeId",place); + success += depositoryRecordService.insertApplicationOutMin(outRecord); + }else{ + // 获取失败的物料信息 + Material materialById = materialService.findMaterialById(mid); + // 获取失败的仓库信息 + Depository depositoryRecordById = depositoryService.findDepositoryRecordById(depositoryId); + errMsg += materialById.getMname() + "在"+depositoryRecordById.getDname()+"出库数量为"+quantity +"失败,数量不足;"; + } } } if(success == 0){ + depositoryRecordService.deleteApplicationOutRecordById(1); return new RestResponse("",666,new StatusInfo("申请失败","超出最大存储容量")); } + if(success < mids.size()){ + // 如果申请成功数量小于申请数量 + return new RestResponse(errMsg,1234,new StatusInfo("出库失败","数量不足")); + } return CrudUtil.postHandle(success,mids.size()); } + // 确认将物料出库 + @PostMapping("/isCheckOut") + public RestResponse isCheckOut(@RequestBody Map map,HttpServletRequest request){ + UserByPort userToken = (UserByPort) request.getAttribute("userToken"); + Integer placeId =ObjectFormatUtil.toInteger(map.get("placeId")); + if(placeId == null){ + // 如果是仓库,则使用默认库位 + map.put("placeId",0); + } + Integer integer = depositoryRecordService.completeApplicationOutMinRecord(map, userToken); + if(integer == 1){ + return new RestResponse("",200,new StatusInfo("出库成功","出库成功")); + }else{ + return new RestResponse("",500,new StatusInfo("出库失败","出库失败,请联系开发人员")); + } + } + + + /** * 获取当前登录用户的部门负责人 * @param user @@ -556,4 +864,8 @@ public class DepositoryRecordController { + + + + } diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java index 1912d7f4..913b491f 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java @@ -54,6 +54,12 @@ public class MaterialController { return new RestResponse(materialPByCondition,materialService.findCountByCondition(map),200); } + /** + * 查询库存 + * @param map + * @param request + * @return + */ @GetMapping("/findInventory") public RestResponse findInventory(@RequestParam Map map,HttpServletRequest request){ UserByPort userToken= (UserByPort) request.getAttribute("userToken"); @@ -169,9 +175,16 @@ public class MaterialController { return new RestResponse(map,1,200); } + /** + * 根据物料编码获取物料 + * @param map + * @param request + * @return + */ @GetMapping("/findMatrialByCode") public RestResponse findMatrialByCode(@RequestParam Map map,HttpServletRequest request){ UserByPort userToken= (UserByPort) request.getAttribute("userToken"); + // 获取当前部门仓库 List depositoryByAdminorg = depositoryService.findDepositoryByAdminorg(userToken.getMaindeparment().toString()); Map param = new HashMap<>(); String code = map.get("code").toString(); @@ -182,14 +195,16 @@ public class MaterialController { param.put("code",code); List materialPByCondition = new ArrayList<>(); if("out".equals(type)) { + // 如果是出库 for (int i = 0; i < depositoryByAdminorg.size(); i++) { param.put("depositoryId", depositoryByAdminorg.get(i).getId()); + // 查找当前用户部门仓库中是否存在该物料 materialPByCondition = materialService.findInventory(param); if (materialPByCondition.size() > 0) { break; } } - }else{ + }else{ // 如果是入库 materialPByCondition = materialService.findMaterialPByCondition(param); } MaterialP mp = null; @@ -301,7 +316,7 @@ public class MaterialController { if(inventory.size() > 0){ // 如果有库存 for (int j = 0; j < inventory.size(); j++) { MaterialP materialP = inventory.get(j); - if(quantity < materialP.getQuantity()){ // 如果当前数量合适则跳出循环 + if(quantity <= materialP.getQuantity()){ // 如果当前数量合适则跳出循环 flag = true; break; } diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java index 301d55af..35389885 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java @@ -66,6 +66,10 @@ public class PageController { @Autowired private RedisTemplate redisTemplate; + @Autowired + private RedisTemplate redisTemplateForHash; + + public static JSONObject Captcha(){ @@ -888,14 +892,17 @@ public class PageController { param.put("depositoryId",depositoryRecordById.getId()); List placeAndMaterialByPid = placeService.findPlaceAndMaterialByPid(placeById.getId()); StringBuilder mname = new StringBuilder(); + StringBuilder mcodeList = new StringBuilder(); StringBuilder midList = new StringBuilder(); for (int i = 0; i < placeAndMaterialByPid.size(); i++) { Material materialById = materialService.findMaterialById(placeAndMaterialByPid.get(i).getMid()); mname.append(materialById.getMname()).append(", "); midList.append(materialById.getId()).append(","); + mcodeList.append(materialById.getCode()).append(","); } - param.put("mname",mname); - param.put("midList",midList); + param.put("mname",mname.toString()); + param.put("midList",midList.toString()); + param.put("mcodeList",mcodeList.toString()); String context = JSONObject.toJSONString(param); String qrCode = ""; try { @@ -1027,7 +1034,42 @@ public class PageController { public ModelAndView application_review(Integer id) { ModelAndView mv = new ModelAndView(); mv.setViewName("pages/application/application-review"); + // 获取主订单信息 ApplicationOutRecordP recordP = depositoryRecordService.findApplicationOutRecordPById(id); + + // 获取所有子订单 + List applicationOutRecordMinByParent = depositoryRecordService.findApplicationOutRecordMinByParent(recordP.getId()); + // 展示物料名 + StringBuilder mname = new StringBuilder(); + // 展示物料编码 + StringBuilder mcode = new StringBuilder(); + // 展示出库的仓库名 + StringBuilder depositoryName = new StringBuilder(); + // 展示出库的库位编码 + StringBuilder placeCode = new StringBuilder(); + + // 当前订单总数 + Integer sumQuantity = 0; + // 当前总额 + Double sumPrice = 0.0; + for (int i = 0; i < applicationOutRecordMinByParent.size(); i++) { + // 获取子订单信息 + ApplicationOutRecordMin applicationOutRecordMin = applicationOutRecordMinByParent.get(i); + // 获取出库物料信息 + Material materialById = materialService.findMaterialById(applicationOutRecordMin.getMid()); + // 获取出库物料仓库信息 + Depository depository = depositoryService.findDepositoryRecordById(applicationOutRecordMin.getDepositoryId()); + // 获取出库库位 + Place placeById = placeService.findPlaceById(applicationOutRecordMin.getPlaceId()); + if(placeById != null) { + placeCode.append(placeById.getCode()).append(","); + } + mname.append(materialById.getMname()).append(","); + mcode.append(materialById.getCode()).append(","); + depositoryName.append(depository.getDname()).append(","); + sumQuantity += applicationOutRecordMin.getQuantity(); + sumPrice += (materialById.getPrice() / 100); + } // 申请人 UserByPort userByPort = FindUserById(recordP.getApplicantId()); // 部门负责人 @@ -1055,7 +1097,14 @@ public class PageController { recordP.setDepositoryManagerName(depositoryManagerNames); recordP.setApplicantName(userByPort.getName()); recordP.setDepartmentheadName(departmenthead.getName()); - recordP.setPrice(recordP.getPrice() / 100); + recordP.setMcode(mcode.toString()); + recordP.setMname(mname.toString()); + recordP.setDepositoryName(depositoryName.toString()); + recordP.setQuantity(sumQuantity); + recordP.setPrice(sumPrice); + if(recordP.getPrice()!=null) { + recordP.setPrice(recordP.getPrice() / 100); + } mv.addObject("record", recordP); return mv; } @@ -1078,6 +1127,8 @@ public class PageController { return mv; } + + // 跳转到出库详情 @GetMapping("/ApplicationOutView") public ModelAndView ApplicationOutView(Integer id) { ModelAndView mv = new ModelAndView(); @@ -1087,12 +1138,42 @@ public class PageController { ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(id); // 获取出库子单 List applicationOutRecordMinByParent = depositoryRecordService.findApplicationOutRecordMinByParent(applicationOutRecordPById.getId()); - + // 展示物料名 + StringBuilder mname = new StringBuilder(); + // 展示物料编码 + StringBuilder mcode = new StringBuilder(); + // 展示出库的仓库名 + StringBuilder depositoryName = new StringBuilder(); + // 展示出库的库位编码 + StringBuilder placeCode = new StringBuilder(); + + // 当前订单总数 + Integer sumQuantity = 0; + // 当前总额 + Double sumPrice = 0.0; + for (int i = 0; i < applicationOutRecordMinByParent.size(); i++) { + // 获取子订单信息 + ApplicationOutRecordMin applicationOutRecordMin = applicationOutRecordMinByParent.get(i); + // 获取出库物料信息 + Material materialById = materialService.findMaterialById(applicationOutRecordMin.getMid()); + // 获取出库物料仓库信息 + Depository depository = depositoryService.findDepositoryRecordById(applicationOutRecordMin.getDepositoryId()); + // 获取出库库位 + Place placeById = placeService.findPlaceById(applicationOutRecordMin.getPlaceId()); + if(placeById != null) { + placeCode.append(placeById.getCode()).append(","); + } + mname.append(materialById.getMname()).append(","); + mcode.append(materialById.getCode()).append(","); + depositoryName.append(depository.getDname()).append(","); + sumQuantity += applicationOutRecordMin.getQuantity(); + sumPrice += (materialById.getPrice() / 100); + } // 申请人 UserByPort userByPort = FindUserById(applicationOutRecordPById.getApplicantId()); // 部门负责人 UserByPort departmenthead = FindUserById(applicationOutRecordPById.getDepartmenthead()); - // 仓库管理员 + // 仓储中心负责人 String manager = applicationOutRecordPById.getDepositoryManager(); String[] depositoryManagerId = new String[0]; if(manager != null){ @@ -1112,11 +1193,12 @@ public class PageController { applicationOutRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationOutRecordPById.getApplicantTime()))); applicationOutRecordPById.setDepartmentheadTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationOutRecordPById.getDepartmentheadTime()))); applicationOutRecordPById.setDepositoryManagerTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationOutRecordPById.getDepositoryManagerTime()))); - applicationOutRecordPById.setPrice(applicationOutRecordPById.getPrice() / 100); - if(applicationOutRecordPById.getPlaceId()!=null) { - Place placeById = placeService.findPlaceById(applicationOutRecordPById.getPlaceId()); - applicationOutRecordPById.setPCode(placeById.getCode()); - } + applicationOutRecordPById.setPrice(sumPrice); + applicationOutRecordPById.setQuantity(sumQuantity); + applicationOutRecordPById.setMname(mname.toString()); + applicationOutRecordPById.setMcode(mcode.toString()); + applicationOutRecordPById.setDepositoryName(depositoryName.toString()); + applicationOutRecordPById.setPCode(placeCode.toString()); mv.addObject("record", applicationOutRecordPById); } else { throw new MyException("缺少必要参数!"); @@ -1417,6 +1499,7 @@ public class PageController { } + // 跳转到添加权限界面 @GetMapping("/postRoleAdd") public ModelAndView PostRoleAdd(Integer id) { ModelAndView mv = new ModelAndView(); @@ -1428,10 +1511,23 @@ public class PageController { return mv; } + // 跳转到扫码界面 @GetMapping("/scanQrCode") public String scanQrCode(){ return "pages/scanQrCode/ScanQrCode"; } + // 跳转到扫码出库界面 + @GetMapping("/scanQrCodeByOut") + public ModelAndView scanQrCodeByOut(Integer id,HttpServletRequest request){ + ModelAndView mv = new ModelAndView(); + // 获取当前要处理的子订单 + ApplicationOutRecordMin applicationOutMinById = depositoryRecordService.findApplicationOutMinById(id); + mv.setViewName("pages/scanQrCode/scanQrCodeOut"); + Material materialById = materialService.findMaterialById(applicationOutMinById.getMid()); + mv.addObject("materialById",materialById); + mv.addObject("record",applicationOutMinById); + return mv; + } // 获取扫描结果并跳转到入库 @GetMapping("/application_in_scanQrCode") @@ -1482,4 +1578,14 @@ public class PageController { mv.setViewName("pages/application/application-out_scanQrCode"); return mv; } + + // 当前仓库中该用户的子订单详情 + @GetMapping("/ApplicationOutMinByDid") + public ModelAndView ApplicationOutMinByDid(Integer depositoryId,Integer state,HttpServletRequest request){ + ModelAndView mv = new ModelAndView(); + mv.addObject("depositoryId",depositoryId); + mv.addObject("state",state); + mv.setViewName("pages/application/application-out_min"); + return mv; + } } diff --git a/src/main/java/com/dreamchaser/depository_manage/entity/ApplicationOutRecordMin.java b/src/main/java/com/dreamchaser/depository_manage/entity/ApplicationOutRecordMin.java index 1cbae241..c8f8f29b 100644 --- a/src/main/java/com/dreamchaser/depository_manage/entity/ApplicationOutRecordMin.java +++ b/src/main/java/com/dreamchaser/depository_manage/entity/ApplicationOutRecordMin.java @@ -44,4 +44,9 @@ public class ApplicationOutRecordMin { */ private Integer parentId; + /** + * 子订单状态(1未完成,2完成) + */ + private Integer state; + } diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java b/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java index d31186fe..cda39ec5 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java @@ -306,4 +306,25 @@ public interface DepositoryRecordMapper { * @return */ List findApplicationOutRecordMinByParent(Integer parentId); + + /** + * 修改子表记录 + * @param map + * @return + */ + Integer updateApplicationOutRecordMin(Map map); + + + /** + * 修改子表记录 + * @param applicationOutRecordMin + * @return + */ + Integer updateApplicationOutRecordMin(ApplicationOutRecordMin applicationOutRecordMin); + /** + * 根据条件获取子订单 + * @param map + * @return + */ + List findApplicationOutMinByCondition(Map map); } diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml b/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml index 345d64fe..21c0bf9d 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml @@ -97,7 +97,7 @@ - + @@ -600,12 +600,10 @@ insert into application_out_record - (id,mid,depository_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,transferId,placeId) + (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,transferId,placeId,pass) values( #{id}, - #{mid}, - #{depositoryId}, #{applicantId}, #{applicantTime}, #{code}, @@ -644,7 +642,8 @@ #{state}, #{istransfer}, #{transferId}, - #{placeId} + #{placeId}, + #{pass} ) @@ -673,6 +672,35 @@ + + + + + + +
+ + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/pages/application/application-review.html b/src/main/resources/templates/pages/application/application-review.html index fd28a5a7..046ed4c9 100644 --- a/src/main/resources/templates/pages/application/application-review.html +++ b/src/main/resources/templates/pages/application/application-review.html @@ -54,6 +54,7 @@ 状态 状态 + 申请人 @@ -81,8 +82,8 @@ 1970-01-01 08:00:00 - 仓库管理员 - 仓库管理员 + 仓储负责人 + 仓储负责人 @@ -159,6 +160,7 @@ step = layui.step; var state=$("#state").text(); + var pass = $("#pass").text(); //当前处于的状态 var position=0,states={},number = 1; if (state === "待部门负责人审核" || state === "部门负责人审核未通过") { @@ -166,9 +168,21 @@ states = [ {title: state}]; number = 2; } else { - // {title: "提交申请"}, - states = [ {title: state}]; - number = 3; + if(state === "待仓储中心负责人审核"|| state === "仓储中心负责人审核未通过"){ + states = [ {title: state}]; + number = 3; + }else{ + if(pass === 1 || pass === "1"){ + number = 4; + states = [{title:"已出库"}] + }else if(pass === 3 || pass === "3"){ + number = 4; + states = [{title:"出库中"}] + }else if(pass === 2 || pass === "2"){ + number = 4; + states = [{title:"未出库"}] + } + } } step.render({ elem: '#stepForm', @@ -199,7 +213,7 @@ } data.departmentheadMessage=$("#departmentheadMessageF").val(); send(data); - } + }; check=function(pass) { let data={}; data.id=$("#id").text(); @@ -210,9 +224,8 @@ } data.depositoryManagerMessage=$("#depositoryManagerMessageF").val(); send(data); - } + }; function send(req) { - console.log(JSON.stringify(req)); $.ajax({ url:"/depositoryRecord/review", type:'put', diff --git a/src/main/resources/templates/pages/application/application_multi.html b/src/main/resources/templates/pages/application/application_multi.html index 397f1135..c0e7cc11 100644 --- a/src/main/resources/templates/pages/application/application_multi.html +++ b/src/main/resources/templates/pages/application/application_multi.html @@ -68,6 +68,7 @@ {field: 'version', width: '10%', title: '规格型号'}, {field: 'code',width: 200,title: '存货编码',sort: true}, {field: 'depositoryName', width: '12%', title: '仓库名称'}, + {field: 'placeCode', width: '12%', title: '库位编码'}, {field: 'quantity', width: '10%', title: '数量',edit:'quantity'}, {field: 'price', width: '10%', title: '单价',edit:'price'}, {field: 'depositoryId', width: '10%', title: '仓库编号',edit:'quantity'}, @@ -107,15 +108,19 @@ req.quantitys = []; req.applyRemarks = []; req.prices = []; + req.placeCodes = []; for (i = 0, len = data.length; i < len; i++) { req.mids[i] = data[i].mid; req.depositoryIds[i] = data[i].depositoryId; req.quantitys[i] = data[i].quantity; req.applyRemarks[i] = data[i].applyRemark; req.prices[i] = data[i].price; + req.placeCodes[i] = data[i].placeCode; } + if(obj.event==='delete'){ - if(req.mids > 0) { + console.log(req) + if(req.mids.length > 0) { layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { $.ajax({ url: "/depositoryRecord/deleteApplicationToRedis", @@ -186,7 +191,11 @@ if (d.status >= 300) { layer.msg(d.statusInfo.message);//失败的表情 return; - } else { + }else if(d.status === 1234){ + layer.msg(d.data) + return + } + else { layer.msg("申请成功!", { icon: 6,//成功的表情 time: 1000 diff --git a/src/main/resources/templates/pages/application/form-step-look_back.html b/src/main/resources/templates/pages/application/form-step-look_back.html index bc1b3f34..45ccab5b 100644 --- a/src/main/resources/templates/pages/application/form-step-look_back.html +++ b/src/main/resources/templates/pages/application/form-step-look_back.html @@ -53,6 +53,7 @@ 状态 2016-11-28 + 申请人 @@ -80,15 +81,15 @@ 2016-11-28 - 仓库管理员 - 2016-11-28 + 仓储负责人 + 仓储负责人 - 仓库管理员备注 + 仓储负责人备注 2016-11-28 - 仓库管理员审核时间 + 仓储负责人审核时间 2016-11-28 @@ -121,6 +122,7 @@ var state=$("#state").text(); + var pass=$("#pass").text(); //当前处于的状态 var position=0,states={},number = 1; @@ -128,8 +130,22 @@ states = [ {title: state}]; number = 2; } else { - states = [ {title: state}]; - number = 3; + if(state === "待仓储中心负责人审核"|| state === "仓储中心负责人审核未通过"){ + states = [ {title: state}]; + number = 3; + }else{ + if(pass === 1 || pass === "1"){ + number = 4; + states = [{title:"已出库"}] + }else if(pass === 3 || pass === "3"){ + number = 4; + states = [{title:"出库中"}] + }else if(pass === 2 || pass === "2"){ + number = 4; + states = [{title:"未出库"}] + } + } + } step.render({ elem: '#stepForm', diff --git a/src/main/resources/templates/pages/application/my-task.html b/src/main/resources/templates/pages/application/my-task.html index cbb45278..8b4e6885 100644 --- a/src/main/resources/templates/pages/application/my-task.html +++ b/src/main/resources/templates/pages/application/my-task.html @@ -28,13 +28,27 @@
未完成任务
+
+ 审核任务 +
    +
    + 出库任务 +
    +
      已完成任务
      +
      + 审核任务 +
        +
        + 出库任务 +
        +
          @@ -51,6 +65,13 @@ //先声明 function openDetail2(data) { }; + + //先声明 + function openDetail3(data) { + }; + //先声明 + function openDetail4(data) { + }; layui.use(['flow', 'layer', 'table', 'util'], function () { var $ = layui.jquery, layer = layui.layer, @@ -77,7 +98,7 @@ } lis.push('
        • ' - +result[i].applicantName+'的') + +result[i].applicantName+'的'); lis.push('出库请求

          '); lis.push('
          ' +result[i].applicantTime+'
        • '); @@ -124,7 +145,73 @@ }); } }); + flow.load({ + elem: '#LAY_floor3' //流加载容器 + ,scrollElem: '#LAY_floor3' //滚动条所在元素,一般不用填,此处只是演示需要。 + ,isAuto:false + ,done: function(page, next){ //执行下一页的回调 + let lis = []; + let result; + $.get('/depositoryRecord/myTashForScanQrCode?page='+page+'&size='+size+'&isDone=0', function(res){ + var Width = "25%"; + result=res.data; + const keys = Object.keys(result); // 获取map中所有的键 + + lis.push("
          "); + for (let i = 0; i < keys.length; i++) { + if(isMobile()){ + Width = "50%"; + } + lis.push('
        • ' + +result[keys[i]][0].depositoryName+'

          ') + lis.push('
          ' + +result[keys[i]][0].applicantTime+'
        • '); + + } + + lis.push("
          ") + pre2+=result.length; + //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页 + //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多 + next(lis.join(''), pre2 < res.count); + }); + } + }); + flow.load({ + elem: '#LAY_floor4' //流加载容器 + ,scrollElem: '#LAY_floor4' //滚动条所在元素,一般不用填,此处只是演示需要。 + ,isAuto:false + ,done: function(page, next){ //执行下一页的回调 + let lis = []; + let result; + $.get('/depositoryRecord/myTashForScanQrCode?page='+page+'&size='+size+'&isDone=1', function(res){ + var Width = "25%"; + result=res.data; + const keys = Object.keys(result); // 获取map中所有的键 + + lis.push("
          "); + for (let i = 0; i < keys.length; i++) { + if(isMobile()){ + Width = "50%"; + } + lis.push('
        • ' + +result[keys[i]][0].depositoryName+'

          ') + lis.push('
          ' + +result[keys[i]][0].applicantTime+'
        • '); + + } + + lis.push("
          ") + pre2+=result.length; + //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页 + //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多 + next(lis.join(''), pre2 < res.count); + }); + } + }); openDetail1 = function (item) { var index = layer.open({ title: '请求详情', @@ -142,7 +229,7 @@ $(window).on("resize", function () { layer.full(index); }); - } + }; openDetail2 = function (item) { var index = layer.open({ title: '请求详情', @@ -159,7 +246,42 @@ $(window).on("resize", function () { layer.full(index); }); - } + }; + openDetail3 = function (item) { + var index = layer.open({ + title: '请求详情', + type: 2, + shade: 0.2, + maxmin: true, + shadeClose: true, + area: ['100%', '100%'], + content: '/ApplicationOutMinByDid?depositoryId='+item+"&state=0", + end:function () { + location.reload() + } + }); + $(window).on("resize", function () { + layer.full(index); + }); + }; + + openDetail4 = function (item) { + var index = layer.open({ + title: '请求详情', + type: 2, + shade: 0.2, + maxmin: true, + shadeClose: true, + area: ['100%', '100%'], + content: '/ApplicationOutMinByDid?depositoryId='+item+"&state=1", + end:function () { + location.reload() + } + }); + $(window).on("resize", function () { + layer.full(index); + }); + }; //定义一个函数判断是手机端还是pc端 function isMobile(){ diff --git a/src/main/resources/templates/pages/depository/table-in.html b/src/main/resources/templates/pages/depository/table-in.html index cf14d2dc..bd1d84e1 100644 --- a/src/main/resources/templates/pages/depository/table-in.html +++ b/src/main/resources/templates/pages/depository/table-in.html @@ -142,7 +142,10 @@ limits: [10, 15, 20, 25, 50], limit: 10, page: true, - skin: 'line' + skin: 'line', + done:function () { + $("[data-field='id']").css('display','none'); + } }); // 监听搜索操作 diff --git a/src/main/resources/templates/pages/depository/table-out.html b/src/main/resources/templates/pages/depository/table-out.html index 5029ac62..9be7d8bf 100644 --- a/src/main/resources/templates/pages/depository/table-out.html +++ b/src/main/resources/templates/pages/depository/table-out.html @@ -135,10 +135,19 @@ {field: 'quantity', width: 80, title: '数量', sort: true}, {field: 'price', title: '金额', minWidth: 80, sort: true}, {field: 'state', width: 150, title: '流程状态'}, + { + field: 'pass', title: '是否完成出库', minWidth: 120, templet: function (d) { + if (d.pass == 1){ + return "是"; + }else{ + return "否"; + } + } + }, {field: 'applicantName', width: 150, title: '申请人'}, {field: 'applicantTime', width: 200, title: '申请时间', sort: true}, { - field: 'istransfer', title: '是否为转移申请', minWidth: 80, templet: function (d) { + field: 'istransfer', title: '是否为转移申请', minWidth: 120, templet: function (d) { if (d.istransfer == 1){ return "是"; }else if(d.istransfer == 2){ diff --git a/src/main/resources/templates/pages/depository/table-stock.html b/src/main/resources/templates/pages/depository/table-stock.html index 177c9d21..a8f1556e 100644 --- a/src/main/resources/templates/pages/depository/table-stock.html +++ b/src/main/resources/templates/pages/depository/table-stock.html @@ -179,9 +179,11 @@ var req = {}; req.mids = []; req.depositoryIds = []; + req.placeCodes = []; for (i = 0, len = data.length; i < len; i++) { req.mids[i] = data[i].id; req.depositoryIds[i] = data[i].depositoryId; + req.placeCodes[i] = data[i].placeCode; } if(req.mids.length > 0) { $.ajax({ diff --git a/src/main/resources/templates/pages/material/material-out.html b/src/main/resources/templates/pages/material/material-out.html index e246f01c..ddb2dd9b 100644 --- a/src/main/resources/templates/pages/material/material-out.html +++ b/src/main/resources/templates/pages/material/material-out.html @@ -46,6 +46,12 @@ +
          + +
          + +
          +
          @@ -198,6 +204,9 @@ if(data.state != ''){ req.state = data.state; } + if(data.code != ''){ + req.code = data.code + } //执行搜索重载 table.reload('currentTableId', { diff --git a/src/main/resources/templates/pages/material/selectType.html b/src/main/resources/templates/pages/material/selectType.html index 6b09ae84..bb2a8c74 100644 --- a/src/main/resources/templates/pages/material/selectType.html +++ b/src/main/resources/templates/pages/material/selectType.html @@ -36,7 +36,6 @@ contentType: "application/json;charset=utf-8", success: function (d) { var data2 = d.data - console.log(data2) test.reload({ data:data2 }); diff --git a/src/main/resources/templates/pages/place/place_edit.html b/src/main/resources/templates/pages/place/place_edit.html index 8093b00b..65855dc4 100644 --- a/src/main/resources/templates/pages/place/place_edit.html +++ b/src/main/resources/templates/pages/place/place_edit.html @@ -92,7 +92,6 @@ layer = layui.layer; var depositoryId = $("#depositoryId").val(); - console.log(depositoryId); form.on('submit(formStep)', function (data) { var req = data.field; req.type = "one"; diff --git a/src/main/resources/templates/pages/post/postRole_add.html b/src/main/resources/templates/pages/post/postRole_add.html index c45db8ac..9e89cbd0 100644 --- a/src/main/resources/templates/pages/post/postRole_add.html +++ b/src/main/resources/templates/pages/post/postRole_add.html @@ -96,7 +96,6 @@ success: function (data) { layer.close(this.layerIndex); if (data.status >= 300) { - console.log(data) layer.msg(data.statusInfo.message,{ icon: 7, time: 200 diff --git a/src/main/resources/templates/pages/scanQrCode/scanQrCodeOut.html b/src/main/resources/templates/pages/scanQrCode/scanQrCodeOut.html index 58d155a9..51ce9d06 100644 --- a/src/main/resources/templates/pages/scanQrCode/scanQrCodeOut.html +++ b/src/main/resources/templates/pages/scanQrCode/scanQrCodeOut.html @@ -47,6 +47,10 @@
          + + + +
          Long validation in progress... @@ -56,7 +60,10 @@ diff --git a/src/test/java/com/dreamchaser/depository_manage/Test.java b/src/test/java/com/dreamchaser/depository_manage/Test.java index a7e3fb96..1c28d65c 100644 --- a/src/test/java/com/dreamchaser/depository_manage/Test.java +++ b/src/test/java/com/dreamchaser/depository_manage/Test.java @@ -27,13 +27,19 @@ import javax.swing.*; import java.util.*; import java.util.concurrent.TimeUnit; - +@SpringBootTest +@RunWith(SpringRunner.class) public class Test { + @Autowired + RedisTemplate redisTemplate; @org.junit.Test public void test1(){ - System.out.println(DateUtil.TimeStampToDateTime(Long.valueOf("1664035200000"))); + StringBuilder code = new StringBuilder("GKQGB20221013000000004"); + int qgb = code.indexOf("QGB"); + + System.out.println(code.replace(qgb,qgb+"QGB".length(),"CS")); } diff --git a/target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml b/target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml index 345d64fe..21c0bf9d 100644 --- a/target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml +++ b/target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml @@ -97,7 +97,7 @@ - + @@ -600,12 +600,10 @@ insert into application_out_record - (id,mid,depository_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,transferId,placeId) + (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,transferId,placeId,pass) values( #{id}, - #{mid}, - #{depositoryId}, #{applicantId}, #{applicantTime}, #{code}, @@ -644,7 +642,8 @@ #{state}, #{istransfer}, #{transferId}, - #{placeId} + #{placeId}, + #{pass} ) @@ -673,6 +672,35 @@ + + + + + + +
          +
          +
          + + + + + + + \ No newline at end of file diff --git a/target/classes/templates/pages/application/application-review.html b/target/classes/templates/pages/application/application-review.html index fd28a5a7..046ed4c9 100644 --- a/target/classes/templates/pages/application/application-review.html +++ b/target/classes/templates/pages/application/application-review.html @@ -54,6 +54,7 @@ 状态 状态 + 申请人 @@ -81,8 +82,8 @@ 1970-01-01 08:00:00 - 仓库管理员 - 仓库管理员 + 仓储负责人 + 仓储负责人 @@ -159,6 +160,7 @@ step = layui.step; var state=$("#state").text(); + var pass = $("#pass").text(); //当前处于的状态 var position=0,states={},number = 1; if (state === "待部门负责人审核" || state === "部门负责人审核未通过") { @@ -166,9 +168,21 @@ states = [ {title: state}]; number = 2; } else { - // {title: "提交申请"}, - states = [ {title: state}]; - number = 3; + if(state === "待仓储中心负责人审核"|| state === "仓储中心负责人审核未通过"){ + states = [ {title: state}]; + number = 3; + }else{ + if(pass === 1 || pass === "1"){ + number = 4; + states = [{title:"已出库"}] + }else if(pass === 3 || pass === "3"){ + number = 4; + states = [{title:"出库中"}] + }else if(pass === 2 || pass === "2"){ + number = 4; + states = [{title:"未出库"}] + } + } } step.render({ elem: '#stepForm', @@ -199,7 +213,7 @@ } data.departmentheadMessage=$("#departmentheadMessageF").val(); send(data); - } + }; check=function(pass) { let data={}; data.id=$("#id").text(); @@ -210,9 +224,8 @@ } data.depositoryManagerMessage=$("#depositoryManagerMessageF").val(); send(data); - } + }; function send(req) { - console.log(JSON.stringify(req)); $.ajax({ url:"/depositoryRecord/review", type:'put', diff --git a/target/classes/templates/pages/application/application_multi.html b/target/classes/templates/pages/application/application_multi.html index 397f1135..c0e7cc11 100644 --- a/target/classes/templates/pages/application/application_multi.html +++ b/target/classes/templates/pages/application/application_multi.html @@ -68,6 +68,7 @@ {field: 'version', width: '10%', title: '规格型号'}, {field: 'code',width: 200,title: '存货编码',sort: true}, {field: 'depositoryName', width: '12%', title: '仓库名称'}, + {field: 'placeCode', width: '12%', title: '库位编码'}, {field: 'quantity', width: '10%', title: '数量',edit:'quantity'}, {field: 'price', width: '10%', title: '单价',edit:'price'}, {field: 'depositoryId', width: '10%', title: '仓库编号',edit:'quantity'}, @@ -107,15 +108,19 @@ req.quantitys = []; req.applyRemarks = []; req.prices = []; + req.placeCodes = []; for (i = 0, len = data.length; i < len; i++) { req.mids[i] = data[i].mid; req.depositoryIds[i] = data[i].depositoryId; req.quantitys[i] = data[i].quantity; req.applyRemarks[i] = data[i].applyRemark; req.prices[i] = data[i].price; + req.placeCodes[i] = data[i].placeCode; } + if(obj.event==='delete'){ - if(req.mids > 0) { + console.log(req) + if(req.mids.length > 0) { layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { $.ajax({ url: "/depositoryRecord/deleteApplicationToRedis", @@ -186,7 +191,11 @@ if (d.status >= 300) { layer.msg(d.statusInfo.message);//失败的表情 return; - } else { + }else if(d.status === 1234){ + layer.msg(d.data) + return + } + else { layer.msg("申请成功!", { icon: 6,//成功的表情 time: 1000 diff --git a/target/classes/templates/pages/application/form-step-look_back.html b/target/classes/templates/pages/application/form-step-look_back.html index bc1b3f34..45ccab5b 100644 --- a/target/classes/templates/pages/application/form-step-look_back.html +++ b/target/classes/templates/pages/application/form-step-look_back.html @@ -53,6 +53,7 @@ 状态 2016-11-28 + 申请人 @@ -80,15 +81,15 @@ 2016-11-28 - 仓库管理员 - 2016-11-28 + 仓储负责人 + 仓储负责人 - 仓库管理员备注 + 仓储负责人备注 2016-11-28 - 仓库管理员审核时间 + 仓储负责人审核时间 2016-11-28 @@ -121,6 +122,7 @@ var state=$("#state").text(); + var pass=$("#pass").text(); //当前处于的状态 var position=0,states={},number = 1; @@ -128,8 +130,22 @@ states = [ {title: state}]; number = 2; } else { - states = [ {title: state}]; - number = 3; + if(state === "待仓储中心负责人审核"|| state === "仓储中心负责人审核未通过"){ + states = [ {title: state}]; + number = 3; + }else{ + if(pass === 1 || pass === "1"){ + number = 4; + states = [{title:"已出库"}] + }else if(pass === 3 || pass === "3"){ + number = 4; + states = [{title:"出库中"}] + }else if(pass === 2 || pass === "2"){ + number = 4; + states = [{title:"未出库"}] + } + } + } step.render({ elem: '#stepForm', diff --git a/target/classes/templates/pages/application/my-task.html b/target/classes/templates/pages/application/my-task.html index cbb45278..8b4e6885 100644 --- a/target/classes/templates/pages/application/my-task.html +++ b/target/classes/templates/pages/application/my-task.html @@ -28,13 +28,27 @@
          未完成任务
          +
          + 审核任务 +
            +
            + 出库任务 +
            +
              已完成任务
              +
              + 审核任务 +
                +
                + 出库任务 +
                +
                  @@ -51,6 +65,13 @@ //先声明 function openDetail2(data) { }; + + //先声明 + function openDetail3(data) { + }; + //先声明 + function openDetail4(data) { + }; layui.use(['flow', 'layer', 'table', 'util'], function () { var $ = layui.jquery, layer = layui.layer, @@ -77,7 +98,7 @@ } lis.push('
                • ' - +result[i].applicantName+'的') + +result[i].applicantName+'的'); lis.push('出库请求

                  '); lis.push('
                  ' +result[i].applicantTime+'
                • '); @@ -124,7 +145,73 @@ }); } }); + flow.load({ + elem: '#LAY_floor3' //流加载容器 + ,scrollElem: '#LAY_floor3' //滚动条所在元素,一般不用填,此处只是演示需要。 + ,isAuto:false + ,done: function(page, next){ //执行下一页的回调 + let lis = []; + let result; + $.get('/depositoryRecord/myTashForScanQrCode?page='+page+'&size='+size+'&isDone=0', function(res){ + var Width = "25%"; + result=res.data; + const keys = Object.keys(result); // 获取map中所有的键 + + lis.push("
                  "); + for (let i = 0; i < keys.length; i++) { + if(isMobile()){ + Width = "50%"; + } + lis.push('
                • ' + +result[keys[i]][0].depositoryName+'

                  ') + lis.push('
                  ' + +result[keys[i]][0].applicantTime+'
                • '); + + } + + lis.push("
                  ") + pre2+=result.length; + //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页 + //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多 + next(lis.join(''), pre2 < res.count); + }); + } + }); + flow.load({ + elem: '#LAY_floor4' //流加载容器 + ,scrollElem: '#LAY_floor4' //滚动条所在元素,一般不用填,此处只是演示需要。 + ,isAuto:false + ,done: function(page, next){ //执行下一页的回调 + let lis = []; + let result; + $.get('/depositoryRecord/myTashForScanQrCode?page='+page+'&size='+size+'&isDone=1', function(res){ + var Width = "25%"; + result=res.data; + const keys = Object.keys(result); // 获取map中所有的键 + + lis.push("
                  "); + for (let i = 0; i < keys.length; i++) { + if(isMobile()){ + Width = "50%"; + } + lis.push('
                • ' + +result[keys[i]][0].depositoryName+'

                  ') + lis.push('
                  ' + +result[keys[i]][0].applicantTime+'
                • '); + + } + + lis.push("
                  ") + pre2+=result.length; + //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页 + //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多 + next(lis.join(''), pre2 < res.count); + }); + } + }); openDetail1 = function (item) { var index = layer.open({ title: '请求详情', @@ -142,7 +229,7 @@ $(window).on("resize", function () { layer.full(index); }); - } + }; openDetail2 = function (item) { var index = layer.open({ title: '请求详情', @@ -159,7 +246,42 @@ $(window).on("resize", function () { layer.full(index); }); - } + }; + openDetail3 = function (item) { + var index = layer.open({ + title: '请求详情', + type: 2, + shade: 0.2, + maxmin: true, + shadeClose: true, + area: ['100%', '100%'], + content: '/ApplicationOutMinByDid?depositoryId='+item+"&state=0", + end:function () { + location.reload() + } + }); + $(window).on("resize", function () { + layer.full(index); + }); + }; + + openDetail4 = function (item) { + var index = layer.open({ + title: '请求详情', + type: 2, + shade: 0.2, + maxmin: true, + shadeClose: true, + area: ['100%', '100%'], + content: '/ApplicationOutMinByDid?depositoryId='+item+"&state=1", + end:function () { + location.reload() + } + }); + $(window).on("resize", function () { + layer.full(index); + }); + }; //定义一个函数判断是手机端还是pc端 function isMobile(){ diff --git a/target/classes/templates/pages/depository/table-in.html b/target/classes/templates/pages/depository/table-in.html index cf14d2dc..bd1d84e1 100644 --- a/target/classes/templates/pages/depository/table-in.html +++ b/target/classes/templates/pages/depository/table-in.html @@ -142,7 +142,10 @@ limits: [10, 15, 20, 25, 50], limit: 10, page: true, - skin: 'line' + skin: 'line', + done:function () { + $("[data-field='id']").css('display','none'); + } }); // 监听搜索操作 diff --git a/target/classes/templates/pages/depository/table-out.html b/target/classes/templates/pages/depository/table-out.html index 5029ac62..9be7d8bf 100644 --- a/target/classes/templates/pages/depository/table-out.html +++ b/target/classes/templates/pages/depository/table-out.html @@ -135,10 +135,19 @@ {field: 'quantity', width: 80, title: '数量', sort: true}, {field: 'price', title: '金额', minWidth: 80, sort: true}, {field: 'state', width: 150, title: '流程状态'}, + { + field: 'pass', title: '是否完成出库', minWidth: 120, templet: function (d) { + if (d.pass == 1){ + return "是"; + }else{ + return "否"; + } + } + }, {field: 'applicantName', width: 150, title: '申请人'}, {field: 'applicantTime', width: 200, title: '申请时间', sort: true}, { - field: 'istransfer', title: '是否为转移申请', minWidth: 80, templet: function (d) { + field: 'istransfer', title: '是否为转移申请', minWidth: 120, templet: function (d) { if (d.istransfer == 1){ return "是"; }else if(d.istransfer == 2){ diff --git a/target/classes/templates/pages/depository/table-stock.html b/target/classes/templates/pages/depository/table-stock.html index 177c9d21..a8f1556e 100644 --- a/target/classes/templates/pages/depository/table-stock.html +++ b/target/classes/templates/pages/depository/table-stock.html @@ -179,9 +179,11 @@ var req = {}; req.mids = []; req.depositoryIds = []; + req.placeCodes = []; for (i = 0, len = data.length; i < len; i++) { req.mids[i] = data[i].id; req.depositoryIds[i] = data[i].depositoryId; + req.placeCodes[i] = data[i].placeCode; } if(req.mids.length > 0) { $.ajax({ diff --git a/target/classes/templates/pages/material/material-out.html b/target/classes/templates/pages/material/material-out.html index e246f01c..ddb2dd9b 100644 --- a/target/classes/templates/pages/material/material-out.html +++ b/target/classes/templates/pages/material/material-out.html @@ -46,6 +46,12 @@
                  +
                  + +
                  + +
                  +
                  @@ -198,6 +204,9 @@ if(data.state != ''){ req.state = data.state; } + if(data.code != ''){ + req.code = data.code + } //执行搜索重载 table.reload('currentTableId', { diff --git a/target/classes/templates/pages/material/selectType.html b/target/classes/templates/pages/material/selectType.html index 6b09ae84..bb2a8c74 100644 --- a/target/classes/templates/pages/material/selectType.html +++ b/target/classes/templates/pages/material/selectType.html @@ -36,7 +36,6 @@ contentType: "application/json;charset=utf-8", success: function (d) { var data2 = d.data - console.log(data2) test.reload({ data:data2 }); diff --git a/target/classes/templates/pages/place/place_edit.html b/target/classes/templates/pages/place/place_edit.html index 8093b00b..65855dc4 100644 --- a/target/classes/templates/pages/place/place_edit.html +++ b/target/classes/templates/pages/place/place_edit.html @@ -92,7 +92,6 @@ layer = layui.layer; var depositoryId = $("#depositoryId").val(); - console.log(depositoryId); form.on('submit(formStep)', function (data) { var req = data.field; req.type = "one"; diff --git a/target/classes/templates/pages/post/postRole_add.html b/target/classes/templates/pages/post/postRole_add.html index c45db8ac..9e89cbd0 100644 --- a/target/classes/templates/pages/post/postRole_add.html +++ b/target/classes/templates/pages/post/postRole_add.html @@ -96,7 +96,6 @@ success: function (data) { layer.close(this.layerIndex); if (data.status >= 300) { - console.log(data) layer.msg(data.statusInfo.message,{ icon: 7, time: 200 diff --git a/target/classes/templates/pages/scanQrCode/scanQrCode2.html b/target/classes/templates/pages/scanQrCode/scanQrCode2.html deleted file mode 100644 index aa5e6ea8..00000000 --- a/target/classes/templates/pages/scanQrCode/scanQrCode2.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - ZXing TypeScript | Decoding from camera stream - - - - - - - - -
                  - -
                  -
                  - 扫描 - 重置 -
                  - -
                  - -
                  - - - -
                  - - -
                  - - -
                  -
                  - -
                  - - - - - - - diff --git a/target/classes/templates/pages/scanQrCode/scanQrCodeOut.html b/target/classes/templates/pages/scanQrCode/scanQrCodeOut.html new file mode 100644 index 00000000..51ce9d06 --- /dev/null +++ b/target/classes/templates/pages/scanQrCode/scanQrCodeOut.html @@ -0,0 +1,332 @@ + + + + + + 扫码 + + + + + + + + + + + + + +
                  + + + + + +
                  + Long validation in progress... +
                  +
                  +
                  + + + + \ No newline at end of file