From 69e3655e9d863e539a48b7f6c92933c0a9ec4959 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Mon, 20 Feb 2023 14:15:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A5=E5=BA=93=E6=97=B6?= =?UTF-8?q?=E5=8D=95=E4=BB=B7=E6=8F=90=E4=BA=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DepositoryRecordController.java | 83 +++--- .../controller/DownLoadFileController.java | 111 +++++++- .../controller/PageController.java | 46 +++- .../entity/ExcelInfoByInventory.java | 8 - .../mapper/MaterialMapper.xml | 16 +- .../impl/DepositoryRecordServiceImpl.java | 188 ++++++++------ .../service/impl/ExcelServiceImpl.java | 27 +- .../service/impl/MaterialServiceImpl.java | 237 +++++++++++------- .../static/js/JcPrinter/index_Demo.js | 2 +- .../pages/application/application-in.html | 62 +---- .../application/application-in_back.html | 31 --- .../application-in_scanQrCode.html | 38 +-- .../pages/application/application_multi.html | 1 - .../pages/depository/table-stock.html | 5 +- .../pages/material/material-view.html | 7 + 15 files changed, 459 insertions(+), 403 deletions(-) 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 1e28f62f..55b81559 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java @@ -189,9 +189,9 @@ public class DepositoryRecordController { map.put("applicantId", userToken.getId()); Map result = new HashMap<>(); if (params.size() < 1 && map.size() > 3) { - String unit = (String)(map.get("unit")); + String unit = (String) (map.get("unit")); if (!"-1".equals(unit)) { - map.put("type","in"); + map.put("type", "in"); Integer addSplitInventory = splitUnitService.addSplitInventory(map); if (addSplitInventory != -1) { integer += addSplitInventory; @@ -222,20 +222,19 @@ public class DepositoryRecordController { insert.put("depositoryId", map.get("depositoryId" + temp)); insert.put("applyRemark", map.get("applyRemark" + temp)); insert.put("code", map.get("code" + temp)); - insert.put("price", map.get("price" + temp).toString()); insert.put("producedDate", map.get("producedDate" + temp)); insert.put("qrCode", map.get("qrCode" + temp)); insert.put("barCode", map.get("barCode" + temp)); - insert.put("unit",map.get("unit" + temp)); - insert.put("placeId",map.get("placeId" + temp)); - String unit = (String)(map.get("unit" + temp)); + insert.put("unit", map.get("unit" + temp)); + insert.put("placeId", map.get("placeId" + temp)); + String unit = (String) (map.get("unit" + temp)); if (!"-1".equals(unit)) { - insert.put("type","in"); + insert.put("type", "in"); Integer addSplitInventory = splitUnitService.addSplitInventory(insert); if (addSplitInventory != -1) { integer += addSplitInventory; successMsg.add(insert); - }else{ + } else { errMsg.add(insert); } } else { @@ -260,14 +259,14 @@ public class DepositoryRecordController { } } } - String unit = (String)(map.get("unit")); + String unit = (String) (map.get("unit")); if (!"-1".equals(unit)) { - map.put("type","in"); + map.put("type", "in"); Integer addSplitInventory = splitUnitService.addSplitInventory(map); if (addSplitInventory != -1) { integer += addSplitInventory; successMsg.add(map); - }else{ + } else { errMsg.add(map); } } else { @@ -403,7 +402,7 @@ public class DepositoryRecordController { insert.put("applyRemark", map.get("applyRemark" + temp)); insert.put("code", map.get("code")); insert.put("placeId", map.get("placeId")); - insert.put("unit",map.get("unit"+temp)); + insert.put("unit", map.get("unit" + temp)); // 获取主订单编号 insert.put("parentId", id); // 插入子订单 @@ -464,11 +463,15 @@ public class DepositoryRecordController { @GetMapping("/applicationInView") public RestResponse findApplicationInRecordByCondition(@RequestParam Map map, HttpServletRequest request) { UserByPort userToken = (UserByPort) request.getAttribute("userToken"); - List list = depositoryRecordService.findApplicationInRecordPByUser(userToken,map); + List list = depositoryRecordService.findApplicationInRecordPByUser(userToken, map); for (ApplicationInRecordP applicationInRecordP : list) { - applicationInRecordP.setPrice(applicationInRecordP.getPrice() / 100); + if (applicationInRecordP.getPrice() != null) { + applicationInRecordP.setPrice(applicationInRecordP.getPrice() / 100); + } else { + applicationInRecordP.setPrice(0.0); + } } - return new RestResponse(list, depositoryRecordService.findApplicationInRecordPCountByUser(userToken,map), 200); + return new RestResponse(list, depositoryRecordService.findApplicationInRecordPCountByUser(userToken, map), 200); } // 当前仓库中该用户的子订单详情 @@ -532,9 +535,9 @@ public class DepositoryRecordController { // 获取申请的物料信息 Inventory materialById = materialService.findInventoryById(applicationOutMinById.getMid()); - if("-1".equals(applicationOutMinById.getUnit())) { + if ("-1".equals(applicationOutMinById.getUnit())) { simpleApplicationOutMinRecordP.setShowQuantity(materialById.getUnit() + ":" + (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut())); - }else{ + } else { simpleApplicationOutMinRecordP.setShowQuantity(applicationOutMinById.getUnit() + ":" + (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut())); } // 获取当前物料所存在的库位 @@ -600,7 +603,7 @@ public class DepositoryRecordController { public RestResponse findApplicationOutRecordByCondition(@RequestParam Map map, HttpServletRequest request) { UserByPort userByPort = (UserByPort) request.getAttribute("userToken"); // 获取对应主订单 - List list = depositoryRecordService.findApplicationOutRecordPByUser(userByPort,map); + List list = depositoryRecordService.findApplicationOutRecordPByUser(userByPort, map); for (ApplicationOutRecordP outRecordP : list) { // 根据主订单获取所有子订单 List applicationOutMinByParentId = depositoryRecordService.findApplicationOutMinByParentId(outRecordP.getId()); @@ -628,7 +631,7 @@ public class DepositoryRecordController { outRecordP.setQuantity(sumQuantity); outRecordP.setPrice(sumPrice); } - return new RestResponse(list, depositoryRecordService.findApplicationOutRecordPCountByUser(userByPort,map), 200); + return new RestResponse(list, depositoryRecordService.findApplicationOutRecordPCountByUser(userByPort, map), 200); } @@ -782,7 +785,7 @@ public class DepositoryRecordController { insert.put("code", map.get("code" + temp)); insert.put("placeId", map.get("placeId" + temp)); insert.put("fromPlaceId", map.get("fromPlaceId" + temp)); - insert.put("unit",map.get("unit"+temp)); + insert.put("unit", map.get("unit" + temp)); Object parentId = map.get("parentId"); if (parentId != null) { insert.put("parentId", parentId); @@ -848,14 +851,14 @@ public class DepositoryRecordController { // 删除出库记录 @PostMapping("/deleteApplicationOutRecord") - public RestResponse deleteApplicationOutRecord(@RequestBody Map map,HttpServletRequest request) { - UserByPort userByPort = (UserByPort) request.getAttribute("userToken"); + public RestResponse deleteApplicationOutRecord(@RequestBody Map map, HttpServletRequest request) { + UserByPort userByPort = (UserByPort) request.getAttribute("userToken"); if (map.containsKey("id")) { Integer id = ObjectFormatUtil.toInteger(map.get("id")); - return CrudUtil.deleteHandle(depositoryRecordService.deleteApplicationOutRecordById(id,userByPort), 1); + return CrudUtil.deleteHandle(depositoryRecordService.deleteApplicationOutRecordById(id, userByPort), 1); } else if (map.containsKey("ids")) { List ids = (List) map.get("ids"); - return CrudUtil.deleteHandle(depositoryRecordService.deleteApplicationOutRecordByIds(ids,userByPort), ids.size()); + return CrudUtil.deleteHandle(depositoryRecordService.deleteApplicationOutRecordByIds(ids, userByPort), ids.size()); } else { throw new MyException("所需请求参数缺失!"); } @@ -863,33 +866,30 @@ public class DepositoryRecordController { // 用于判断该记录是否正在运行 @PostMapping("/judgeApplicationOutRecordStatus") - public RestResponse judgeApplicationOutRecordStatus(@RequestBody Map map){ + public RestResponse judgeApplicationOutRecordStatus(@RequestBody Map map) { if (map.containsKey("id")) { Integer id = ObjectFormatUtil.toInteger(map.get("id")); // 获取当前记录是否能删除 boolean b = depositoryRecordService.judgeApplicationOutRecordStatus(id); - return new RestResponse(b,0,1); + return new RestResponse(b, 0, 1); } else if (map.containsKey("ids")) { List ids = (List) map.get("ids"); List resultIds = new ArrayList<>(); - for (Integer id:ids - ) { + for (Integer id : ids + ) { boolean b1 = depositoryRecordService.judgeApplicationOutRecordStatus(id); - if(!b1){ + if (!b1) { resultIds.add(id); } } resultIds.add(2); - return new RestResponse(resultIds,0,2); - } - else { + return new RestResponse(resultIds, 0, 2); + } else { throw new MyException("所需请求参数缺失!"); } } - - /** * 自动生成出入库订单 * @@ -904,7 +904,7 @@ public class DepositoryRecordController { Integer end = page * 10; UserByPort userToken = (UserByPort) request.getAttribute("userToken"); Long size = redisTemplateForHash.boundListOps("mids" + userToken.getId()).size(); - if(size == null){ + if (size == null) { size = 0L; } if (end > size) { @@ -931,7 +931,6 @@ public class DepositoryRecordController { ap.setVersion(materialById.getVersion()); ap.setMname(materialById.getMname()); ap.setCode(materialById.getCode()); - ap.setPrice(materialById.getPrice()); ap.setApplicant(userToken.getId()); ap.setQuantity(1.0); ap.setUnit("-1"); @@ -977,9 +976,9 @@ public class DepositoryRecordController { String type = (String) map.get("type"); Integer success = 0; if ("in".equals(type)) { - String unit = (String)(map.get("unit")); + String unit = (String) (map.get("unit")); if (!"-1".equals(unit)) { - map.put("type","in"); + map.put("type", "in"); Integer addSplitInventory = splitUnitService.addSplitInventory(map); if (addSplitInventory != -1) { success += addSplitInventory; @@ -1078,7 +1077,7 @@ public class DepositoryRecordController { List placeCodes = (List) map.get("placeCodes"); List applyRemarks = (List) map.get("applyRemarks"); List prices = (List) map.get("prices"); - List units = (List)map.get("units"); + List units = (List) map.get("units"); String errMsg = ""; Integer id = 0; if ("in".equals(type)) { @@ -1093,7 +1092,7 @@ public class DepositoryRecordController { // 先定义最终要使用的库位,默认是默认库位 Integer placeId = 0; - if(!"0000".equals(placeCode)){ + if (!"0000".equals(placeCode)) { // 如果当前选择的不是默认库位 Place place = placeService.findPlaceByDidAndCode(depositoryId, placeCode); placeId = place.getId(); @@ -1113,7 +1112,7 @@ public class DepositoryRecordController { inRecord.put("price", price); inRecord.put("applyRemark", applyRemark); if (!"-1".equals(unit)) { - map.put("type","in"); + map.put("type", "in"); Integer addSplitInventory = splitUnitService.addSplitInventory(inRecord); if (addSplitInventory != -1) { success += addSplitInventory; @@ -1244,7 +1243,7 @@ public class DepositoryRecordController { } if (success == 0) { - depositoryRecordService.deleteApplicationOutRecordById(1,userToken); + depositoryRecordService.deleteApplicationOutRecordById(1, userToken); return new RestResponse("", 666, new StatusInfo("申请失败", "超出最大存储容量")); } if (success < mids.size()) { diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/DownLoadFileController.java b/src/main/java/com/dreamchaser/depository_manage/controller/DownLoadFileController.java index bc1fbc6c..c2a471ba 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DownLoadFileController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DownLoadFileController.java @@ -22,8 +22,8 @@ public class DownLoadFileController { * @param response * @功能描述 下载文件: */ - @RequestMapping("/download") - public void download(HttpServletRequest request,HttpServletResponse response) { + @RequestMapping("/zipDownload") + public void zipDownload(HttpServletRequest request,HttpServletResponse response) { try { String path = "static/upload/PrintServer.zip"; @@ -53,4 +53,111 @@ public class DownLoadFileController { } } + /** + * @param response + * @功能描述 下载文件: + */ + @RequestMapping("/materialImportDownload") + public void materialImportDownload(HttpServletRequest request,HttpServletResponse response) { + try { + + String path = "static/upload/materialImport.xlsx"; + + String fileName = "materialImport.xlsx"; + response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); + response.setContentType("content-type:octet-stream"); + /* .getClassLoader() 方法是在静态文件路径添加一个/ */ + InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(path); + OutputStream outputStream = response.getOutputStream(); + try { + byte[] buffer = new byte[1024]; + int len; + assert inputStream != null; + while ((len = inputStream.read(buffer)) != -1) { /* 将流中内容写出去 .*/ + outputStream.write(buffer, 0, len); + } + }catch (IOException e){ + e.printStackTrace(); + }finally { + assert inputStream != null; + inputStream.close(); + outputStream.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * @param response + * @功能描述 下载文件: + */ + @RequestMapping("/materialTypeImportDownload") + public void materialTypeImportDownload(HttpServletRequest request,HttpServletResponse response) { + try { + + String path = "static/upload/materialTypeImport.xlsx"; + + String fileName = "materialTypeImport.xlsx"; + response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); + response.setContentType("content-type:octet-stream"); + /* .getClassLoader() 方法是在静态文件路径添加一个/ */ + InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(path); + OutputStream outputStream = response.getOutputStream(); + try { + byte[] buffer = new byte[1024]; + int len; + assert inputStream != null; + while ((len = inputStream.read(buffer)) != -1) { /* 将流中内容写出去 .*/ + outputStream.write(buffer, 0, len); + } + }catch (IOException e){ + e.printStackTrace(); + }finally { + assert inputStream != null; + inputStream.close(); + outputStream.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * @param response + * @功能描述 下载文件: + */ + @RequestMapping("/inventoryImportDownload") + public void inventoryImportDownload(HttpServletRequest request,HttpServletResponse response) { + try { + + String path = "static/upload/inventoryImport.xlsx"; + + String fileName = "inventoryImport.xlsx"; + response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); + response.setContentType("content-type:octet-stream"); + /* .getClassLoader() 方法是在静态文件路径添加一个/ */ + InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(path); + OutputStream outputStream = response.getOutputStream(); + try { + byte[] buffer = new byte[1024]; + int len; + assert inputStream != null; + while ((len = inputStream.read(buffer)) != -1) { /* 将流中内容写出去 .*/ + outputStream.write(buffer, 0, len); + } + }catch (IOException e){ + e.printStackTrace(); + }finally { + assert inputStream != null; + inputStream.close(); + outputStream.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + } 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 339d5b42..ee789fb2 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java @@ -1353,7 +1353,11 @@ public class PageController { String unit = applicationOutRecordMin.getUnit(); if ("-1".equals(unit)) { - sumPrice += (inventoryById.getPrice() * applicationOutRecordMin.getQuantity()); + if (inventoryById.getPrice() != null) { + sumPrice += (inventoryById.getPrice() * applicationOutRecordMin.getQuantity()); + } else { + sumPrice += 0; + } sumUnit.append(inventoryById.getUnit()).append(","); } else { // 用于获取当前拆单记录 @@ -1365,7 +1369,11 @@ public class PageController { // 获取当前拆单与基础单位的进制 int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); sumUnit.append(unit).append(","); - sumPrice += (inventoryById.getPrice() / scale * applicationOutRecordMin.getQuantity()); + if (inventoryById.getPrice() != null) { + sumPrice += (inventoryById.getPrice() / scale * applicationOutRecordMin.getQuantity()); + } else { + sumPrice += 0; + } } } // 申请人 @@ -1436,7 +1444,12 @@ public class PageController { UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationInRecordPById.getApplicantId(), userToken); applicationInRecordPById.setApplicantName(userByPort.getName()); applicationInRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecordPById.getApplicantTime()))); - applicationInRecordPById.setPrice(applicationInRecordPById.getPrice() / 100); + if (applicationInRecordPById.getPrice() != null) { + applicationInRecordPById.setPrice(applicationInRecordPById.getPrice() / 100); + + } else { + applicationInRecordPById.setPrice(0.0); + } } else { // 如果是组合 @@ -1483,7 +1496,10 @@ public class PageController { String unit = recordMinP.getUnit(); if ("-1".equals(unit)) { recordMinP.setUnit(inventoryById.getUnit()); - double price = (inventoryById.getPrice()) * recordMinP.getQuantity(); + double price = 0.0; + if (inventoryById.getPrice() != null) { + price = (inventoryById.getPrice()) * recordMinP.getQuantity(); + } BigDecimal bg = new BigDecimal(price); price = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); recordMinP.setPrice(price); @@ -1496,7 +1512,10 @@ public class PageController { SplitInfo splitInfo = splitUnitService.findSplitInfoByMidAndUnit(paramForSplitInfo); // 获取当前拆单与基础单位的进制 int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); - double price = (inventoryById.getPrice()) / scale * recordMinP.getQuantity(); + double price = 0.0; + if (inventoryById.getPrice() != null) { + price = (inventoryById.getPrice()) / scale * recordMinP.getQuantity(); + } BigDecimal bg = new BigDecimal(price); price = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); recordMinP.setPrice(price); @@ -1570,7 +1589,7 @@ public class PageController { // 如果当前子订单已经处理 // 获取当前处理人 UserByPort disposer = LinkInterfaceUtil.FindUserById(checkId, userToken); - outDisposer.append(disposer.getName() + ","); + outDisposer.append(disposer.getName()).append(","); recordMinP.setCheckerName(disposer.getName()); } else { outDisposer.append("暂未处理,"); @@ -1586,7 +1605,12 @@ public class PageController { String unit = recordMinP.getUnit(); if ("-1".equals(unit)) { // 如果是基础单位 - sumPrice += (inventoryById.getPrice() * applicationOutRecordMin.getQuantity()); + if (inventoryById.getPrice() != null) { + sumPrice += (inventoryById.getPrice() * applicationOutRecordMin.getQuantity()); + } else { + sumPrice += 0.0; + } + } else { // 如果是拆单 @@ -1598,7 +1622,11 @@ public class PageController { SplitInfo splitInfo = splitUnitService.findSplitInfoByMidAndUnit(paramForSplitInfo); // 获取当前拆单记录与基础单位的进制 int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); - sumPrice += (inventoryById.getPrice() / scale * applicationOutRecordMin.getQuantity()); + if (inventoryById.getPrice() != null) { + sumPrice += (inventoryById.getPrice() / scale * applicationOutRecordMin.getQuantity()); + } else { + sumPrice += 0.0; + } } recordMinPList.add(recordMinP); } @@ -2231,7 +2259,7 @@ public class PageController { param.put("mid", mp.getId()); param.put("mname", mp.getMname()); param.put("code", mp.getCode()); - param.put("price", mp.getPrice()); + param.put("price", mp.getPrice() != null ? mp.getPrice() : 0); param.put("version", mp.getVersion()); param.put("codeFlag", 1); List materialByBarCodeByCondition = materialService.findMaterialByBarCodeByCondition(param); diff --git a/src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfoByInventory.java b/src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfoByInventory.java index b0aa0c46..79c85c85 100644 --- a/src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfoByInventory.java +++ b/src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfoByInventory.java @@ -39,14 +39,6 @@ public class ExcelInfoByInventory { @ExcelValid(message = "数量未填写") private String quantity; - /** 总金额 */ - @ExcelProperty("总金额") - private String amounts; - - /** 单价 */ - @ExcelProperty("单价") - private String price; - /** 仓库编码 */ @ExcelProperty(value = "库位码") private String depositoryCode; diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml index 6d14694d..47213c7a 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml @@ -125,16 +125,16 @@ - id,depository_id,mname,quantity,price,type_id,state,code ,version ,amounts ,unit ,texture,tname,depositoryCode,dname,producedDate,shelfLife,productionPlace,brand,remark + id,depository_id,mname,quantity,price,type_id,state,code ,version ,unit ,texture,tname,depositoryCode,dname,producedDate,shelfLife,productionPlace,brand,remark - id,depository_id,mname,quantity,price,type_id,state,tname,dname,version,amounts ,unit ,texture,code,depositoryCode,producedDate,shelfLife,productionPlace,brand,remark + id,depository_id,mname,quantity,price,type_id,state,tname,dname,version ,unit ,texture,code,depositoryCode,producedDate,shelfLife,productionPlace,brand,remark - id,mid,depositoryId,mname,quantity,price,mtid,mstate,tname,dname,version,amounts ,unit ,texture,mcode,depositoryCode,producedDate,shelfLife,productionPlace,brand,remark,numberOfTemporary + id,mid,depositoryId,mname,quantity,price,mtid,mstate,tname,dname,version ,unit ,texture,mcode,depositoryCode,producedDate,shelfLife,productionPlace,brand,remark,numberOfTemporary @@ -766,13 +766,11 @@ - insert into inventory(id,mid,quantity,amounts,price,producedDate,depository_id) + insert into inventory(id,mid,quantity,producedDate,depository_id) values ( #{id}, #{mid}, #{quantity}, - #{amounts}, - #{price}, #{producedDate}, #{depositoryId} ) @@ -971,12 +969,6 @@ quantity = #{quantity}, - - price = #{price}, - - - amounts = #{amounts}, - number_of_temporary = #{numberOfTemporary} diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java index bbf888ce..ae3681de 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java @@ -88,7 +88,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { param.put("mname", mname); List list = materialMapper.findMaterialByCondition(param); Material material = list.get(0); - map.put("price", (material.getPrice() / 100) * quantity * 100); + if (material.getPrice() != null) { + map.put("price", (material.getPrice() / 100) * quantity * 100); + } else { + + map.put("price", 0); + } return depositoryRecordMapper.insertDepositoryRecord(map); } @@ -111,7 +116,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { //构造单号 String code = createCode(depositoryRecordById.getDname(), "InOrderNumber", "in", ""); Double quantity = Double.parseDouble((String) map.get("quantity")); - double price = Double.parseDouble((String) map.get("price")); Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); // 根据物料id查询物料 Material material = materialMapper.findMaterialById(mid); @@ -134,18 +138,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { param.put("mcode", material.getCode()); // 判断该仓库中有无该物物料 List materialByCondition = materialMapper.findInventory(param); - // 获取当前入库金额 - Double amounts = (quantity * price * 100); - // 获取平均价格 - double avgPrice = 0.0; - if (quantity != 0) { - avgPrice = (amounts) / (quantity); - } else { - avgPrice = price * 100; - } - map.put("amounts", amounts); - map.put("price", price * 100); + String simpleTime = DateUtil.getSimpleTime(new Date()); map.put("applicant_time", DateUtil.DateTimeToTimeStamp(simpleTime)); map.put("code", code); @@ -155,11 +149,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { Integer newMid = 0; if (materialByCondition.size() > 0) { // 如果当前存在 Inventory mt = materialByCondition.get(0); - map.put("oldPrice", mt.getPrice()); map.put("mid", mt.getMid()); - mt.setAmounts(mt.getAmounts() + amounts); mt.setQuantity((int) (mt.getQuantity() + quantity)); - mt.setPrice(avgPrice); mt.setProducedDate(producedDate); materialMapper.updateInventory(mt); newMid = mt.getId(); @@ -167,9 +158,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { Map insert = new HashMap<>(); Material materialById = materialMapper.findMaterialById(mid); insert.put("depositoryId", depositoryId); - insert.put("price", avgPrice); insert.put("quantity", quantity); - insert.put("amounts", amounts); insert.put("shelfLife", materialById.getShelfLife()); insert.put("producedDate", producedDate); insert.put("mid", map.get("mid")); @@ -218,8 +207,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { if (mid != null) { // 获取当前物料 Inventory materialById = materialMapper.findInventoryById(mid); - int amounts = (int) ((materialById.getPrice() / 100) * quantity * 100); - map.put("price", amounts); + map.put("price", 0); + if (materialById.getPrice() != null) { + int amounts = (int) ((materialById.getPrice() / 100) * quantity * 100); + map.put("price", amounts); + } Depository depositoryRecordById = depositoryMapper.findDepositoryById(materialById.getDepositoryId()); dname = depositoryRecordById.getDname(); } @@ -362,12 +354,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { Map mapForToday = new HashMap<>(); mapForToday.put("start", nowTimeForCalc); mapForToday.put("end", now); - mapForToday.put("list",list); + mapForToday.put("list", list); // 用于查询昨天的入库记录 Map mapForYesterday = new HashMap<>(); mapForYesterday.put("start", yesterdayTimeForCalc); mapForYesterday.put("end", nowTimeForCalc); - mapForYesterday.put("list",list); + mapForYesterday.put("list", list); // 查询今天目前为止的入库 List applicationInRecordPForToday = depositoryRecordMapper.findApplicationInRecordPForAPeriodOfTime(mapForToday); @@ -386,7 +378,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 获取当前入库类型(1物料2组合) Integer flagForGroup = applicationInRecordP.getFlagForGroup(); sumForToday += applicationInRecordP.getQuantity(); - priceForToday += applicationInRecordP.getPrice() * applicationInRecordP.getQuantity(); + if (applicationInRecordP.getPrice() != null) { + priceForToday += applicationInRecordP.getPrice() * applicationInRecordP.getQuantity(); + } else { + priceForToday += 0; + } } @@ -394,7 +390,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { for (int i = 0; i < applicationInRecordPForYesterday.size(); i++) { ApplicationInRecordP applicationInRecordP = applicationInRecordPForYesterday.get(i); sumForYesterDay += applicationInRecordP.getQuantity(); - priceForYesterDay += applicationInRecordP.getPrice() * applicationInRecordP.getQuantity(); + if (applicationInRecordP.getPrice() != null) { + priceForYesterDay += applicationInRecordP.getPrice() * applicationInRecordP.getQuantity(); + } else { + priceForYesterDay += 0; + } } Map result = new HashMap<>(); result.put("total", sumForToday); @@ -425,7 +425,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { * @return */ @Override - public Map CalculateAllApplicationOutCount(String state,List list) { + public Map CalculateAllApplicationOutCount(String state, List list) { // 获取昨天出库订单 // 获取当前时间 @@ -440,12 +440,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { Map mapForToday = new HashMap<>(); mapForToday.put("start", nowTimeForCalc); mapForToday.put("end", now); - mapForToday.put("list",list); + mapForToday.put("list", list); // 用于查询昨天的出库记录 Map mapForYesterday = new HashMap<>(); mapForYesterday.put("start", yesterdayTimeForCalc); mapForYesterday.put("end", nowTimeForCalc); - mapForYesterday.put("list",list); + mapForYesterday.put("list", list); // 用于最终的结果 Map result = new HashMap<>(); @@ -979,8 +979,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { restResponse.setData(""); restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); } - } - else { + } else { // 如果是拆单后的出库 // 用于获取对应的拆单记录 @@ -1121,9 +1120,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { inventory.setQuantity(inventory.getQuantity() - 1); - // 重新计算总额 - inventory.setAmounts(inventory.getQuantity() * inventory.getPrice()); - // 修改库存记录 materialMapper.updateInventory(inventory); @@ -1218,8 +1214,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 令库存-1 inventory.setQuantity(inventory.getQuantity() - surplus_redundant); - // 重新计算总额 - inventory.setAmounts(inventory.getQuantity() * inventory.getPrice()); // 修改库存记录 materialMapper.updateInventory(inventory); @@ -1258,8 +1252,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { } } - } - else { + } else { // 如果拆单库存处理记录不存在 int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); @@ -1267,22 +1260,20 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 如果当前库存数量满足要求 // 获取当前出库的具体数目 - int residue = (int) Math.ceil(trueOut / (double)splitInfo.getQuantity()); + int residue = (int) Math.ceil(trueOut / (double) splitInfo.getQuantity()); // 获取剩余数目 int residue_realQuantity = residue * scale - trueOut; - // 设置新总额 - inventory.setAmounts(inventory.getAmounts() - residue * inventory.getPrice()); // 设置新库存 - inventory.setQuantity(inventory.getQuantity() - residue ); + inventory.setQuantity(inventory.getQuantity() - residue); //更新库存 materialMapper.updateInventory(inventory); // 更新对应库位的库存 // 修改当前库位存放物料的数量 - placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue ); + placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue); placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); // 修改库位数量 @@ -1292,15 +1283,20 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 插入拆单记录 - Map insertForSplitInventory = new HashMap<>(); - insertForSplitInventory.put("mid",inventory.getMid()); - insertForSplitInventory.put("mcode",inventory.getCode()); - insertForSplitInventory.put("price",inventory.getPrice() / scale); - insertForSplitInventory.put("quantity",residue_realQuantity); - insertForSplitInventory.put("unit",unit); - insertForSplitInventory.put("depositoryId",applicationOutMinById.getDepositoryId()); - insertForSplitInventory.put("placeId",placeAndMaterialByMidAndPid.getPid()); - insertForSplitInventory.put("type","in"); + Map insertForSplitInventory = new HashMap<>(); + insertForSplitInventory.put("mid", inventory.getMid()); + insertForSplitInventory.put("mcode", inventory.getCode()); + if (inventory.getPrice() != null) { + + insertForSplitInventory.put("price", inventory.getPrice() / scale); + } else { + insertForSplitInventory.put("price", 0); + } + insertForSplitInventory.put("quantity", residue_realQuantity); + insertForSplitInventory.put("unit", unit); + insertForSplitInventory.put("depositoryId", applicationOutMinById.getDepositoryId()); + insertForSplitInventory.put("placeId", placeAndMaterialByMidAndPid.getPid()); + insertForSplitInventory.put("type", "in"); splitUnitService.addSplitInventory(insertForSplitInventory); Integer new_id = ObjectFormatUtil.toInteger(insertForSplitInventory.get("newInMid")); depositoryRecordMapper.deleteApplicationInRecordById(new_id); @@ -1523,8 +1519,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { materialAndPlace.setQuantity(materialAndPlace.getQuantity() - inventory_quantity); inventory.setQuantity(inventory.getQuantity() - inventory_quantity); - // 重新设置总额 - inventory.setAmounts(inventory.getAmounts() - inventory_quantity * inventory.getPrice()); // 修改库存数量 materialMapper.updateInventory(inventory); @@ -1554,8 +1548,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 设置当前库存数量 materialAndPlace.setQuantity(materialAndPlace.getQuantity() - surplus_redundant); inventory.setQuantity(inventory.getQuantity() - surplus_redundant); - // 设置当前总额 - inventory.setAmounts(inventory.getPrice() * inventory.getQuantity()); // 修改库存数量 materialMapper.updateInventory(inventory); @@ -1732,8 +1724,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { @Override public Integer reviewByQyWxApproval(String mainId, ApprovalInfo_Details approvalInfo_details, String userAgent, String spStatus, String spNo, boolean flagForFirst, int flagForDepository) { - if(flagForDepository == 3){ - // 如果是仓库管理员审批,直接返回 + if (flagForDepository == 3) { + // 如果是仓库管理员审批,直接返回 return 0; } @@ -1917,8 +1909,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 将当前redis中存储的spno删除 redisTemplate.delete(spNo); } - } - else { + } else { // 如果是部门负责人 String departmentheadTime = recordP.getDepartmentheadTime(); @@ -1999,6 +1990,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { /** * 根据主键查询转移记录 + * * @param id * @return */ @@ -2024,7 +2016,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { map.put("state", "待部门负责人审核"); String simpleTime = DateUtil.getSimpleTime(new Date()); map.put("applicantTime", DateUtil.DateTimeToTimeStamp(simpleTime)); - map.put("price", material.getPrice() * quantity * 100); + if (material.getPrice() != null) { + + map.put("price", material.getPrice() * quantity * 100); + } else { + map.put("price", 0); + } map.put("istransfer", 1); map.put("fromId", material.getDepositoryId()); String fromPlaceId = (String) map.get("fromPlaceId"); @@ -2168,7 +2165,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { }).start(); - } else { // 如果没有通过 updateInventoryForOutRefused(record); @@ -2211,8 +2207,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1); } }).start(); - } - else { + } else { String result = ""; // 开启线程更改其他用户卡片模板样式 String simpleTime = DateUtil.getSimpleTime(new Date()); @@ -2224,13 +2219,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // map.put("mid", record.getMid()); // Material material = materialMapper.findMaterialById(record.getMid()); Integer depositoryManagerPass = (Integer) map.get("depositoryManagerPass"); - if(depositoryManagerPass == null){ + if (depositoryManagerPass == null) { depositoryManagerPass = (Integer) map.get("departmentheadPass"); } String departmentheadTime = record.getDepartmentheadTime(); // 用于标识部门负责人是否审批 boolean flagFordepartmentTime = false; // 默认审批过 - if("0".equals(departmentheadTime)){ + if ("0".equals(departmentheadTime)) { flagFordepartmentTime = true; } if (depositoryManagerPass == 1) { @@ -2645,7 +2640,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { if (inventories.size() > 0) { // 如果在该仓库 - map.put("price", inventoryById.getPrice().toString()); + if (inventoryById.getPrice() != null) { + + map.put("price", inventoryById.getPrice().toString()); + } else { + map.put("price", "0"); + } // 进行入库操作 applicationInPlace(map); @@ -2656,14 +2656,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { Integer quantity = ObjectFormatUtil.toInteger(map.get("quantity")); // 转移到的仓库 insert.put("depositoryId", transferRecord.getToId()); - // 单价 - insert.put("price", inventoryById.getPrice()); // 库存物料 insert.put("mid", inventoryById.getMid()); // 数量 insert.put("quantity", quantity); - // 总额 - insert.put("amounts", quantity * inventoryById.getPrice()); // 仓库编码 insert.put("depositoryCode", inventoryById.getDepositoryCode()); // 生产日期 @@ -2787,7 +2783,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 进行修改当前拆单库存数量 map.put("newInMid", placeAndMaterial.getId()); - map.put("price", inventoryById.getPrice() / scaleQuantity); + if (inventoryById.getPrice() != null) { + + map.put("price", inventoryById.getPrice() / scaleQuantity); + } else { + map.put("price", 0); + } // 实际入库数量 map.put("realQuantity", quantity.toString()); @@ -2859,7 +2860,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 进行修改当前拆单库存数量 map.put("newInMid", placeAndMaterial.getId()); - map.put("price", inventoryById.getPrice() / scaleQuantity); + if (inventoryById.getPrice() != null) { + + map.put("price", inventoryById.getPrice() / scaleQuantity); + } else { + map.put("price", 0); + } // 实际入库数量 map.put("realQuantity", quantity.toString()); @@ -2902,7 +2908,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { } else { // 如果不小于 - map.put("price", inventoryById.getPrice() / scaleQuantity); + if (inventoryById.getPrice() != null) { + + map.put("price", inventoryById.getPrice() / scaleQuantity); + } else { + map.put("price", 0); + } updateSplitInventoryForMoreScale(inventoryById, map, splitInfo, quantity, insertForMaterialAndPlace, insertForSplitInventory); } @@ -2915,10 +2926,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 用于添加一条库存记录 Map insertForInventory = new HashMap<>(); insertForInventory.put("depositoryId", transferRecord.getToId()); - insertForInventory.put("price", inventoryById.getPrice()); insertForInventory.put("mid", inventoryById.getMid()); insertForInventory.put("quantity", 0); - insertForInventory.put("amounts", 0); insertForInventory.put("depositoryCode", inventoryById.getDepositoryCode()); insertForInventory.put("producedDate", inventoryById.getProducedDate()); // 添加一条库存记录 @@ -2949,7 +2958,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { splitUnitMapper.addSplitInventory(insertForSplitInventory); } else { // 如果不小于 - map.put("price", inventoryById.getPrice() / scaleQuantity); + if (inventoryById.getPrice() != null) { + + map.put("price", inventoryById.getPrice() / scaleQuantity); + } else { + map.put("price", 0); + } updateSplitInventoryForMoreScale(inventoryById, map, splitInfo, quantity, insertForMaterialAndPlace, insertForSplitInventory); } @@ -3500,7 +3514,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { Integer count = 0; for (int i = 0; i < applicationInRecordPAll.size(); i++) { ApplicationInRecordP applicationInRecordP = applicationInRecordPAll.get(i); - double price = applicationInRecordP.getPrice(); + double price = 0.0; + if (applicationInRecordP.getPrice() != null) { + price = applicationInRecordP.getPrice(); + } sum += price * applicationInRecordP.getQuantity() / 100; count += applicationInRecordP.getQuantity(); } @@ -3533,7 +3550,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { ApplicationOutRecordMin applicationOutRecordMin = minByCondition.get(k); Integer mid = applicationOutRecordMin.getMid(); Material materialById = materialMapper.findMaterialById(mid); - sum += (materialById.getPrice() / 100) * applicationOutRecordMin.getQuantity(); + if (materialById.getPrice() != null) { + + sum += (materialById.getPrice() / 100) * applicationOutRecordMin.getQuantity(); + } else { + sum += 0; + } } } @@ -3544,7 +3566,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { ApplicationOutRecordMin recordMin = applicationOutMinForComplete.get(i); Integer mid = recordMin.getMid(); Material materialById = materialMapper.findMaterialById(mid); - sum += (materialById.getPrice() / 100) * recordMin.getQuantity(); + if (materialById.getPrice() != null) { + sum += (materialById.getPrice() / 100) * recordMin.getQuantity(); + } + else{ + sum += 0; + } } } BigDecimal bg = new BigDecimal(sum); @@ -3958,7 +3985,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 获取当前出库物料 Inventory materialById = materialMapper.findInventoryById(recordMin.getMid()); // 计算当前出库金额 - double price_out = materialById.getPrice() * recordMin.getQuantity(); + double price_out = 0.0; + if (materialById.getPrice() != null) { + price_out = materialById.getPrice() * recordMin.getQuantity(); + } BigDecimal bg = new BigDecimal(price_out / 100); price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); price += price_out; diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java index edb321b5..9120d9b8 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java @@ -244,7 +244,7 @@ public class ExcelServiceImpl implements ExcelService { Map map = new HashMap<>(); map.put("mname",mname); map.put("version",version); - List materialPByCondition = materialService.findMaterialPByCondition(map); + List materialPByCondition = materialService.findMaterialPByConditionForTable(map); if(materialPByCondition.size() == 0){ // 如果没有当前物料 String s = dataIndex.get(i); @@ -313,31 +313,6 @@ public class ExcelServiceImpl implements ExcelService { insert.put("tempPlaceCode", excelInfoByInventory.getDepositoryCode()); insert.put("quantity", String.valueOf(ObjectFormatUtil.toInteger(excelInfoByInventory.getQuantity()))); - if(excelInfoByInventory.getPrice() != null && "".equals(excelInfoByInventory.getPrice())) { - // 如果模板中总金额未填写 - if (excelInfoByInventory.getAmounts() == null || "".equals(excelInfoByInventory.getAmounts())) { - // 求均值 - // 总金额 - Double amounts = Double.parseDouble(excelInfoByInventory.getPrice()) * 100 * Double.parseDouble(excelInfoByInventory.getQuantity()); - insert.put("amounts", amounts); - // 保留两位 - Double avgPrice = Double.parseDouble(excelInfoByInventory.getQuantity()); - BigDecimal bg = new BigDecimal(avgPrice); - avgPrice = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - insert.put("price", String.valueOf(avgPrice)); - } else { - // 求均值 - insert.put("amounts", Double.parseDouble(excelInfoByInventory.getAmounts()) * 100); - Double avgPrice = (Double.parseDouble(excelInfoByInventory.getAmounts()) * 100) / ((Double.parseDouble(excelInfoByInventory.getQuantity()))); - // 保留两位 - BigDecimal bg = new BigDecimal(avgPrice); - avgPrice = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - insert.put("price", String.valueOf(avgPrice)); - } - }else{ - insert.put("price",0); - insert.put("amounts",0); - } insert.put("depositoryId", depositoryId); insert.put("depositoryCode", excelInfoByInventory.getDepositoryCode()); insert.put("mid", material.getId()); diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java index ee9b78b8..fd3fa9cc 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java @@ -149,10 +149,6 @@ public class MaterialServiceImpl implements MaterialService { public Integer updateMaterial(Map map) { if (map.containsKey("price")) { Double price = Double.parseDouble((String) map.get("price")) * 100; - Integer quantity = Integer.parseInt((String) map.get("quantity")); - if (!map.containsKey("amounts")) { - map.put("amounts", price * quantity); - } map.put("price", price); } // 判断是否有保质期 @@ -218,8 +214,13 @@ public class MaterialServiceImpl implements MaterialService { map.put("state", state); List list = materialMapper.findMaterialByCondition(map); for (Material material : list) { + if(material.getPrice() != null){ + material.setPrice(material.getPrice() / 100); - material.setAmounts(material.getAmounts() / 100); + }else{ + material.setPrice(0.0); + } + material.setAmounts(material.getPrice() * material.getQuantity()); // 获取当前物料所处仓库 Integer depositoryId = material.getDepositoryId(); // 获取当前物料所处库位 @@ -245,6 +246,7 @@ public class MaterialServiceImpl implements MaterialService { /** * 根据条件查询符合条件的物料信息(用于表格展示) + * * @param map 条件map * @return 符合条件的物料信息 */ @@ -302,8 +304,13 @@ public class MaterialServiceImpl implements MaterialService { map.put("state", state); List list = materialMapper.findInventory(map); for (Inventory inventory : list) { - inventory.setPrice(inventory.getPrice() / 100); - inventory.setAmounts(inventory.getAmounts() / 100); + if (inventory.getPrice() != null) { + + inventory.setPrice(inventory.getPrice() / 100); + } else { + inventory.setPrice(0.0); + } + inventory.setAmounts(inventory.getPrice() * inventory.getQuantity()); // 获取当前物料所处仓库 Integer depositoryId = inventory.getDepositoryId(); // 获取当前物料所处库位 @@ -325,6 +332,7 @@ public class MaterialServiceImpl implements MaterialService { /** * 根据物料编码及所处仓库查询库存 + * * @param map 待查询条件 * @return */ @@ -357,13 +365,16 @@ public class MaterialServiceImpl implements MaterialService { map.put("begin", (page - 1) * size); } List list = materialMapper.findMaterialByCondition(map); - for (int i = 0; i < list.size(); i++) { - list.get(i).setPrice(list.get(i).getPrice() / 100); - list.get(i).setAmounts(list.get(i).getAmounts() / 100); + for (Material material : list) { + if(material.getPrice() == null){ + material.setPrice(0.0); + } + material.setPrice(material.getPrice() / 100); + material.setAmounts(material.getPrice() * material.getQuantity()); // 获取当前物料所处仓库 - Integer depositoryId = list.get(i).getDepositoryId(); + Integer depositoryId = material.getDepositoryId(); // 获取当前物料所处库位 - Integer mid = list.get(i).getId(); + Integer mid = material.getId(); List placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depositoryId); StringBuilder placeCode = new StringBuilder(); for (int j = 0; j < placeByMidAndDid.size(); j++) { @@ -372,9 +383,9 @@ public class MaterialServiceImpl implements MaterialService { if (depositoryId != null) { Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId); String code = depositoryRecordById.getCode(); - list.get(i).setDepositoryCode(code); + material.setDepositoryCode(code); } - list.get(i).setPlaceCode(placeCode.toString()); + material.setPlaceCode(placeCode.toString()); } return packForMatieral(list); } @@ -422,9 +433,12 @@ public class MaterialServiceImpl implements MaterialService { @Override public List findMaterialAll() { List materialList = materialMapper.findMaterialByCondition(new HashMap()); - for (int i = 0; i < materialList.size(); i++) { - materialList.get(i).setPrice(materialList.get(i).getPrice() / 100); - materialList.get(i).setAmounts(materialList.get(i).getAmounts() / 100); + for (Material material : materialList) { + if(material.getPrice() == null){ + material.setPrice(0.0); + } + material.setPrice(material.getPrice() / 100); + material.setAmounts(material.getPrice() * material.getQuantity()); } return materialList; } @@ -440,8 +454,13 @@ public class MaterialServiceImpl implements MaterialService { Material material = materialMapper.findMaterialById(id); MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId()); material.setTypeName(materialTypeByOldId.getTname()); + if(material.getPrice() != null){ + material.setPrice(material.getPrice() / 100); - material.setAmounts(material.getAmounts() / 100); + }else{ + material.setPrice(0.0); + } + material.setAmounts(material.getPrice() * material.getQuantity()); return material; } @@ -454,10 +473,13 @@ public class MaterialServiceImpl implements MaterialService { @Override public Inventory findInventoryById(int id) { Inventory material = materialMapper.findInventoryById(id); - MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId()); - material.setTypeName(materialTypeByOldId.getTname()); - material.setPrice(material.getPrice() / 100); - material.setAmounts(material.getAmounts() / 100); + if (material.getPrice() != null) { + + material.setPrice(material.getPrice() / 100); + } else { + material.setPrice(0.0); + } + material.setAmounts(material.getPrice() * material.getQuantity()); return material; } @@ -473,8 +495,13 @@ public class MaterialServiceImpl implements MaterialService { for (Inventory inventory : inventoryByMid) { MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(inventory.getMaterialTypeId()); inventory.setTypeName(materialTypeByOldId.getTname()); + if(inventory.getPlaceCode() != null){ + inventory.setPrice(inventory.getPrice() / 100); - inventory.setAmounts(inventory.getAmounts() / 100); + }else{ + inventory.setPrice(0.0); + } + inventory.setAmounts(inventory.getPrice() * inventory.getQuantity()); } return inventoryByMid; } @@ -549,8 +576,13 @@ public class MaterialServiceImpl implements MaterialService { @Override public Material findMaterialAndTypeById(int id) { Material material = materialMapper.findMaterialAndTypeById(id); - material.setPrice(material.getPrice() / 100); - material.setAmounts(material.getAmounts() / 100); + if (material.getPrice() != null) { + + material.setPrice(material.getPrice() / 100); + } else { + material.setPrice(0.0); + } + material.setAmounts(material.getPrice() * material.getQuantity()); Long producedDate = material.getProducedDate(); if (producedDate != null) { material.setShowProducedDate(DateUtil.TimeStampToDateTimeForDay(producedDate)); @@ -582,10 +614,15 @@ public class MaterialServiceImpl implements MaterialService { @Override public List findMaterialByIds(List ids) { List materialList = materialMapper.findInventoryByIds(ids); - for (int i = 0; i < materialList.size(); i++) { - Inventory material = materialList.get(i); - materialList.get(i).setPrice(material.getPrice() / 100); - materialList.get(i).setAmounts(material.getAmounts() / 100); + for (Inventory material : materialList) { + if(material.getPrice() != null){ + + material.setPrice(material.getPrice() / 100); + }else{ + material.setPrice(0.0); + } + + material.setAmounts(material.getPrice() * material.getQuantity()); } return materialList; } @@ -648,7 +685,10 @@ public class MaterialServiceImpl implements MaterialService { Double sum = 0.0; List materialAll = materialMapper.findInventory(new HashMap()); for (int i = 0; i < materialAll.size(); i++) { - sum += materialAll.get(i).getAmounts() / 100; + Inventory inventory = materialAll.get(i); + if (inventory.getPrice() != null) { + sum += inventory.getPrice() * inventory.getQuantity() / 100; + } } BigDecimal bg = new BigDecimal(sum); sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); @@ -757,29 +797,32 @@ public class MaterialServiceImpl implements MaterialService { // 获取当前具体数据 MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(place.getId(), m.getId()); // 获取当前是否存在拆单处理记录 - // 获取当前物料对应的所有拆单数目 - List splitInfoByMid = splitUnitMapper.findSplitInfoByMid(inventory.getMid()); - for (SplitInfo splitInfo : splitInfoByMid - ) { - // 获取当前拆单单位的总数 - int saveQuantity = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); - - if (splitInventoryForUnit.containsKey(splitInfo.getNewUnit())) { - // 如果当前存在该拆单类型的记录 - - // 更新当前类型数据 - splitInventoryForUnit.put(splitInfo.getNewUnit(), splitInventoryForUnit.get(splitInfo.getNewUnit()) + saveQuantity); - } else { - // 如果不存在,则新增 - splitInventoryForUnit.put(splitInfo.getNewUnit(), saveQuantity); - - } - BigDecimal bigDecimal = BigDecimal.valueOf(inventory.getPrice() / splitInfo.getQuantity()); - double split_price = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - amounts += split_price * saveQuantity; - unit = splitInfo.getNewUnit(); + // 获取当前物料对应的所有拆单数目 + List splitInfoByMid = splitUnitMapper.findSplitInfoByMid(inventory.getMid()); + for (SplitInfo splitInfo : splitInfoByMid + ) { + // 获取当前拆单单位的总数 + int saveQuantity = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); + + if (splitInventoryForUnit.containsKey(splitInfo.getNewUnit())) { + // 如果当前存在该拆单类型的记录 + + // 更新当前类型数据 + splitInventoryForUnit.put(splitInfo.getNewUnit(), splitInventoryForUnit.get(splitInfo.getNewUnit()) + saveQuantity); + } else { + // 如果不存在,则新增 + splitInventoryForUnit.put(splitInfo.getNewUnit(), saveQuantity); } + if(inventory.getPrice() == null){ + inventory.setPrice(0.0); + } + BigDecimal bigDecimal = BigDecimal.valueOf(inventory.getPrice() / splitInfo.getQuantity()); + double split_price = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + amounts += split_price * saveQuantity; + unit = splitInfo.getNewUnit(); + + } // } } @@ -815,11 +858,11 @@ public class MaterialServiceImpl implements MaterialService { m.setProducedDate(DateUtil.TimeStampToDateTimeForDay(producedDate)); } List splitInfoByMid = splitUnitService.findSplitInfoByMid(m.getMid()); - if(splitInfoByMid == null){ + if (splitInfoByMid == null) { splitInfoByMid = new ArrayList<>(); } - Map paramByBarcode = new HashMap<>(); + Map paramByBarcode = new HashMap<>(); paramByBarcode.put("mcode", m.getCode()); paramByBarcode.put("codeFlag", 1); List materialByBarCodeByCondition = materialMapper.findMaterialByBarCodeByCondition(paramByBarcode); @@ -861,18 +904,23 @@ public class MaterialServiceImpl implements MaterialService { Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId); List materialByDepository = materialMapper.findMaterialByDepository(map); - for (int i = 0; i < materialByDepository.size(); i++) { - materialByDepository.get(i).setDepositoryCode(depositoryRecordById.getCode()); + for (Inventory inventory : materialByDepository) { + inventory.setDepositoryCode(depositoryRecordById.getCode()); // 获取当前物料所处库位 - Integer mid = materialByDepository.get(i).getId(); + Integer mid = inventory.getId(); List placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depositoryId); StringBuilder placeCode = new StringBuilder(); for (int j = 0; j < placeByMidAndDid.size(); j++) { placeCode.append(placeByMidAndDid.get(j).getCode()).append(" "); } - materialByDepository.get(i).setPlaceCode(placeCode.toString()); - materialByDepository.get(i).setAmounts(materialByDepository.get(i).getAmounts() / 100); - materialByDepository.get(i).setPrice(materialByDepository.get(i).getPrice() / 100); + inventory.setPlaceCode(placeCode.toString()); + if (inventory.getPrice() != null) { + + inventory.setPrice(inventory.getPrice() / 100); + } else { + inventory.setPrice(0.0); + } + inventory.setAmounts(inventory.getPrice() * inventory.getQuantity()); } return pack(materialByDepository); @@ -893,12 +941,6 @@ public class MaterialServiceImpl implements MaterialService { public Integer insertInventoryForImport(Map map) { if (map.containsKey("quantity")) { int quantity = (int) Math.round(Double.parseDouble(map.get("quantity").toString())); - int price = 0; - if (map.containsKey("price")) { - price = (int) (Double.parseDouble(map.get("price").toString())); - } - map.put("price", price); - map.put("amounts", quantity * price); } Map params = new HashMap<>(); // params.put("code", map.get("code")); @@ -913,17 +955,8 @@ public class MaterialServiceImpl implements MaterialService { // 如果该物料存在 Inventory material = inventory.get(0); - Double price = 0.0; - if (map.containsKey("price")) { - price = (Double.parseDouble(map.get("price").toString())) / 100; - } + int quantity = (int) Math.round(Double.parseDouble(map.get("quantity").toString())); - // 获取当前入库金额 - Double amounts = (quantity * price * 100); - // 获取平均价格 - Double avgPrice = (material.getAmounts() + amounts) / (material.getQuantity() + quantity); - material.setPrice(avgPrice); - material.setAmounts(material.getAmounts() + amounts); material.setQuantity(material.getQuantity() + quantity); // 获取当前物料要存入的库位 @@ -1056,6 +1089,9 @@ public class MaterialServiceImpl implements MaterialService { if (materialAndBarCode.getIid() != null) { Inventory inventoryByMid = materialMapper.findInventoryById(materialAndBarCode.getIid()); if (inventoryByMid != null) { + if(inventoryByMid.getPrice() == null){ + inventoryByMid.setPrice(0.0); + } materialAndBarCode.setPrice(inventoryByMid.getPrice() / 100); } else { materialAndBarCode.setPrice(0.0); @@ -1466,7 +1502,7 @@ public class MaterialServiceImpl implements MaterialService { paramForSplitInventory.put("iid", pidAndMidForBefore.getId()); // 转移之前的拆单库存记录 SplitInventory splitInventoryForBefore = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); - if(splitInventoryForBefore != null) { + if (splitInventoryForBefore != null) { //如果存在 // 设置转移前库存的数量 @@ -1476,14 +1512,13 @@ public class MaterialServiceImpl implements MaterialService { // 修改转移前的记录 splitUnitMapper.updateSplitInventory(splitInventoryForBefore); - } - else{ + } else { // 如果不存在 // 获取当前单位对应的进制 int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); // 计算当前转移数目对应需要减少的数目 - int num = (int)Math.ceil(quantity / (double)scale); + int num = (int) Math.ceil(quantity / (double) scale); // 修改当前库存数量 inventoryByMid.setQuantity(inventoryByMid.getQuantity() - num); @@ -1493,15 +1528,18 @@ public class MaterialServiceImpl implements MaterialService { pidAndMidForBefore.setQuantity(pidAndMidForBefore.getQuantity() - num); placeService.updateMaterialAndPlace(pidAndMidForBefore); - Map insertForSplitInventory = new HashMap<>(); - insertForSplitInventory.put("mid",inventoryByMid.getMid()); - insertForSplitInventory.put("mcode",inventoryByMid.getCode()); - insertForSplitInventory.put("price",inventoryByMid.getPrice() / scale); - insertForSplitInventory.put("quantity",num * scale - quantity); - insertForSplitInventory.put("unit",unit); - insertForSplitInventory.put("depositoryId",map.get("depositoryId")); - insertForSplitInventory.put("placeId",pidAndMidForBefore.getPid()); - insertForSplitInventory.put("type","in"); + Map insertForSplitInventory = new HashMap<>(); + insertForSplitInventory.put("mid", inventoryByMid.getMid()); + insertForSplitInventory.put("mcode", inventoryByMid.getCode()); + if(inventoryByMid.getPrice() == null){ + inventoryByMid.setPrice(0.0); + } + insertForSplitInventory.put("price", inventoryByMid.getPrice() / scale); + insertForSplitInventory.put("quantity", num * scale - quantity); + insertForSplitInventory.put("unit", unit); + insertForSplitInventory.put("depositoryId", map.get("depositoryId")); + insertForSplitInventory.put("placeId", pidAndMidForBefore.getPid()); + insertForSplitInventory.put("type", "in"); splitUnitService.addSplitInventory(insertForSplitInventory); Integer new_id = ObjectFormatUtil.toInteger(insertForSplitInventory.get("newInMid")); depositoryRecordMapper.deleteApplicationInRecordById(new_id); @@ -1511,6 +1549,9 @@ public class MaterialServiceImpl implements MaterialService { // 定义进制时算法需要的参数 Map paramForNewMap = new HashMap<>(); paramForNewMap.put("mid", inventoryByMid.getMid()); + if(inventoryByMid.getPrice() == null){ + inventoryByMid.setPrice(0.0); + } paramForNewMap.put("price", String.valueOf(inventoryByMid.getPrice() / 100)); paramForNewMap.put("unit", unit); paramForNewMap.put("depositoryId", map.get("depositoryId")); @@ -1547,6 +1588,9 @@ public class MaterialServiceImpl implements MaterialService { SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo); } else { + if(inventoryByMid.getPrice() == null){ + inventoryByMid.setPrice(0.0); + } paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); paramForNewMap.put("realQuantity", String.valueOf(dispose)); paramForNewMap.put("quantity", String.valueOf(dispose)); @@ -1566,8 +1610,7 @@ public class MaterialServiceImpl implements MaterialService { // 修改库存数量 splitUnitMapper.updateSplitInventory(splitInventoryForAfter); } - } - else { + } else { // 如果不存在转移后的拆单库存记录 // 定义用于添加拆单库存记录 @@ -1592,6 +1635,9 @@ public class MaterialServiceImpl implements MaterialService { SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo); } else { + if(inventoryByMid.getPrice() == null){ + inventoryByMid.setPrice(0.0); + } paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); paramForNewMap.put("realQuantity", String.valueOf(dispose)); paramForNewMap.put("quantity", String.valueOf(dispose)); @@ -1638,6 +1684,9 @@ public class MaterialServiceImpl implements MaterialService { SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, ObjectFormatUtil.toInteger(insertForSplitInventory.get("id")), paramForNewMap, quantity, splitInfo); } else { + if(inventoryByMid.getPrice() == null){ + inventoryByMid.setPrice(0.0); + } paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); paramForNewMap.put("realQuantity", String.valueOf(dispose)); paramForNewMap.put("quantity", String.valueOf(dispose)); @@ -2658,7 +2707,7 @@ public class MaterialServiceImpl implements MaterialService { } StringBuilder title = new StringBuilder(); Depository depositoryById = depositoryMapper.findDepositoryById(inventory.getDepositoryId()); - title = new StringBuilder(inventory.getMname() + ",规格型号: " + version + ","+depositoryById.getDname()+"库存数量:" + inventory.getUnit() + ":" + inventory.getQuantity()); + title = new StringBuilder(inventory.getMname() + ",规格型号: " + version + "," + depositoryById.getDname() + "库存数量:" + inventory.getUnit() + ":" + inventory.getQuantity()); // 获取对应拆单库存处理记录 List splitInventoryList = splitUnitMapper.findSplitInventoryByIid(inventory.getId()); if (splitInventoryList.size() > 0) { @@ -2905,12 +2954,10 @@ public class MaterialServiceImpl implements MaterialService { if ("1".equals(type)) { // 如果是入库 materialByTypeIds = materialMapper.findMaterialByTypeIdsAndMname(paramForMnameAndMtid); - } - else if ("2".equals(type)) { + } else if ("2".equals(type)) { // 如果是出库 inventoryByTypeIdsAndMname = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid); - } - else if ("3".equals(type)) { + } else if ("3".equals(type)) { // 如果是盘点 List inventoryList = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid); diff --git a/src/main/resources/static/js/JcPrinter/index_Demo.js b/src/main/resources/static/js/JcPrinter/index_Demo.js index 3a731521..9ddb2795 100644 --- a/src/main/resources/static/js/JcPrinter/index_Demo.js +++ b/src/main/resources/static/js/JcPrinter/index_Demo.js @@ -566,7 +566,7 @@ var app = new Vue({ }, downLoadServer(){ - window.open("/download/download","_self"); + window.open("/download/zipDownload","_self"); }, /** * 开始打印任务 diff --git a/src/main/resources/templates/pages/application/application-in.html b/src/main/resources/templates/pages/application/application-in.html index 15780b87..329e183a 100644 --- a/src/main/resources/templates/pages/application/application-in.html +++ b/src/main/resources/templates/pages/application/application-in.html @@ -125,15 +125,6 @@ autocomplete="off" class="layui-input"> -
- -
- -
-
@@ -608,13 +599,6 @@ onclick="selectDate(this)" autocomplete="off" class="layui-input">
-
- -
- -
-
@@ -659,7 +643,7 @@ // 获取当前高度 var height = parseInt(($("#stepForm").css('height')).split("px")[0]); params.push(NewIdNumber); - $("#stepForm").css("height", height + 558 + 'px'); + $("#stepForm").css("height", height + 520 + 'px'); $("#" + parentId).after(materialItem); }; // 实现卡片删除 @@ -671,7 +655,7 @@ // 获取祖父节点 var reparent = parent.parentNode; var height = parseInt(($("#stepForm").css('height')).split("px")[0]); - $("#stepForm").css("height", height - 558 + 'px'); + $("#stepForm").css("height", height - 520 + 'px'); params = remove(params, parentId); reparent.removeChild(parent); }; @@ -710,9 +694,6 @@ var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialName = materialItem[1]; var materialId = materialName.parentNode.parentNode.childNodes[3]; - // 单价条目 - var priceItem = priceChildren.childNodes[3].childNodes; - var priceValue = priceItem[1]; // 条形码条码 var barCodeItem = barCodeChildren.childNodes[3]; var req = {}; @@ -731,7 +712,6 @@ layer.msg("没有该编码,请确认是否输入正确"); materialName.value = ""; materialId.value = ""; - priceValue.value = ""; obj.value = ""; $("#barCode" + idNumber).empty(); $("#unit" + idNumber).empty(); @@ -740,7 +720,6 @@ } else { materialName.value = d.mname; materialId.value = d.mid; - priceValue.value = d.price; // 获取物料与条形码的对应关系 var materialAndBarCodeList = d["materialAndBarCodeList"]; var barCode = $("#barCode" + idNumber); @@ -804,9 +783,6 @@ var materialName = materialItem[1]; var materialId = materialName.parentNode.parentNode.childNodes[3]; var mname = materialName.value; - // 单价条目 - var priceItem = priceChildren.childNodes[3].childNodes; - var priceValue = priceItem[1]; // 条形码条码 var barCodeItem = barCodeChildren.childNodes[3]; mname = mname.split(",")[0]; @@ -843,7 +819,6 @@ code = ""; } codeValue.value = code; - priceValue.value = material.price; var materialAndBarCodeList = material["materialAndBarCodeList"]; var barCodeInput = barCodeItem.childNodes[1].childNodes[1]; var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; @@ -994,9 +969,6 @@ var materialName = materialItem[1]; var materialId = materialName.parentNode.parentNode.childNodes[3]; var mname = materialName.value; - // 单价条目 - var priceItem = priceChildren.childNodes[3].childNodes; - var priceValue = priceItem[1]; // 条形码条码 var barCodeItem = barCodeChildren.childNodes[3]; if (data === null) { @@ -1014,7 +986,6 @@ materialName.value = data.mname; materialId.value = data.mid; codeValue.value = code; - priceValue.value = data.price; var materialAndBarCodeList = data["materialAndBarCodeList"]; var idNumber = materialId.name.split("mid")[1]; if (materialAndBarCodeList.length > 0) { @@ -1113,9 +1084,6 @@ var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialName = materialItem[1]; var materialId = materialName.parentNode.parentNode.childNodes[3]; - // 单价条目 - var priceItem = priceChildren.childNodes[3].childNodes; - var priceValue = priceItem[1]; // 条形码条码 var code = material.mcode; if (code === undefined) { @@ -1124,7 +1092,6 @@ materialName.value = material.mname; materialId.value = material.mid; codeValue.value = code; - priceValue.value = material.price; barCodeInput.value = result; var idNumber = materialId.name.split("mid")[1]; var shelfLife = material.shelfLife; @@ -1781,31 +1748,6 @@ }; - form.on('select()', function (data) { - let elem = data.elem; //得到select原始DOM对象 - let elemId = elem.id; - if (elemId.indexOf("unit") === 0) { - // 如果进行选择的是计量单位 - let id = elemId.split("unit")[1]; - let mid = $("#mid" + id).val(); - let unit = data.value; - let req = {}; - req.newUnit = unit; - req.mid = mid; - $.ajax({ - url: "/split/calcPriceForSplit", - data: JSON.stringify(req), - dataType: "json", - type: "post", - contentType: "application/json;charset=utf-8", - success: function (res) { - let data = res.data; - $("#price" + id).val(data); - } - }); - } - }); - }) diff --git a/src/main/resources/templates/pages/application/application-in_back.html b/src/main/resources/templates/pages/application/application-in_back.html index 886d86be..a3999d8f 100644 --- a/src/main/resources/templates/pages/application/application-in_back.html +++ b/src/main/resources/templates/pages/application/application-in_back.html @@ -68,13 +68,6 @@ autocomplete="off" class="layui-input" >
-
- -
- -
-
@@ -346,30 +339,6 @@ step.next('#stepForm'); }); - form.on('select()', function (data) { - let elem = data.elem; //得到select原始DOM对象 - let elemId = elem.id; - if(elemId.indexOf("unit") === 0){ - // 如果进行选择的是计量单位 - let id = elemId.split("unit")[1]; - let mid = $("#mid"+id).val(); - let unit = data.value; - let req = {}; - req.newUnit = unit; - req.mid = mid; - $.ajax({ - url:"/split/calcPriceForSplit", - data:JSON.stringify(req), - dataType:"json", - type:"post", - contentType: "application/json;charset=utf-8", - success:function (res) { - let data = res.data; - $("#price"+id).val(data); - } - }); - } - }); }) diff --git a/src/main/resources/templates/pages/application/application-in_scanQrCode.html b/src/main/resources/templates/pages/application/application-in_scanQrCode.html index 47330eed..84d93a45 100644 --- a/src/main/resources/templates/pages/application/application-in_scanQrCode.html +++ b/src/main/resources/templates/pages/application/application-in_scanQrCode.html @@ -298,13 +298,6 @@
-
- -
- -
-
@@ -338,7 +331,7 @@ if (NewIdNumber !== "") { params.push(NewIdNumber) } - $("#stepForm").css("height", height + 495 + 'px'); + $("#stepForm").css("height", height + 460 + 'px'); var materialItem = firstItem + depositoryItem + lastItem; // 最终 $("#btn_sub").prepend(materialItem) }; @@ -535,13 +528,7 @@
-
- -
- -
-
+
@@ -572,7 +559,7 @@ // 获取当前高度 var height = parseInt(($("#stepForm").css('height')).split("px")[0]); params.push(NewIdNumber); - $("#stepForm").css("height", height + 555 + 'px'); + $("#stepForm").css("height", height + 520 + 'px'); var materialItem = firstItem + depositoryItem + lastItem; $("#" + parentId).after(materialItem); }; @@ -586,7 +573,7 @@ // 获取祖父节点 var reparent = parent.parentNode; var height = parseInt(($("#stepForm").css('height')).split("px")[0]); - $("#stepForm").css("height", height - 555 + 'px'); + $("#stepForm").css("height", height - 520 + 'px'); params = remove(params, parentId); reparent.removeChild(parent); }; @@ -618,9 +605,6 @@ var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialName = materialItem[1]; var materialId = materialName.parentNode.parentNode.childNodes[3]; - // 单价条目 - var priceItem = priceChildren.childNodes[3].childNodes; - var priceValue = priceItem[1]; // 条形码条码 var barCodeItem = barCodeChildren.childNodes[3]; @@ -640,14 +624,12 @@ layer.msg("没有该编码,请确认是否输入正确"); materialName.value = ""; materialId.value = ""; - priceValue.value = ""; obj.value = ""; $("#barCode" + idNumber).remove(); form.render(); } else { materialName.value = d.mname; materialId.value = d.id; - priceValue.value = d.price; // 获取物料与条形码的对应关系 var materialAndBarCodeList = d["materialAndBarCodeList"]; var splitInfoList = d["splitInfoList"]; @@ -703,9 +685,6 @@ var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialName = materialItem[1]; var materialId = materialName.parentNode.parentNode.childNodes[3]; - // 单价条目 - var priceItem = priceChildren.childNodes[3].childNodes; - var priceValue = priceItem[1]; var mname = materialName.value; mname = mname.split(",")[0]; // 条形码条码 @@ -746,7 +725,6 @@ code = ""; } codeValue.value = code; - priceValue.value = material.price; var materialAndBarCodeList = material["materialAndBarCodeList"]; var barCodeInput = barCodeItem.childNodes[1].childNodes[1]; var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; @@ -885,9 +863,6 @@ var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialName = materialItem[1]; var materialId = materialName.parentNode.parentNode.childNodes[3]; - // 单价条目 - var priceItem = priceChildren.childNodes[3].childNodes; - var priceValue = priceItem[1]; // 条形码 var barCodeChildren = parent.childNodes[9]; var barCodeItem = barCodeChildren.childNodes[3]; @@ -902,7 +877,6 @@ materialName.value = material.mname; materialId.value = material.mid; codeValue.value = code; - priceValue.value = material.price; barCodeInput.value = result; var idNumber = materialId.name.split("mid")[1]; var shelfLife = material.shelfLife; @@ -1000,9 +974,6 @@ var materialName = materialItem[1]; var materialId = materialName.parentNode.parentNode.childNodes[3]; var mname = materialName.value; - // 单价条目 - var priceItem = priceChildren.childNodes[3].childNodes; - var priceValue = priceItem[1]; // 条形码条码 var barCodeItem = barCodeChildren.childNodes[3]; if (data === null) { @@ -1021,7 +992,6 @@ materialName.value = data.mname; materialId.value = data.id; codeValue.value = code; - priceValue.value = data.price; var materialAndBarCodeList = data["materialAndBarCodeList"]; var idNumber = materialId.name.split("mid")[1]; if (materialAndBarCodeList.length > 0) { diff --git a/src/main/resources/templates/pages/application/application_multi.html b/src/main/resources/templates/pages/application/application_multi.html index 770d24e7..762b52a8 100644 --- a/src/main/resources/templates/pages/application/application_multi.html +++ b/src/main/resources/templates/pages/application/application_multi.html @@ -96,7 +96,6 @@ {field: 'depositoryName', width: 150, title: '仓库名称'}, {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"}, {field: 'quantity', width: 150, title: '数量',edit:'quantity'}, - {field: 'price', width: 150, title: '单价',edit:'price'}, {field: 'applyRemark', width: 150, title: '备注说明',edit:'applyRemark'}, {title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"} ] diff --git a/src/main/resources/templates/pages/depository/table-stock.html b/src/main/resources/templates/pages/depository/table-stock.html index 16a66d89..8f712bfe 100644 --- a/src/main/resources/templates/pages/depository/table-stock.html +++ b/src/main/resources/templates/pages/depository/table-stock.html @@ -459,7 +459,7 @@ done: function (res) { layer.closeAll('loading'); //关闭loading //如果上传成功 - if (res.code == 200) { + if (res.code === 200) { var re = ""; for (let i = 0; i < res.data.errMsg.length; i++) { var show = "

" + res.data.errMsg[i] + ":错误" + "

"; @@ -469,9 +469,8 @@ var code = res.data.dataList[i]["code"] === null ? '' : res.data.dataList[i]["code"]; var mname = res.data.dataList[i]["mname"]; var version = res.data.dataList[i]["version"] === null ? '' : res.data.dataList[i]["version"]; - var price = res.data.dataList[i]["price"]; var quantity = res.data.dataList[i]["quantity"]; - var show = "

" + code + ", " + mname + ", " + version + ", 单价为" + price + ", 数量为" + quantity + ":成功" + "

"; + var show = "

" + code + ", " + mname + ", " + version + ", 数量为" + quantity + ":成功" + "

"; re += show } diff --git a/src/main/resources/templates/pages/material/material-view.html b/src/main/resources/templates/pages/material/material-view.html index 0c674843..1d313eec 100644 --- a/src/main/resources/templates/pages/material/material-view.html +++ b/src/main/resources/templates/pages/material/material-view.html @@ -100,6 +100,13 @@ class="layui-input">
+
+ +
+ +
+