|  |  | @ -1,43 +1,24 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station.function; |  |  |  | package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station.function; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService; |  |  |  | import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkOrderCutService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipVariableCollectContext; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesWorkOrderCutDetailModel; |  |  |  | import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesWorkOrderCutDetailModel; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseSwsService; |  |  |  | import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseSwsService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IShippingDispatchService; |  |  |  | import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IShippingDispatchService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.function.IFsmModuleFunctionService; |  |  |  | import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.function.IFsmModuleFunctionService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.platform.common.util.MesPcnConstWords; |  |  |  | import cn.estsh.i3plus.platform.common.util.MesPcnConstWords; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; |  |  |  | import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.mes.bean.MesCutScheme; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.mes.bean.MesCutSchemeFg; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.mes.bean.MesPart; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrderCutMaterial; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.mes.model.ButtonDynamicModel; |  |  |  | import cn.estsh.i3plus.pojo.mes.model.ButtonDynamicModel; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.mes.model.StationCustomDialogBean; |  |  |  | import cn.estsh.i3plus.pojo.mes.model.StationCustomDialogBean; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; |  |  |  | import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.mes.model.StationResultBean; |  |  |  | import cn.estsh.i3plus.pojo.mes.model.StationResultBean; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.mes.repository.MesCutSchemeRepository; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.estsh.i3plus.pojo.mes.repository.MesPartRepository; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.alibaba.fastjson.JSONObject; |  |  |  | import com.alibaba.fastjson.JSONObject; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.google.common.base.Objects; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import lombok.extern.slf4j.Slf4j; |  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.beans.BeanUtils; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.beans.factory.annotation.Autowired; |  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.stereotype.Service; |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.util.CollectionUtils; |  |  |  | import org.springframework.util.CollectionUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.util.StringUtils; |  |  |  | import org.springframework.util.StringUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.jws.Oneway; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.ArrayList; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.List; |  |  |  | import java.util.List; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Map; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.function.Function; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.stream.Collectors; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | /** |  |  |  | /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  * @Description : 裁片工单弹框接口实现【裁片工单打印弹框】 |  |  |  |  * @Description : 裁片工单弹框接口实现【裁片工单打印弹框】 | 
			
		
	
	
		
		
			
				
					|  |  | @ -52,13 +33,6 @@ public class MesFunctionDialogCutOrderPrintService extends BaseSwsService implem | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Autowired |  |  |  |     @Autowired | 
			
		
	
		
		
			
				
					
					|  |  |  |     private IShippingDispatchService shippingDispatchService; |  |  |  |     private IShippingDispatchService shippingDispatchService; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Autowired |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     private IMesWorkOrderCutService workOrderCutService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Autowired |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     private MesCutSchemeRepository cutSchemeRepository; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Autowired |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     private MesPartRepository mesPartRepository; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Override |  |  |  |     @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |     public Boolean doFunction(StationRequestBean reqBean, StationResultBean resultBean, ButtonDynamicModel buttonDynamicModel) { |  |  |  |     public Boolean doFunction(StationRequestBean reqBean, StationResultBean resultBean, ButtonDynamicModel buttonDynamicModel) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -92,60 +66,6 @@ public class MesFunctionDialogCutOrderPrintService extends BaseSwsService implem | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<MesWorkOrderCutDetailModel> mesWorkOrderCutFgDataContextList = productionDispatchContextStepService.getMesWorkOrderCutFgDataContext(reqBean); |  |  |  |         List<MesWorkOrderCutDetailModel> mesWorkOrderCutFgDataContextList = productionDispatchContextStepService.getMesWorkOrderCutFgDataContext(reqBean); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         // 如果当前存在成品列表则直接返回
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (CollectionUtils.isEmpty(mesWorkOrderCutFgDataContextList)) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             //获取上下文生产扫/读信息:加工单
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<MesEquipVariableCollectContext> equipVariableCollectContextList = productionDispatchContextStepService.getScanWorkOrderNoContext(reqBean); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             String cutWorkOrderNo = equipVariableCollectContextList.get(0).getEquipVariableValue(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             DdlPackBean schemePackBean = DdlPackBean.getDdlPackBean(reqBean.getOrganizeCode()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             DdlPreparedPack.getStringEqualPack(cutWorkOrderNo, "cutCode", schemePackBean); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             MesCutScheme mesCutScheme =cutSchemeRepository.getByProperty(schemePackBean); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             // 如果是补片方案,则需要查询裁片工单原材料,而不是裁片方案原材料
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (mesCutScheme != null && Objects.equal(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(),mesCutScheme.getIsFree())) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 // 查裁片工单物料列表
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 List<MesWorkOrderCutMaterial> workOrderCutMaterialList = workOrderCutService.queryCutOrderMaterialList(cutWorkOrderNo, reqBean.getOrganizeCode()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (CollectionUtils.isEmpty(workOrderCutMaterialList)) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     MesPcnException.throwFlowException("裁片工单为补片方案但未添加原材料信息"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 List<String> partNoList = workOrderCutMaterialList.stream().map(MesWorkOrderCutMaterial::getPartNo).collect(Collectors.toList()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 // 查询物料信息
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 DdlPackBean partBean = DdlPackBean.getDdlPackBean(reqBean.getOrganizeCode()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 DdlPreparedPack.getInPackList(partNoList, "partNo", partBean); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 List<MesPart> mesPartList = mesPartRepository.findByHqlWhere(partBean); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 Map<String,List<MesPart>> map = mesPartList.stream().collect(Collectors.groupingBy(MesPart::getPartNo)); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 mesWorkOrderCutFgDataContextList = new ArrayList<>(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 for (MesWorkOrderCutMaterial mesWorkOrderCutMaterial : workOrderCutMaterialList) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     MesWorkOrderCutDetailModel cutDetailModel = new MesWorkOrderCutDetailModel(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     BeanUtils.copyProperties(mesWorkOrderCutMaterial, cutDetailModel); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     cutDetailModel.setPartName(map.get(mesWorkOrderCutMaterial.getPartNo()).get(0).getPartName()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     mesWorkOrderCutFgDataContextList.add(cutDetailModel); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } else { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 // 查询物料信息
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 List<MesCutSchemeFg> mesCutSchemeFgs = workOrderCutService.queryCutSchemeFgList(cutWorkOrderNo, reqBean.getOrganizeCode()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 mesWorkOrderCutFgDataContextList = new ArrayList<>(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 for (MesCutSchemeFg mesWorkOrderCutMaterial : mesCutSchemeFgs) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     MesWorkOrderCutDetailModel cutDetailModel = new MesWorkOrderCutDetailModel(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     BeanUtils.copyProperties(mesWorkOrderCutMaterial, cutDetailModel); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     mesWorkOrderCutFgDataContextList.add(cutDetailModel); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             productionDispatchContextStepService.dispatchMesWorkOrderCutFgDataContext(reqBean, mesWorkOrderCutFgDataContextList); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         return CollectionUtils.isEmpty(mesWorkOrderCutFgDataContextList) ? dialogBean.unDialog() : dialogBean.obj(mesWorkOrderCutFgDataContextList); |  |  |  |         return CollectionUtils.isEmpty(mesWorkOrderCutFgDataContextList) ? dialogBean.unDialog() : dialogBean.obj(mesWorkOrderCutFgDataContextList); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |