|  |  |  | 
|---|
|  |  |  | @RequestBody(required = false) CombParam param, | 
|---|
|  |  |  | HttpServletRequest request) { | 
|---|
|  |  |  | log.info("PACK信息下发接口调用"+appkey+param); | 
|---|
|  |  |  | auth(appkey, param, request); | 
|---|
|  |  |  | auth("ea1f0459efc02a79f046f982767939ae", param, request); | 
|---|
|  |  |  | if (Cools.isEmpty(param)) { | 
|---|
|  |  |  | return R.parse(BaseRes.PARAM); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | //        }else if (!sourceLoc.getCrnNo().equals(loc.getCrnNo())) { | 
|---|
|  |  |  | //            throw new CoolException("移转库位属于不同堆垛机"); | 
|---|
|  |  |  | }else if(sourceLoc.getPackStatus()!=3){ | 
|---|
|  |  |  | if(sourceLoc.getLocType1()!=loc.getLocType1()){ | 
|---|
|  |  |  | throw new CoolException("源库为与目标库位的库位类型不同"); | 
|---|
|  |  |  | if(sourceLoc.getLocType1()==loc.getLocType1()){ | 
|---|
|  |  |  | throw new CoolException("源库为与目标库位的库位类型相同"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Date now = new Date(); | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Scheduled(cron = "0/60 * * * * ? ") | 
|---|
|  |  |  | @Scheduled(cron = "0/5 * * * * ? ") | 
|---|
|  |  |  | private void execute() { | 
|---|
|  |  |  | if (confirmDeep) return; | 
|---|
|  |  |  | //if (confirmDeep) return; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ReturnT<String> result = standingHandler.start(); | 
|---|
|  |  |  | if (!result.isSuccess()) { | 
|---|
|  |  |  | 
|---|
|  |  |  | TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>() | 
|---|
|  |  |  | .eq("loc_no",locMast.getLocNo()) | 
|---|
|  |  |  | .eq("barcode",locDetl.getMatnr()) | 
|---|
|  |  |  | .eq("status",4) | 
|---|
|  |  |  | .eq("status",4)//完成测试 | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if (!Cools.isEmpty(testMast)){ | 
|---|
|  |  |  | if (testMast.getStatus()==4){ | 
|---|
|  |  |  | 
|---|
|  |  |  | wrkMast.setIoPri(13D); // 优先级:13 | 
|---|
|  |  |  | wrkMast.setCrnNo(1); | 
|---|
|  |  |  | wrkMast.setSourceStaNo(203); // 源站 | 
|---|
|  |  |  | wrkMast.setStaNo(205); // 目标站  2号堆垛机入库站 | 
|---|
|  |  |  | wrkMast.setStaNo(206); // 目标站  2号堆垛机入库站 | 
|---|
|  |  |  | wrkMast.setSourceLocNo(locMast.getLocNo()); // 源库位 | 
|---|
|  |  |  | wrkMast.setFullPlt("Y"); // 满板:Y | 
|---|
|  |  |  | wrkMast.setPicking("N"); // 拣料 | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq("pack_status", 5) | 
|---|
|  |  |  | .eq("freeze",0)); | 
|---|
|  |  |  | Integer ioType = 101;   //入出库类型 | 
|---|
|  |  |  | //静置完成出库站104 | 
|---|
|  |  |  | //静置完成出库站103 | 
|---|
|  |  |  | for(LocMast locMast : locMasts){ | 
|---|
|  |  |  | LocDetl locDetl=locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no",locMast.getLocNo())); | 
|---|
|  |  |  | if (Cools.isEmpty(locDetl) || Cools.isEmpty(locDetl.getMatnr())){ | 
|---|
|  |  |  | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | wrkMast.setSourceStaNo(210); // 源站 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | wrkMast.setStaNo(104); // 目标站 | 
|---|
|  |  |  | wrkMast.setStaNo(103); // 目标站 | 
|---|
|  |  |  | wrkMast.setSourceLocNo(locMast.getLocNo()); // 源库位 | 
|---|
|  |  |  | wrkMast.setFullPlt("Y"); // 满板:Y | 
|---|
|  |  |  | wrkMast.setPicking("N"); // 拣料 | 
|---|
|  |  |  | 
|---|
|  |  |  | locMast.setLocSts("R"); | 
|---|
|  |  |  | locMast.setModiTime(now); | 
|---|
|  |  |  | locMast.setPackStatus(6); //6:静置完成 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | CombParam combParam = new CombParam(); | 
|---|
|  |  |  | combParam.setPackNo(mat.getMatnr()); | 
|---|
|  |  |  | combParam.setLocNo(locMast.getLocNo()); | 
|---|
|  |  |  | 
|---|
|  |  |  | locMast.setPackStatus(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | WrkDetl wrkDetl1 = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("zpallet",locMast.getBarcode())); | 
|---|
|  |  |  | locMast.setPackStatus(5); | 
|---|
|  |  |  | TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>() | 
|---|
|  |  |  | .eq("barcode",locMast.getBarcode()) | 
|---|
|  |  |  | .eq("barcode",wrkDetl1.getMatnr()) | 
|---|
|  |  |  | .eq("status",4) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | testMast.setStatus(5); | 
|---|
|  |  |  | testMast.setModiTime(new Date()); | 
|---|
|  |  |  | if (!testMastService.update(testMast,new EntityWrapper<TestMast>().eq("barcode",locMast.getBarcode()).eq("status",4))){ | 
|---|
|  |  |  | if (!testMastService.update(testMast,new EntityWrapper<TestMast>().eq("barcode",wrkDetl1.getMatnr()).eq("status",4))){ | 
|---|
|  |  |  | throw new CoolException("更改测试状态失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | CombParam combParam = new CombParam(); | 
|---|
|  |  |  | combParam.setPackNo(wrkDetls.get(0).getMatnr()); | 
|---|
|  |  |  | combParam.setLocNo(wrkMast.getLocNo()); | 
|---|
|  |  |  | combParam.setBarcode(wrkMast.getBarcode()); | 
|---|
|  |  |  | if (locMast.getCrnNo()==1){ | 
|---|
|  |  |  | combParam.setPackSts(0); | 
|---|
|  |  |  | combParam.setStepSts(2); | 
|---|
|  |  |  | 
|---|
|  |  |  | //                            exceptionHandle("全板出库 ===>> 修改源库位状态失败;[workNo={0}],[sourceLocNo={1}]", wrkMast.getWrkNo(), wrkMast.getSourceLocNo()); | 
|---|
|  |  |  | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
|---|
|  |  |  | return FAIL.setMsg("全板出库 ===>> 修改源库位状态失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]"); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | //2.出库完成上报 | 
|---|
|  |  |  | CombParam combParam = new CombParam(); | 
|---|
|  |  |  | combParam.setPackNo(wrkDetls101.get(0).getMatnr()); | 
|---|
|  |  |  | combParam.setLocNo(wrkMast.getLocNo()); | 
|---|
|  |  |  | combParam.setBarcode(wrkMast.getBarcode()); | 
|---|
|  |  |  | //目标站206出库 | 
|---|
|  |  |  | if(wrkMast.getStaNo()==206){ | 
|---|
|  |  |  | combParam.setPackSts(1);//OK | 
|---|
|  |  |  | combParam.setStepSts(7);//测试库出库完成 | 
|---|
|  |  |  | }else if(wrkMast.getStaNo()==204){//NG 出库 | 
|---|
|  |  |  | combParam.setPackSts(2);//NG | 
|---|
|  |  |  | combParam.setStepSts(8);//NG出库完成 | 
|---|
|  |  |  | }else if(wrkMast.getStaNo()==103){//目标站103出库 | 
|---|
|  |  |  | combParam.setPackSts(1);//OK | 
|---|
|  |  |  | combParam.setStepSts(6);//静置库出库完成 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | combParam.setRequestTime(DateUtils.convert(now)); | 
|---|
|  |  |  | new PostMesDataUtils().postMesData("MES系统",mesUrl,inpath,combParam); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | 
|---|
|  |  |  | private ApiLogService apiLogService = new ApiLogServiceImpl(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public ReturnT<String> postMesData(String name,String URL,String mesPath, Object combParam){ | 
|---|
|  |  |  | if (true){ | 
|---|
|  |  |  | System.out.println("name:"+name+",URL:"+URL+",mesPath:"+mesPath+",combParam:"+combParam); | 
|---|
|  |  |  | return SUCCESS; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        if (true){ | 
|---|
|  |  |  | //            System.out.println("name:"+name+",URL:"+URL+",mesPath:"+mesPath+",combParam:"+combParam); | 
|---|
|  |  |  | //            return SUCCESS; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | if(combParam != null){ | 
|---|
|  |  |  | String response = ""; | 
|---|
|  |  |  | boolean success = false; | 
|---|
|  |  |  | 
|---|
|  |  |  | .setJson(JSON.toJSONString(combParam)) | 
|---|
|  |  |  | .build() | 
|---|
|  |  |  | .doPost(); | 
|---|
|  |  |  | System.out.println("response:"+response); | 
|---|
|  |  |  | JSONObject jsonObject = JSON.parseObject(response); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (jsonObject.getInteger("code").equals(200)) { | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | 
|---|
|  |  |  | if (Cools.isEmpty(param.getSourceStaNo())) { | 
|---|
|  |  |  | return R.error("源站编号不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (Cools.isEmpty(param.getBarcode())) { | 
|---|
|  |  |  | return R.error("托盘码不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | boolean logs=true; | 
|---|
|  |  |  | TestMast testMast11=new TestMast(); | 
|---|
|  |  |  | //如果pack码为空,查测试表 | 
|---|
|  |  |  | if (Cools.isEmpty(param.getPackNo())) { | 
|---|
|  |  |  | return R.error("packNo不能为空"); | 
|---|
|  |  |  | testMast11= testMastService.selectOne(new EntityWrapper<TestMast>() | 
|---|
|  |  |  | .eq("user_id",param.getBarcode())//查托盘码 | 
|---|
|  |  |  | .eq("status",4));   //完成测试 | 
|---|
|  |  |  | logs=false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Date now = new Date(); | 
|---|
|  |  |  | if (true){ | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | Mat mat = matService.selectByMatnr(param.getPackNo()); | 
|---|
|  |  |  | Mat mat=new Mat(); | 
|---|
|  |  |  | if(logs){ | 
|---|
|  |  |  | mat = matService.selectByMatnr(param.getPackNo()); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | mat = matService.selectByMatnr(testMast11.getBarcode()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (Cools.isEmpty(mat)){ | 
|---|
|  |  |  | return R.error("商品信息档案未查询到pack信息"+param.getPackNo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!wrkDetlService.insert(wrkDetl)) { | 
|---|
|  |  |  | throw new CoolException("保存工作明细失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>().eq("barcode", wrkMast.getBarcode())); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>() | 
|---|
|  |  |  | .eq("barcode", wrkDetl.getMatnr()));//pack码 | 
|---|
|  |  |  | if (Cools.isEmpty(testMast)){ | 
|---|
|  |  |  | //生成测试档 | 
|---|
|  |  |  | testMast=new TestMast(); | 
|---|
|  |  |  | testMast.setChannel(locMast.getChannel()); | 
|---|
|  |  |  | testMast.setUserId(locMast.getLocNo()); | 
|---|
|  |  |  | testMast.setUserId(wrkMast.getBarcode());//托盘码 | 
|---|
|  |  |  | testMast.setStatus(1); | 
|---|
|  |  |  | testMast.setBarcode(wrkDetl.getMatnr()); | 
|---|
|  |  |  | testMast.setLocNo(locMast.getLocNo()); | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new CoolException(wrkDetl.getMatnr()+"生成测试档失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | throw new CoolException(wrkDetl.getMatnr()+"已存在测试档"); | 
|---|
|  |  |  | testMast.setBarcode(wrkDetl.getMatnr()); | 
|---|
|  |  |  | testMast.setChannel(locMast.getChannel()); | 
|---|
|  |  |  | testMast.setLocNo(locMast.getLocNo()); | 
|---|
|  |  |  | testMast.setAppeTime(now); | 
|---|
|  |  |  | if(!testMastService.update(testMast,new EntityWrapper<TestMast>().eq("barcode", wrkDetl.getMatnr()))){ | 
|---|
|  |  |  | throw new CoolException(wrkDetl.getMatnr()+"更新测试档失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // 更新入库通知档 ioStatus ===>> Y | 
|---|
|  |  |  | 
|---|
|  |  |  | # MES系统 | 
|---|
|  |  |  | mes: | 
|---|
|  |  |  | # 是否开启上报 | 
|---|
|  |  |  | start: false | 
|---|
|  |  |  | start: true | 
|---|
|  |  |  | # MES系统ip | 
|---|
|  |  |  | url: 172.28.15.251:7899 | 
|---|
|  |  |  | url: 10.12.20.12:5001 | 
|---|
|  |  |  | # 入库上报 | 
|---|
|  |  |  | inPath: mes-pm/in/stock/condition/warehousing | 
|---|
|  |  |  | inPath: api/InterFace/get_InterFace_TestStorage | 
|---|
|  |  |  | # 出库上报 | 
|---|
|  |  |  | outPath: mes-pm/in/stock/condition/exWarehouse | 
|---|
|  |  |  | outPath: api/InterFace/get_InterFace_TestStorage | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 充放电测试通道 | 
|---|
|  |  |  | channel: | 
|---|