| | |
| | | List<WrkDetl> wrkDetls54 = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo())); |
| | | if (wrkDetls54.isEmpty()) { |
| | | // exceptionHandle("并板入库 ===>> 工作明细档为空;[workNo={0}]", wrkMast.getWrkNo()); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("并板入库 ===>> 工作明细档为空; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | } |
| | | // 修改库存明细数量,如无库存,曾新增 |
| | | for (WrkDetl wrkDetl : wrkDetls54) { |
| | | }else { |
| | | // 修改库存明细数量,如无库存,曾新增 |
| | | for (WrkDetl wrkDetl : wrkDetls54) { |
| | | |
| | | LocDetl locDetl = locDetlService.selectItem(locMast.getLocNo(), wrkDetl); |
| | | if (null != locDetl) { |
| | | if (!locDetlService.updateAnfme(wrkDetl.getAnfme(), locMast.getLocNo(), wrkDetl)) { |
| | | LocDetl locDetl = locDetlService.selectItem(locMast.getLocNo(), wrkDetl); |
| | | if (null != locDetl) { |
| | | if (!locDetlService.updateAnfme(wrkDetl.getAnfme(), locMast.getLocNo(), wrkDetl)) { |
| | | // exceptionHandle("并板入库 ===>> 修改库存明细数量失败;[workNo={0}],[matnr={1}]", wrkMast.getWrkNo(), wrkDetl.getMatnr()); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("并板入库 ===>> 修改库存明细数量失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | } |
| | | } else { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("并板入库 ===>> 修改库存明细数量失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | } |
| | | } else { |
| | | |
| | | InOut inOut=inOutService.selectByMatnr(wrkDetl.getMatnr()); |
| | | if (inOut != null){ |
| | | inOut.setTemp1("在库");//属性 是否在库 |
| | | inOut.setBrand(wrkDetl.getZpallet());//托盘条码 |
| | | inOut.setTemp3(wrkMast.getLocNo());//库位号 |
| | | InOut inOut=inOutService.selectByMatnr(wrkDetl.getMatnr()); |
| | | if (inOut != null){ |
| | | inOut.setTemp1("在库");//属性 是否在库 |
| | | inOut.setBrand(wrkDetl.getZpallet());//托盘条码 |
| | | inOut.setTemp3(wrkMast.getLocNo());//库位号 |
| | | // inOut.setModiTime(now.toString()); |
| | | } |
| | | if (!inOutService.updateById(inOut)){ |
| | | return FAIL.setMsg("更新模具属性失败"); |
| | | } |
| | | } |
| | | if (!inOutService.updateById(inOut)){ |
| | | return FAIL.setMsg("更新模具属性失败"); |
| | | } |
| | | |
| | | //更新半托信息 |
| | | HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(wrkDetl.getZpallet()); |
| | | //对模具的规格做处理得到厚度 |
| | | Integer thickness = 0; |
| | | if (!Cools.isEmpty(wrkDetl.getSpecs())){ |
| | | String[] split = wrkDetl.getSpecs().split("\\*"); |
| | | thickness = Integer.parseInt(split[1]); |
| | | } |
| | | if (halfBarcode == null){ |
| | | HalfBarcode hb = new HalfBarcode(); |
| | | hb.setZpallet(wrkDetl.getZpallet()); |
| | | hb.setSpecs(wrkDetl.getZpallet().substring(0,1)); |
| | | hb.setAnfme(1); |
| | | if (Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==6){ |
| | | hb.setPrice(2650 - thickness); |
| | | }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==7){ |
| | | hb.setPrice(1750 - thickness); |
| | | }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==8){ |
| | | hb.setPrice(800 - thickness); |
| | | //更新半托信息 |
| | | HalfBarcode halfBarcode = halfBarcodeService.selectByZpallet(wrkDetl.getZpallet()); |
| | | //对模具的规格做处理得到厚度 |
| | | Integer thickness = 0; |
| | | if (!Cools.isEmpty(wrkDetl.getSpecs())){ |
| | | String[] split = wrkDetl.getSpecs().split("\\*"); |
| | | thickness = Integer.parseInt(split[1]); |
| | | } |
| | | if (!halfBarcodeService.insert(hb)){ |
| | | throw new CoolException("更新半托信息失败"); |
| | | if (halfBarcode == null){ |
| | | HalfBarcode hb = new HalfBarcode(); |
| | | hb.setZpallet(wrkDetl.getZpallet()); |
| | | hb.setSpecs(wrkDetl.getZpallet().substring(0,1)); |
| | | hb.setAnfme(1); |
| | | if (Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==6){ |
| | | hb.setPrice(2650 - thickness); |
| | | }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==7){ |
| | | hb.setPrice(1750 - thickness); |
| | | }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==8){ |
| | | hb.setPrice(800 - thickness); |
| | | } |
| | | if (!halfBarcodeService.insert(hb)){ |
| | | throw new CoolException("更新半托信息失败"); |
| | | } |
| | | }else { |
| | | if (Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==6){ |
| | | halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); |
| | | halfBarcode.setPrice(halfBarcode.getPrice() - thickness); |
| | | }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==7){ |
| | | halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); |
| | | halfBarcode.setPrice(halfBarcode.getPrice() - thickness); |
| | | }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==8){ |
| | | halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); |
| | | halfBarcode.setPrice(halfBarcode.getPrice() - thickness); |
| | | } |
| | | if (!halfBarcodeService.half(halfBarcode)){ |
| | | throw new CoolException("更新半托信息失败"); |
| | | } |
| | | } |
| | | }else { |
| | | if (Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==6){ |
| | | halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); |
| | | halfBarcode.setPrice(halfBarcode.getPrice() - thickness); |
| | | }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==7){ |
| | | halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); |
| | | halfBarcode.setPrice(halfBarcode.getPrice() - thickness); |
| | | }else if(Integer.parseInt(wrkDetl.getZpallet().substring(0,1))==8){ |
| | | halfBarcode.setAnfme(halfBarcode.getAnfme() + 1); |
| | | halfBarcode.setPrice(halfBarcode.getPrice() - thickness); |
| | | } |
| | | if (!halfBarcodeService.half(halfBarcode)){ |
| | | throw new CoolException("更新半托信息失败"); |
| | | } |
| | | } |
| | | |
| | | locDetl = new LocDetl(); |
| | | locDetl.sync(wrkDetl); |
| | | locDetl.setLocNo(wrkMast.getLocNo()); // 库位号 |
| | | locDetl.setAnfme(wrkDetl.getAnfme()); // 数量 |
| | | locDetl.setZpallet(wrkDetl.getZpallet()); // 托盘条码 |
| | | locDetl.setModiTime(now); |
| | | locDetl.setAppeTime(now); |
| | | if (!locDetlService.insert(locDetl)) { |
| | | locDetl = new LocDetl(); |
| | | locDetl.sync(wrkDetl); |
| | | locDetl.setLocNo(wrkMast.getLocNo()); // 库位号 |
| | | locDetl.setAnfme(wrkDetl.getAnfme()); // 数量 |
| | | locDetl.setZpallet(wrkDetl.getZpallet()); // 托盘条码 |
| | | locDetl.setModiTime(now); |
| | | locDetl.setAppeTime(now); |
| | | if (!locDetlService.insert(locDetl)) { |
| | | // exceptionHandle("并板入库 ===>> 新增库存明细失败;[workNo={0}],[matnr={1}]", wrkMast.getWrkNo(), wrkDetl.getMatnr()); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("并板入库 ===>> 新增库存明细失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("并板入库 ===>> 新增库存明细失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 修改库位状态 Q ====>> F |
| | | if (locMast.getLocSts().equals("Q")) { |
| | | locMast.setLocSts("F"); |