| | |
| | | package com.zy.asrs.task.handler; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.DocType; |
| | |
| | | if (null == docType) { |
| | | return SUCCESS; |
| | | } |
| | | if (!Cools.isEmpty(docType.getMemo())) { |
| | | if (docType.getMemo().equals("hand")) { |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), 6L, null)) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | } |
| | | List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | | // 入库完成上报 |
| | | if (docType.getPakin() == 1) { |
| | |
| | | erpService.updateTimeForVoucherDetail(order.getOrderNo()); |
| | | } |
| | | |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), 6L, null)) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | return FAIL.setMsg(e.getMessage()); |
| | |
| | | // 出库完成上报 |
| | | if (docType.getPakout() == 1) { |
| | | try { |
| | | double TotalNum = 0.0; |
| | | Integer TotalCount = orderDetls.size(); |
| | | // erp 同步 |
| | | int state = 2; |
| | | if (!erpService.updateStateForVoucher(order.getOrderNo(), state)) { |
| | |
| | | } else { |
| | | Date now = new Date(); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | VoucherDetail voucherDetail = new VoucherDetail(); |
| | | voucherDetail.setVoucherID(order.getOrderNo()); |
| | | voucherDetail.setPickID("fepvnn0496"); |
| | | voucherDetail.setBarcode(orderDetl.getBatch()); |
| | | voucherDetail.setBarcode(DateUtils.convert(now)); |
| | | if (!erpService.insertVoucherDetail(voucherDetail)) { |
| | | throw new CoolException(order.getOrderNo() + "订单添加VoucherDetail"+ JSON.toJSONString(voucherDetail)+"失败"); |
| | | TotalNum = TotalNum + orderDetl.getAnfme(); |
| | | if (null == erpService.selectVoucherDetail(order.getOrderNo(), orderDetl.getBatch())) { |
| | | VoucherDetail voucherDetail = new VoucherDetail(); |
| | | voucherDetail.setVoucherID(order.getOrderNo()); |
| | | voucherDetail.setPickID("fepvnn0496"); |
| | | voucherDetail.setBarcode(orderDetl.getBatch()); |
| | | voucherDetail.setLastUpdatedDate(DateUtils.convert(now)); |
| | | if (!erpService.insertVoucherDetail(voucherDetail)) { |
| | | throw new CoolException(order.getOrderNo() + "订单添加VoucherDetail"+ JSON.toJSONString(voucherDetail)+"失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // 更新重量和数量 |
| | | if (!erpService.updateStateForVoucher(order.getOrderNo(), TotalNum, TotalCount)) { |
| | | throw new CoolException(order.getOrderNo() + "订单修改重量和数量失败"); |
| | | } |
| | | |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), 6L, null)) { |
| | | throw new CoolException("服务器内部错误,请联系管理员"); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |