|
@@ -15,8 +15,10 @@ import com.github.zuihou.business.classSchedule.service.ScheduleUserDateService;
|
|
|
import com.github.zuihou.business.externalApi.dao.MesNoticeLogMapper;
|
|
|
import com.github.zuihou.business.externalApi.dao.MesNoticeMapper;
|
|
|
import com.github.zuihou.business.externalApi.dto.MesNoticeUpdateDTO;
|
|
|
+import com.github.zuihou.business.externalApi.entity.ExternalDrawingMaterials;
|
|
|
import com.github.zuihou.business.externalApi.entity.MesNotice;
|
|
|
import com.github.zuihou.business.externalApi.entity.MesNoticeLog;
|
|
|
+import com.github.zuihou.business.externalApi.service.ExternalDrawingMaterialsService;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.Order;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.OrderQuality;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.TTask;
|
|
@@ -24,6 +26,7 @@ import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.OrderQualityService;
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.OrderService;
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.entity.BomProcedureProductionresource;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.MesNoticeLogService;
|
|
|
import com.github.zuihou.business.productionReadyCenter.service.MesNoticeService;
|
|
|
import com.github.zuihou.business.util.MsgUtil;
|
|
@@ -33,6 +36,8 @@ import com.github.zuihou.context.BaseContextHandler;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
import com.github.zuihou.exception.BizException;
|
|
|
+import com.github.zuihou.tenant.entity.Productionresource;
|
|
|
+import com.github.zuihou.tenant.service.ProductionresourceService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -62,6 +67,9 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
|
|
|
@Autowired
|
|
|
private ScheduleUserDateService scheduleUserDateService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProductionresourceService productionresourceService;
|
|
|
|
|
|
|
|
|
@Value("${mes-work-schedule.enabled:false}")
|
|
@@ -91,7 +99,7 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
|
|
|
// 新增到log日志界面
|
|
|
MesNoticeLog mesNoticeLog = new MesNoticeLog();
|
|
|
- BeanUtils.copyProperties(mesNotice1,mesNoticeLog);
|
|
|
+ BeanUtils.copyProperties(mesNotice1, mesNoticeLog);
|
|
|
mesNoticeLog.setNoticeId(mesNotice1.getId());
|
|
|
mesNoticeLog.setId(null);
|
|
|
mesNoticeLogService.save(mesNoticeLog);
|
|
@@ -102,8 +110,10 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
|
|
|
@Autowired
|
|
|
private OrderQualityService orderQualityService;
|
|
|
+
|
|
|
/**
|
|
|
* 上游,上报零件加工完成报工
|
|
|
+ *
|
|
|
* @param order
|
|
|
* @return
|
|
|
*/
|
|
@@ -114,20 +124,20 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
List<MesNoticeLog> mesNoticeLogsList = new ArrayList<>();
|
|
|
// 修改代办为完工
|
|
|
MesNotice mesNotice = baseMapper.selectOne(new LbqWrapper<MesNotice>().eq(MesNotice::getBatchNo, order.getBatchNo()).eq(MesNotice::getBuType, "TASKDISTRIBUTE").ne(MesNotice::getStatus, "3").last("limit 1"));
|
|
|
- if(mesNotice==null || mesNotice.getId() == null || mesNotice.getOrderNo() == null) return null;
|
|
|
+ if (mesNotice == null || mesNotice.getId() == null || mesNotice.getOrderNo() == null) return null;
|
|
|
mesNotice.setStatus("3");
|
|
|
mesNoticeList.add(mesNotice);
|
|
|
|
|
|
// 修改上报MES的数据完工零件数据
|
|
|
- MesNoticeLog mesNoticeLog = mesNoticeLogService.getOne(new LbqWrapper<MesNoticeLog>().eq(MesNoticeLog::getStatus,"4").eq(MesNoticeLog::getNoticeId, mesNotice.getId()).orderByDesc(MesNoticeLog::getCreateTime).last("limit 1"));
|
|
|
+ MesNoticeLog mesNoticeLog = mesNoticeLogService.getOne(new LbqWrapper<MesNoticeLog>().eq(MesNoticeLog::getStatus, "4").eq(MesNoticeLog::getNoticeId, mesNotice.getId()).orderByDesc(MesNoticeLog::getCreateTime).last("limit 1"));
|
|
|
MesNotice mesNoticeRepost = baseMapper.selectOne(new LbqWrapper<MesNotice>().eq(MesNotice::getBatchNo, order.getBatchNo()).eq(MesNotice::getBuType, "TASKAPPLY").ne(MesNotice::getStatus, "3").last("limit 1"));
|
|
|
- double plmenge = Double.parseDouble(order.getProduceNum().toString());
|
|
|
- if(mesNoticeRepost!=null) {
|
|
|
- mesNoticeRepost.setStatus("5").setOrderInfo(String.valueOf(plmenge)).setWorkReport(mesNoticeLog!=null? String.format("%.1f",(plmenge - Double.parseDouble(mesNoticeLog.getOrderInfo()))): String.valueOf(plmenge));
|
|
|
- if("QUALITYREPORT".equals(mesNoticeRepost.getApiType())){
|
|
|
+ double plmenge = Double.parseDouble(order.getProduceNum().toString());
|
|
|
+ if (mesNoticeRepost != null) {
|
|
|
+ mesNoticeRepost.setStatus("5").setOrderInfo(String.valueOf(plmenge)).setWorkReport(mesNoticeLog != null ? String.format("%.1f", (plmenge - Double.parseDouble(mesNoticeLog.getOrderInfo()))) : String.valueOf(plmenge));
|
|
|
+ if ("QUALITYREPORT".equals(mesNoticeRepost.getApiType())) {
|
|
|
OrderQuality orderQuality = orderQualityService.getOne(new LbqWrapper<OrderQuality>().eq(OrderQuality::getOrderId, order.getId()).eq(OrderQuality::getMeasuringType, "1").last("limit 1"));
|
|
|
JSONObject dataInfo = JSONObject.parseObject(mesNoticeRepost.getAcceptPar());
|
|
|
- JSONArray jsonArray = JSONArray.parseArray(orderQuality==null? null : orderQuality.getMeasuringReport());
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(orderQuality == null ? null : orderQuality.getMeasuringReport());
|
|
|
dataInfo.put("resultList", jsonArray);
|
|
|
mesNoticeRepost.setAcceptPar(JSONObject.toJSONString(dataInfo));
|
|
|
}
|
|
@@ -140,11 +150,11 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
// if(count<=0){
|
|
|
// mesNoticeLogService.save(mesNoticeLog);
|
|
|
// }
|
|
|
- if(mesNoticeList!=null && mesNoticeList.size()>0){
|
|
|
+ if (mesNoticeList != null && mesNoticeList.size() > 0) {
|
|
|
for (MesNotice notice : mesNoticeList) {
|
|
|
- if(notice.getId()==null){
|
|
|
+ if (notice.getId() == null) {
|
|
|
baseMapper.insert(notice);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
baseMapper.updateById(notice);
|
|
|
}
|
|
|
|
|
@@ -158,42 +168,62 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(!mesNoticeLogsList.isEmpty()){
|
|
|
+ if (!mesNoticeLogsList.isEmpty()) {
|
|
|
mesNoticeLogService.saveBatchSomeColumn(mesNoticeLogsList);
|
|
|
}
|
|
|
|
|
|
return mesNotice;
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ExternalDrawingMaterialsService externalDrawingMaterialsService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<MesNotice> pageList(IPage page, Wrapper<MesNotice> queryWrapper) {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
- return baseMapper.pageList(page, queryWrapper);
|
|
|
+ IPage<MesNotice> mesNoticeIPage = baseMapper.pageList(page, queryWrapper);
|
|
|
+ List<ExternalDrawingMaterials> listR = externalDrawingMaterialsService.list(Wraps.<ExternalDrawingMaterials>lbQ().eq(ExternalDrawingMaterials::getEnabled, 1));
|
|
|
+ Map<String, ExternalDrawingMaterials> map = listR == null ? null : listR.stream().collect(Collectors.toMap(ExternalDrawingMaterials::getExternalMeterialCode, t -> t));
|
|
|
+ if (!mesNoticeIPage.getRecords().isEmpty()) {
|
|
|
+ for (MesNotice record : mesNoticeIPage.getRecords()) {
|
|
|
+ try {
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(record.getAcceptPar());
|
|
|
+ jsonObject.getString("");
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.info("转换出错,不做处理");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return mesNoticeIPage;
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public String addNoticeMore(List<MesNotice> models, boolean isExist) {
|
|
|
log.info("==============新增notice数据开始====================={}", JSONObject.toJSONString(models));
|
|
|
-
|
|
|
+
|
|
|
StringBuffer existMsg = new StringBuffer();
|
|
|
List<MesNotice> needAddMesNotice = new ArrayList<>();
|
|
|
List<MesNotice> needUpdateMesNotice = new ArrayList<>();
|
|
|
|
|
|
for (MesNotice model : models) {
|
|
|
MesNotice mesNotice = baseMapper.selectOne(Wraps.<MesNotice>lbQ().eq(MesNotice::getCheckPar, model.getCheckPar()));
|
|
|
- if(mesNotice ==null){
|
|
|
+ if (mesNotice == null) {
|
|
|
MesNotice newModel = new MesNotice();
|
|
|
BeanUtils.copyProperties(model, newModel);
|
|
|
needAddMesNotice.add(newModel);
|
|
|
- }else if (isExist){
|
|
|
- if("1".equals(mesNotice.getStatus())) {
|
|
|
+ } else if (isExist) {
|
|
|
+ if ("1".equals(mesNotice.getStatus())) {
|
|
|
model.setId(mesNotice.getId());
|
|
|
- existMsg.append("\n此订单已存在:"+ model.getOrderNo());
|
|
|
- }else {
|
|
|
- existMsg.append("\n此订单已存在:"+ model.getOrderNo());
|
|
|
+ existMsg.append("\n此订单已存在:" + model.getOrderNo());
|
|
|
+ } else {
|
|
|
+ existMsg.append("\n此订单已存在:" + model.getOrderNo());
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
// 以传输的数据为主
|
|
|
model.setId(mesNotice.getId());
|
|
|
BeanUtils.copyProperties(model, mesNotice);
|
|
@@ -204,12 +234,12 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
}
|
|
|
|
|
|
// 新增
|
|
|
- if(!needAddMesNotice.isEmpty()){
|
|
|
+ if (!needAddMesNotice.isEmpty()) {
|
|
|
baseMapper.insertBatchSomeColumn(needAddMesNotice);
|
|
|
}
|
|
|
|
|
|
// 修改
|
|
|
- if(!needUpdateMesNotice.isEmpty()){
|
|
|
+ if (!needUpdateMesNotice.isEmpty()) {
|
|
|
for (MesNotice mesNotice : needUpdateMesNotice) {
|
|
|
baseMapper.updateAllById(mesNotice);
|
|
|
}
|
|
@@ -218,7 +248,7 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
List<MesNoticeLog> mesNoticeLogs = new ArrayList<>();
|
|
|
// 新增,修改,的数据添加日志
|
|
|
needAddMesNotice.addAll(needUpdateMesNotice);
|
|
|
- for (MesNotice model: needAddMesNotice) {
|
|
|
+ for (MesNotice model : needAddMesNotice) {
|
|
|
MesNoticeLog build = MesNoticeLog.builder().build();
|
|
|
BeanUtils.copyProperties(model, build);
|
|
|
build.setNoticeId(model.getId());
|
|
@@ -232,7 +262,7 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
|
|
|
// 已存在只增加日志
|
|
|
for (MesNotice model : models) {
|
|
|
- if(model.getId()==null){
|
|
|
+ if (model.getId() == null) {
|
|
|
continue;
|
|
|
}
|
|
|
MesNoticeLog build = MesNoticeLog.builder().build();
|
|
@@ -247,7 +277,7 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
mesNoticeLogs.add(build);
|
|
|
}
|
|
|
|
|
|
- if(!mesNoticeLogs.isEmpty()){
|
|
|
+ if (!mesNoticeLogs.isEmpty()) {
|
|
|
mesNoticeLogMapper.insertBatchSomeColumn(mesNoticeLogs);
|
|
|
}
|
|
|
|
|
@@ -265,23 +295,23 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
MesNotice mesNotice = baseMapper.selectOne(Wraps.<MesNotice>lbQ().eq(MesNotice::getCheckPar, model.getCheckPar()));
|
|
|
if (!Objects.isNull(mesNotice)) {
|
|
|
MesNotice data = baseMapper.selectOne(new LbqWrapper<MesNotice>().eq(MesNotice::getOrderNo, model.getOrderNo()).ne(MesNotice::getStatus, "3").eq(MesNotice::getBuType, model.getBuType()).last("limit 1"));
|
|
|
- if(data == null) throw new BizException("数据有误,此任务已经为完成状态");
|
|
|
+ if (data == null) throw new BizException("数据有误,此任务已经为完成状态");
|
|
|
String num = null;
|
|
|
- BigDecimal b1 = new BigDecimal(data.getOrderInfo() ==null ? "0": data.getOrderInfo() );
|
|
|
+ BigDecimal b1 = new BigDecimal(data.getOrderInfo() == null ? "0" : data.getOrderInfo());
|
|
|
|
|
|
- if(model.getStatus().equals("0")) {
|
|
|
+ if (model.getStatus().equals("0")) {
|
|
|
//上料新增
|
|
|
BigDecimal b2 = new BigDecimal(0.2);
|
|
|
double val = b1.add(b2).doubleValue();
|
|
|
num = String.valueOf(val);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
num = this.orderWorkStatistics(data.getId());
|
|
|
}
|
|
|
data.setStatus(model.getStatus()).setOrderInfo(num);
|
|
|
data.setAcceptPar(model.getAcceptPar());
|
|
|
baseMapper.updateAllById(data);
|
|
|
model.setId(data.getId()).setOrderInfo(data.getOrderInfo());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
baseMapper.insert(model);
|
|
|
}
|
|
|
|
|
@@ -289,12 +319,12 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
MesNoticeLog mesNoticeLog = new MesNoticeLog();
|
|
|
BeanUtils.copyProperties(model, mesNoticeLog, "id");
|
|
|
mesNoticeLog.setNoticeId(model.getId());
|
|
|
- if(model.getApiType().equals("MESPROCESSREPORT")) {
|
|
|
+ if (model.getApiType().equals("MESPROCESSREPORT")) {
|
|
|
//Long parentId = (this.mesWorkSchedule)?this.getCurrentScheduleId(model.getUserCode()) : 1L;
|
|
|
//mesNoticeLog.setParentId(parentId);
|
|
|
List<MesNoticeLog> mesNoticeLogList = mesNoticeLogService.list(new LbqWrapper<MesNoticeLog>().eq(MesNoticeLog::getNoticeId, model.getId()).eq(MesNoticeLog::getApiType, "MESPROCESSREPORT").orderByDesc(MesNoticeLog::getCreateTime).last("limit 1"));
|
|
|
//首次报工和上班打卡报工和订单加工完成报工
|
|
|
- if(mesNoticeLogList.size() == 0 || (mesNoticeLogList.size()==1 && mesNoticeLogList.get(0).getStatus().equals("4"))||(model.getOrderInfo() == String.valueOf(plmenge))){
|
|
|
+ if (mesNoticeLogList.size() == 0 || (mesNoticeLogList.size() == 1 && mesNoticeLogList.get(0).getStatus().equals("4")) || (model.getOrderInfo() == String.valueOf(plmenge))) {
|
|
|
isAutoPost = true;
|
|
|
}
|
|
|
}
|
|
@@ -308,7 +338,7 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
|
|
|
this.addNotice(model, 1.0);
|
|
|
// 调用接口发送需求
|
|
|
- String returnData = msgUtil.httpForPost(model.getApiAddress(),model.getAcceptPar());
|
|
|
+ String returnData = msgUtil.httpForPost(model.getApiAddress(), model.getAcceptPar());
|
|
|
|
|
|
return returnData;
|
|
|
}
|
|
@@ -335,68 +365,83 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public R processReport(List<Long> orderIds, TTask tTask, boolean onWork) {
|
|
|
+ BaseContextHandler.setTenant("0000");
|
|
|
+
|
|
|
List<MesNotice> needAddMesNotices = new ArrayList<>();
|
|
|
// 需要先增加日志
|
|
|
List<Order> list = orderService.list(Wraps.<Order>lbQ().in(Order::getId, orderIds));
|
|
|
// 完工数量
|
|
|
- double gutmenge =0;
|
|
|
+ double gutmenge = 0;
|
|
|
|
|
|
for (Order order : list) {
|
|
|
- MesNotice mesNoticeSource = baseMapper.selectOne(Wraps.<MesNotice>lbQ().eq(MesNotice::getId, order.getNoticeId()));
|
|
|
- MesNotice mesNotice = baseMapper.selectOne(Wraps.<MesNotice>lbQ().eq(MesNotice::getParentNoticeId, mesNoticeSource.getParentNoticeId()));
|
|
|
+ if (order.getNoticeId() == null) {
|
|
|
+ return R.success("检测到为自定义订单");
|
|
|
+ }
|
|
|
+ MesNotice mesNoticeSource = baseMapper.selectOne(Wraps.<MesNotice>lbQ().eq(MesNotice::getId, order.getNoticeId()).orderByDesc(MesNotice::getCreateTime).last("limit 1"));
|
|
|
+ if (mesNoticeSource == null) {
|
|
|
+ return R.success("检测到为自定义订单");
|
|
|
+ }
|
|
|
+ MesNotice mesNotice = baseMapper.selectOne(Wraps.<MesNotice>lbQ().eq(MesNotice::getParentNoticeId, mesNoticeSource.getId()).orderByDesc(MesNotice::getCreateTime).last("limit 1"));
|
|
|
String needReplacement = null;
|
|
|
- if(mesNotice==null || Objects.isNull(mesNotice)){
|
|
|
- needReplacement = mesNotice.getLineCode()+"&"+mesNotice.getBuType()+"&"+mesNotice.getApiType();
|
|
|
+ if (mesNotice == null || Objects.isNull(mesNotice)) {
|
|
|
+ mesNotice = new MesNotice();
|
|
|
+ BeanUtils.copyProperties(mesNoticeSource, mesNotice);
|
|
|
+ needReplacement = mesNoticeSource.getLineCode() + "&" + mesNoticeSource.getBuType() + "&" + mesNoticeSource.getApiType();
|
|
|
gutmenge = 0;
|
|
|
- mesNotice.setId(null).setBuType("TASKAPPLY").setSource(mesNoticeSource.getTargetSource()).setTargetSource(mesNoticeSource.getSource()).setOrderInfo(gutmenge+"");
|
|
|
- if(mesNotice.getApiType().equals("MESTASK")){
|
|
|
+ mesNotice.setId(null).setBuType("TASKAPPLY").setSource(mesNoticeSource.getTargetSource()).setTargetSource(mesNoticeSource.getSource()).setOrderInfo(gutmenge + "");
|
|
|
+ if (mesNotice.getApiType().equals("MESTASK")) {
|
|
|
mesNotice.setApiType("MESPROCESSREPORT");
|
|
|
- }else if(mesNotice.getApiType().equals("QUALITYTASK")){
|
|
|
+ } else if (mesNotice.getApiType().equals("QUALITYTASK")) {
|
|
|
mesNotice.setApiType("QUALITYREPORT");
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
gutmenge = Double.parseDouble(mesNotice.getOrderInfo());
|
|
|
}
|
|
|
|
|
|
// 计算完成度
|
|
|
- if(tTask !=null){
|
|
|
+ if (tTask != null) {
|
|
|
List<TWorkpiece> tWorkpieces = workpieceService.list(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getOrderId, order.getId()).eq(TWorkpiece::getCompleteBatchNo, tTask.getCompleteBatchNo()));
|
|
|
- if(!tWorkpieces.isEmpty()){
|
|
|
+ if (!tWorkpieces.isEmpty()) {
|
|
|
//计算完工数量
|
|
|
String number = this.orderWorkStatistics(order.getNoticeId());
|
|
|
|
|
|
BigDecimal newCompletionDegree = new BigDecimal(number);
|
|
|
- BigDecimal oldCompletionDegree = new BigDecimal( tWorkpieces.get(0).getCompleteProgress()==null? "0": tWorkpieces.get(0).getCompleteProgress());
|
|
|
- BigDecimal latestCompletionDegree = new BigDecimal(mesNotice.getOrderInfo()==null? "0": mesNotice.getOrderInfo());
|
|
|
- BigDecimal xzCompletionDegree = latestCompletionDegree.subtract(oldCompletionDegree).add(newCompletionDegree);
|
|
|
+ BigDecimal oldCompletionDegree = new BigDecimal(tWorkpieces.get(0).getCompleteProgress() == null ? "0" : tWorkpieces.get(0).getCompleteProgress());
|
|
|
+ BigDecimal latestCompletionDegree = new BigDecimal(mesNotice.getOrderInfo() == null ? "0" : mesNotice.getOrderInfo());
|
|
|
+ BigDecimal xzCompletionDegree = latestCompletionDegree.subtract(oldCompletionDegree).add(newCompletionDegree);
|
|
|
|
|
|
gutmenge = xzCompletionDegree.doubleValue();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 计算是否完工
|
|
|
+ // 是否进行中
|
|
|
boolean inProgress = true;
|
|
|
|
|
|
- BigDecimal sumReport = new BigDecimal(mesNotice.getSumReport()==null?"0":mesNotice.getSumReport());
|
|
|
- BigDecimal wrkReport = new BigDecimal(gutmenge).add(new BigDecimal(mesNotice.getOrderInfo()==null? "0": mesNotice.getOrderInfo()));
|
|
|
- if(sumReport.compareTo(wrkReport) <= 0){
|
|
|
- inProgress =false;
|
|
|
+ BigDecimal sumReport = new BigDecimal(mesNotice.getSumReport() == null ? "0" : mesNotice.getSumReport());
|
|
|
+ BigDecimal wrkReport = new BigDecimal(gutmenge).add(new BigDecimal(mesNotice.getOrderInfo() == null ? "0" : mesNotice.getOrderInfo()));
|
|
|
+ if (sumReport.compareTo(wrkReport) <= 0) {
|
|
|
+ inProgress = false;
|
|
|
mesNotice.setStatus("5");
|
|
|
- if(autoPostEnable){
|
|
|
+ if (autoPostEnable) {
|
|
|
mesNotice.setStatus("3");
|
|
|
}
|
|
|
//把 来源的任务也给改成完成
|
|
|
mesNoticeSource.setStatus("3");
|
|
|
needAddMesNotices.add(mesNoticeSource);
|
|
|
- }else {
|
|
|
- mesNotice.setStatus(onWork?"0":"4");// 0进行中,4暂停
|
|
|
+ } else {
|
|
|
+ mesNotice.setStatus(onWork ? "0" : "4");// 0进行中,4暂停
|
|
|
}
|
|
|
- mesNotice.setWorkReport(gutmenge+"");
|
|
|
- mesNotice.setOrderInfo(mesNotice.getOrderInfo()==null?"0" : mesNotice.getOrderInfo());
|
|
|
+ mesNotice.setWorkReport(gutmenge + "");
|
|
|
+ mesNotice.setOrderInfo(mesNotice.getOrderInfo() == null ? "0" : mesNotice.getOrderInfo());
|
|
|
|
|
|
String url = null;
|
|
|
JSONObject dataInfo = new JSONObject();
|
|
|
- if(mesNotice.getApiType().equals("MESPROCESSREPORT")){
|
|
|
+ if (mesNotice.getApiType().equals("MESPROCESSREPORT")) {
|
|
|
+
|
|
|
+ Map map = new HashMap();
|
|
|
+ Object o = tTask == null ? map.put("orderId", order.getId()) : map.put("tTaskId", tTask.getId());
|
|
|
+ List<Productionresource> resourceByConditions = productionresourceService.getResourceByConditions(map);
|
|
|
+
|
|
|
url = (null == msgUtil.redis_get(ParameterKey.PARAMETERS) ? "" : ((Map<String, String>) msgUtil.redis_get(ParameterKey.PARAMETERS)).get(ParameterKey.MESBG).toString());
|
|
|
JSONObject acceptPar = JSONObject.parseObject(mesNotice.getAcceptPar());
|
|
|
dataInfo.put("finr", "407");
|
|
@@ -404,52 +449,52 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
dataInfo.put("auidnr", acceptPar.getString("auidnr"));
|
|
|
dataInfo.put("afonr", acceptPar.getString("afonr"));
|
|
|
dataInfo.put("kpos", acceptPar.getString("kpos"));
|
|
|
- dataInfo.put("kapaz", acceptPar.getString("kapaz")==null? "0" : acceptPar.getString("kapaz").isEmpty());
|
|
|
+ dataInfo.put("kapaz", resourceByConditions.isEmpty() ? "0" : resourceByConditions.get(0).getProductionNo());
|
|
|
dataInfo.put("plmenge", acceptPar.getString("plmenge"));
|
|
|
dataInfo.put("gutmenge", gutmenge);
|
|
|
dataInfo.put("ausschuss", 0);
|
|
|
dataInfo.put("aussfinish", 0);
|
|
|
dataInfo.put("pnr", mesNotice.getUserCode());
|
|
|
- dataInfo.put("status", inProgress ? "KS":"JS");
|
|
|
+ dataInfo.put("status", inProgress ? "KS" : "JS");
|
|
|
dataInfo.put("batchno", order.getBatchNo());
|
|
|
- }else if ( mesNotice.getApiType().equals("QUALITYREPORT")) {
|
|
|
+ } else if (mesNotice.getApiType().equals("QUALITYREPORT")) {
|
|
|
url = (null == msgUtil.redis_get(ParameterKey.PARAMETERS) ? "" : ((Map<String, String>) msgUtil.redis_get(ParameterKey.PARAMETERS)).get(ParameterKey.POSTBACK420TASKCHECKDATA).toString());
|
|
|
dataInfo = JSONObject.parseObject(mesNotice.getAcceptPar());
|
|
|
OrderQuality orderQuality = orderQualityService.getOne(new LbqWrapper<OrderQuality>().eq(OrderQuality::getOrderId, order.getId()).eq(OrderQuality::getMeasuringType, "1").last("limit 1"));
|
|
|
- JSONArray jsonArray = JSONArray.parseArray(orderQuality==null? null : orderQuality.getMeasuringReport());
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(orderQuality == null ? null : orderQuality.getMeasuringReport());
|
|
|
dataInfo.put("resultList", jsonArray);
|
|
|
}
|
|
|
mesNotice.setAcceptPar(dataInfo.toJSONString());
|
|
|
mesNotice.setApiAddress(url);
|
|
|
|
|
|
|
|
|
- if(!mesNotice.getCheckPar().isEmpty() && needReplacement!=null){
|
|
|
- mesNotice.setCheckPar(mesNotice.getCheckPar().replace(needReplacement,mesNotice.getLineCode()+"&"+mesNotice.getBuType()+"&"+mesNotice.getApiType()));
|
|
|
+ if (!mesNotice.getCheckPar().isEmpty() && needReplacement != null) {
|
|
|
+ mesNotice.setCheckPar(mesNotice.getCheckPar().replace(needReplacement, mesNotice.getLineCode() + "&" + mesNotice.getBuType() + "&" + mesNotice.getApiType()));
|
|
|
}
|
|
|
|
|
|
needAddMesNotices.add(mesNotice);
|
|
|
}
|
|
|
|
|
|
- String s = this.addNoticeMore(needAddMesNotices,false);
|
|
|
+ String s = this.addNoticeMore(needAddMesNotices, false);
|
|
|
|
|
|
StringBuffer errorInfo = new StringBuffer();
|
|
|
for (MesNotice needAddMesNotice : needAddMesNotices) {
|
|
|
String returnData = null;
|
|
|
try {
|
|
|
- BigDecimal wrkReport = new BigDecimal(needAddMesNotice.getWorkReport()==null? "0":needAddMesNotice.getWorkReport()).add(new BigDecimal(needAddMesNotice.getOrderInfo()==null? "0": needAddMesNotice.getOrderInfo()));
|
|
|
+ BigDecimal wrkReport = new BigDecimal(needAddMesNotice.getWorkReport() == null ? "0" : needAddMesNotice.getWorkReport()).add(new BigDecimal(needAddMesNotice.getOrderInfo() == null ? "0" : needAddMesNotice.getOrderInfo()));
|
|
|
if (autoPostEnable && !needAddMesNotice.getApiAddress().isEmpty() && (wrkReport.compareTo(BigDecimal.ZERO) == 0 || needAddMesNotice.getStatus().equals("3"))) {
|
|
|
returnData = msgUtil.httpForPost(needAddMesNotice.getApiAddress(), needAddMesNotice.getAcceptPar());
|
|
|
}
|
|
|
- }catch (Exception ex){
|
|
|
+ } catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
- errorInfo.append("<br> 上报失败:"+needAddMesNotice.getOrderNo()+" ;原因:"+ ex.getMessage() +" ;返回结果:"+ returnData);
|
|
|
+ errorInfo.append("<br> 上报失败:" + needAddMesNotice.getOrderNo() + " ;原因:" + ex.getMessage() + " ;返回结果:" + returnData);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(errorInfo == null || errorInfo.toString().isEmpty()){
|
|
|
+ if (errorInfo == null || errorInfo.toString().isEmpty()) {
|
|
|
return R.success();
|
|
|
}
|
|
|
- return R.success(null, "上报失败,需要手动触发:"+errorInfo.toString());
|
|
|
+ return R.success(null, "上报失败,需要手动触发:" + errorInfo.toString());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -478,16 +523,16 @@ public class MesNoticeServiceImpl extends SuperServiceImpl<MesNoticeMapper, MesN
|
|
|
|
|
|
@Override
|
|
|
public String orderWorkStatistics(Long mesNoticeId) {
|
|
|
- Map map = baseMapper.orderWorkStatistics(mesNoticeId);
|
|
|
- return map ==null? null :map.get("total").toString();
|
|
|
+ Map map = baseMapper.orderWorkStatistics(mesNoticeId);
|
|
|
+ return map == null ? null : map.get("total").toString();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Long getCurrentScheduleId(String userCode){
|
|
|
- User user = userService.getOne(new LbqWrapper<User>().eq(User::getWorkDescribe, userCode).last("limit 1"));
|
|
|
+ public Long getCurrentScheduleId(String userCode) {
|
|
|
+ User user = userService.getOne(new LbqWrapper<User>().eq(User::getWorkDescribe, userCode).last("limit 1"));
|
|
|
String date = DateUtil.dateToString0(new Date(), "yyyy-MM-dd");
|
|
|
List<ScheduleUserDate> scheduleUserDateList = scheduleUserDateService.getPageList(new LbqWrapper<ScheduleUserDate>().eq(ScheduleUserDate::getUserId, user.getId()).eq(ScheduleUserDate::getDate, date).orderByDesc(ScheduleUserDate::getCreateTime).last("limit 1"));
|
|
|
- ScheduleUserDate scheduleUserDate = scheduleUserDateList.size()==1? scheduleUserDateList.get(0) : null;
|
|
|
+ ScheduleUserDate scheduleUserDate = scheduleUserDateList.size() == 1 ? scheduleUserDateList.get(0) : null;
|
|
|
return scheduleUserDate != null ? scheduleUserDate.getId() : null;
|
|
|
}
|
|
|
}
|