From 19490a5a2a08216b9243ae75b41343785bab6fe7 Mon Sep 17 00:00:00 2001 From: hy2250089 Date: Tue, 7 Jan 2020 21:56:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E7=AE=A1=E7=90=86=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BF=AE=E6=94=B91=EF=BC=9A=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=97=A5=E6=9C=9F=E9=99=8D=E5=BA=8F=E3=80=81?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=89=A9=E6=96=99=E5=8F=8A=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 +++ wms-parent.iml | 7 ++++ .../wms/produce/manage/PmsApplication.java | 2 + .../dao/MaterialsOutgoingLogMapper.java | 3 ++ .../manage/mapper/MaterialsInfoMapper.xml | 2 +- .../mapper/MaterialsOutgoingLogMapper.xml | 10 ++++- .../manage/mapper/ProductProcessMapper.xml | 16 -------- .../model/MaterialsOutgoingLogParams.java | 2 +- .../manage/service/MaterialsInfoService.java | 1 + .../service/MaterialsOutgoingLogService.java | 3 ++ .../impl/MaterialsInfoServiceImpl.java | 40 +++++++++++++++++-- .../impl/MaterialsOutgoingLogServiceImpl.java | 6 +++ .../manage/web/MaterialsInfoController.java | 37 ++++++++++++----- .../web/MaterialsOutgoingLogController.java | 2 - .../manage/web/OtherServiceController.java | 4 +- 15 files changed, 104 insertions(+), 37 deletions(-) diff --git a/pom.xml b/pom.xml index 2fc2805..f06671c 100644 --- a/pom.xml +++ b/pom.xml @@ -106,6 +106,12 @@ pagehelper 4.2.1 + + + tk.mybatis + mapper-spring-boot-starter + 2.0.2 + com.alibaba diff --git a/wms-parent.iml b/wms-parent.iml index 04eecf9..0568428 100644 --- a/wms-parent.iml +++ b/wms-parent.iml @@ -76,6 +76,13 @@ + + + + + + + diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/PmsApplication.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/PmsApplication.java index 2747bd6..813918b 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/PmsApplication.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/PmsApplication.java @@ -1,5 +1,7 @@ package com.deer.wms.produce.manage; + +import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/dao/MaterialsOutgoingLogMapper.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/dao/MaterialsOutgoingLogMapper.java index 92d0b69..c7a64cb 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/dao/MaterialsOutgoingLogMapper.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/dao/MaterialsOutgoingLogMapper.java @@ -6,9 +6,12 @@ import com.deer.wms.produce.manage.model.MaterialsOutgoingLogParams; import com.deer.wms.produce.manage.model.MaterialsOutgoingLogVo; import com.deer.wms.project.seed.core.mapper.Mapper; +import java.util.HashMap; import java.util.List; public interface MaterialsOutgoingLogMapper extends Mapper { List findListByOneMaterial(MaterialsOutgoingLogParams params); + void deleteByOutgoingIds(List ids); + } \ No newline at end of file diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/mapper/MaterialsInfoMapper.xml b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/mapper/MaterialsInfoMapper.xml index baa1d9e..c562421 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/mapper/MaterialsInfoMapper.xml +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/mapper/MaterialsInfoMapper.xml @@ -78,7 +78,7 @@ AND com.company_id = #{companyId} - order by materials.id + order by materials.create_time DESC + + + DELETE FROM mt_alone_materials_outgoing_log WHERE id IN + + #{ids} + + + \ No newline at end of file diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/mapper/ProductProcessMapper.xml b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/mapper/ProductProcessMapper.xml index 7c73340..c9f09c7 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/mapper/ProductProcessMapper.xml +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/mapper/ProductProcessMapper.xml @@ -118,21 +118,5 @@ ORDER BY prodproc.create_time DESC, prodproc.update_time DESC - \ No newline at end of file diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/MaterialsOutgoingLogParams.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/MaterialsOutgoingLogParams.java index 5fd6a13..14a7208 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/MaterialsOutgoingLogParams.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/MaterialsOutgoingLogParams.java @@ -8,7 +8,7 @@ import com.deer.wms.project.seed.core.service.QueryParams; */ public class MaterialsOutgoingLogParams extends QueryParams { - private Integer type = ProduceManageConstant.TYPE_IN;//默认为入库记录 + private Integer type; private Integer materialsId; diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/MaterialsInfoService.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/MaterialsInfoService.java index f099fdc..144a465 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/MaterialsInfoService.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/MaterialsInfoService.java @@ -20,4 +20,5 @@ public interface MaterialsInfoService extends Service { List findMaterialsByKeyWords(MaterialsInfoParams params); + void deleteRelevantById(Integer materialsId); } diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/MaterialsOutgoingLogService.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/MaterialsOutgoingLogService.java index 674b6ca..a369cba 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/MaterialsOutgoingLogService.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/MaterialsOutgoingLogService.java @@ -8,6 +8,7 @@ import com.deer.wms.produce.manage.model.MaterialsOutgoingLogVo; import com.deer.wms.project.seed.core.service.Service; +import java.util.HashMap; import java.util.List; /** @@ -19,4 +20,6 @@ public interface MaterialsOutgoingLogService extends Service findListByOneMaterial(MaterialsOutgoingLogParams params) ; void save(MaterialsOutgoingLog materialsOutgoingLog, CurrentUser currentUser); + + void deleteByOutgoingIds(List ids); } diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/MaterialsInfoServiceImpl.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/MaterialsInfoServiceImpl.java index 750eb0a..0e095d7 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/MaterialsInfoServiceImpl.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/MaterialsInfoServiceImpl.java @@ -1,16 +1,18 @@ package com.deer.wms.produce.manage.service.impl; import com.deer.wms.produce.manage.dao.MaterialsInfoMapper; -import com.deer.wms.produce.manage.model.MaterialsInfo; -import com.deer.wms.produce.manage.model.MaterialsInfoDto; -import com.deer.wms.produce.manage.model.MaterialsInfoParams; -import com.deer.wms.produce.manage.model.MaterialsInfoVO; +import com.deer.wms.produce.manage.model.*; import com.deer.wms.produce.manage.service.MaterialsInfoService; +import com.deer.wms.produce.manage.service.MaterialsOutgoingLogService; +import com.deer.wms.produce.manage.service.MaterialsStockInfoService; import com.deer.wms.project.seed.core.service.AbstractService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; /** @@ -23,6 +25,11 @@ public class MaterialsInfoServiceImpl extends AbstractService findList(MaterialsInfoParams params) { @@ -44,5 +51,30 @@ public class MaterialsInfoServiceImpl extends AbstractService materialsOutgoingLogList = materialsOutgoingLogService.findListByOneMaterial(params); + System.out.println("=========="+materialsOutgoingLogList.size()); + if((null!=materialsOutgoingLogList) && (materialsOutgoingLogList.size()!=0)){ + List ids = new ArrayList(); + for (MaterialsOutgoingLogVo materialsOutgoingLogVo : materialsOutgoingLogList){ + ids.add(materialsOutgoingLogVo.getId()); + } + + System.out.println("----------"+ids.size()); + if((null!=ids) && (ids.size()!=0)) { + materialsOutgoingLogService.deleteByOutgoingIds(ids); + } + } + + } + } diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/MaterialsOutgoingLogServiceImpl.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/MaterialsOutgoingLogServiceImpl.java index 90673e0..be73b51 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/MaterialsOutgoingLogServiceImpl.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/MaterialsOutgoingLogServiceImpl.java @@ -13,6 +13,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Date; +import java.util.HashMap; import java.util.List; /** @@ -87,4 +88,9 @@ public class MaterialsOutgoingLogServiceImpl extends AbstractService ids) { + materialsOutgoingLogMapper.deleteByOutgoingIds(ids); + } } diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/MaterialsInfoController.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/MaterialsInfoController.java index 1c93ca6..8f2dc94 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/MaterialsInfoController.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/MaterialsInfoController.java @@ -74,24 +74,39 @@ public class MaterialsInfoController { materialsInfo.setCompanyId(currentUser.getCompanyId()); materialsInfo.setCode(ProduceManagePublicMethod.creatUniqueCode("WL")); materialsInfoService.save(materialsInfo); - return ResultGenerator.genSuccessResult(); } - + + /** + * hy正在用 + * 删除物料,顺带删除相应的库存信息、出入库记录 + * @param materialsId + * @return + */ + @ApiImplicitParams({ + @ApiImplicitParam(name = "materialsId", value = "物料id", paramType = "query", dataType = "int", required = true) + }) @OperateLog(description = "删除物料", type = "删除") @ApiOperation(value = "删除物料", notes = "删除物料") - @DeleteMapping("/delete/{materialsId}") - public Result delete(@PathVariable Integer materialsId) { - //删除物料,顺带删除相应的库存信息 - MaterialsInfo materialsInfo = materialsInfoService.findById(materialsId); - materialsInfoService.deleteById(materialsId); - MaterialsStockInfo stock = materialsStockInfoService.findBy("materialsId", - materialsInfo.getId()); - materialsStockInfoService.deleteById(stock.getId()); + @DeleteMapping("/delete") + public Result delete(Integer materialsId, @ApiIgnore @User CurrentUser currentUser) { + //if(currentUser==null){ + // return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null ); + //} + materialsInfoService.deleteRelevantById(materialsId); return ResultGenerator.genSuccessResult(); } - + + /** + * hy正在用 + * 物料更新 + * @param materialsInfo + * @return + */ + @ApiImplicitParams({ + @ApiImplicitParam(name = "materialsInfo", value = "物料", paramType = "body", dataType = "MaterialsInfo", required = true) + }) @OperateLog(description = "修改物料", type = "更新") @ApiOperation(value = "修改物料", notes = "修改物料") @PostMapping("/update") diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/MaterialsOutgoingLogController.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/MaterialsOutgoingLogController.java index 2635a2b..d75d2fd 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/MaterialsOutgoingLogController.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/MaterialsOutgoingLogController.java @@ -38,8 +38,6 @@ public class MaterialsOutgoingLogController { @Autowired private MaterialsStockInfoService materialsStockInfoService; - //@Autowired - //private MaterialsOutgoingLogDTOService materialsOutgoingLogDTOService; /** * hy正在用 diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/OtherServiceController.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/OtherServiceController.java index b57fd9d..9cb96a1 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/OtherServiceController.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/OtherServiceController.java @@ -26,13 +26,15 @@ import java.util.List; @RequestMapping("/other/service") public class OtherServiceController { + private String ipUrl = "http://132.232.34.114:9060/wms/"; + @Autowired private RestTemplate restTemplate; //获取所有客户 @GetMapping public Result getClients() { - JSONObject jsonObject = restTemplate.getForObject("http://132.232.34.114:9060/wms/client/manages/list/new", JSONObject.class); + JSONObject jsonObject = restTemplate.getForObject(ipUrl+"client/manages/list/new", JSONObject.class); JSONObject data = jsonObject.getJSONObject("data"); JSONArray listJson = data.getJSONArray("list"); List list = JSON.parseObject(listJson.toJSONString(), ArrayList.class);