|
|
|
@ -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;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询湿料计划管理
|
|
|
|
|
*
|
|
|
|
@ -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());
|
|
|
|
|
}
|
|
|
|
|
return success(detailList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (check) {
|
|
|
|
|
tempList.add(temp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|