Merge remote-tracking branch '惠信/dev_zhangke' into develop
This commit is contained in:
commit
dbe48a46a2
|
|
@ -2,17 +2,22 @@ package com.nflg.wms.admin.controller;
|
|||
|
||||
import com.nflg.wms.admin.pojo.dto.LdapDepartmentDTO;
|
||||
import com.nflg.wms.admin.pojo.dto.LdapUserDTO;
|
||||
import com.nflg.wms.admin.service.SapService;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnItemQO;
|
||||
import com.nflg.wms.repository.entity.Language;
|
||||
import com.nflg.wms.repository.service.ILanguageService;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
import com.sap.conn.jco.JCoException;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import tech.powerjob.common.enhance.SafeRunnable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 测试
|
||||
|
|
@ -27,15 +32,46 @@ public class TestController extends BaseController {
|
|||
// @Resource
|
||||
// private LdapService ldapService;
|
||||
|
||||
|
||||
@Resource
|
||||
private SapService sapService;
|
||||
@GetMapping("/add")
|
||||
public void add() {
|
||||
Language language = new Language()
|
||||
.setCode("test1")
|
||||
.setName("测试1")
|
||||
.setValue("aaa")
|
||||
.setIco("")
|
||||
.setZone("");
|
||||
languageService.save(language);
|
||||
public void add() throws JCoException {
|
||||
// try {
|
||||
sapService.zwm00_MB017("1309976");
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
List<C_MaterialReturnItemQO>items=new ArrayList<>();
|
||||
C_MaterialReturnItemQO item=new C_MaterialReturnItemQO()
|
||||
.setBatchNumber("1")
|
||||
.setSerialNumber("2222")
|
||||
.setResbMatnr("2147854512")
|
||||
.setResbWerks("1020")
|
||||
.setMsebErfmg(new BigDecimal(1.2));
|
||||
|
||||
|
||||
items.add( item);
|
||||
|
||||
C_MaterialReturnItemQO item1=new C_MaterialReturnItemQO()
|
||||
.setBatchNumber("12333")
|
||||
.setSerialNumber("222112")
|
||||
.setResbMatnr("2147854512")
|
||||
.setResbWerks("1020")
|
||||
.setMsebErfmg(new BigDecimal(1.8));
|
||||
items.add( item1);
|
||||
|
||||
// Language language = new Language()
|
||||
// .setCode("test1")
|
||||
// .setName("测试1")
|
||||
// .setValue("aaa")
|
||||
// .setIco("")
|
||||
// .setZone("");
|
||||
// languageService.save(language);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,8 +8,12 @@ import com.nflg.wms.admin.pojo.dto.ZIM003105DTO;
|
|||
import com.nflg.wms.admin.pojo.dto.ZIM003DTO;
|
||||
import com.nflg.wms.common.constant.STATE;
|
||||
import com.nflg.wms.common.exception.NflgException;
|
||||
import com.nflg.wms.common.pojo.dto.C_MaterialReturnDTO;
|
||||
import com.nflg.wms.common.pojo.dto.C_MaterialReturnQueryDTO;
|
||||
import com.nflg.wms.common.pojo.dto.SAPOrderDTO;
|
||||
import com.nflg.wms.common.pojo.dto.SAPSyncFromDTO;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnItemQO;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnQO;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.sap.conn.jco.*;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
@ -17,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
|
|
@ -30,9 +35,10 @@ public class SapService {
|
|||
|
||||
/**
|
||||
* 扫码质检入库
|
||||
*
|
||||
* @param dto 数据
|
||||
*/
|
||||
public String zim003_105(ZIM003105DTO dto){
|
||||
public String zim003_105(ZIM003105DTO dto) {
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("I_EBELN", dto.getEbeln());
|
||||
parameters.put("I_MBLNR", dto.getMblnr());
|
||||
|
|
@ -53,10 +59,10 @@ public class SapService {
|
|||
list1.add(Map.of("WERKS", dto.getItem1().getWerks()));
|
||||
tables.put("T_LIST1", list1);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(dto.getItem2())){
|
||||
if (CollectionUtil.isNotEmpty(dto.getItem2())) {
|
||||
List<Map<String, Object>> list2 = new ArrayList<>();
|
||||
dto.getItem2().forEach(item -> {
|
||||
Map<String, Object> map=new HashMap<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("EBELP", item.getEBELP());
|
||||
map.put("SERNR", item.getSERNR());
|
||||
map.put("FLAG", item.getFLAG());
|
||||
|
|
@ -66,14 +72,15 @@ public class SapService {
|
|||
}
|
||||
|
||||
JCoParameterList tOut = execReturnParameter("ZIM_003_105", parameters, tables);
|
||||
return StrUtil.equals(tOut.getString("TYPE"),"S")? "" : tOut.getString("MSG");
|
||||
return StrUtil.equals(tOut.getString("TYPE"), "S") ? "" : tOut.getString("MSG");
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码入库
|
||||
*
|
||||
* @param dto 数据
|
||||
*/
|
||||
public String zim003(ZIM003DTO dto){
|
||||
public String zim003(ZIM003DTO dto) {
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("EBELP", dto.getEbeln());
|
||||
parameters.put("USNAM", dto.getUsnam());
|
||||
|
|
@ -90,10 +97,10 @@ public class SapService {
|
|||
list1.add(Map.of("KZKRI", dto.getItem1().getKZKRI()));
|
||||
tables.put("T_LIST1", list1);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(dto.getItem2())){
|
||||
if (CollectionUtil.isNotEmpty(dto.getItem2())) {
|
||||
List<Map<String, Object>> list2 = new ArrayList<>();
|
||||
dto.getItem2().forEach(item -> {
|
||||
Map<String, Object> map=new HashMap<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("EBELP", item.getEBELP());
|
||||
map.put("SERNR", item.getSERNR());
|
||||
map.put("FLAG", item.getFLAG());
|
||||
|
|
@ -103,30 +110,31 @@ public class SapService {
|
|||
}
|
||||
|
||||
JCoParameterList tOut = execReturnParameter("ZIM_003", parameters, tables);
|
||||
return StrUtil.equals(tOut.getString("TYPE"),"S")? "" : tOut.getString("MSG");
|
||||
return StrUtil.equals(tOut.getString("TYPE"), "S") ? "" : tOut.getString("MSG");
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存库存
|
||||
*
|
||||
* @param factory 工厂编号
|
||||
* @param materialNo 物料编号
|
||||
* @param warehouseNo 仓库编号
|
||||
* @param binNos 储位编号列表
|
||||
*/
|
||||
public void ZWM3A02(String factory,String materialNo,String warehouseNo,Collection<String> binNos) {
|
||||
public void ZWM3A02(String factory, String materialNo, String warehouseNo, Collection<String> binNos) {
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("WERKS", factory);
|
||||
parameters.put("MATNR", materialNo);
|
||||
parameters.put("LGORT", warehouseNo);
|
||||
parameters.put("LGPBE", StrUtil.join("/",binNos));
|
||||
parameters.put("LGPBE", StrUtil.join("/", binNos));
|
||||
|
||||
JCoTable tOut = execReturnTable("ZWM3A02", parameters);
|
||||
|
||||
if (tOut.getNumRows() > 0){
|
||||
if (tOut.getNumRows() > 0) {
|
||||
tOut.setRow(0);
|
||||
VUtil.trueThrowBusinessError(StrUtil.equals(tOut.getString("E_TYPE"),"E"))
|
||||
VUtil.trueThrowBusinessError(StrUtil.equals(tOut.getString("E_TYPE"), "E"))
|
||||
.throwMessage(tOut.getString("E_MSG"));
|
||||
}else {
|
||||
} else {
|
||||
log.error("保存库存失败");
|
||||
VUtil.trueThrowBusinessError(true).throwMessage("保存库存失败");
|
||||
}
|
||||
|
|
@ -134,6 +142,7 @@ public class SapService {
|
|||
|
||||
/**
|
||||
* 获取库存信息
|
||||
*
|
||||
* @param factory 工厂编号
|
||||
* @param warehouseNo 仓库编号
|
||||
* @param materialNo 物料编号
|
||||
|
|
@ -145,6 +154,7 @@ public class SapService {
|
|||
|
||||
/**
|
||||
* 获取库存信息
|
||||
*
|
||||
* @param factory 工厂编号
|
||||
* @param warehouseNos 仓库编号列表
|
||||
* @param beginTime 开始时间,格式yyyyMMdd
|
||||
|
|
@ -193,6 +203,7 @@ public class SapService {
|
|||
|
||||
/**
|
||||
* 获取订单中物料的信息
|
||||
*
|
||||
* @param orderNo 采购单号
|
||||
* @param supplierNo 供应商编号
|
||||
* @param materialNo 物料编号
|
||||
|
|
@ -231,6 +242,7 @@ public class SapService {
|
|||
|
||||
/**
|
||||
* 搜索订单
|
||||
*
|
||||
* @param supplierNo 供应商编码
|
||||
*/
|
||||
public List<SAPOrderDTO> searchOrder(String supplierNo) {
|
||||
|
|
@ -256,6 +268,57 @@ public class SapService {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 成本中心退库查询
|
||||
* 根据退库单号查询物料退库信息
|
||||
*
|
||||
* @param resebRsNum 退库单号
|
||||
* @return 预留单号
|
||||
*/
|
||||
public List<C_MaterialReturnQueryDTO> zwm00_MB017(String resebRsNum) throws JCoException {
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("I_RSNUM", resebRsNum);
|
||||
JCoFunction function = exec("ZWM00_MB017", parameters, null);
|
||||
JCoTable tOut = function.getTableParameterList().getTable("T_OUT");
|
||||
log.info("SAP返回: {}", tOut);
|
||||
List<C_MaterialReturnQueryDTO> result = new ArrayList<>();
|
||||
// if (out.getString("TYPE").equals("S")) {
|
||||
for (int i = 0; i < tOut.getNumRows(); i++) {
|
||||
tOut.setRow(i);
|
||||
result.add(new C_MaterialReturnQueryDTO()
|
||||
.setResbRspos(tOut.getString("RSPOS"))
|
||||
.setMaktx(tOut.getString("MAKTX"))
|
||||
.setResbMatnr(tOut.getString("MATNR"))
|
||||
.setResbBdmng(tOut.getString("BDMNG"))
|
||||
.setResbLgort(tOut.getString("LGORT"))
|
||||
.setResbWerks(tOut.getString("WERKS"))
|
||||
.setResbMeins(tOut.getString("MEINS")));
|
||||
}
|
||||
log.debug("数据:{}", JSONUtil.toJsonStr(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
// 成本中心退库确认
|
||||
private C_MaterialReturnDTO zwm00_MB112(C_MaterialReturnQO request) {
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("I_RSNUM", request.getResbRsNum());
|
||||
parameters.put("I_USNAM", request.getResbRsNum());
|
||||
List<C_MaterialReturnItemQO> items = request.getItems();
|
||||
//
|
||||
// / /Map<String, Map<String, Double>> summary = items.stream()
|
||||
// / / .collect(Collectors.groupingBy(
|
||||
// / / C_MaterialReturnItemQO::getResbRspos,
|
||||
// / /
|
||||
// / / Collectors.groupingBy(
|
||||
// / / C_MaterialReturnItemQO::getResbMatnr,
|
||||
// / /Collectors.summingDouble(item -> Double.parseDouble(item.getMsebErfmg()))
|
||||
// / / )
|
||||
// / / ));
|
||||
return null;
|
||||
}
|
||||
|
||||
//成本中心领料查询
|
||||
//成本中心领料
|
||||
private JCoTable execReturnTable(String functionName, Map<String, Object> parameters) {
|
||||
return execReturnTable(functionName, parameters, null, "T_OUT");
|
||||
}
|
||||
|
|
@ -266,7 +329,7 @@ public class SapService {
|
|||
|
||||
private JCoTable execReturnTable(String functionName, Map<String, Object> parameters, Map<String, List<Map<String, Object>>> tables, String outName) {
|
||||
try {
|
||||
JCoFunction function=exec(functionName,parameters,tables);
|
||||
JCoFunction function = exec(functionName, parameters, tables);
|
||||
JCoTable out = function.getTableParameterList().getTable(outName);
|
||||
log.info("SAP返回: {}", out);
|
||||
return out;
|
||||
|
|
@ -278,7 +341,7 @@ public class SapService {
|
|||
|
||||
private JCoParameterList execReturnParameter(String functionName, Map<String, Object> parameters, Map<String, List<Map<String, Object>>> tables) {
|
||||
try {
|
||||
JCoFunction function=exec(functionName,parameters,tables);
|
||||
JCoFunction function = exec(functionName, parameters, tables);
|
||||
JCoParameterList out = function.getExportParameterList();
|
||||
log.info("SAP返回: {}", out);
|
||||
return out;
|
||||
|
|
@ -292,6 +355,8 @@ public class SapService {
|
|||
log.info("SAP functionName:{}", functionName);
|
||||
JCoFunction function = repository.getFunction(functionName);
|
||||
log.info("SAP ImportParameter:{}", JSONUtil.toJsonStr(parameters));
|
||||
log.info("---{}", function.getImportParameterList().getListMetaData());
|
||||
|
||||
if (CollectionUtil.isNotEmpty(parameters)) {
|
||||
parameters.forEach((name, value) -> function.getImportParameterList().setValue(name, value));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class C_MaterialReturnDTO {
|
||||
//物料凭证(202移动类型凭证)
|
||||
private String eMblnr;
|
||||
|
||||
//物料凭证年度
|
||||
private String eMJahr;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class C_MaterialReturnQueryDTO {
|
||||
// 预留项目号 RESB-RSPOS
|
||||
private String resbRspos;
|
||||
//MAKTX 物料描述
|
||||
private String maktx;
|
||||
//RESB-MATNR 物料号
|
||||
private String resbMatnr;
|
||||
//RESB-BDMNG 需求数量
|
||||
private String resbBdmng;
|
||||
// RESB-LGORT 库存地点
|
||||
private String resbLgort;
|
||||
// RESB-WERKS 工厂
|
||||
private String resbWerks;
|
||||
//RESB-MEINS 单位
|
||||
private String resbMeins;
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class C_MaterialReturnItemQO {
|
||||
|
||||
//预留项目号
|
||||
private String resbRspos;
|
||||
|
||||
// 物料号
|
||||
private String resbMatnr;
|
||||
|
||||
//实退数量
|
||||
private BigDecimal msebErfmg;
|
||||
|
||||
//库存地点
|
||||
private String resbLgort;
|
||||
|
||||
// 工厂
|
||||
private String resbWerks;
|
||||
|
||||
// 单位
|
||||
private String resbMeins;
|
||||
|
||||
// 批次
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String batchNumber;
|
||||
|
||||
/**
|
||||
* 序列号,多个序列号使用;号隔开
|
||||
*/
|
||||
private String serialNumber;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class C_MaterialReturnQO {
|
||||
//预留号
|
||||
private String resbRsNum;
|
||||
|
||||
//PDA操作员
|
||||
private String pdaOperator;
|
||||
|
||||
// 预留单退料详情信息
|
||||
private List<C_MaterialReturnItemQO> items;
|
||||
}
|
||||
|
|
@ -29,9 +29,6 @@ public class WmsSrmMaterialReceiptServiceImpl extends ServiceImpl<WmsSrmMaterial
|
|||
@Resource
|
||||
private IWmsSrmMaterialReceiptItemService wmsSrmMaterialReceiptItemService;
|
||||
|
||||
@Resource
|
||||
private IWmsSrmMaterialReceiptService wmsSrmMaterialReceiptService;
|
||||
|
||||
@Resource
|
||||
private IWmsInTaskService taskService;
|
||||
|
||||
|
|
@ -39,7 +36,7 @@ public class WmsSrmMaterialReceiptServiceImpl extends ServiceImpl<WmsSrmMaterial
|
|||
@Transactional
|
||||
public void generateReceiptInfo(List<WmsSrmMaterialReceipt> receipts, List<WmsSrmMaterialReceiptItem> receiptitems, List<WmsInTaskItem> tasks) {
|
||||
if (Objects.nonNull(receipts) && !receipts.isEmpty()) {
|
||||
wmsSrmMaterialReceiptService.saveBatch(receipts);
|
||||
saveBatch(receipts);
|
||||
}
|
||||
if (Objects.nonNull(receipts) && !receipts.isEmpty()) {
|
||||
wmsSrmMaterialReceiptItemService.saveBatch(receiptitems);
|
||||
|
|
|
|||
Loading…
Reference in New Issue