Commit 881c701b authored by 李驰骋's avatar 李驰骋

入库调整

parent e61289b0
package com.topsunit.scanservice.ximai.controller; package com.topsunit.scanservice.ximai.controller;
import com.topsunit.scanservice.ximai.dto.MoctcCreateCriteria; import com.topsunit.scanservice.ximai.dto.*;
import com.topsunit.scanservice.ximai.dto.MoctcCreateDto;
import com.topsunit.scanservice.ximai.dto.MoctcCreateParams;
import com.topsunit.scanservice.ximai.dto.MoctfCreateParams;
import com.topsunit.scanservice.ximai.service.MoctcService; import com.topsunit.scanservice.ximai.service.MoctcService;
import com.topsunit.scanservice.ximai.service.MoctfService; import com.topsunit.scanservice.ximai.service.MoctfService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -26,4 +23,11 @@ public class MoctfController { ...@@ -26,4 +23,11 @@ public class MoctfController {
public void create(@RequestBody MoctfCreateParams createParams) { public void create(@RequestBody MoctfCreateParams createParams) {
moctfService.create(createParams); moctfService.create(createParams);
} }
@PostMapping("/moctf/createByErp")
public void createByErp(@RequestBody MoctfCreateParams2 createParams) {
moctfService.create2(createParams);
}
} }
...@@ -7,6 +7,8 @@ import com.topsunit.scanservice.ximai.entity.MocthId; ...@@ -7,6 +7,8 @@ import com.topsunit.scanservice.ximai.entity.MocthId;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.Optional;
/** /**
* <p>Title: MoctfDao</p> * <p>Title: MoctfDao</p>
* <p>Description: MoctfDao</p> * <p>Description: MoctfDao</p>
...@@ -16,4 +18,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; ...@@ -16,4 +18,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @date 2024/10/23 * @date 2024/10/23
*/ */
public interface MoctfDao extends JpaRepository<Moctf, MoctfId>, JpaSpecificationExecutor<Moctf> { public interface MoctfDao extends JpaRepository<Moctf, MoctfId>, JpaSpecificationExecutor<Moctf> {
Optional<Moctf> findFirstByTf001AndTf002StartingWithOrderByTf002Desc(String tf001, String tf002);
} }
...@@ -3,6 +3,7 @@ package com.topsunit.scanservice.ximai.dto; ...@@ -3,6 +3,7 @@ package com.topsunit.scanservice.ximai.dto;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
...@@ -21,8 +22,10 @@ public class MoctcCreateDto { ...@@ -21,8 +22,10 @@ public class MoctcCreateDto {
/*产品品号*/ /*产品品号*/
@ApiModelProperty("产品品号") @ApiModelProperty("产品品号")
private String ta006; private String ta006;
@ApiModelProperty("预计产量")
private BigDecimal ta015;
/*入库仓库*/ /*入库仓库*/
@ApiModelProperty("性质 1.厂内工单、2.委外工单") @ApiModelProperty("入库仓库")
private String ta020; private String ta020;
/*性质 1.厂内工单、2.委外工单*/ /*性质 1.厂内工单、2.委外工单*/
@ApiModelProperty("性质 1.厂内工单、2.委外工单") @ApiModelProperty("性质 1.厂内工单、2.委外工单")
......
package com.topsunit.scanservice.ximai.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* <p>Title: MoctfCreateParams</p>
* <p>Description: 完工入库申请表头</p>
*
* @author chicheng.li
* @version V1.0
* @date 2024/10/22
*/
@Data
public class MoctfCreateParams2 {
@ApiModelProperty("入库单别")
private String tg001="5801";
@ApiModelProperty("仓库")
private String tg010;
@ApiModelProperty("库位")
private String tg036;
@ApiModelProperty("入库数量")
private BigDecimal tg011;
@ApiModelProperty("工单单别")
private String tg014;
@ApiModelProperty("工单单号")
private String tg015;
}
...@@ -63,4 +63,56 @@ public class MoctfService { ...@@ -63,4 +63,56 @@ public class MoctfService {
moctf.setTf024(create.getDetails().get(0).getTg011()); moctf.setTf024(create.getDetails().get(0).getTg011());
moctfDao.save(moctf); moctfDao.save(moctf);
} }
@Transactional
public void create2(MoctfCreateParams2 create){
Moctf moctf = BeanUtil.toBeanIgnoreError(new MoctfCreateParams(), Moctf.class);
Calendar curr = Calendar.getInstance();
String currStr = DateUtil.format(curr.getTime(), "yyyyMMdd");
moctf.setTf001(create.getTg001());
moctf.setTf002(this.getNewTf002(create.getTg001()));
moctf.setTf003(currStr);
moctf.setTf012(currStr);
AtomicReference<String> ta083 = new AtomicReference<String>();
Moctg moctg = BeanUtil.toBeanIgnoreError(new MoctgCreateParams(), Moctg.class);
BeanUtil.copyProperties(create, moctg);
//查询工单
Mocta mocta = moctaDao.findById(new MoctaId(create.getTg014(), create.getTg015())).orElseThrow(()->new TopsunitException(MessageUtils.getMessage("未找到对应工单:{0},{1}",create.getTg014(),create.getTg015())));
//查询物料
Invmb invmb = invmbDao.findById(mocta.getTa006()).orElseThrow(()->new TopsunitException(MessageUtils.getMessage("未找到对应物料:{0}", mocta.getTa006())));
moctg.setTg001(moctf.getTf001());
moctg.setTg002(moctf.getTf002());
moctg.setTg004(invmb.getMb001());
moctg.setTg005(invmb.getMb002());
moctg.setTg006(invmb.getMb003());
moctg.setTg007(invmb.getMb004());
moctg.setTg013(create.getTg011());
moctg.setTg037(invmb.getMb004());
moctg.setTg010(invmb.getMb017());
ta083.set(mocta.getTa083());
//查询物料默认仓库
Invmc invmc = invmcDao.findById(new InvmcId(invmb.getMb001(), invmb.getMb017())).orElseThrow(()->new TopsunitException(MessageUtils.getMessage("未找到对应物料默认库:{0},{1}", invmb.getMb001(), invmb.getMb017())));
moctg.setTg036(invmc.getMc015());
moctg.setTg030(currStr);
moctg.setTg038(moctg.getTg011());
moctgDao.save(moctg);
moctf.setTf033(ta083.get());
moctf.setTf023(create.getTg011());
moctf.setTf024(create.getTg011());
moctfDao.save(moctf);
}
private String getNewTf002(String tf001) {
String prefix = com.topsunit.scanservice.ximai.common.DateUtil.currentDateString();
return moctfDao.findFirstByTf001AndTf002StartingWithOrderByTf002Desc(tf001, prefix)
.map(i -> {
int currentOrdianl = Integer.parseInt(i.getTf002().replace(prefix, ""));
return prefix + String.format("%03d", currentOrdianl + 1);
})
.orElse(prefix + "001");
}
} }
...@@ -152,7 +152,7 @@ public class PurccService { ...@@ -152,7 +152,7 @@ public class PurccService {
.orElseThrow(()->new TopsunitException(MessageUtils.getMessage("未配置打印机:")+printParams.getUdf01())); .orElseThrow(()->new TopsunitException(MessageUtils.getMessage("未配置打印机:")+printParams.getUdf01()));
String url = "http://%s:8085/ximaiprintservice/print/PrintLabelByBarTender"; String url = "http://%s:8085/ximaiprintservice/print/PrintLabelByBarTender";
url = String.format(url, warehouseArrive.getWarehouseName()); url = String.format(url, warehouseArrive.getPrintIp());
List<List<PrintField>> codeList = new ArrayList<>(); List<List<PrintField>> codeList = new ArrayList<>();
purcdPrintParamsList.forEach(i -> { purcdPrintParamsList.forEach(i -> {
purcdDao.findById(new PurcdId(i.getCd001(), i.getCd002(), i.getCd003())).ifPresent(j -> { purcdDao.findById(new PurcdId(i.getCd001(), i.getCd002(), i.getCd003())).ifPresent(j -> {
......
...@@ -12,7 +12,10 @@ import com.topsunit.scanservice.ximai.dto.PurthCreateParams; ...@@ -12,7 +12,10 @@ import com.topsunit.scanservice.ximai.dto.PurthCreateParams;
import com.topsunit.scanservice.ximai.dto.mapper.PurtgMapper; import com.topsunit.scanservice.ximai.dto.mapper.PurtgMapper;
import com.topsunit.scanservice.ximai.entity.*; import com.topsunit.scanservice.ximai.entity.*;
import com.topsunit.scanservice.ximai.security.CurrentActor; import com.topsunit.scanservice.ximai.security.CurrentActor;
import com.topsunit.scanservice.ximai.security.CurrentActorSetter;
import com.topsunit.scanservice.ximai.utils.MessageUtils; import com.topsunit.scanservice.ximai.utils.MessageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -46,6 +49,8 @@ public class PurtgService { ...@@ -46,6 +49,8 @@ public class PurtgService {
private final PurmaDao purmaDao; private final PurmaDao purmaDao;
private final CmsniDao cmsniDao; private final CmsniDao cmsniDao;
private final PurtgMapper purtgMapper; private final PurtgMapper purtgMapper;
@Autowired
ApplicationContext applicationContext;
public PurtgService(CurrentActor currentActor, CmsmgDao cmsmgDao, InvmbDao invmbDao, InvmcDao invmcDao, InvmeDao invmeDao, PurccDao purccDao, PurcdDao purcdDao, PurtcDao purtcDao, PurtdDao purtdDao, PurtgDao purtgDao, PurthDao purthDao, PurmaDao purmaDao, CmsniDao cmsniDao, PurtgMapper purtgMapper) { public PurtgService(CurrentActor currentActor, CmsmgDao cmsmgDao, InvmbDao invmbDao, InvmcDao invmcDao, InvmeDao invmeDao, PurccDao purccDao, PurcdDao purcdDao, PurtcDao purtcDao, PurtdDao purtdDao, PurtgDao purtgDao, PurthDao purthDao, PurmaDao purmaDao, CmsniDao cmsniDao, PurtgMapper purtgMapper) {
this.currentActor = currentActor; this.currentActor = currentActor;
...@@ -172,6 +177,10 @@ public class PurtgService { ...@@ -172,6 +177,10 @@ public class PurtgService {
// tg046 // tg046
// tg047 // tg047
// tg048 // tg048
CurrentActorSetter currentActorSetter = applicationContext.getBean(CurrentActorSetter.class);
if(currentActorSetter.getActor()==null){
throw new TopsunitException(MessageUtils.getMessage("未找到用户:{0}", currentActorSetter.getActorStr()));
}
purtg.setTg049(currentActor.getActor().getMv004()); purtg.setTg049(currentActor.getActor().getMv004());
purtg.setTg050("N"); purtg.setTg050("N");
// tg051 // tg051
......
topsunit: topsunit:
token-expires-hour: 8760 token-expires-hour: 8760
token-secret: q8w3Cx9Lr4fT2y6uV5sZ8aE1mN0kP7gH token-secret: q8w3Cx9Lr4fT2y6uV5sZ8aE1mN0kP7gH
authentication-enabled: true authentication-enabled: false
print-api-url: http://127.0.0.1:8085/ximaiprintservice/print/PrintLabelByBarTender print-api-url: http://127.0.0.1:8085/ximaiprintservice/print/PrintLabelByBarTender
share-url: smb://127.0.0.1/share share-url: smb://127.0.0.1/share
mes-url: http://localhost:8088 mes-url: http://localhost:8088
......
spring: spring:
profiles: profiles:
active: active:
- test-sh - dev
\ No newline at end of file \ No newline at end of file
...@@ -41,4 +41,5 @@ ...@@ -41,4 +41,5 @@
通知单{0}已全部出库=通知单{0}已全部出库 通知单{0}已全部出库=通知单{0}已全部出库
未找到销售订单:{0},{1}=未找到销售订单:{0},{1} 未找到销售订单:{0},{1}=未找到销售订单:{0},{1}
未找到销售订单:{0},{1},{2}=未找到销售订单:{0},{1},{2} 未找到销售订单:{0},{1},{2}=未找到销售订单:{0},{1},{2}
未找到客户:{0}=未找到客户:{0} 未找到客户:{0}=未找到客户:{0}
\ No newline at end of file 未找到用户:{0}=未找到用户:{0}
\ No newline at end of file
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