master
philip 3 years ago
parent bf1ba1d3b6
commit 772fa58b45

@ -31,10 +31,8 @@ import com.foreverwin.mesnac.production.mapper.SfcCrossMapper;
import com.foreverwin.mesnac.production.mapper.SfcDataAssembleMapper;
import com.foreverwin.mesnac.production.model.LoadInventory;
import com.foreverwin.mesnac.production.model.SfcHoldLog;
import com.foreverwin.mesnac.production.service.LoadInventoryService;
import com.foreverwin.mesnac.production.service.PodTemplateService;
import com.foreverwin.mesnac.production.service.SfcCrossService;
import com.foreverwin.mesnac.production.service.SfcHoldLogService;
import com.foreverwin.mesnac.production.model.WorkShopTransfer;
import com.foreverwin.mesnac.production.service.*;
import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.meext.MEServices;
import com.foreverwin.modular.core.util.CommonMethods;
@ -92,6 +90,8 @@ public class PodTemplateServiceImpl implements PodTemplateService {
private LoadInventoryService loadInventoryService;
@Autowired
private SfcHoldLogService sfcHoldLogService;
@Autowired
private WorkShopTransferService workShopTransferService;
@Override
public Map<String, Object> resrceEnter(WorkCenterDto workCenterDto) {
@ -208,6 +208,9 @@ public class PodTemplateServiceImpl implements PodTemplateService {
String dispatchNo = sfcDto.getDispatchNo();
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(site, sfc));
BigDecimal qty = new BigDecimal(sfcServiceById.getQty().toString());
WorkShopTransfer transfer = workShopTransferService.sfcEnter(sfc, "OUT");
String isOutSource = transfer.getIsOutSource();
if (StringUtil.isBlank(isOutSource)||!isOutSource.equals(Constants.STATUS_Y)){
//是否有互检检验项目
List<InspectionItemDetail> inspectionItemDetails = inspectionItemService.selectQualityInspection(sfc, operation, stepId, Constants.INSPECTION_TYPE_H);
if (inspectionItemDetails.size() > 0 && inspectionItemDetails.get(0) != null) {
@ -220,6 +223,7 @@ public class PodTemplateServiceImpl implements PodTemplateService {
throw new BaseException("互检任务不合格,不能开始请检查");
}
}
}
//是否完成专检
QueryWrapper<InspectionTask> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(InspectionTask.CATEGORY, Constants.INSPECTION_TYPE_P);
@ -258,7 +262,11 @@ public class PodTemplateServiceImpl implements PodTemplateService {
if (status.equals("404")) {
throw new BaseException("产品条码" + sfc + "已暂停");
}
BigDecimal workHour=BigDecimal.ZERO;
BigDecimal qty = new BigDecimal(sfcServiceById.getQty().toString());
WorkShopTransfer transfer = workShopTransferService.sfcEnter(sfc, "OUT");
String isOutSource = transfer.getIsOutSource();
if (StringUtil.isBlank(isOutSource)||!isOutSource.equals(Constants.STATUS_Y)) {
//是否有自检检验项目
List<InspectionItemDetail> inspectionItemDetails = inspectionItemService.selectQualityInspection(sfc, operation, stepId, Constants.INSPECTION_TYPE_Z);
if (inspectionItemDetails.size() > 0 && inspectionItemDetails.get(0) != null) {
@ -283,7 +291,6 @@ public class PodTemplateServiceImpl implements PodTemplateService {
}
//物料消耗
materialConsumption(site, operation, HandleEnum.SFC.getHandle(site, sfc), stepId, resrce);
try {
//专检创建
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("SFC", sfc);
@ -312,7 +319,7 @@ public class PodTemplateServiceImpl implements PodTemplateService {
//计算工时
LocalDateTime startTime = sfcService.getSfcStartTime(HandleEnum.SFC.getHandle(site, sfc));
long workHourSeconds = Duration.between(startTime, LocalDateTime.now()).getSeconds();
BigDecimal workHour = new BigDecimal(workHourSeconds).divide(BigDecimal.valueOf(3600), 2, RoundingMode.HALF_UP);
workHour = new BigDecimal(workHourSeconds).divide(BigDecimal.valueOf(3600), 2, RoundingMode.HALF_UP);
//减去暂停时间
QueryWrapper<SfcHoldLog> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(SfcHoldLog.SFC, sfc);
@ -323,6 +330,9 @@ public class PodTemplateServiceImpl implements PodTemplateService {
BigDecimal holdTime = list.stream().map(SfcHoldLog::getHoldDuration).reduce(BigDecimal.ZERO, BigDecimal::add);
workHour = workHour.subtract(holdTime);
}
}
try {
sfcCrossService.completeAction(site, currentRevisionRef.getHandle(), resrce, sfcServiceById.getHandle(), qty);
//更改派工单状态
sfcDispatchCommonService.updateSfcDispatchStatus(site, CommonMethods.getUser(), dispatchNo, DispatchStatusEnum.COMPLETE.getCode(),workHour);

Loading…
Cancel
Save