| | |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | | @RequestMapping("/pack/comb/auth") |
| | | @ManagerAuth(memo = "下线组托") |
| | | public R packComb(@RequestBody CombParam combParam) { |
| | | mobileService.packComb(combParam, getUserId()); |
| | | return R.ok("组托成功"); |
| | | } |
| | | // @RequestMapping("/pack/comb/auth") |
| | | // @ManagerAuth(memo = "下线组托") |
| | | // public R packComb(@RequestBody CombParam combParam) { |
| | | // mobileService.packComb(combParam, getUserId()); |
| | | // return R.ok("组托成功"); |
| | | // } |
| | | |
| | | |
| | | // 出库 --------------------------------------------------------------------------------------------------- |
| | |
| | | if (!Cools.isEmpty(waitMatins)) { |
| | | for (OrderDetl waitMatin : waitMatins) { |
| | | CombBillQueryVo vo = new CombBillQueryVo(); |
| | | vo.setDetlId(waitMatin.getId()); |
| | | vo.setMatnr(waitMatin.getMatnr()); |
| | | vo.setMatName(waitMatin.getMaktx()); |
| | | vo.setQty(waitMatin.getAnfme() - waitMatin.getWorkQty()); |
| | |
| | | vo.setSize(waitMatin.getModel()); |
| | | vo.setColor(waitMatin.getColor()); |
| | | vo.setItemBatch(waitMatin.getBatch()); |
| | | vo.setLuHao(waitMatin.getLuHao()); |
| | | vo.setOutOrderNo(waitMatin.getOutOrderNo()); |
| | | vo.setSPgNO(waitMatin.getSPgNO()); |
| | | vo.setProType(waitMatin.getProType()); |
| | | vo.setPacking(waitMatin.getPacking()); |
| | | //vo.setOveFlag(waitMatin.getOveFlag()); |
| | | vos.add(vo); |
| | | } |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | |
| | | if (issued <= 0.0D) { |
| | | continue; |
| | | } |
| | | List<LocDetl> locDetls = null; |
| | | if (Cools.isEmpty(orderDetls.get(0).getSPgNO())) { |
| | | locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, null); |
| | | if (locDetls == null) { |
| | | locDetls = locDetlService.queryStock(orderDetl.getMatnr(), null, null, null); |
| | | } |
| | | } else { |
| | | locDetls = locDetlService.queryStock(orderDetl.getSPgNO()); |
| | | } |
| | | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl); |
| | | |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (Cools.isEmpty(locDetl.getBatch()) || Cools.isEmpty(orderDetl.getBatch())) { |
| | | if (locDetl.getMatnr().equals(orderDetl.getMatnr())) { |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | |
| | | issued = issued - locDetl.getAnfme(); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | if (locDetl.getMatnr().equals(orderDetl.getMatnr()) && locDetl.getBatch().equals(orderDetl.getBatch())) { |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); |
| | | locDto.setStaNos(staNos); |
| | | locDto.setModel(locDetl.getModel()); |
| | | locDtos.add(locDto); |
| | | exist.add(locDetl.getLocNo()); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | waitPakinService.delete(new EntityWrapper<>(entity)); |
| | | //订单关联,修改订单作业数量 |
| | | if (!Cools.isEmpty(entity.getOrderNo())) { |
| | | if (!orderDetlService.decrease(entity.getOrderNo(), entity.getMatnr(), entity.getBatch(), entity.getAnfme())) { |
| | | if (!orderDetlService.decrease(entity, entity.getAnfme())) { |
| | | return R.error("订单数据回滚失败"); |
| | | } |
| | | } |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Data |
| | | public class CombBillQueryVo { |
| | | |
| | | private Long detlId; |
| | | |
| | | private String billNo; |
| | | |
| | |
| | | private String itemBatch; |
| | | |
| | | private Integer oveFlag; |
| | | |
| | | |
| | | |
| | | private String outOrderNo; |
| | | /** |
| | | * 炉号\客户图号 |
| | | */ |
| | | private String luHao; |
| | | |
| | | |
| | | private String packing; |
| | | /** |
| | | * 派工单 |
| | | */ |
| | | private String sPgNO; |
| | | |
| | | |
| | | |
| | | private String proType; |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | @TableField("out_order_no") |
| | | private String outOrderNo; |
| | | |
| | | |
| | | /** |
| | | * 工单号 |
| | | */ |
| | | @TableField("pg_no") |
| | | private String sPgNO; |
| | | |
| | | @TableField("pro_type") |
| | | private String proType; |
| | | |
| | | /** |
| | | * 炉号\客户图号 |
| | | */ |
| | | @TableField("lu_hao") |
| | | private String luHao; |
| | | |
| | | |
| | | @TableField("packing") |
| | | private String packing; |
| | | |
| | | |
| | | public String getBeBatch$(){ |
| | | if (null == this.beBatch){ return null; } |
| | |
| | | @Data |
| | | public static class CombMat { |
| | | |
| | | private Long detlId; |
| | | |
| | | // 物料编号 |
| | | private String matnr; |
| | | |
| | |
| | | |
| | | int decrease(@Param("orderNo")String orderNo, @Param("matnr")String matnr, @Param("batch")String batch, @Param("qty")Double qty); |
| | | |
| | | int decrease2(@Param("id")Long id, @Param("qty")Double qty); |
| | | |
| | | int modifyStatus(@Param("orderId") Long orderId, @Param("status")Integer status); |
| | | |
| | | int addToLogTable(OrderDetl orderDetl); |
| | | |
| | | int increaseQtyByOrderNo(@Param("orderNo")String orderNo, @Param("matnr")String matnr, @Param("batch")String batch, @Param("qty")Double qty); |
| | | |
| | | int increaseWorkQty(@Param("orderId")Long orderId, @Param("matnr")String matnr, @Param("batch")String batch, @Param("workQty")Double workQty); |
| | | int increaseWorkQty(@Param("id")Long id, @Param("workQty")Double workQty); |
| | | |
| | | |
| | | List<OrderDetl> listByOrderNo(@Param("orderNo") String orderNo); |
| | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.entity.StockStatisDTO; |
| | | import com.zy.asrs.entity.result.StockVo; |
| | | |
| | |
| | | |
| | | // -------------------------------------------------- |
| | | |
| | | List<LocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos); |
| | | //List<LocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos); |
| | | |
| | | List<LocDetl> queryStock(String sPgNO); |
| | | List<LocDetl> queryStock(OrderDetl orderDetl); |
| | | |
| | | List<LocDetl> queryStockByModel(String model); |
| | | |
| | |
| | | */ |
| | | void adjust(MobileAdjustParam param, Long userId); |
| | | |
| | | void packComb(CombParam param, Long userId); |
| | | //void packComb(CombParam param, Long userId); |
| | | |
| | | void pakoutByOrder(JSONObject param, Long userId); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.entity.WaitPakin; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | Page<OrderDetl> getPakoutPage(Page<OrderDetl> page); |
| | | |
| | | OrderDetl selectItem(Long orderId, String matnr, String batch,Double qty); |
| | | |
| | | OrderDetl selectItem(String orderNo, String matnr, String batch,Double qty); |
| | | |
| | | OrderDetl selectQtyItem(String orderNo, String matnr, String batch, Double qty); |
| | | // OrderDetl selectItem(Long orderId, String matnr, String batch,Double qty); |
| | | // |
| | | // OrderDetl selectItem(String orderNo, String matnr, String batch,Double qty); |
| | | // |
| | | // OrderDetl selectQtyItem(String orderNo, String matnr, String batch, Double qty); |
| | | |
| | | OrderDetl findByLook(List<OrderDetl> orderDetls, Long orderId, String matnr, String batch); |
| | | |
| | | boolean increase(Long orderId, String matnr, String batch, Double qty); |
| | | |
| | | boolean decrease(String orderNo, String matnr, String batch, Double qty); |
| | | //boolean decrease(String orderNo, String matnr, String batch, Double qty); |
| | | |
| | | boolean decrease(WrkDetl wrkDetl, Double qty); |
| | | |
| | | boolean decrease(WaitPakin waitPakin, Double qty); |
| | | |
| | | boolean modifyStatus(Long orderId, Integer status); |
| | | |
| | |
| | | |
| | | /** |
| | | * 入出库任务生成时,更新单据表中作业数量 |
| | | * @param orderId |
| | | * @param matnr |
| | | * @param batch |
| | | * @param orderDetl |
| | | * @param workQty |
| | | * @return |
| | | */ |
| | | boolean increaseWorkQty(Long orderId, String matnr, String batch, Double workQty); |
| | | boolean increaseWorkQty(OrderDetl orderDetl, Double workQty); |
| | | |
| | | List<OrderDetl> selectItem(String orderNo); |
| | | |
| | | OrderDetl selectItem(WaitPakin waitPakin); |
| | | } |
| | |
| | | |
| | | void checkComplete(String orderNo); |
| | | |
| | | boolean saveHandlerOrder(Boolean pakin, WrkMast wrkMast, List<WrkDetl> wrkDetls); |
| | | //boolean saveHandlerOrder(Boolean pakin, WrkMast wrkMast, List<WrkDetl> wrkDetls); |
| | | |
| | | void remove(Long orderId); |
| | | |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.entity.StockStatisDTO; |
| | | import com.zy.asrs.entity.result.StockVo; |
| | | import com.zy.asrs.mapper.LocDetlMapper; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.utils.MatCompareUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | |
| | | return this.baseMapper.countLocNoNum(locNo); |
| | | } |
| | | |
| | | @Override |
| | | public List<LocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos) { |
| | | return this.baseMapper.queryStock(null, matnr, batch, orderNo, locNos); |
| | | } |
| | | // @Override |
| | | // public List<LocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos) { |
| | | // return this.baseMapper.queryStock(null, matnr, batch, orderNo, locNos); |
| | | // } |
| | | |
| | | @Override |
| | | public List<LocDetl> queryStock(String spgNo) { |
| | | return this.baseMapper.queryStock(spgNo, null, null, null, null); |
| | | public List<LocDetl> queryStock(OrderDetl orderDetl) { |
| | | List<LocDetl> data = new ArrayList<>(); |
| | | List<LocDetl> locDetls = this.baseMapper.queryStock(null, orderDetl.getMatnr(), null, null, null); |
| | | if (locDetls == null) { |
| | | return null; |
| | | } |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (MatCompareUtils.compare(locDetl, orderDetl)) { |
| | | data.add(locDetl); |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | @Override |
| | |
| | | param.getCombMats().forEach(elem -> { |
| | | |
| | | // 订单明细数量校验 |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch(),elem.getAnfme() ); |
| | | //OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch(),elem.getAnfme() ); |
| | | OrderDetl orderDetl = orderDetlService.selectById(elem.getDetlId()); |
| | | if (elem.getAnfme() > orderDetl.getEnableQty()) { |
| | | throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); |
| | | } |
| | | // 修改订单作业数量 |
| | | if (!orderDetlService.increaseWorkQty(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme())) { |
| | | if (!orderDetlService.increaseWorkQty(orderDetl, elem.getAnfme())) { |
| | | throw new CoolException("修改单据作业数量失败"); |
| | | } |
| | | |
| | |
| | | waitPakin.setAppeTime(now); |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getOrderNo(), waitPakin.getMatnr(), waitPakin.getBatch(),detlDto.getAnfme()); |
| | | if (orderDetl == null) { |
| | | orderDetl = orderDetlService.selectItem(order.getOrderNo(), waitPakin.getMatnr(), null,detlDto.getAnfme()); |
| | | } |
| | | OrderDetl orderDetl = orderDetlService.selectItem(waitPakin); |
| | | // if (orderDetl == null) { |
| | | // orderDetl = orderDetlService.selectItem(order.getOrderNo(), waitPakin.getMatnr(), null,detlDto.getAnfme()); |
| | | // } |
| | | if (orderDetl!=null){ |
| | | waitPakin.setBatch(orderDetl.getBatch()); |
| | | waitPakin.setSPgNO(orderDetl.getSPgNO()); |
| | | waitPakin.setOutOrderNo(orderDetl.getOutOrderNo()); |
| | | waitPakin.setProType(orderDetl.getProType()); |
| | | waitPakin.setLuHao(orderDetl.getLuHao()); |
| | | waitPakin.setPacking(orderDetl.getPacking()); |
| | | } |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void packComb(CombParam param, Long userId) { |
| | | if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | | // 判断是否有相同条码的数据 |
| | | if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { |
| | | throw new CoolException(param.getBarcode() + "数据正在进行入库"); |
| | | } |
| | | Date now = new Date(); |
| | | |
| | | boolean packDown = Parameter.get().getPackDown().equals("true"); |
| | | |
| | | // 无单组托 |
| | | if (Cools.isEmpty(param.getOrderNo())) { |
| | | |
| | | // 生成入库通知档 |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | param.getCombMats().forEach(elem -> { |
| | | // 打包上线数据校验 |
| | | if (packDown) { |
| | | Pack pack = packService.selectByBarcode(elem.getMatnr()); |
| | | if (pack == null) { |
| | | throw new CoolException(elem.getMatnr() + "条码冗余,请检查!"); |
| | | } |
| | | if (pack.getSettle() != 1) { |
| | | throw new CoolException(elem.getMatnr() + "条码已下线,请检查!"); |
| | | } |
| | | } |
| | | Mat analyse = MatUtils.analyseMat(elem.getMatnr()); |
| | | // 条码、物料代码、序列号、数量 |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), analyse.getMatnr(), analyse.getBarcode(), elem.getAnfme()); |
| | | // DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme()); |
| | | if (DetlDto.has(detlDtos, detlDto)) { |
| | | DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch()); |
| | | assert one != null; |
| | | one.setAnfme(one.getAnfme() + detlDto.getAnfme()); |
| | | } else { |
| | | detlDtos.add(detlDto); |
| | | } |
| | | }); |
| | | |
| | | if (packDown) { |
| | | MesCombParam mesCombParam = new MesCombParam(); |
| | | mesCombParam.setZpallet(param.getBarcode()); |
| | | mesCombParam.setPakinTime(DateUtils.convert(now)); |
| | | mesCombParam.setLgort("5008"); |
| | | mesCombParam.setPlantCode("5000"); |
| | | mesCombParam.setFromCode("5012-20"); |
| | | mesCombParam.setStationCode("JJQ-PFZPDB-XX"); |
| | | for (DetlDto detlDto : detlDtos) { |
| | | mesCombParam.getList().add(new MesCombParam.Detl(detlDto.getOrderNo(), detlDto.getAnfme())); |
| | | } |
| | | String response = ""; |
| | | boolean success = false; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(MesConstant.URL) |
| | | .setPath(MesConstant.PACK_DOWN_URL) |
| | | .setJson(JSON.toJSONString(mesCombParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | success = true; |
| | | } else if (jsonObject.getInteger("code").equals(500)) { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PACK_DOWN_URL, JSON.toJSONString(mesCombParam), response); |
| | | throw new CoolException(jsonObject.getString("msg")); |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PACK_DOWN_URL, JSON.toJSONString(mesCombParam), response); |
| | | throw new CoolException("上报mes系统失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | throw new CoolException(e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "打包下线帮托上报", |
| | | MesConstant.URL + MesConstant.PACK_DOWN_URL, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(mesCombParam), |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { |
| | | log.error("", e); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | // 生成入库单据 |
| | | String orderNo = "PACK" + snowflakeIdWorker.nextId(); |
| | | OpenOrderPakinParam openParam = new OpenOrderPakinParam(); |
| | | openParam.setOrderNo(orderNo); |
| | | openParam.setOrderTime(DateUtils.convert(now)); |
| | | openParam.setOrderType("打包入库单"); |
| | | openParam.setOrderDetails(detlDtos); |
| | | openService.pakinOrderCreate(openParam); |
| | | Order order = orderService.selectByNo(orderNo); |
| | | if (null == order) { |
| | | throw new CoolException("生成单据失败"); |
| | | } |
| | | if (!orderService.updateSettle(order.getId(), 2L, userId)) { |
| | | throw new CoolException("修改单据状态失败"); |
| | | } |
| | | |
| | | // 生成入库通知档 |
| | | for (DetlDto detlDto : detlDtos) { |
| | | |
| | | // 修改作业数量 ---------------------------------------- |
| | | // 订单明细数量校验 |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), detlDto.getMatnr(), detlDto.getBatch(),detlDto.getAnfme()); |
| | | if (detlDto.getAnfme() > orderDetl.getEnableQty()) { |
| | | throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); |
| | | } |
| | | // 修改订单作业数量 |
| | | if (!orderDetlService.increaseWorkQty(order.getId(), detlDto.getMatnr(), detlDto.getBatch(), detlDto.getAnfme())) { |
| | | throw new CoolException("修改单据作业数量失败"); |
| | | } |
| | | |
| | | // 保存入库通知档 |
| | | Mat mat = matService.selectByMatnr(detlDto.getMatnr()); |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(detlDto.getMatnr() + "商品档案不存在"); |
| | | } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setOrderNo(orderNo); |
| | | waitPakin.setBatch(detlDto.getBatch()); |
| | | waitPakin.setZpallet(param.getBarcode()); // 托盘码 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | | waitPakin.setAnfme(detlDto.getAnfme()); // 数量 |
| | | waitPakin.setStatus("Y"); // 状态 |
| | | waitPakin.setAppeUser(userId); |
| | | waitPakin.setAppeTime(now); |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | // 修改打包数据状态 |
| | | Pack pack = packService.selectByBarcode(detlDto.getOrderNo()); |
| | | pack.setSettle(2L); |
| | | pack.setUpdateTime(now); |
| | | pack.setUpdateBy(userId); |
| | | if (!packService.updateById(pack)) { |
| | | throw new CoolException("修改打包数据异常"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | // @Override |
| | | // @Transactional |
| | | // public void packComb(CombParam param, Long userId) { |
| | | // if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { |
| | | // throw new CoolException(BaseRes.PARAM); |
| | | // } |
| | | // // 判断是否有相同条码的数据 |
| | | // if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | // eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { |
| | | // throw new CoolException(param.getBarcode() + "数据正在进行入库"); |
| | | // } |
| | | // Date now = new Date(); |
| | | // |
| | | // boolean packDown = Parameter.get().getPackDown().equals("true"); |
| | | // |
| | | // // 无单组托 |
| | | // if (Cools.isEmpty(param.getOrderNo())) { |
| | | // |
| | | // // 生成入库通知档 |
| | | // List<DetlDto> detlDtos = new ArrayList<>(); |
| | | // param.getCombMats().forEach(elem -> { |
| | | // // 打包上线数据校验 |
| | | // if (packDown) { |
| | | // Pack pack = packService.selectByBarcode(elem.getMatnr()); |
| | | // if (pack == null) { |
| | | // throw new CoolException(elem.getMatnr() + "条码冗余,请检查!"); |
| | | // } |
| | | // if (pack.getSettle() != 1) { |
| | | // throw new CoolException(elem.getMatnr() + "条码已下线,请检查!"); |
| | | // } |
| | | // } |
| | | // Mat analyse = MatUtils.analyseMat(elem.getMatnr()); |
| | | // // 条码、物料代码、序列号、数量 |
| | | // DetlDto detlDto = new DetlDto(elem.getMatnr(), analyse.getMatnr(), analyse.getBarcode(), elem.getAnfme()); |
| | | //// DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme()); |
| | | // if (DetlDto.has(detlDtos, detlDto)) { |
| | | // DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch()); |
| | | // assert one != null; |
| | | // one.setAnfme(one.getAnfme() + detlDto.getAnfme()); |
| | | // } else { |
| | | // detlDtos.add(detlDto); |
| | | // } |
| | | // }); |
| | | // |
| | | // if (packDown) { |
| | | // MesCombParam mesCombParam = new MesCombParam(); |
| | | // mesCombParam.setZpallet(param.getBarcode()); |
| | | // mesCombParam.setPakinTime(DateUtils.convert(now)); |
| | | // mesCombParam.setLgort("5008"); |
| | | // mesCombParam.setPlantCode("5000"); |
| | | // mesCombParam.setFromCode("5012-20"); |
| | | // mesCombParam.setStationCode("JJQ-PFZPDB-XX"); |
| | | // for (DetlDto detlDto : detlDtos) { |
| | | // mesCombParam.getList().add(new MesCombParam.Detl(detlDto.getOrderNo(), detlDto.getAnfme())); |
| | | // } |
| | | // String response = ""; |
| | | // boolean success = false; |
| | | // try { |
| | | // response = new HttpHandler.Builder() |
| | | // .setUri(MesConstant.URL) |
| | | // .setPath(MesConstant.PACK_DOWN_URL) |
| | | // .setJson(JSON.toJSONString(mesCombParam)) |
| | | // .build() |
| | | // .doPost(); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // if (jsonObject.getInteger("code").equals(200)) { |
| | | // success = true; |
| | | // } else if (jsonObject.getInteger("code").equals(500)) { |
| | | // log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PACK_DOWN_URL, JSON.toJSONString(mesCombParam), response); |
| | | // throw new CoolException(jsonObject.getString("msg")); |
| | | // } else { |
| | | // log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PACK_DOWN_URL, JSON.toJSONString(mesCombParam), response); |
| | | // throw new CoolException("上报mes系统失败"); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // log.error("fail", e); |
| | | // throw new CoolException(e.getMessage()); |
| | | // } finally { |
| | | // try { |
| | | // // 保存接口日志 |
| | | // apiLogService.save( |
| | | // "打包下线帮托上报", |
| | | // MesConstant.URL + MesConstant.PACK_DOWN_URL, |
| | | // null, |
| | | // "127.0.0.1", |
| | | // JSON.toJSONString(mesCombParam), |
| | | // response, |
| | | // success |
| | | // ); |
| | | // } catch (Exception e) { |
| | | // log.error("", e); |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | // |
| | | // // 生成入库单据 |
| | | // String orderNo = "PACK" + snowflakeIdWorker.nextId(); |
| | | // OpenOrderPakinParam openParam = new OpenOrderPakinParam(); |
| | | // openParam.setOrderNo(orderNo); |
| | | // openParam.setOrderTime(DateUtils.convert(now)); |
| | | // openParam.setOrderType("打包入库单"); |
| | | // openParam.setOrderDetails(detlDtos); |
| | | // openService.pakinOrderCreate(openParam); |
| | | // Order order = orderService.selectByNo(orderNo); |
| | | // if (null == order) { |
| | | // throw new CoolException("生成单据失败"); |
| | | // } |
| | | // if (!orderService.updateSettle(order.getId(), 2L, userId)) { |
| | | // throw new CoolException("修改单据状态失败"); |
| | | // } |
| | | // |
| | | // // 生成入库通知档 |
| | | // for (DetlDto detlDto : detlDtos) { |
| | | // |
| | | // // 修改作业数量 ---------------------------------------- |
| | | // // 订单明细数量校验 |
| | | // OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), detlDto.getMatnr(), detlDto.getBatch(),detlDto.getAnfme()); |
| | | // |
| | | // if (detlDto.getAnfme() > orderDetl.getEnableQty()) { |
| | | // throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); |
| | | // } |
| | | // // 修改订单作业数量 |
| | | // if (!orderDetlService.increaseWorkQty(orderDetl, detlDto.getAnfme())) { |
| | | // throw new CoolException("修改单据作业数量失败"); |
| | | // } |
| | | // |
| | | // // 保存入库通知档 |
| | | // Mat mat = matService.selectByMatnr(detlDto.getMatnr()); |
| | | // if (Cools.isEmpty(mat)) { |
| | | // throw new CoolException(detlDto.getMatnr() + "商品档案不存在"); |
| | | // } |
| | | // WaitPakin waitPakin = new WaitPakin(); |
| | | // waitPakin.sync(mat); |
| | | // waitPakin.setOrderNo(orderNo); |
| | | // waitPakin.setBatch(detlDto.getBatch()); |
| | | // waitPakin.setZpallet(param.getBarcode()); // 托盘码 |
| | | // waitPakin.setIoStatus("N"); // 入出状态 |
| | | // waitPakin.setAnfme(detlDto.getAnfme()); // 数量 |
| | | // waitPakin.setStatus("Y"); // 状态 |
| | | // waitPakin.setAppeUser(userId); |
| | | // waitPakin.setAppeTime(now); |
| | | // waitPakin.setModiUser(userId); |
| | | // waitPakin.setModiTime(now); |
| | | // if (!waitPakinService.insert(waitPakin)) { |
| | | // throw new CoolException("保存入库通知档失败"); |
| | | // } |
| | | // // 修改打包数据状态 |
| | | // Pack pack = packService.selectByBarcode(detlDto.getOrderNo()); |
| | | // pack.setSettle(2L); |
| | | // pack.setUpdateTime(now); |
| | | // pack.setUpdateBy(userId); |
| | | // if (!packService.updateById(pack)) { |
| | | // throw new CoolException("修改打包数据异常"); |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.entity.WaitPakin; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import com.zy.asrs.mapper.OrderDetlMapper; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import com.zy.asrs.utils.MatCompareUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | return this.baseMapper.listByOrderNo(orderNo); |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetl selectItem(Long orderId, String matnr, String batch, Double qty) { |
| | | List<OrderDetl> detlList = this.baseMapper.selectItem(orderId, matnr, batch); |
| | | if (detlList == null || detlList.isEmpty()) { |
| | | return null; |
| | | } else if (detlList.size() == 1) { |
| | | return detlList.get(0); |
| | | } else { |
| | | if (qty != null) { |
| | | for (OrderDetl orderDetl : detlList) { |
| | | if (qty.equals(orderDetl.getAnfme())) { |
| | | return orderDetl; |
| | | } |
| | | } |
| | | } |
| | | return detlList.get(0); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetl selectQtyItem(String orderNo, String matnr, String batch, Double qty) { |
| | | List<OrderDetl> detlList = this.baseMapper.selectItemByOrderNo(orderNo, matnr, batch); |
| | | if (detlList == null || detlList.isEmpty()) { |
| | | return null; |
| | | } else if (detlList.size() == 1) { |
| | | return detlList.get(0); |
| | | } else { |
| | | if (qty != null) { |
| | | for (OrderDetl orderDetl : detlList) { |
| | | if (!orderDetl.getQty().equals(orderDetl.getWorkQty()) && qty.equals(orderDetl.getAnfme())) { |
| | | return orderDetl; |
| | | } |
| | | } |
| | | } |
| | | return detlList.get(0); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetl selectItem(String orderNo, String matnr, String batch, Double qty) { |
| | | List<OrderDetl> detlList = this.baseMapper.selectItemByOrderNo(orderNo, matnr, batch); |
| | | if (detlList == null || detlList.isEmpty()) { |
| | | return null; |
| | | } else if (detlList.size() == 1) { |
| | | return detlList.get(0); |
| | | } else { |
| | | if (qty != null) { |
| | | for (OrderDetl orderDetl : detlList) { |
| | | if (qty.equals(orderDetl.getAnfme())) { |
| | | return orderDetl; |
| | | } |
| | | } |
| | | } |
| | | return detlList.get(0); |
| | | } |
| | | } |
| | | // @Override |
| | | // public OrderDetl selectItem(Long orderId, String matnr, String batch, Double qty) { |
| | | // List<OrderDetl> detlList = this.baseMapper.selectItem(orderId, matnr, batch); |
| | | // if (detlList == null || detlList.isEmpty()) { |
| | | // return null; |
| | | // } else if (detlList.size() == 1) { |
| | | // return detlList.get(0); |
| | | // } else { |
| | | // if (qty != null) { |
| | | // for (OrderDetl orderDetl : detlList) { |
| | | // if (qty.equals(orderDetl.getAnfme())) { |
| | | // return orderDetl; |
| | | // } |
| | | // } |
| | | // } |
| | | // return detlList.get(0); |
| | | // } |
| | | // } |
| | | // |
| | | // @Override |
| | | // public OrderDetl selectQtyItem(String orderNo, String matnr, String batch, Double qty) { |
| | | // List<OrderDetl> detlList = this.baseMapper.selectItemByOrderNo(orderNo, matnr, batch); |
| | | // if (detlList == null || detlList.isEmpty()) { |
| | | // return null; |
| | | // } else if (detlList.size() == 1) { |
| | | // return detlList.get(0); |
| | | // } else { |
| | | // if (qty != null) { |
| | | // for (OrderDetl orderDetl : detlList) { |
| | | // if (!orderDetl.getQty().equals(orderDetl.getWorkQty()) && qty.equals(orderDetl.getAnfme())) { |
| | | // return orderDetl; |
| | | // } |
| | | // } |
| | | // } |
| | | // return detlList.get(0); |
| | | // } |
| | | // } |
| | | // |
| | | // @Override |
| | | // public OrderDetl selectItem(String orderNo, String matnr, String batch, Double qty) { |
| | | // List<OrderDetl> detlList = this.baseMapper.selectItemByOrderNo(orderNo, matnr, batch); |
| | | // if (detlList == null || detlList.isEmpty()) { |
| | | // return null; |
| | | // } else if (detlList.size() == 1) { |
| | | // return detlList.get(0); |
| | | // } else { |
| | | // if (qty != null) { |
| | | // for (OrderDetl orderDetl : detlList) { |
| | | // if (qty.equals(orderDetl.getAnfme())) { |
| | | // return orderDetl; |
| | | // } |
| | | // } |
| | | // } |
| | | // return detlList.get(0); |
| | | // } |
| | | // } |
| | | |
| | | @Override |
| | | public OrderDetl findByLook(List<OrderDetl> orderDetls, Long orderId, String matnr, String batch) { |
| | |
| | | return this.baseMapper.increase(orderId, matnr, batch, qty) > 0; |
| | | } |
| | | |
| | | // @Override |
| | | // public boolean decrease(String orderNo, String matnr, String batch, Double qty) { |
| | | // int decrease = this.baseMapper.decrease(orderNo, matnr, batch, qty); |
| | | // if (decrease == 0) { |
| | | // return this.baseMapper.decrease(orderNo, matnr, null, qty) > 0; |
| | | // } else { |
| | | // return true; |
| | | // } |
| | | // } |
| | | @Override |
| | | public boolean decrease(String orderNo, String matnr, String batch, Double qty) { |
| | | int decrease = this.baseMapper.decrease(orderNo, matnr, batch, qty); |
| | | public boolean decrease(WrkDetl wrkDetl, Double qty) { |
| | | List<OrderDetl> detlList = selectItem(wrkDetl.getOrderNo()); |
| | | for (OrderDetl orderDetl : detlList) { |
| | | if (MatCompareUtils.compare(orderDetl, wrkDetl)) { |
| | | int decrease = this.baseMapper.decrease2(orderDetl.getId(), qty); |
| | | if (decrease == 0) { |
| | | return this.baseMapper.decrease(orderNo, matnr, null, qty) > 0; |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean decrease(WaitPakin waitPakin, Double qty) { |
| | | List<OrderDetl> detlList = selectItem(waitPakin.getOrderNo()); |
| | | for (OrderDetl orderDetl : detlList) { |
| | | if (MatCompareUtils.compare(orderDetl, waitPakin)) { |
| | | int decrease = this.baseMapper.decrease2(orderDetl.getId(), qty); |
| | | if (decrease == 0) { |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | |
| | | /** |
| | | * 入出库任务生成时,更新单据表中作业数量 |
| | | * |
| | | * @param orderId |
| | | * @param matnr |
| | | * @param batch |
| | | * @param orderDetl |
| | | * @param workQty |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean increaseWorkQty(Long orderId, String matnr, String batch, Double workQty) { |
| | | return this.baseMapper.increaseWorkQty(orderId, matnr, batch, workQty) > 0; |
| | | public boolean increaseWorkQty(OrderDetl orderDetl, Double workQty) { |
| | | return this.baseMapper.increaseWorkQty(orderDetl.getId(), workQty) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public OrderDetl selectItem(WaitPakin waitPakin) { |
| | | List<OrderDetl> detlList = this.baseMapper.selectItemByOrderNo(waitPakin.getOrderNo(), waitPakin.getOrderNo(), waitPakin.getBatch()); |
| | | if (detlList == null || detlList.isEmpty()) { |
| | | return null; |
| | | } else if (detlList.size() == 1) { |
| | | return detlList.get(0); |
| | | } else { |
| | | for (OrderDetl orderDetl : detlList) { |
| | | if (MatCompareUtils.compare(waitPakin, orderDetl)) { |
| | | return orderDetl; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveHandlerOrder(Boolean pakin, WrkMast wrkMast, List<WrkDetl> wrkDetls) { |
| | | try { |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | wrkDetls.forEach(wrkDetl -> { |
| | | detlDtos.add(new DetlDto(wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme())); |
| | | }); |
| | | String orderNo = "HAND" + snowflakeIdWorker.nextId(); |
| | | if (pakin) { |
| | | // 生成入库单据 |
| | | OpenOrderPakinParam openParam = new OpenOrderPakinParam(); |
| | | openParam.setOrderNo(orderNo); |
| | | openParam.setOrderTime(DateUtils.convert(wrkMast.getModiTime())); |
| | | openParam.setOrderType("手动入库单"); |
| | | openParam.setOrderDetails(detlDtos); |
| | | openService.pakinOrderCreate(openParam); |
| | | } else { |
| | | // 生成出库单据 |
| | | OpenOrderPakoutParam openParam = new OpenOrderPakoutParam(); |
| | | openParam.setOrderNo(orderNo); |
| | | openParam.setOrderTime(DateUtils.convert(wrkMast.getModiTime())); |
| | | openParam.setOrderType("手动出库单"); |
| | | openParam.setOrderDetails(detlDtos); |
| | | openService.pakoutOrderCreate(openParam); |
| | | } |
| | | |
| | | Order order = this.selectByNo(orderNo); |
| | | if (null == order) { |
| | | throw new CoolException("生成单据失败"); |
| | | } |
| | | if (!this.updateSettle(order.getId(), 4L, null)) { |
| | | throw new CoolException("修改单据状态失败"); |
| | | } |
| | | for (DetlDto detlDto : detlDtos) { |
| | | // 修改订单明细数量 |
| | | if (!orderDetlService.increase(order.getId(), detlDto.getMatnr(), detlDto.getBatch(), detlDto.getAnfme())) { |
| | | throw new CoolException("修改单据明细数量失败"); |
| | | } |
| | | // 修改订单作业数量 |
| | | if (!orderDetlService.increaseWorkQty(order.getId(), detlDto.getMatnr(), detlDto.getBatch(), detlDto.getAnfme())) { |
| | | throw new CoolException("修改单据作业数量失败"); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("saveHandlerOrder===>>", e); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | // @Override |
| | | // public boolean saveHandlerOrder(Boolean pakin, WrkMast wrkMast, List<WrkDetl> wrkDetls) { |
| | | // try { |
| | | // List<DetlDto> detlDtos = new ArrayList<>(); |
| | | // wrkDetls.forEach(wrkDetl -> { |
| | | // detlDtos.add(new DetlDto(wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme())); |
| | | // }); |
| | | // String orderNo = "HAND" + snowflakeIdWorker.nextId(); |
| | | // if (pakin) { |
| | | // // 生成入库单据 |
| | | // OpenOrderPakinParam openParam = new OpenOrderPakinParam(); |
| | | // openParam.setOrderNo(orderNo); |
| | | // openParam.setOrderTime(DateUtils.convert(wrkMast.getModiTime())); |
| | | // openParam.setOrderType("手动入库单"); |
| | | // openParam.setOrderDetails(detlDtos); |
| | | // openService.pakinOrderCreate(openParam); |
| | | // } else { |
| | | // // 生成出库单据 |
| | | // OpenOrderPakoutParam openParam = new OpenOrderPakoutParam(); |
| | | // openParam.setOrderNo(orderNo); |
| | | // openParam.setOrderTime(DateUtils.convert(wrkMast.getModiTime())); |
| | | // openParam.setOrderType("手动出库单"); |
| | | // openParam.setOrderDetails(detlDtos); |
| | | // openService.pakoutOrderCreate(openParam); |
| | | // } |
| | | // |
| | | // Order order = this.selectByNo(orderNo); |
| | | // if (null == order) { |
| | | // throw new CoolException("生成单据失败"); |
| | | // } |
| | | // if (!this.updateSettle(order.getId(), 4L, null)) { |
| | | // throw new CoolException("修改单据状态失败"); |
| | | // } |
| | | // for (DetlDto detlDto : detlDtos) { |
| | | // // 修改订单明细数量 |
| | | // if (!orderDetlService.increase(order.getId(), detlDto.getMatnr(), detlDto.getBatch(), detlDto.getAnfme())) { |
| | | // throw new CoolException("修改单据明细数量失败"); |
| | | // } |
| | | // // 修改订单作业数量 |
| | | // if (!orderDetlService.increaseWorkQty(order.getId(), detlDto.getMatnr(), detlDto.getBatch(), detlDto.getAnfme())) { |
| | | // throw new CoolException("修改单据作业数量失败"); |
| | | // } |
| | | // } |
| | | // } catch (Exception e) { |
| | | // log.error("saveHandlerOrder===>>", e); |
| | | // return false; |
| | | // } |
| | | // return true; |
| | | // } |
| | | |
| | | @Override |
| | | public void remove(Long orderId) { |
| | |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | | // 修改订单明细 |
| | | if (!orderDetlService.increaseWorkQty(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), locDto.getAnfme())) { |
| | | if (!orderDetlService.increaseWorkQty(orderDetl, locDto.getAnfme())) { |
| | | throw new CoolException("修改订单明细数量失败"); |
| | | } |
| | | orderService.updateSettle(orderDetl.getOrderId(), 2L, userId); |
| | |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | if (!Cools.isEmpty(wrkDetl.getOrderNo())) { |
| | | if (!orderDetlService.decrease(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme())) { |
| | | if (!orderDetlService.decrease(wrkDetl, wrkDetl.getAnfme())) { |
| | | throw new CoolException("订单数据回滚失败"); |
| | | } |
| | | |
New file |
| | |
| | | package com.zy.asrs.utils; |
| | | |
| | | import com.core.common.Cools; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.lang.reflect.Field; |
| | | |
| | | /** |
| | | * 用户物料信息比对,判断是否为同一物料 |
| | | */ |
| | | public class MatCompareUtils { |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(MatCompareUtils.class); |
| | | |
| | | private static final String[] sameFields = {"matnr", "batch", "outOrderNo", "luHao", "packing", "sPgNO", "proType"}; |
| | | |
| | | |
| | | public static boolean compare(Object object1, Object object2) { |
| | | if (object1 == null || object2 == null) { |
| | | return false; |
| | | } |
| | | for (String fieldName : sameFields) { |
| | | Object fieldValue1 = getFieldValue(object1, fieldName); |
| | | Object fieldValue2 = getFieldValue(object2, fieldName); |
| | | if (isSame(fieldValue1, fieldValue2)) { |
| | | log.info("字段{}信息一致,{}-{}", fieldName, fieldValue1, fieldValue2); |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | private static boolean isSame(Object fieldValue1, Object fieldValue2) { |
| | | if (Cools.isEmpty(fieldValue1)) { |
| | | fieldValue1 = ""; |
| | | } |
| | | if (Cools.isEmpty(fieldValue2)) { |
| | | fieldValue2 = ""; |
| | | } |
| | | return fieldValue1.equals(fieldValue2); |
| | | } |
| | | |
| | | private static Object getFieldValue(Object object, String fieldName) { |
| | | Class<?> aClass = object.getClass(); |
| | | Field field = null; |
| | | try { |
| | | field = aClass.getDeclaredField(fieldName); |
| | | } catch (NoSuchFieldException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | field.setAccessible(true); // 设置为可访问 |
| | | try { |
| | | return field.get(object); |
| | | } catch (IllegalAccessException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | //root application context 没有parent |
| | | ApplicationContext context = event.getApplicationContext().getParent(); |
| | | if(context == null){ |
| | | loadLicense(); |
| | | //TODO |
| | | //loadLicense(); |
| | | } |
| | | } |
| | | |
| | |
| | | </choose> |
| | | </update> |
| | | |
| | | <update id="decrease2"> |
| | | update man_order_detl |
| | | set work_qty = work_qty - #{qty} |
| | | where 1=1 |
| | | and id = #{id} |
| | | </update> |
| | | |
| | | <update id="modifyStatus"> |
| | | update man_order_detl |
| | | set status = #{status} |
| | |
| | | update man_order_detl |
| | | set work_qty = work_qty + #{workQty} |
| | | where 1=1 |
| | | and order_id = #{orderId} |
| | | and matnr = #{matnr} |
| | | <choose> |
| | | <when test="batch != null and batch != ''"> |
| | | and batch = #{batch} |
| | | </when> |
| | | <otherwise> |
| | | and (batch IS NULL OR batch = '') |
| | | </otherwise> |
| | | </choose> |
| | | and id = #{id} |
| | | </update> |
| | | |
| | | |