|
|
|
@ -19,6 +19,7 @@ import com.op.system.api.domain.dto.WCSDTO;
|
|
|
|
|
import com.op.system.api.domain.dto.WCSDataDTO;
|
|
|
|
|
import com.op.system.api.domain.dto.WCSDataItemsDTO;
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -29,6 +30,7 @@ import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
|
|
|
|
|
import static com.op.common.core.web.domain.AjaxResult.error;
|
|
|
|
@ -51,6 +53,7 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
|
|
|
|
|
//
|
|
|
|
|
// @Value("${wcs.url1}")
|
|
|
|
|
// public String materialPlanSyncUrl;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询湿料计划管理
|
|
|
|
|
*
|
|
|
|
@ -117,9 +120,9 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
|
|
|
|
|
// 已下发计划不允许删除
|
|
|
|
|
for (String id : ids) {
|
|
|
|
|
ProWetMaterialPlan plan = proWetMaterialPlanMapper.selectProWetMaterialPlanById(id);
|
|
|
|
|
if (plan.getSyncFlag().equals("Y")){
|
|
|
|
|
if (plan.getSyncFlag().equals("Y")) {
|
|
|
|
|
SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
return error("日期为"+formatDate.format(plan.getPlanTime())+"的计划已下发,不允许删除!");
|
|
|
|
|
return error("日期为" + formatDate.format(plan.getPlanTime()) + "的计划已下发,不允许删除!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (String id : ids) {
|
|
|
|
@ -248,12 +251,39 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public AjaxResult getWetMaterialPlanDetailListById(String id) {
|
|
|
|
|
List<ProWetMaterialPlanDetail> detailList = proWetMaterialPlanDetailMapper.selectProWetMaterialPlanDetailListById(id);
|
|
|
|
|
// 获取班次名称和料罐名称
|
|
|
|
|
// 湿料详情数据处理(去重)
|
|
|
|
|
List<ProWetMaterialPlanDetail> tempList = new ArrayList<>();
|
|
|
|
|
for (ProWetMaterialPlanDetail detail : detailList) {
|
|
|
|
|
ProWetMaterialPlanDetail temp = new ProWetMaterialPlanDetail();
|
|
|
|
|
|
|
|
|
|
// 获取班次名称和料罐名称
|
|
|
|
|
detail.setShiftDesc(proWetMaterialPlanMapper.selectShiftById(String.valueOf(detail.getShiftId())));
|
|
|
|
|
detail.setBucketName(proWetMaterialPlanMapper.selectBucketNameById(detail.getBucketId()));
|
|
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(detail,temp);
|
|
|
|
|
|
|
|
|
|
if (tempList.size() == 0) {
|
|
|
|
|
tempList.add(temp);
|
|
|
|
|
}else {
|
|
|
|
|
boolean check = true;
|
|
|
|
|
|
|
|
|
|
for (ProWetMaterialPlanDetail data : tempList) {
|
|
|
|
|
// 找到重复
|
|
|
|
|
if (data.getWorkorderCode().equals(temp.getWorkorderCode())) {
|
|
|
|
|
check = false;
|
|
|
|
|
StringBuilder bucketName = new StringBuilder(data.getBucketName());
|
|
|
|
|
bucketName.append(",").append(temp.getBucketName());
|
|
|
|
|
data.setBucketName(bucketName.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (check) {
|
|
|
|
|
tempList.add(temp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return success(detailList);
|
|
|
|
|
return success(tempList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -267,19 +297,27 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
|
|
|
|
|
@Transactional
|
|
|
|
|
public AjaxResult updateWetMaterialPlanDetail(List<ProWetMaterialPlanDetail> detailList) {
|
|
|
|
|
// 获取该计划详情下的主计划信息
|
|
|
|
|
ProWetMaterialPlan proWetMaterialPlan = proWetMaterialPlanMapper.selectProWetMaterialPlanById(detailList.get(0).getWetMaterialPlanId());
|
|
|
|
|
ProWetMaterialPlan proWetMaterialPlan = proWetMaterialPlanMapper.selectProWetMaterialPlanByWorkIdN(detailList.get(0).getWorkorderId());
|
|
|
|
|
// 更新主计划信息
|
|
|
|
|
// 更新人
|
|
|
|
|
proWetMaterialPlan.setUpdateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
// 更新时间
|
|
|
|
|
proWetMaterialPlan.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
// 更新至数据库
|
|
|
|
|
proWetMaterialPlanMapper.updateProWetMaterialPlan(proWetMaterialPlan);
|
|
|
|
|
|
|
|
|
|
// 循环将详情信息更新至数据库
|
|
|
|
|
// 删除所有详情信息
|
|
|
|
|
proWetMaterialPlanDetailMapper.deleteProWetMaterialPlanDetailByPlanId(proWetMaterialPlan.getId());
|
|
|
|
|
|
|
|
|
|
for (ProWetMaterialPlanDetail detail : detailList) {
|
|
|
|
|
proWetMaterialPlanDetailMapper.updateProWetMaterialPlanDetail(detail);
|
|
|
|
|
ProOrderWorkorder workOrder = new ProOrderWorkorder();
|
|
|
|
|
BeanUtils.copyProperties(detail,workOrder);
|
|
|
|
|
workOrder.setShiftId(String.valueOf(detail.getShiftId()));
|
|
|
|
|
workOrder.setBucketId(Integer.valueOf(detail.getBucketId()));
|
|
|
|
|
workOrder.setMaterialId(Integer.valueOf(detail.getMaterialId()));
|
|
|
|
|
proWetMaterialPlanDetailMapper.insertProWetMaterialPlanDetail(createProWetMaterialPlanDetail(workOrder,proWetMaterialPlan.getId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// throw new RuntimeException();
|
|
|
|
|
return success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -293,8 +331,8 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public AjaxResult checkChangePlan(String id) {
|
|
|
|
|
List<ProWetMaterialPlanDetail> list = proWetMaterialPlanDetailMapper.selectProWetMaterialPlanDetailByOrderId(id);
|
|
|
|
|
if (list.size()>0){
|
|
|
|
|
return error(500,"计划已接料!不可修改!");
|
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
return error(500, "计划已接料!不可修改!");
|
|
|
|
|
}
|
|
|
|
|
return success();
|
|
|
|
|
}
|
|
|
|
@ -471,29 +509,29 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService
|
|
|
|
|
return detail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String args[]){
|
|
|
|
|
public static void main(String args[]) {
|
|
|
|
|
List<ProWetMaterialPlanDetail> planDetails = new ArrayList<>();
|
|
|
|
|
ProWetMaterialPlanDetail d1=new ProWetMaterialPlanDetail();
|
|
|
|
|
ProWetMaterialPlanDetail d1 = new ProWetMaterialPlanDetail();
|
|
|
|
|
d1.setBucketCode("LG1");
|
|
|
|
|
d1.setMaterialCode("WL00001");
|
|
|
|
|
planDetails.add(d1);
|
|
|
|
|
ProWetMaterialPlanDetail d2=new ProWetMaterialPlanDetail();
|
|
|
|
|
ProWetMaterialPlanDetail d2 = new ProWetMaterialPlanDetail();
|
|
|
|
|
d2.setBucketCode("LG2");
|
|
|
|
|
d2.setMaterialCode("WL00002");
|
|
|
|
|
planDetails.add(d2);
|
|
|
|
|
ProWetMaterialPlanDetail d3=new ProWetMaterialPlanDetail();
|
|
|
|
|
ProWetMaterialPlanDetail d3 = new ProWetMaterialPlanDetail();
|
|
|
|
|
d3.setBucketCode("LG1");
|
|
|
|
|
d3.setMaterialCode("WL00001");
|
|
|
|
|
planDetails.add(d3);
|
|
|
|
|
//罐
|
|
|
|
|
// List<String> gList = planDetails.stream().map(ProWetMaterialPlanDetail::getBucketCode).distinct().collect(Collectors.toList());
|
|
|
|
|
// List<String> gList = planDetails.stream().map(ProWetMaterialPlanDetail::getBucketCode).distinct().collect(Collectors.toList());
|
|
|
|
|
//
|
|
|
|
|
// List<ProWetMaterialPlanDetail> glList = planDetails.stream()
|
|
|
|
|
// .map(e -> new ProWetPlanDetailDTO(e.getBucketCode(), e.getMaterialCode()))
|
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
|
//罐-料
|
|
|
|
|
Map<String, String> mapStream = planDetails.stream()
|
|
|
|
|
.collect(Collectors.toMap(ProWetMaterialPlanDetail::getBucketCode,ProWetMaterialPlanDetail::getMaterialCode, (k1, k2) -> k1));
|
|
|
|
|
.collect(Collectors.toMap(ProWetMaterialPlanDetail::getBucketCode, ProWetMaterialPlanDetail::getMaterialCode, (k1, k2) -> k1));
|
|
|
|
|
System.out.println(mapStream);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|