|
|
|
@ -24,6 +24,7 @@ import com.op.system.api.domain.dto.WechartDTO;
|
|
|
|
|
import com.op.system.api.domain.mes.BaseProductDTO;
|
|
|
|
|
import com.op.system.api.domain.mes.ProRfidProcessDetail;
|
|
|
|
|
import com.op.system.api.domain.quality.*;
|
|
|
|
|
import com.op.system.api.domain.sap.SapCustom;
|
|
|
|
|
import com.op.system.api.domain.sap.SapSupplier;
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
|
|
|
@ -627,6 +628,7 @@ public class OpenServiceImpl implements OpenService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* factoryCode 1000
|
|
|
|
|
* 物料编码+productCode
|
|
|
|
|
* 物料描述+productDescZh
|
|
|
|
|
* 物料组编码+productGroup
|
|
|
|
@ -636,29 +638,58 @@ public class OpenServiceImpl implements OpenService {
|
|
|
|
|
* 计量转换分子+umrez
|
|
|
|
|
* 分母UMREZ+umren
|
|
|
|
|
* 检验标准+ mvgr5
|
|
|
|
|
* 毛重(无\0)+ grosseight
|
|
|
|
|
* 毛重(无\0)+ grossWeight
|
|
|
|
|
* 体积 volume
|
|
|
|
|
* **/
|
|
|
|
|
@Override
|
|
|
|
|
public AjaxResult sendProductCheckNo(List<BaseProductDTO> dtos) {
|
|
|
|
|
try {
|
|
|
|
|
logger.info("oa更新检验标准发送参数"+JSONObject.toJSONString(dtos));
|
|
|
|
|
// int allsize = dtos.size();
|
|
|
|
|
// if(CollectionUtils.isEmpty(dtos)){
|
|
|
|
|
// return error("oa更新检验标准发送参数为空");
|
|
|
|
|
// }
|
|
|
|
|
// int inserttimes = allsize / 100 + 1;
|
|
|
|
|
// for (int m = 0; m < inserttimes; m++) {
|
|
|
|
|
// List<BaseProductDTO> everyList;
|
|
|
|
|
// if (m < (inserttimes - 1)) {
|
|
|
|
|
// everyList = dtos.subList(m * 100, (m + 1) * 100);
|
|
|
|
|
// } else {
|
|
|
|
|
// everyList = dtos.subList(m * 100, allsize);
|
|
|
|
|
// }
|
|
|
|
|
// if (everyList.size() > 0) {
|
|
|
|
|
// sapBomMapper.addSupplierBatchs(everyList);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
if(CollectionUtils.isEmpty(dtos)){
|
|
|
|
|
return error("oa更新检验标准发送参数为空");
|
|
|
|
|
}
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_"+dtos.get(0).getFactoryCode());
|
|
|
|
|
|
|
|
|
|
//sap返回的产品编码
|
|
|
|
|
List<String> codes = dtos.stream().map(BaseProductDTO::getProductCode).collect(Collectors.toList());
|
|
|
|
|
//sap返回的客户编码-本地已存在
|
|
|
|
|
List<String> exsitCodes = openMapper.getExsitCodes(codes);
|
|
|
|
|
//sap返回的产品编码-本地不存在// 差集 (list2 - list1)
|
|
|
|
|
List<String> noExsitCodes = codes.stream().filter(item -> !exsitCodes.contains(item)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<BaseProductDTO> updates = new ArrayList<>();
|
|
|
|
|
for (String exsitCode : exsitCodes) {
|
|
|
|
|
List<BaseProductDTO> updates0 = dtos.stream().filter(dto -> dto.getProductCode().equals(exsitCode)).collect(Collectors.toList());
|
|
|
|
|
updates.addAll(updates0);
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(updates)) {
|
|
|
|
|
int m = openMapper.updateProductNoBatchs(updates);
|
|
|
|
|
System.out.println("oa产品更新成功条数:" + m);
|
|
|
|
|
}
|
|
|
|
|
List<BaseProductDTO> adds = new ArrayList<>();
|
|
|
|
|
for (String noExsitCode : noExsitCodes) {
|
|
|
|
|
List<BaseProductDTO> adds0 = dtos.stream().filter(dto -> dto.getProductCode().equals(noExsitCode)).collect(Collectors.toList());
|
|
|
|
|
adds.addAll(adds0);
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(adds)) {
|
|
|
|
|
|
|
|
|
|
int allsize = adds.size();
|
|
|
|
|
int inserttimes = allsize / 100 + 1;
|
|
|
|
|
for (int m = 0; m < inserttimes; m++) {
|
|
|
|
|
List<BaseProductDTO> everyList;
|
|
|
|
|
if (m < (inserttimes - 1)) {
|
|
|
|
|
everyList = adds.subList(m * 100, (m + 1) * 100);
|
|
|
|
|
} else {
|
|
|
|
|
everyList = adds.subList(m * 100, allsize);
|
|
|
|
|
}
|
|
|
|
|
if (everyList.size() > 0) {
|
|
|
|
|
openMapper.addProductNoBatchs(everyList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println("oa产品新增成功条数:" + allsize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return success();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|