| | |
| | | import com.aps.common.log.enums.BusinessType; |
| | | import com.aps.common.security.annotation.RequiresPermissions; |
| | | import com.aps.core.domain.ApsStandardProcessRouteLine; |
| | | import com.aps.core.mapper.ApsStandardProcessRouteLineMapper; |
| | | import com.aps.core.service.IApsStandardProcessRouteLineService; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private IApsStandardProcessRouteLineService apsStandardProcessRouteLineService; |
| | | |
| | | @Resource |
| | | private ApsStandardProcessRouteLineMapper mapper; |
| | | /** |
| | | * 查询标准工艺路线Line列表 |
| | | */ |
| | |
| | | { |
| | | return toAjax(apsStandardProcessRouteLineService.deleteApsStandardProcessRouteLineByIds(ids)); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/getStandardTime") |
| | | public AjaxResult getStandardTime(@RequestBody ApsStandardProcessRouteLine apsStandardProcessRouteLine) |
| | | { |
| | | BigDecimal standardTime = mapper.selectTotalStandTime(apsStandardProcessRouteLine.getRouteId()).getStandardTime(); |
| | | return toAjax(standardTime.intValue()); |
| | | } |
| | | } |
| | |
| | | * @return 结果 |
| | | */ |
| | | public int deleteApsStandardProcessRouteLineByIds(Long[] ids); |
| | | |
| | | ApsStandardProcessRouteLine selectTotalStandTime(String routeHeaderId); |
| | | } |
| | |
| | | /*定义工厂为南通 */ |
| | | String plantCode="FORTUNA"; |
| | | /*定义主单类型为钣金主单*/ |
| | | String mainOrderType = "0"; |
| | | String mainOrderType = "main"; |
| | | /*生成新批次号*/ |
| | | String batchNum= requireBatchService.getNewBatchNumber(); |
| | | /*获取钣金主单信息*/ |
| | |
| | | private void matchRequireAndSubPlan(ApsPlateStandardRequire require) { |
| | | BigDecimal netRequirement = require.getNetRequirement(); |
| | | require.setMatchMode("工单匹配"); |
| | | if(require.getBomLineCode().equals("W0202-100028")){ |
| | | System.out.println("W0202-100028"); |
| | | } |
| | | if (netRequirement.compareTo(BigDecimal.ZERO) > 0) { |
| | | ApsPlatePlan platePlan = apsPlatePlanMapper.selectUnMatchPlateSubPlan(require.getOrgCode(), require.getBomLineCode()); |
| | | /*子件工单的未匹配数量 作为当前的库存*/ |
| | |
| | | */ |
| | | @Override |
| | | public ApsStandardProcessRouteLine getRouteLineTotalTime(ApsPlateStandardRequire require) { |
| | | // 定义独占生产模式常量 |
| | | String productivityModel_monopolize = "独占"; |
| | | // 初始化总工时为0 |
| | | BigDecimal totalRouteTime = BigDecimal.ZERO; |
| | | //工厂 |
| | |
| | | ApsStandardProcessRouteLine ret=new ApsStandardProcessRouteLine(); |
| | | ret.setRouteId(String.valueOf(routId)); |
| | | ret.setRouteTime(BigDecimal.ZERO); |
| | | |
| | | // 查询标准工艺路线头部信息 |
| | | Optional<ApsStandardProcessRouteHeader> firstProcessRoute = standardProcessRouteHeaderMapper.queryStandardProcessRouteHeaderByPlantAndItemCode(plant, itemNumber).stream().findFirst(); |
| | | if (firstProcessRoute.isPresent()) { |
| | |
| | | // 构建工艺路线行参数对象 |
| | | ApsStandardProcessRouteLine routeLineParam =new ApsStandardProcessRouteLine(); |
| | | routeLineParam.setRouteId(routeHeader.getRouteId()); |
| | | |
| | | // 查询标准工艺路线行信息 |
| | | List<ApsStandardProcessRouteLine> apsStandardProcessRouteLines = apsStandardProcessRouteLineMapper.selectApsStandardProcessRouteLineList(routeLineParam); |
| | | /*工艺路线Line 总工时*/ |
| | | |
| | | if(apsStandardProcessRouteLines.isEmpty()){ |
| | | saveRequireError(require,"工序不存在"); |
| | | }else { |
| | | // 遍历每个工艺路线行 |
| | | apsStandardProcessRouteLines.forEach(line -> { |
| | | // 默认将设计产能设置为路线时间 |
| | | line.setRouteTime(line.getDesignCapacity()); |
| | | // 如果生产模式为独占,则路线时间为设计产能乘以净需求量 |
| | | if (line.getProductivityModel().equals(productivityModel_monopolize)) { |
| | | line.setRouteTime(line.getDesignCapacity().multiply(require.getNetRequirement())); |
| | | } |
| | | |
| | | }); |
| | | // 累加路线时间到总工时中 |
| | | totalRouteTime = apsStandardProcessRouteLines.stream() |
| | | .map(ApsStandardProcessRouteLine::getRouteTime) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | } |
| | | |
| | | BigDecimal standardTime = apsStandardProcessRouteLineMapper.selectTotalStandTime(routeHeader.getRouteId()).getStandardTime(); |
| | | totalRouteTime =standardTime.multiply(require.getNetRequirement()); |
| | | ret.setRouteTime(totalRouteTime); |
| | | ret.setRouteId(routeHeader.getRouteId()); |
| | | }else { |
| | |
| | | select id,document_number,main_part_number,item_number,plant,professional_affiliation,production_quantity, |
| | | unmatched_quantity,version |
| | | from aps_plate_plan |
| | | where del_flag='0' and professional_affiliation !='0' and unmatched_quantity > 0 |
| | | where del_flag='0' and professional_affiliation ='sub' and unmatched_quantity > 0 |
| | | <if test="plant != null and plant !='' "> and plant = #{plant}</if> |
| | | <if test="itemNumber != null and itemNumber !='' "> and item_number = #{itemNumber}</if> |
| | | order by document_number asc,id asc |
| | |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="selectTotalStandTime" parameterType="String" resultMap="ApsStandardProcessRouteLineResult"> |
| | | select sum(standard_time) as standard_time |
| | | from aps_standard_process_route_line |
| | | where route_id = #{routeId} |
| | | ; |
| | | </select> |
| | | </mapper> |
| | |
| | | param.setDocState(Arrays.asList(0,1,2,4)); |
| | | param.setBeginDate(yesterdayMidnight.format(formatter)); |
| | | param.setEndDate(today.format(formatter)); |
| | | param.setPageSize(100); |
| | | param.setPageSize(500); |
| | | while (continueFlag){ |
| | | param.setPageIndex(currentPage); |
| | | continueFlag= batchSaveByPager(param); |
| | |
| | | order.setProcessStatus("0"); |
| | | order.setOpStatus(jsonObject.getString("OpStatus")); |
| | | order.setNextOpName(jsonObject.getString("NextOpName")); |
| | | order.setLowOrderCode(jsonObject.getString("LowLevelCode")); |
| | | jobs.add(order); |
| | | orderIds.add(order.getOrderId()); |
| | | } catch (Exception e) { |
| | |
| | | op_num,work_center,dept, |
| | | start_date,complete_date,next_dept, |
| | | is_hold_release,is_out_source,org_code, |
| | | order_id,now(),'0',org_code,doc_status,std_op,op_status,next_op_name, |
| | | case when low_order_code='0' then 'main' else 'sub' end as professional_affiliation, |
| | | cast(order_id as bigint) as id,now(),'0',org_code,doc_status,std_op,op_status,next_op_name, |
| | | (case when low_order_code='0' then 'main' else 'sub' end ) as professional_affiliation, |
| | | order_create_time |
| | | from aps_work_order_job |
| | | where ( doc_status in (0,1,2,4) and is_hold_release='0' |