物料管理测试修改1:列表查询日期降序、删除物料及相关信息修改

This commit is contained in:
hy2250089 2020-01-07 21:56:39 +08:00
parent 957a7ac495
commit 19490a5a2a
15 changed files with 104 additions and 37 deletions

View File

@ -106,6 +106,12 @@
<artifactId>pagehelper</artifactId>
<version>4.2.1</version>
</dependency>
<!-- MyBatis 通用 Mapper -->
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>2.0.2</version>
</dependency>
<!--阿里 FastJson依赖-->
<dependency>
<groupId>com.alibaba</groupId>

View File

@ -76,6 +76,13 @@
<orderEntry type="library" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:4.2.1" level="project" />
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:0.9.5" level="project" />
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-starter:2.0.2" level="project" />
<orderEntry type="library" name="Maven: tk.mybatis:mapper-core:1.0.2" level="project" />
<orderEntry type="library" name="Maven: tk.mybatis:mapper-base:1.0.1" level="project" />
<orderEntry type="library" name="Maven: tk.mybatis:mapper-weekend:1.1.3" level="project" />
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring:1.0.1" level="project" />
<orderEntry type="library" name="Maven: tk.mybatis:mapper-extra:1.0.1" level="project" />
<orderEntry type="library" name="Maven: tk.mybatis:mapper-spring-boot-autoconfigure:2.0.2" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.22" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.1.2" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.2" level="project" />

View File

@ -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;

View File

@ -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<MaterialsOutgoingLog> {
List<MaterialsOutgoingLogVo> findListByOneMaterial(MaterialsOutgoingLogParams params);
void deleteByOutgoingIds(List<Integer> ids);
}

View File

@ -78,7 +78,7 @@
<if test="companyId != null">
AND com.company_id = #{companyId}
</if>
</where> order by materials.id
</where> order by materials.create_time DESC
</select>
<select id="findDetailById" parameterType="com.deer.wms.produce.manage.model.MaterialsInfoParams" resultMap="MatInfoDTOResultMap">

View File

@ -47,6 +47,14 @@
<if test="companyId != null">
AND outgoing.company_id = #{companyId}
</if>
</where> ORDER BY outgoing.id
</where> ORDER BY outgoing.create_time DESC
</select>
<delete id="deleteByOutgoingIds" parameterType = "java.util.List">
DELETE FROM mt_alone_materials_outgoing_log WHERE id IN
<foreach collection="list" item="ids" open="(" separator="," close=")">
#{ids}
</foreach>
</delete>
</mapper>

View File

@ -118,21 +118,5 @@
</where> ORDER BY prodproc.create_time DESC, prodproc.update_time DESC
</select>
<!--没用
<select id="findProductProcessPoById" parameterType="com.deer.wms.produce.manage.model.ProductProcessParams" resultMap="ProductProcessPoResultMap">
SELECT prodproc.*, prodbom.product_process_name, product.product_name
FROM mt_alone_product_process prodproc
LEFT JOIN mt_alone_product_process_bom prodbom ON prodproc.product_bom_id = prodbom.id AND prodproc.company_id = prodbom.company_id
LEFT JOIN mt_alone_machining_product product ON prodbom.product_id = product.id AND prodbom.company_id = product.company_id
<where>
<if test=" != null">
AND DATE_FORMAT(prodproc.create_time,'%Y-%m-%d') = DATE_FORMAT(#{createDate}, '%Y-%m-%d')
</if>
<if test="companyId != null">
AND prodproc.company_id = #{companyId}
</if>
</where>
</select>
-->
</mapper>

View File

@ -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;

View File

@ -20,4 +20,5 @@ public interface MaterialsInfoService extends Service<MaterialsInfo, Integer> {
List<MaterialsInfoVO> findMaterialsByKeyWords(MaterialsInfoParams params);
void deleteRelevantById(Integer materialsId);
}

View File

@ -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<MaterialsOutgoingLo
List<MaterialsOutgoingLogVo> findListByOneMaterial(MaterialsOutgoingLogParams params) ;
void save(MaterialsOutgoingLog materialsOutgoingLog, CurrentUser currentUser);
void deleteByOutgoingIds(List<Integer> ids);
}

View File

@ -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<MaterialsInfo, Int
@Autowired
private MaterialsInfoMapper materialsInfoMapper;
@Autowired
private MaterialsStockInfoService materialsStockInfoService;
@Autowired
private MaterialsOutgoingLogService materialsOutgoingLogService;
@Override
public List<MaterialsInfoDto> findList(MaterialsInfoParams params) {
@ -44,5 +51,30 @@ public class MaterialsInfoServiceImpl extends AbstractService<MaterialsInfo, Int
return materialsInfoMapper.findMaterialsByKeyWords(params);
}
@Override
public void deleteRelevantById(Integer materialsId) {
materialsInfoMapper.deleteByPrimaryKey(materialsId);
MaterialsStockInfo stock = materialsStockInfoService.findBy("materialsId", materialsId);
if(null!=stock)
materialsStockInfoService.deleteById(stock.getId());
MaterialsOutgoingLogParams params = new MaterialsOutgoingLogParams();
params.setMaterialsId(materialsId);
params.setCompanyId(1);
List<MaterialsOutgoingLogVo> materialsOutgoingLogList = materialsOutgoingLogService.findListByOneMaterial(params);
System.out.println("=========="+materialsOutgoingLogList.size());
if((null!=materialsOutgoingLogList) && (materialsOutgoingLogList.size()!=0)){
List<Integer> ids = new ArrayList<Integer>();
for (MaterialsOutgoingLogVo materialsOutgoingLogVo : materialsOutgoingLogList){
ids.add(materialsOutgoingLogVo.getId());
}
System.out.println("----------"+ids.size());
if((null!=ids) && (ids.size()!=0)) {
materialsOutgoingLogService.deleteByOutgoingIds(ids);
}
}
}
}

View File

@ -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<MaterialsOu
materialsStockInfoService.update(stock);
}
}
@Override
public void deleteByOutgoingIds(List<Integer> ids) {
materialsOutgoingLogMapper.deleteByOutgoingIds(ids);
}
}

View File

@ -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")

View File

@ -38,8 +38,6 @@ public class MaterialsOutgoingLogController {
@Autowired
private MaterialsStockInfoService materialsStockInfoService;
//@Autowired
//private MaterialsOutgoingLogDTOService materialsOutgoingLogDTOService;
/**
* hy正在用

View File

@ -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);