|
|
@ -16,9 +16,11 @@ import org.nl.common.exception.BadRequestException; |
|
|
|
import org.nl.common.utils.CodeUtil; |
|
|
|
import org.nl.common.utils.SecurityUtils; |
|
|
|
import org.nl.system.service.notice.ISysNoticeService; |
|
|
|
import org.nl.wms.database.brick.service.IMdBaseBrickInfoService; |
|
|
|
import org.nl.wms.database.material.service.IMdBaseMaterialService; |
|
|
|
import org.nl.wms.database.material.service.dao.MdBaseMaterial; |
|
|
|
import org.nl.wms.ext.acs.service.WmsToAcsService; |
|
|
|
import org.nl.wms.ext.acs.service.dto.to.BaseResponse; |
|
|
|
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse; |
|
|
|
import org.nl.wms.ext.mes.service.WmsToMesService; |
|
|
|
import org.nl.wms.ext.mes.service.dto.MesOrderInfo; |
|
|
@ -65,6 +67,8 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper, |
|
|
|
private IMdBaseMaterialService materialService; |
|
|
|
@Autowired |
|
|
|
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; |
|
|
|
@Autowired |
|
|
|
private IMdBaseBrickInfoService baseBrickInfoService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public IPage<PdmBdWorkorder> queryAll(PdmBdWorkorderQuery query, PageQuery page) { |
|
|
@ -275,4 +279,38 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper, |
|
|
|
public List<PdmBdWorkorder> getTheDayProducedWorkOrderByDevice(String s) { |
|
|
|
return pdmBdWorkorderMapper.getTheDayProducedWorkOrderByDevice(s); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void forceFinish(PdmBdWorkorder entity) { |
|
|
|
String workorderCode = entity.getWorkorder_code(); |
|
|
|
if (workorderCode == null) { |
|
|
|
throw new BadRequestException("工单标识不能为空!"); |
|
|
|
} |
|
|
|
PdmBdWorkorder bdWorkorder = this.getByCode(workorderCode); |
|
|
|
if (bdWorkorder == null) { |
|
|
|
throw new BadRequestException("未找到工单号[" + workorderCode + "]的记录!"); |
|
|
|
} |
|
|
|
if (bdWorkorder.getWorkorder_status().equals(WorkOrderStatusEnum.ISSUED.getCode()) |
|
|
|
|| bdWorkorder.getWorkorder_status().equals(WorkOrderStatusEnum.UNPRODUCED.getCode())) { |
|
|
|
throw new BadRequestException("工单号[" + workorderCode + "]未生产不能完成工!"); |
|
|
|
} |
|
|
|
if (bdWorkorder.getWorkorder_status().equals(WorkOrderStatusEnum.COMPLETE.getCode())) { |
|
|
|
throw new BadRequestException("工单号[" + workorderCode + "]已完工,不能重复完工!"); |
|
|
|
} |
|
|
|
bdWorkorder.setWorkorder_status(WorkOrderStatusEnum.COMPLETE.getCode()); |
|
|
|
bdWorkorder.setRealproduceend_date(DateUtil.now()); |
|
|
|
TaskUtils.setWorkOrderUpdateByAcs(bdWorkorder); |
|
|
|
// 统计合不合格数量到工单字段中
|
|
|
|
int qualified_qty = baseBrickInfoService.getCountQualifiedQty(bdWorkorder.getWorkorder_code()); |
|
|
|
int unqualified_qty = baseBrickInfoService.getCountUnqualifiedQty(bdWorkorder.getWorkorder_code()); |
|
|
|
bdWorkorder.setQualified_qty(qualified_qty); |
|
|
|
bdWorkorder.setUnqualified_qty(unqualified_qty); |
|
|
|
this.updateById(bdWorkorder); |
|
|
|
try { |
|
|
|
// todo: 统计当前设备的不合格位置的数量作为不合格数,并上报给mes
|
|
|
|
// wmsToMesService.reportPressUnusedMaterial(bdWorkorder);
|
|
|
|
} catch (Exception e) { |
|
|
|
log.info("调用mes异常:{}", e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|