| | |
| | | package com.zy.asrs.task.handler; |
| | | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.DocType; |
| | |
| | | @Autowired |
| | | private ExdInstockTargetService exdInstockTargetService; |
| | | |
| | | |
| | | @Autowired |
| | | private ExdOutstockTargetService exdOutstockTargetService; |
| | | |
| | |
| | | exdOutstockTarget.setFbillno(orderDetl.getOrderNo()); |
| | | if (order.getDocType() == 42) { |
| | | exdOutstockTarget.setFtrantype(41); |
| | | } else if (order.getDocType() == 21) { |
| | | exdOutstockTarget.setFtrantype(81); |
| | | } else { |
| | | exdOutstockTarget.setFtrantype(order.getDocType().intValue()); |
| | | } |
| | |
| | | return SUCCESS; |
| | | } |
| | | |
| | | @Transactional |
| | | public ReturnT<String> start1(Order order, OrderDetl orderDetl) { |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if (null == docType) { |
| | | return SUCCESS; |
| | | } |
| | | List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | | if (orderDetls.isEmpty()) { |
| | | return SUCCESS; |
| | | } |
| | | |
| | | double count = orderDetl.getQty() - (Cools.isEmpty(orderDetl.getUnits()) ? 0.0 : orderDetl.getUnits()); |
| | | if (docType.getPakout() == 1) { |
| | | // 出库完成上报 |
| | | ExdOutstockTarget exdOutstockTarget = null; |
| | | exdOutstockTarget = new ExdOutstockTarget(); |
| | | //订单内码 |
| | | exdOutstockTarget.setFinterid(orderDetl.getDeadWarn()); |
| | | //单号 = erp订单号+物料编号+上报次数 |
| | | exdOutstockTarget.setFbillno(orderDetl.getOrderNo() + "--" + orderDetl.getMatnr() + "--" + orderDetl.getInspect()); |
| | | |
| | | //部门ID |
| | | exdOutstockTarget.setFdeptid(0); |
| | | //供应商/客户ID |
| | | exdOutstockTarget.setFsupplyid(0); |
| | | //制单用户ID |
| | | exdOutstockTarget.setFbillerid(0); |
| | | //细表ID |
| | | exdOutstockTarget.setFentryid(0); |
| | | //物料ID |
| | | exdOutstockTarget.setFitemid(0); |
| | | //源单数量 |
| | | exdOutstockTarget.setFqtymust(0.0); |
| | | //出库数量 |
| | | //单据类型 |
| | | exdOutstockTarget.setFtrantype(21); |
| | | |
| | | //单据日期 |
| | | exdOutstockTarget.setFdate(DateUtils.convert(order.getOrderTime())); |
| | | //红蓝字 |
| | | exdOutstockTarget.setFrob(orderDetl.getBeBatch()); |
| | | //操作用户 |
| | | exdOutstockTarget.setFuserid(Integer.getInteger(orderDetl.getColor())); |
| | | //写入时间 |
| | | exdOutstockTarget.setWritetime(new Date()); |
| | | //写入者 |
| | | exdOutstockTarget.setWritor("WMS"); |
| | | //状态 |
| | | exdOutstockTarget.setStatus(0); |
| | | if (exdOutstockTargetService.insert(exdOutstockTarget)) { |
| | | orderDetl.setInspect((Cools.isEmpty(orderDetl.getInspect()) ? 1 : (orderDetl.getInspect() + 1))); |
| | | orderDetl.setUnits(count + (Cools.isEmpty(orderDetl.getUnits()) ? 0.0 : orderDetl.getUnits())); |
| | | orderDetlService.updateById(orderDetl); |
| | | } |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | } |