|
|
|
@ -47,9 +47,9 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
|
|
|
|
|
private ProOrderWorkorderMapper proOrderWorkorderMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ProWetMaterialPlanDetailMapper proWetMaterialPlanDetailMapper;
|
|
|
|
|
|
|
|
|
|
@Value("${wcs.url1}")
|
|
|
|
|
public String materialPlanSyncUrl;
|
|
|
|
|
//
|
|
|
|
|
// @Value("${wcs.url1}")
|
|
|
|
|
// public String materialPlanSyncUrl;
|
|
|
|
|
/**
|
|
|
|
|
* 查询湿料计划管理
|
|
|
|
|
*
|
|
|
|
@ -307,65 +307,65 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
|
|
|
|
|
* ]
|
|
|
|
|
* }
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public AjaxResult syncWCS(@PathVariable String id) {
|
|
|
|
|
|
|
|
|
|
//获取湿料计划
|
|
|
|
|
WCSDTO wcsdto = new WCSDTO();
|
|
|
|
|
wcsdto.setReqCode(id);//主计划id
|
|
|
|
|
wcsdto.setReqTime(DateUtils.getNowDate());
|
|
|
|
|
List<ProWetMaterialPlanDetail> planDetails = proWetMaterialPlanDetailMapper.selectDetailListById(id);
|
|
|
|
|
|
|
|
|
|
//罐
|
|
|
|
|
List<String> gList = planDetails.stream().map(ProWetMaterialPlanDetail::getBucketCode)
|
|
|
|
|
.distinct().collect(Collectors.toList());
|
|
|
|
|
//罐-料
|
|
|
|
|
Map<String, String> glMap = planDetails.stream()
|
|
|
|
|
.collect(Collectors.toMap(ProWetMaterialPlanDetail::getBucketCode,
|
|
|
|
|
ProWetMaterialPlanDetail::getMaterialCode, (k1, k2) -> k1));
|
|
|
|
|
|
|
|
|
|
List<WCSDataDTO> data = new ArrayList<>();
|
|
|
|
|
WCSDataDTO wCSDataDTO = null;
|
|
|
|
|
for (String g : gList) {
|
|
|
|
|
wCSDataDTO = new WCSDataDTO();
|
|
|
|
|
wCSDataDTO.setSku(glMap.get(g));//罐
|
|
|
|
|
wCSDataDTO.setLoadNo(g);//料
|
|
|
|
|
List<WCSDataItemsDTO> unLoadItems = new ArrayList<>();//上位机集合
|
|
|
|
|
//罐-工单
|
|
|
|
|
List<ProWetMaterialPlanDetail> ggList = planDetails.stream()
|
|
|
|
|
.filter(plan -> plan.getBucketCode().equals(g))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
WCSDataItemsDTO wCSDataItemsDTO = null;
|
|
|
|
|
for (ProWetMaterialPlanDetail gg : ggList) {
|
|
|
|
|
//根据工单查收坯机编码
|
|
|
|
|
String bucketCode = proOrderWorkorderMapper.getBucketCodeByWorkId(gg.getWorkorderId());
|
|
|
|
|
if (StringUtils.isNotBlank(bucketCode)) {
|
|
|
|
|
wCSDataItemsDTO = new WCSDataItemsDTO();
|
|
|
|
|
wCSDataItemsDTO.setUnloadNo(bucketCode);
|
|
|
|
|
unLoadItems.add(wCSDataItemsDTO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
wCSDataDTO.setUnLoadItems(unLoadItems);
|
|
|
|
|
}
|
|
|
|
|
wcsdto.setData(data);
|
|
|
|
|
try {
|
|
|
|
|
String sendResult = HttpUtils.sendPost(materialPlanSyncUrl, JSON.toJSONString(wcsdto));
|
|
|
|
|
WCSDTO resultdto = JSON.parseObject(sendResult, WCSDTO.class);
|
|
|
|
|
if ("1".equals(resultdto.getCode())) {
|
|
|
|
|
return error(resultdto.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
return error("调用接口异常");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProWetMaterialPlan detail = new ProWetMaterialPlan();
|
|
|
|
|
detail.setId(id);
|
|
|
|
|
detail.setSyncFlag("Y");//已经同步的标识
|
|
|
|
|
proWetMaterialPlanMapper.updateProWetMaterialPlan(detail);
|
|
|
|
|
return success();
|
|
|
|
|
}
|
|
|
|
|
// @Override
|
|
|
|
|
// @DS("#header.poolName")
|
|
|
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
// public AjaxResult syncWCS(@PathVariable String id) {
|
|
|
|
|
//
|
|
|
|
|
// //获取湿料计划
|
|
|
|
|
// WCSDTO wcsdto = new WCSDTO();
|
|
|
|
|
// wcsdto.setReqCode(id);//主计划id
|
|
|
|
|
// wcsdto.setReqTime(DateUtils.getNowDate());
|
|
|
|
|
// List<ProWetMaterialPlanDetail> planDetails = proWetMaterialPlanDetailMapper.selectDetailListById(id);
|
|
|
|
|
//
|
|
|
|
|
// //罐
|
|
|
|
|
// List<String> gList = planDetails.stream().map(ProWetMaterialPlanDetail::getBucketCode)
|
|
|
|
|
// .distinct().collect(Collectors.toList());
|
|
|
|
|
// //罐-料
|
|
|
|
|
// Map<String, String> glMap = planDetails.stream()
|
|
|
|
|
// .collect(Collectors.toMap(ProWetMaterialPlanDetail::getBucketCode,
|
|
|
|
|
// ProWetMaterialPlanDetail::getMaterialCode, (k1, k2) -> k1));
|
|
|
|
|
//
|
|
|
|
|
// List<WCSDataDTO> data = new ArrayList<>();
|
|
|
|
|
// WCSDataDTO wCSDataDTO = null;
|
|
|
|
|
// for (String g : gList) {
|
|
|
|
|
// wCSDataDTO = new WCSDataDTO();
|
|
|
|
|
// wCSDataDTO.setSku(glMap.get(g));//罐
|
|
|
|
|
// wCSDataDTO.setLoadNo(g);//料
|
|
|
|
|
// List<WCSDataItemsDTO> unLoadItems = new ArrayList<>();//上位机集合
|
|
|
|
|
// //罐-工单
|
|
|
|
|
// List<ProWetMaterialPlanDetail> ggList = planDetails.stream()
|
|
|
|
|
// .filter(plan -> plan.getBucketCode().equals(g))
|
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
|
// WCSDataItemsDTO wCSDataItemsDTO = null;
|
|
|
|
|
// for (ProWetMaterialPlanDetail gg : ggList) {
|
|
|
|
|
// //根据工单查收坯机编码
|
|
|
|
|
// String bucketCode = proOrderWorkorderMapper.getBucketCodeByWorkId(gg.getWorkorderId());
|
|
|
|
|
// if (StringUtils.isNotBlank(bucketCode)) {
|
|
|
|
|
// wCSDataItemsDTO = new WCSDataItemsDTO();
|
|
|
|
|
// wCSDataItemsDTO.setUnloadNo(bucketCode);
|
|
|
|
|
// unLoadItems.add(wCSDataItemsDTO);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// wCSDataDTO.setUnLoadItems(unLoadItems);
|
|
|
|
|
// }
|
|
|
|
|
// wcsdto.setData(data);
|
|
|
|
|
// try {
|
|
|
|
|
// String sendResult = HttpUtils.sendPost(materialPlanSyncUrl, JSON.toJSONString(wcsdto));
|
|
|
|
|
// WCSDTO resultdto = JSON.parseObject(sendResult, WCSDTO.class);
|
|
|
|
|
// if ("1".equals(resultdto.getCode())) {
|
|
|
|
|
// return error(resultdto.getMessage());
|
|
|
|
|
// }
|
|
|
|
|
// }catch (Exception e){
|
|
|
|
|
// return error("调用接口异常");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// ProWetMaterialPlan detail = new ProWetMaterialPlan();
|
|
|
|
|
// detail.setId(id);
|
|
|
|
|
// detail.setSyncFlag("Y");//已经同步的标识
|
|
|
|
|
// proWetMaterialPlanMapper.updateProWetMaterialPlan(detail);
|
|
|
|
|
// return success();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 创建湿料(主)计划
|
|
|
|
|