钣金详细计划:批量设置的计划完工日期> 导入的需求日期> 工单自身的计划完工日期
钣金工单计划:导入的需求日期> 工单自身的计划完工日期
| | |
| | | */ |
| | | public List<ApsPlatePlan> selectPlateRedundantOrderList(ApsPlatePlan apsPlatePlan); |
| | | |
| | | List<ApsPlatePlan> selectPlatePlanByPlantMajor(String plant,String professionalAffiliation); |
| | | List<ApsPlatePlan> selectPlatePlanByPlantMajor(String plant); |
| | | |
| | | /** |
| | | * 获取一条未匹配的子计划 |
| | |
| | | * @return 结果 |
| | | */ |
| | | public int deleteApsPlateProcessStatByIds(String[] ids); |
| | | /**统计临时数据*/ |
| | | /**统计临时数据 |
| | | * 批量设置的计划完工日期> 导入的需求日期> 工单自身的计划完工日期 |
| | | * */ |
| | | List<ApsPlateProcessStat> queryTempStat(); |
| | | |
| | | /** |
| | |
| | | requireBatchService.initRequireBatch(); |
| | | /*定义工厂为南通 */ |
| | | String plantCode="FORTUNA"; |
| | | /*定义主单类型为钣金主单*/ |
| | | String mainOrderType = "main"; |
| | | /*获取钣金主单信息*/ |
| | | List<ApsPlatePlan> mainPlans = platePlanMapper.selectPlatePlanByPlantMajor(plantCode,mainOrderType); |
| | | List<ApsPlatePlan> mainPlans = platePlanMapper.selectPlatePlanByPlantMajor(plantCode); |
| | | Hashtable<String, ApsMaterialStorageManagement> usedStorage = new Hashtable<>(); |
| | | /*内存中存储子件工单*/ |
| | | Hashtable<String, List<ApsPlatePlan>> subPlans = new Hashtable<>(); |
| | |
| | | for (ApsPlatePlan mainPlan : mainPlans) { |
| | | String itemNumber = mainPlan.getItemNumber(); |
| | | /*根据料号 获取BOM Header */ |
| | | |
| | | |
| | | List<ApsPlateStandardRequire> requiresList=new ArrayList<>(); |
| | | List<ApsPlateStandardRequireBomStockDetail> stockDetailsList=new ArrayList<>(); |
| | | List<ApsPlateStandardRequireBomOrderDetail> orderDetailsList=new ArrayList<>(); |
| | | |
| | | |
| | | log.info("开始生成需求:工单号:"+mainPlan.getDocumentNumber()); |
| | | /*当前Bom节点处理完成后,处理下级BOM*/ |
| | | getBomRequires(plantCode, "0","0",itemNumber,BigDecimal.ONE, batchNum, null |
| | |
| | | </update> |
| | | |
| | | <select id="selectPlatePlanByPlantMajor" parameterType="com.aps.core.domain.ApsPlate.ApsPlatePlan" resultMap="ApsPlatePlanResult"> |
| | | select id,document_number,main_part_number,item_number,plant,professional_affiliation,production_quantity,require_id, |
| | | unmatched_quantity,version, production_base,plan_end_day,order_create_time,low_order_code |
| | | from aps_plate_plan |
| | | <where> |
| | | <if test="plant != null "> and plant = #{plant} </if> |
| | | <if test="professionalAffiliation != null "> and professional_affiliation = 'main' </if> |
| | | and del_flag='0' |
| | | </where> |
| | | order by document_number asc,id asc |
| | | with rd as ( |
| | | select doc_no,require_date from aps_plate_require_date where del_flag=0 |
| | | ) |
| | | select |
| | | app.id,app.document_number,app.main_part_number,app.item_number,app.plant,app.professional_affiliation,app.production_quantity,app.require_id, |
| | | app.unmatched_quantity,app.version, app.production_base,app.order_create_time,app.low_order_code, |
| | | app.plan_end_day as orign_end_day, |
| | | COALESCE(rd.require_date,app.plan_end_day) as plan_end_day |
| | | from aps_plate_plan as app |
| | | left join rd on app.document_number=rd.doc_no |
| | | where app.del_flag='0' and app.professional_affiliation = 'main' |
| | | <if test="plant != null "> and plant = #{plant} </if> |
| | | order by document_number ,id |
| | | </select> |
| | | |
| | | <select id="selectUnMatchPlateSubPlan" parameterType="com.aps.core.domain.ApsPlate.ApsPlatePlan" resultMap="ApsPlatePlanResult"> |
| | |
| | | </delete> |
| | | |
| | | <select id="queryTempStat" resultMap="ApsPlateProcessStatResult"> |
| | | with dt as ( select doc_no,require_date from aps_plate_require_date where del_flag=0), |
| | | rd as ( select doc_no,plan_end_day from aps_plate_standard_require_order_end_day where del_flag=0) |
| | | select row_number() over (partition by rt.work_order_no order by rt.process_number desc ) as num, |
| | | rt.work_order_no, |
| | | rt.work_order_no, |
| | | rt.process_name, |
| | | cast(rt.process_number as numeric(18, 2)) as route_process_number, |
| | | cast(pl.process_number as numeric(18, 2)) as current_process_number, |
| | |
| | | rt.process_plan_start_day, |
| | | rt.process_plan_end_day, |
| | | pl.plan_end_day, |
| | | COALESCE(rd.plan_end_day,pl.plan_end_day) as order_plan_end_day |
| | | rd.plan_end_day as modify_day, |
| | | dt.require_date, |
| | | COALESCE(rd.plan_end_day, COALESCE(dt.require_date, pl.plan_end_day) ) as order_plan_end_day |
| | | from aps_plate_plan as pl |
| | | left join aps_process_route as rt on pl.document_number = rt.work_order_no |
| | | left join aps_plate_standard_require_order_end_day as rd on pl.document_number = rd.doc_no and rd.del_flag =0 |
| | | where pl.document_number is not null and rt.work_order_no is not null and |
| | | (pl.plan_end_day is not null or rd.plan_end_day is not null ) |
| | | order by rt.work_order_no asc, rt.process_number desc |
| | | left join rd on pl.document_number = rd.doc_no |
| | | left join dt on pl.document_number=dt.doc_no |
| | | where pl.document_number is not null |
| | | and rt.work_order_no is not null |
| | | order by rt.work_order_no, rt.process_number desc |
| | | </select> |
| | | <update id="removeOtherStat" parameterType="String"> |
| | | delete from aps_plate_process_stat where batch_number != #{batchNumber} |