Commit 36b6969c authored by 李驰骋's avatar 李驰骋

到货仓数据添加

库存添加物料名称字段
parent 6cc12926
......@@ -30,7 +30,7 @@ public class InvmcController {
@ApiModelProperty("品号仓储信息查询")
@PostMapping("/invml/getforinvmlinfo")
public List<InvmlDto> getForInvmbInfo(@RequestBody InvmlCriteria criteria) {
return invmcService.getInvmlList(criteria);
return invmcService.getInvmlList2(criteria);
}
}
package com.topsunit.scanservice.ximai.controller;
import com.topsunit.scanservice.ximai.dao.WarehouseArriveDao;
import com.topsunit.scanservice.ximai.dto.*;
import com.topsunit.scanservice.ximai.entity.WarehouseArrive;
import com.topsunit.scanservice.ximai.service.*;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -74,4 +76,10 @@ public class StockController {
purccService.validate(params);
}
@ApiModelProperty("到货仓查询")
@PostMapping("/warehouseArrive/list")
public List<WarehouseArriveDto> warehouseArriveList() {
return invmcService.warehouseArriveList();
}
}
package com.topsunit.scanservice.ximai.dao;
import com.topsunit.scanservice.ximai.dto.IInvmlDto;
import com.topsunit.scanservice.ximai.dto.InvmlDto;
import com.topsunit.scanservice.ximai.entity.Invml;
import com.topsunit.scanservice.ximai.entity.InvmlId;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
......@@ -18,9 +21,14 @@ import java.util.Optional;
public interface InvmlDao extends JpaRepository<Invml, InvmlId>, JpaSpecificationExecutor<Invml> {
List<Invml> findByMl001OrderByMl002AscMl003AscMl004Asc(String ml001);
List<Invml> findByMl001InOrderByMl002AscMl003AscMl004Asc(List<String> ml001List);
@Query(value = "select il.*,ib.MB002 materialName from INVML il left join INVMB ib on il.ML001 = ib.MB001 where il.ML001 = :ml001 and il.ML002 = :ml002", nativeQuery = true)
List<IInvmlDto> findJoinInvmb(@Param(value = "ml001") String ml001, @Param(value = "ml002") String ml002);
/*
关联通知单查询库明细
*/
@Query(value = "select il.* from COPTO co left join INVML il on il.ML001 = co.TO007 where TO001 = :to001 and TO002 = :to002", nativeQuery = true)
List<Invml> findWithCopto(@Param(value = "to001") String to001, @Param(value = "to002") String to002);
@Query(value = "select il.*,co.TO008 materialName from COPTO co left join INVML il on il.ML001 = co.TO007 where TO001 = :to001 and TO002 = :to002", nativeQuery = true)
List<IInvmlDto> findWithCopto(@Param(value = "to001") String to001, @Param(value = "to002") String to002);
}
package com.topsunit.scanservice.ximai.dao;
import com.topsunit.scanservice.ximai.entity.Admmf;
import com.topsunit.scanservice.ximai.entity.AdmmfId;
import com.topsunit.scanservice.ximai.entity.WarehouseArrive;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.Optional;
/**
* * <p>Title: WarehouseArriveDao</p>
* <p>Description: WarehouseArriveDao</p>
*
* @author chicheng.li
* @version V1.0
* @date 2021/11/8
*/
public interface WarehouseArriveDao extends JpaRepository<WarehouseArrive, Integer>, JpaSpecificationExecutor<WarehouseArrive> {
public Optional<WarehouseArrive> findFirstByWarehouseName(String warehouseName);
}
package com.topsunit.scanservice.ximai.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* <p>Title: InvmlDto</p>
* <p>Description: 品号仓库库位档</p>
*
* @author xi.feng
* @version V1.0
* @date 2021/11/11
*/
public interface IInvmlDto {
@ApiModelProperty("品号")
public String getMl001();
@ApiModelProperty("品名")
public String getMaterialName();
@ApiModelProperty("仓库")
public String getMl002();
@ApiModelProperty("库位")
public String getMl003();
@ApiModelProperty("批号")
public String getMl004();
@ApiModelProperty("库存数量")
public BigDecimal getMl005();
}
......@@ -20,16 +20,19 @@ public class InvmlDto {
*/
@ApiModelProperty("品号")
private String ml001;
@ApiModelProperty("品名")
private String materialName;
/**
* 仓库
*/
@ApiModelProperty("仓库")
private String ml002;
private String ml002;
/**
* 库位
*/
@ApiModelProperty("库位")
private String ml003;
private String ml003;
/**
* 批号
*/
......
......@@ -12,6 +12,9 @@ import java.util.List;
@Data
public class StockArrivalParams {
@ApiModelProperty("到货仓")
String warehouse;
@ApiModelProperty("确认明细")
List<StockArrivalParams.StockArrivalDetail> details;
@Data
......
package com.topsunit.scanservice.ximai.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* <p>Title: WAREHOUSE_ARRIVE</p>
* <p>Description: 到货仓</p>
*
* @author chicheng.li
* @version V1.0
* @date 2025/1/9
*/
@Data
public class WarehouseArriveDto {
String id;
String warehouseName;
String printIp;
}
package com.topsunit.scanservice.ximai.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
/**
* <p>Title: WAREHOUSE_ARRIVE</p>
* <p>Description: 到货仓</p>
*
* @author chicheng.li
* @version V1.0
* @date 2025/1/9
*/
@Data
@Entity
@Table(name = "WAREHOUSE_ARRIVE")
public class WarehouseArrive {
@Id
String id;
@ApiModelProperty("仓库名称")
@Column(name = "warehouse_name")
String warehouseName;
@ApiModelProperty("打印机IP")
@Column(name = "print_ip")
String printIp;
}
package com.topsunit.scanservice.ximai.service;
import com.topsunit.scanservice.ximai.dao.InvmaDao;
import com.topsunit.scanservice.ximai.dao.InvmbDao;
import com.topsunit.scanservice.ximai.dao.InvmcDao;
import com.topsunit.scanservice.ximai.dao.InvmlDao;
import cn.hutool.core.bean.BeanUtil;
import com.topsunit.scanservice.ximai.dao.*;
import com.topsunit.scanservice.ximai.dto.*;
import com.topsunit.scanservice.ximai.dto.mapper.InvmbMapper;
import com.topsunit.scanservice.ximai.dto.mapper.InvmlMapper;
......@@ -12,6 +10,7 @@ import com.topsunit.scanservice.ximai.entity.Invmb;
import com.topsunit.scanservice.ximai.entity.Invmc;
import com.topsunit.scanservice.ximai.entity.Invml;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.domain.Specification;
......@@ -47,6 +46,8 @@ public class InvmcService {
private InvmlDao invmlDao;
@Autowired
private InvmlMapper invmlMapper;
@Autowired
private WarehouseArriveDao warehouseArriveDao;
public List<InvmlDto> getInvmlList(InvmlCriteria criteria) {
Specification<Invml> query = new Specification<Invml>() {
......@@ -68,6 +69,30 @@ public class InvmcService {
return invmlMapper.toInvmlDto(list);
}
public List<InvmlDto> getInvmlList2(InvmlCriteria criteria) {
Specification<Invml> query = new Specification<Invml>() {
@Override
public Predicate toPredicate(Root<Invml> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
List<Predicate> predicates = new ArrayList<Predicate>();
if (StringUtils.isNotBlank(criteria.getMl001())) {
Predicate predicate = criteriaBuilder.equal(root.get("ml001"), criteria.getMl001() );
predicates.add(predicate);
}
if (StringUtils.isNotBlank(criteria.getMl002())) {
Predicate predicate = criteriaBuilder.equal(root.get("ml002"), criteria.getMl002());
predicates.add(predicate);
}
return criteriaQuery.where(predicates.toArray(new Predicate[0])).getRestriction();
}
};
List<IInvmlDto> data = invmlDao.findJoinInvmb(criteria.getMl001(), criteria.getMl002());
return data.stream().map(s->{
InvmlDto temp = new InvmlDto();
BeanUtils.copyProperties(s, temp);
return temp;
}).collect(Collectors.toList());
}
/**
* 通过交货通知单查询库存
* @param to001 单别
......@@ -75,8 +100,17 @@ public class InvmcService {
* @return
*/
public List<InvmlDto> getInvmlWithCopto(String to001,String to002){
List<Invml> list = invmlDao.findWithCopto(to001, to002);
return invmlMapper.toInvmlDto(list);
List<IInvmlDto> data = invmlDao.findWithCopto(to001, to002);
return data.stream().map(s->{
InvmlDto temp = new InvmlDto();
BeanUtils.copyProperties(s, temp);
return temp;
}).collect(Collectors.toList());
}
public List<WarehouseArriveDto> warehouseArriveList() {
return warehouseArriveDao.findAll().stream().map(s->{
return BeanUtil.toBean(s, WarehouseArriveDto.class);
}).collect(Collectors.toList());
}
}
package com.topsunit.scanservice.ximai.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.topsunit.scanservice.ximai.common.DateUtil;
import com.topsunit.scanservice.ximai.common.TopsunitException;
import com.topsunit.scanservice.ximai.dao.*;
......@@ -123,10 +124,19 @@ public class InvtaService {
//盘点仓库、库位
invtb.setTb012(detail.getWarehouse());
invtb.setTb029(detail.getLocation());
//判断调拨库位是否与当前一致
if(StringUtils.isNotEmpty(detail.getAllocateWarehouse()) &&
StringUtils.isNotEmpty(detail.getAllocateLocation())){
if(StrUtil.trim(detail.getAllocateWarehouse()).equals(StrUtil.trim(detail.getWarehouse())) &&
StrUtil.trim(detail.getAllocateLocation()).equals(StrUtil.trim(detail.getLocation()))){
throw new TopsunitException("调拨库位与当前一致");
}
}
invtb.setTb013(detail.getAllocateWarehouse());
invtb.setTb030(detail.getAllocateLocation());
invtbDao.save(invtb);
total = total.add(invtb.getTb007());
i++;
}
invta.setTa011(total);
invta.setTa012(BigDecimal.ZERO);
......
......@@ -40,6 +40,8 @@ public class PurccService {
private PrintConfig printConfig;
@Autowired
private InvmbDao invmbDao;
@Autowired
private WarehouseArriveDao warehouseArriveDao;
private static String DATA_TYPE = "3701";
......@@ -140,17 +142,11 @@ public class PurccService {
if (purcdPrintParamsList.isEmpty()) {
return;
}
String printCode = Optional.ofNullable(printParams.getUdf01())
.filter(i -> i.length() > 1)
.map(i -> i.substring(0, 1))
.orElse("");
String url = printConfig.getUrls()
.stream()
.filter(i-> i.getCode().equals(printCode))
.map(PrintConfigUrl::getUrl)
.findFirst()
.orElseThrow(()->new TopsunitException("未配置打印机"));
WarehouseArrive warehouseArrive = warehouseArriveDao.findFirstByWarehouseName(printParams.getUdf01())
.orElseThrow(()->new TopsunitException("未配置打印机:"+printParams.getUdf01()));
String url = "http://%s:8085/ximaiprintservice/print/PrintLabelByBarTender";
url = String.format(url, warehouseArrive.getWarehouseName());
List<List<PrintField>> codeList = new ArrayList<>();
purcdPrintParamsList.forEach(i -> {
purcdDao.findById(new PurcdId(i.getCd001(), i.getCd002(), i.getCd003())).ifPresent(j -> {
......@@ -229,6 +225,7 @@ public class PurccService {
purcc.setCc003(currStr);
purcc.setCc001(DATA_TYPE);
purcc.setCc002(this.getNewCc002(DATA_TYPE));
purcc.setUdf01(stockArrivalParams.getWarehouse());
purccDao.save(purcc);
int i=1;
for(StockArrivalParams.StockArrivalDetail detail : stockArrivalParams.getDetails()){
......
......@@ -41,6 +41,8 @@ logging:
druid:
sql:
Statement: debug
file:
name: logs/erp-service.log
spring:
devtools:
restart:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment