| | |
| | | private ReceiveService receiveService; |
| | | @Autowired |
| | | private ReceiveDetlService receiveDetlService; |
| | | @Autowired |
| | | private PickoutService pickoutService; |
| | | @Autowired |
| | | private PickoutDetlService pickoutDetlService; |
| | | |
| | | @Transactional |
| | | public List<StoPreTab> stockOutPreview(OrderStoDto orderStoDto, Long hostId) { |
| | |
| | | }); |
| | | return res; |
| | | } |
| | | public List<StoPreTab> orderOutPreview(OrderStoDto orderStoDto, Long hostId){ |
| | | if (Cools.isEmpty(orderStoDto) || Cools.isEmpty(orderStoDto.getDtos())) { |
| | | throw new CoolException("数据异常,请联系管理员"); |
| | | } |
| | | List<StoPreTab> res = new ArrayList<>(); |
| | | // 检查库存是否足够 |
| | | // locDetlService.checkLocDetlCount(orderStoDto.getDtos()); |
| | | |
| | | for (MatnrDto matnrDto : orderStoDto.getDtos()) { |
| | | // 判断物料是否存在 |
| | | Mat mat = matService.selectByMatnr(hostId, matnrDto.getMatnr()); |
| | | if (null == mat) { |
| | | throw new CoolException(matnrDto.getMatnr() + "物料尚未更新。" + orderStoDto.getOrderNo() +"单据因此中断!"); |
| | | } |
| | | |
| | | Double sumAnfme = Optional.ofNullable(locDetlService.selectCountByMatnr(mat.getMatnr(), hostId)).orElse(0.0D); |
| | | double lack = 0.0D; |
| | | // 缺货 |
| | | if (sumAnfme < matnrDto.getCount()) { |
| | | lack = matnrDto.getCount() - sumAnfme; |
| | | // 视图对象 |
| | | StoPreTab tab = new StoPreTab(); |
| | | tab.setTitle(mat.getMaktx() + "(" + mat.getMatnr() + ")"); |
| | | tab.setMatnr(mat.getMatnr()); |
| | | tab.setMaktx(mat.getMaktx()); |
| | | tab.setAnfme(matnrDto.getCount()); |
| | | tab.setLocNo("缺货"); |
| | | tab.setTotal(lack); |
| | | tab.setReduce(lack); |
| | | tab.setRemQty(0.0D); |
| | | tab.setPrior(false); |
| | | tab.setPrior$("×"); |
| | | tab.setType(0); |
| | | res.add(tab); |
| | | } |
| | | |
| | | // 查询存有当前物料的货位 |
| | | List<LocDetl> locDetls = locDetlService.findOfSort(hostId, mat.getMatnr()); |
| | | double issued = Optional.of(matnrDto.getCount() - lack).orElse(0.0D) ; |
| | | double anfme = issued; |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (issued > 0) { |
| | | // 视图对象 |
| | | StoPreTab tab = new StoPreTab(); |
| | | tab.setTitle(mat.getMaktx() + "(" + mat.getMatnr() + ")"); |
| | | tab.setMatnr(mat.getMatnr()); |
| | | tab.setMaktx(mat.getMaktx()); |
| | | tab.setAnfme(matnrDto.getCount()); |
| | | |
| | | tab.setLocNo(locDetl.getLocNo()); |
| | | tab.setNodeId(locDetl.getNodeId()); |
| | | tab.setTotal(locDetl.getAnfme()); |
| | | tab.setReduce(issued>=locDetl.getAnfme()?locDetl.getAnfme():issued); |
| | | tab.setRemQty(tab.getTotal() - tab.getReduce()); |
| | | tab.setPrior(locDetlService.isPrior(locDetl.getNodeId(), mat.getMatnr())); |
| | | tab.setPrior$(tab.getPrior()?"✔":"×"); |
| | | tab.setType(1); |
| | | res.add(tab); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | res.sort(new Comparator<StoPreTab>() { |
| | | @Override |
| | | public int compare(StoPreTab o1, StoPreTab o2) { |
| | | // return o1.getMatnr().length() - o2.getMatnr().length(); |
| | | return (int) (o1.getAnfme() - o2.getAnfme()); |
| | | } |
| | | }); |
| | | return res; |
| | | } |
| | | @Transactional |
| | | public void stockOutProcess(OrderStoDto orderStoDto, Long hostId) { |
| | | if (Cools.isEmpty(orderStoDto) || Cools.isEmpty(orderStoDto.getDtos())) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | for (int i = 2; i < 51; i++) { |
| | |
| | | "GO"); |
| | | } |
| | | } |
| | | |
| | | |
| | | public void orderStockOutProcess(OrderStoDto orderStoDto, Long hostId, Long userId) { |
| | | if (Cools.isEmpty(orderStoDto) || Cools.isEmpty(orderStoDto.getDtos())) { |
| | | return; |
| | | } |
| | | |
| | | // Receive receive = receiveService.selectByOrderNo(receiveStoDto.getOrderNo(), hostId); |
| | | Order order = orderService.selectByOrderNo(orderStoDto.getOrderNo(), hostId); |
| | | if (order == null) { |
| | | throw new CoolException(orderStoDto.getOrderNo() + "单据不存在"); |
| | | } |
| | | Date now = new Date(); |
| | | // 检查库存是否足够 |
| | | locDetlService.checkLocDetlCount(orderStoDto.getDtos(), hostId); |
| | | |
| | | for (MatnrDto matnrDto : orderStoDto.getDtos()) { |
| | | // 判断物料是否存在 |
| | | Mat mat = matService.selectByMatnr(hostId, matnrDto.getMatnr()); |
| | | if (null == mat) { |
| | | throw new CoolException(matnrDto.getMatnr() + "物料尚未更新。" + matnrDto.getCount() +"单据因此中断!"); |
| | | } |
| | | // 查询存有当前物料的货位 |
| | | List<LocDetl> locDetls = locDetlService.findOfSort(hostId, mat.getMatnr()); |
| | | double issued = Optional.ofNullable(matnrDto.getCount()).orElse(0.0D); |
| | | Pickout pickout = new Pickout(); |
| | | pickout.setHostId(hostId); |
| | | pickout.setUserId(userId); |
| | | pickout.setWrkNo(String.valueOf(snowflakeIdWorker.nextId())); |
| | | pickout.setWrkSts(1L); |
| | | pickout.setCreateBy(userId.intValue()); |
| | | pickout.setUpdateBy(userId.intValue()); |
| | | pickoutService.insert(pickout); |
| | | for (LocDetl locDetl : locDetls) { |
| | | |
| | | if (issued > 0) { |
| | | PickoutDetl pickoutDetl = new PickoutDetl(); |
| | | pickoutDetl.setHeadId(pickout.getId()); |
| | | pickoutDetl.setNodeId(locDetl.getNodeId()); |
| | | pickoutDetl.setNodeName(locDetl.getLocNo()); |
| | | pickoutDetl.setAnfme(issued>=locDetl.getAnfme()?locDetl.getAnfme():issued); |
| | | pickoutDetl.setMatnr(locDetl.getMatnr()); |
| | | pickoutDetl.setMaktx(locDetl.getMaktx()); |
| | | pickoutDetl.setName(locDetl.getName()); |
| | | pickoutDetl.setSpecs(locDetl.getSpecs()); |
| | | pickoutDetl.setModel(locDetl.getModel()); |
| | | pickoutDetl.setBatch(locDetl.getBatch()); |
| | | pickoutDetl.setUnit(locDetl.getUnit()); |
| | | pickoutDetl.setBarcode(locDetl.getBarcode()); |
| | | pickoutDetl.setPrice(locDetl.getPrice()); |
| | | pickoutDetl.setWeight(locDetl.getWeight()); |
| | | pickoutDetl.setStatus(1); |
| | | pickoutDetl.setCreateBy(userId.intValue()); |
| | | pickoutDetl.setUpdateBy(userId.intValue()); |
| | | |
| | | // // 保存出库通知单 |
| | | // Pakout pakout = new Pakout(); |
| | | // pakout.setHostId(hostId); |
| | | // pakout.setWrkSts(1L); |
| | | // pakout.setAnfme(issued>=locDetl.getAnfme()?locDetl.getAnfme():issued); |
| | | // pakout.setZpallet(locDetl.getZpallet()); |
| | | // pakout.setLocNo(locDetl.getLocNo()); |
| | | // pakout.setNodeId(locDetl.getNodeId()); |
| | | // pakout.setWrkNo(String.valueOf(snowflakeIdWorker.nextId())); |
| | | // VersionUtils.setPakout(pakout, mat); |
| | | // pakout.setDocId(receive.getDocType()); // 单据类型 |
| | | // pakout.setDocNum(receive.getOrderNo()); // 单据编号 |
| | | // pakout.setCreateTime(now); |
| | | // pakout.setUpdateTime(now); |
| | | // pakout.setStatus(1); |
| | | if (!pickoutDetlService.insert(pickoutDetl)) { |
| | | throw new CoolException("保存出库通知单失败"); |
| | | } |
| | | if (issued>=locDetl.getAnfme()) { |
| | | // // 删除库存明细 |
| | | // if (!locDetlService.removeStock(locDetl.getNodeId(), mat.getMatnr())) { |
| | | // throw new CoolException("删除库存明细失败"); |
| | | // } |
| | | } else { |
| | | // // 修改库存明细数量 |
| | | // if (!locDetlService.reduceStock(locDetl.getNodeId(), mat.getMatnr(), issued)) { |
| | | // throw new CoolException("修改库存明细数量失败"); |
| | | // } |
| | | } |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | } |
| | | } |
| | | // 修改单据状态 |
| | | if (!orderService.updateSettle(orderStoDto.getOrderNo(), 2L, hostId)) { |
| | | throw new CoolException("修改单据状态失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | for (Long id : ids) { |
| | | Order target = orderService.selectOne(new EntityWrapper<Order>() |
| | | .eq("id", id)); |
| | | if (target.getSettle() != 0 || target.getSettle() != 1) { |
| | | if (target.getSettle() == 0 || target.getSettle() == 1) { |
| | | orderService.deleteById(id); |
| | | orderDetlService.delete(new EntityWrapper<OrderDetl>() |
| | | .eq("order_id",id)); |
| | | }else { |
| | | throw new CoolException("仅允许删除'初始化','待处理'状态的订单"); |
| | | } |
| | | |
| | | } |
| | | if (Cools.isEmpty((Object) ids)){ |
| | | return R.error(); |
| | | } |
| | | for (Long id : ids){ |
| | | if (!orderService.deleteById(id)) { |
| | | throw new CoolException("服务器错误,请联系管理员"); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import zy.cloud.wms.manager.entity.Pickout; |
| | | import zy.cloud.wms.manager.entity.PickoutDetl; |
| | | import zy.cloud.wms.manager.service.PickoutDetlService; |
| | | import zy.cloud.wms.manager.service.PickoutService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | |
| | | |
| | | @Autowired |
| | | private PickoutService pickoutService; |
| | | @Autowired |
| | | private PickoutDetlService pickoutDetlService; |
| | | |
| | | @RequestMapping(value = "/pickout/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | pickoutDetlService.delete(new EntityWrapper<PickoutDetl>() |
| | | .eq("head_id",id)); |
| | | pickoutService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | |
| | | @RequestMapping("/stock/out/print") |
| | | @ManagerAuth(memo = "拣货单打印") |
| | | public R stockOutPrint(@RequestBody StockOutParam stockOutParam) { |
| | | |
| | | |
| | | return workService.stockInPrint(stockOutParam, getUserId(), getHostId()); |
| | | return workService.stockOutPrint(stockOutParam, getUserId(), getHostId()); |
| | | } |
| | | |
| | | @RequestMapping("/stock/allot") |
| | |
| | | return workService.initOrder(param, getUserId(), getHostId()); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/stock/transfer") |
| | | @ManagerAuth(memo = "库存调拨") |
| | | public R stockTransfer(@RequestBody AsrsTransferParam number) { |
| | |
| | | eq("host_id", getHostId()).orderBy("create_time", false).eq("doc_class",docClass)); |
| | | return R.ok().add(docTypes); |
| | | } |
| | | @RequestMapping("docType/out/get") |
| | | @ManagerAuth |
| | | public R getDocOutTypeData(Integer docClass){ |
| | | List<DocType> docTypes = docTypeService.selectList(new EntityWrapper<DocType>().eq("status", 1). |
| | | eq("host_id", getHostId()).orderBy("create_time", false).eq("doc_class",docClass)); |
| | | return R.ok().add(docTypes); |
| | | } |
| | | |
| | | // 获取所有客户 |
| | | @RequestMapping("/cstmr/all/get") |
| | |
| | | // null // |
| | | // ); |
| | | |
| | | public String getWrkSts$(){ |
| | | if (this.wrkSts == 1) { |
| | | return "未拣货"; |
| | | } |
| | | if (this.wrkSts == 2) { |
| | | return "未打印"; |
| | | } |
| | | if (this.wrkSts == 3) { |
| | | return "已完成"; |
| | | } |
| | | return ""; |
| | | } |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | |
| | | * 库位ID |
| | | */ |
| | | @ApiModelProperty(value= "库位ID") |
| | | @TableField("node_id") |
| | | @TableField("nodeId") |
| | | private Long nodeId; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value= "修改人员ID") |
| | | @TableField("update_by") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateBy; |
| | | private Integer updateBy; |
| | | |
| | | /** |
| | | * 备注 |
| | |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public Date getUpdateBy() { |
| | | return updateBy; |
| | | } |
| | | |
| | | public String getUpdateBy$(){ |
| | | if (Cools.isEmpty(this.updateBy)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateBy); |
| | | } |
| | | |
| | | public void setUpdateBy(Date updateBy) { |
| | | this.updateBy = updateBy; |
| | | } |
| | | |
| | | |
| | | public String getMemo() { |
| | | return memo; |
| | |
| | | |
| | | R stockCheckAuditing(Long checkId, Long userId, Long hostId); |
| | | |
| | | R initOutOrder(InitOrderParam param, Long userId, Long hostId); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public R stockOutPreview(StockOutParam param, Long userId, Long hostId) { |
| | | Wrapper<Receive> wrapper = new EntityWrapper<Receive>() |
| | | Wrapper<Order> wrapper = new EntityWrapper<Order>() |
| | | .eq("order_no", param.getOrderNo()); |
| | | if (hostId != null) { |
| | | wrapper.eq("host_id", hostId); |
| | | } |
| | | Receive order_no = receiveService.selectOne(wrapper); |
| | | Order order_no = orderService.selectOne(wrapper); |
| | | |
| | | if (order_no.getSettle() != 1){ |
| | | return R.error("此单据无法生成拣货单"); |
| | |
| | | // if (order.getSettle() != 1) { |
| | | // return R.error("此单据无法生成拣货单"); |
| | | // } |
| | | List<ReceiveDetl> receiveDetls = receiveDetlService.selectByOrderNo(order_no.getOrderNo(), hostId); |
| | | if (Cools.isEmpty(receiveDetls)) { |
| | | List<OrderDetl> orderDetls = orderDetlService.selectByOrderNo(order_no.getOrderNo(), hostId); |
| | | if (Cools.isEmpty(orderDetls)) { |
| | | return R.error("此单据已失效,请联系管理员"); |
| | | } |
| | | // List<OrderDetl> orderDetls = orderDetlService.selectByOrderNo(order.getOrderNo(), hostId); |
| | |
| | | // return R.error("此单据已失效,请联系管理员"); |
| | | // } |
| | | |
| | | ReceiveStoDto receiveStoDto = new ReceiveStoDto().create(order_no.getOrderNo(), receiveDetls); |
| | | OrderStoDto orderStoDto = new OrderStoDto().create(order_no.getOrderNo(), orderDetls); |
| | | // OrderStoDto dto = new OrderStoDto().create(order.getOrderNo(), orderDetls); |
| | | return R.ok().add(mainService.receiveStockOutPreview(receiveStoDto, hostId)); |
| | | return R.ok().add(mainService.orderOutPreview(orderStoDto, hostId)); |
| | | } |
| | | |
| | | @Override |
| | | public R stockOutCreate(StockOutParam param, Long userId, Long hostId) { |
| | | Receive receive = receiveService.selectByOrderNo(param.getOrderNo(), hostId); |
| | | // Order order = orderService.selectByOrderNo(param.getOrderNo(), hostId); |
| | | if (receive.getSettle() != 1) { |
| | | // Receive receive = receiveService.selectByOrderNo(param.getOrderNo(), hostId); |
| | | Order order = orderService.selectByOrderNo(param.getOrderNo(), hostId); |
| | | if (order.getSettle() != 1) { |
| | | return R.error("此单据无法生成拣货单"); |
| | | } |
| | | List<ReceiveDetl> receiveDetls = receiveDetlService.selectByOrderNo(param.getOrderNo(), hostId); |
| | | List<OrderDetl> orderDetls = orderDetlService.selectByOrderNo(param.getOrderNo(), hostId); |
| | | // List<OrderDetl> orderDetls = orderDetlService.selectByOrderNo(param.getOrderNo(), hostId); |
| | | if (Cools.isEmpty(receiveDetls)) { |
| | | if (Cools.isEmpty(orderDetls)) { |
| | | return R.error("此单据已失效,请联系管理员"); |
| | | } |
| | | ReceiveStoDto receiveStoDto = new ReceiveStoDto().create(receive.getOrderNo(), receiveDetls); |
| | | OrderStoDto orderStoDto = new OrderStoDto().create(order.getOrderNo(), orderDetls); |
| | | // OrderStoDto dto = new OrderStoDto().create(receive.getOrderNo(), receiveDetls); |
| | | // 开始整理出库数据 |
| | | mainService.receiveStockOutProcess(receiveStoDto,hostId); |
| | | mainService.orderStockOutProcess(orderStoDto,hostId,userId); |
| | | return R.ok("生成拣货单成功"); |
| | | } |
| | | |
| | |
| | | order1.setOrderNo(param.getOrderNo()); |
| | | order1.setOrderTime(param.getOrderTime()); |
| | | order1.setDocType(param.getDocType()); |
| | | order1.setItemId(item.getId()); |
| | | order1.setItemId(item == null? null : item.getId()); |
| | | order1.setItemName(param.getItem()); |
| | | order1.setCstmr(cstmr.getId()); |
| | | order1.setCstmr(cstmr == null? null : cstmr.getId()); |
| | | order1.setCstmrName(param.getCstmr()); |
| | | order1.setSettle(1L); |
| | | order1.setStatus(1); |
| | |
| | | log.error("{}商品不存在。", dto.getMatnr()); |
| | | continue; |
| | | } |
| | | ReceiveDetl receiveDetl = new ReceiveDetl(); |
| | | receiveDetl.setHostId(hostId); |
| | | receiveDetl.setOrderId(order1.getId()); |
| | | receiveDetl.setAnfme(dto.getCount()); |
| | | receiveDetl.setCreateTime(now); |
| | | receiveDetl.setCreateBy(userId); |
| | | receiveDetl.setUpdateBy(userId); |
| | | receiveDetl.setUpdateTime(now); |
| | | receiveDetl.setStatus(1); |
| | | receiveDetl.setMatnr(mat.getMatnr()); |
| | | receiveDetl.setMaktx(mat.getMaktx()); |
| | | receiveDetl.setName(mat.getName()); |
| | | receiveDetl.setSpecs(mat.getSpecs()); |
| | | receiveDetl.setModel(mat.getModel()); |
| | | receiveDetl.setBatch(mat.getBatch()); |
| | | receiveDetl.setUnit(mat.getUnit()); |
| | | receiveDetl.setBarcode(mat.getBarcode()); |
| | | receiveDetl.setItemNum(mat.getItemNum()); |
| | | receiveDetl.setCount(Double.valueOf(mat.getCount())); |
| | | receiveDetl.setUnitPrice(mat.getPrice()); |
| | | receiveDetl.setWeight(mat.getWeight()); |
| | | if (!receiveDetlService.insert(receiveDetl)) { |
| | | OrderDetl orderDetl = new OrderDetl(); |
| | | orderDetl.setHostId(hostId); |
| | | orderDetl.setOrderId(order1.getId()); |
| | | orderDetl.setAnfme(dto.getCount()); |
| | | orderDetl.setCreateTime(now); |
| | | orderDetl.setCreateBy(userId); |
| | | orderDetl.setUpdateBy(userId); |
| | | orderDetl.setUpdateTime(now); |
| | | orderDetl.setStatus(1); |
| | | orderDetl.setMatnr(mat.getMatnr()); |
| | | orderDetl.setMaktx(mat.getMaktx()); |
| | | orderDetl.setName(mat.getName()); |
| | | orderDetl.setSpecs(mat.getSpecs()); |
| | | orderDetl.setModel(mat.getModel()); |
| | | orderDetl.setBatch(mat.getBatch()); |
| | | orderDetl.setUnit(mat.getUnit()); |
| | | orderDetl.setBarcode(mat.getBarcode()); |
| | | orderDetl.setItemNum(mat.getItemNum()); |
| | | orderDetl.setCount(mat.getCount() == null ? 0 : mat.getCount()); |
| | | orderDetl.setUnitPrice(mat.getPrice()); |
| | | orderDetl.setWeight(mat.getWeight()); |
| | | if (!orderDetlService.insert(orderDetl)) { |
| | | throw new CoolException("保存订单明细失败"); |
| | | } |
| | | } |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | // @Transactional |
| | | public R initOutOrder(InitOrderParam param, Long userId, Long hostId) { |
| | | Order order_no = orderService.selectOne(new EntityWrapper<Order>() |
| | | .eq("order_no", param.getOrderNo())); |
| | | // Order order = orderService.selectByOrderNo(param.getOrderNo(), hostId); |
| | | if (order_no != null) { |
| | | return R.error("抱歉单号已存在,请修改单号"); |
| | | } |
| | | Date now = new Date(); |
| | | Item item = itemService.selectByName(param.getItem()); |
| | | Cstmr cstmr = cstmrService.selectByName(param.getCstmr()); |
| | | |
| | | // 新增订单表头 |
| | | order_no = new Order(); |
| | | order_no.setHostId(hostId); |
| | | order_no.setUuid(String.valueOf(snowflakeIdWorker.nextId())); |
| | | order_no.setOrderNo(param.getOrderNo()); |
| | | order_no.setOrderTime(param.getOrderTime()); |
| | | order_no.setDocType(param.getDocType()); |
| | | order_no.setItemId(item==null?null:item.getId()); |
| | | order_no.setItemName(param.getItem()); |
| | | order_no.setCstmr(cstmr==null?null:cstmr.getId()); |
| | | order_no.setCstmrName(param.getCstmr()); |
| | | order_no.setSettle(1L); |
| | | order_no.setStatus(1); |
| | | order_no.setCreateTime(now); |
| | | order_no.setCreateBy(userId); |
| | | order_no.setUpdateTime(now); |
| | | order_no.setUpdateBy(userId); |
| | | |
| | | // if (!orderService.insert(order)) { |
| | | // throw new CoolException("保存订单表头失败!"); |
| | | // } |
| | | if (!orderService.insert(order_no)) { |
| | | throw new CoolException("保存订单表头失败!"); |
| | | } |
| | | |
| | | // // 遍历商品数量并保存 |
| | | // for (MatnrDto dto : param.getList()){ |
| | | // Mat mat = matService.selectByMatnr(hostId, dto.getMatnr()); |
| | | // if (mat == null) { |
| | | // log.error("{}商品不存在。", dto.getMatnr()); |
| | | // continue; |
| | | // } |
| | | // OrderDetl orderDetl = new OrderDetl(); |
| | | // orderDetl.setHostId(hostId); |
| | | // orderDetl.setOrderId(order.getId()); // 订单内码 |
| | | // orderDetl.setAnfme(dto.getCount()); // 数量 |
| | | // orderDetl.setCreateBy(userId); |
| | | // orderDetl.setCreateTime(now); |
| | | // orderDetl.setUpdateBy(userId); |
| | | // orderDetl.setUpdateTime(now); |
| | | // orderDetl.setStatus(1); |
| | | // VersionUtils.setOrderDetl(orderDetl, mat); |
| | | // if (!orderDetlService.insert(orderDetl)) { |
| | | // throw new CoolException("保存订单明细失败"); |
| | | // } |
| | | // } |
| | | // 遍历商品数量并保存 |
| | | for (MatnrDto dto : param.getList()){ |
| | | Mat mat = matService.selectByMatnr(hostId, dto.getMatnr()); |
| | | if (mat == null) { |
| | | log.error("{}商品不存在。", dto.getMatnr()); |
| | | continue; |
| | | } |
| | | OrderDetl orderDtel = new OrderDetl(); |
| | | orderDtel.setHostId(hostId); |
| | | orderDtel.setOrderId(order_no.getId()); |
| | | orderDtel.setAnfme(dto.getCount()); |
| | | orderDtel.setCreateTime(now); |
| | | orderDtel.setCreateBy(userId); |
| | | orderDtel.setUpdateBy(userId); |
| | | orderDtel.setUpdateTime(now); |
| | | orderDtel.setStatus(1); |
| | | orderDtel.setMatnr(mat.getMatnr()); |
| | | orderDtel.setMaktx(mat.getMaktx()); |
| | | orderDtel.setName(mat.getName()); |
| | | orderDtel.setSpecs(mat.getSpecs()); |
| | | orderDtel.setModel(mat.getModel()); |
| | | orderDtel.setBatch(mat.getBatch()); |
| | | orderDtel.setUnit(mat.getUnit()); |
| | | orderDtel.setBarcode(mat.getBarcode()); |
| | | orderDtel.setItemNum(mat.getItemNum()); |
| | | orderDtel.setCount(mat.getCount() == null ? 0 : mat.getCount()); |
| | | orderDtel.setUnitPrice(mat.getPrice()); |
| | | orderDtel.setWeight(mat.getWeight()); |
| | | if (!orderDetlService.insert(orderDtel)) { |
| | | throw new CoolException("保存订单明细失败"); |
| | | } |
| | | } |
| | | return R.ok("创建订单成功"); |
| | | } |
| | | |
| | | } |
| | |
| | | </resultMap> |
| | | |
| | | <update id="updateSettle"> |
| | | update man_receive set settle = #{settle} where 1=1 and order_no = #{orderNo} and host_id = #{hostId} |
| | | update man_order set settle = #{settle} where 1=1 and order_no = #{orderNo} and host_id = #{hostId} |
| | | </update> |
| | | <update id="updateStatus"> |
| | | UPDATE man_order set settle = 2, wave_no = null WHERE order_no = #{orderNo} |
| | |
| | | // 单据类型 |
| | | var docTypeData; |
| | | $.ajax({ |
| | | url: baseUrl+"/work/docType/all/get", |
| | | url: baseUrl+"/work/docType/out/get", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data:{docClass: 2}, |
| | | method: 'POST', |
| | |
| | | var form = layui.form; |
| | | var admin = layui.admin; |
| | | |
| | | |
| | | /****************************************** 左边表 *************************************************/ |
| | | var leftTB = table.render({ |
| | | elem: '#leftTable', |
| | | url: baseUrl + '/pickout/list/auth', |
| | | height: 'full-100', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res){ |
| | | return{ |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | } |
| | | }, |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | defaultToolbar: [], |
| | | cols:[[ |
| | | // {type: 'checkbox'} |
| | | {field: 'wrkNo', align: 'center',title: '任务号'} |
| | | ,{field: 'id', align: 'center',title: '唯一ID',hide: true} |
| | | ,{field: 'hostId', align: 'center',title: '商户ID', hide: true} |
| | | ,{field: 'userId', align: 'center',title: '用户ID', hide: true} |
| | | |
| | | ,{field: 'wrkSts$', align: 'center',title: '工作状态' ,templet: '#wrkStsTpl' , width: 100} |
| | | ,{field: 'zpallet', align: 'center',title: '条形码' , hide:true} |
| | | ,{field: 'createTime$', align: 'center',title: '', hide:true} |
| | | ,{field: 'createBy', align: 'center',title: '', hide:true} |
| | | ,{field: 'updateTime$', align: 'center',title: '', hide:true} |
| | | ,{field: 'updateBy', align: 'center',title: '', hide:true} |
| | | ,{field: 'memo', align: 'center',title: '', hide:true} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:180} |
| | | ]], |
| | | done: function (res,curr,count){ |
| | | $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); |
| | | } |
| | | }); |
| | | // 监听行工具事件 |
| | | table.on('tool(leftTable)', function(obj){ |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'complete': |
| | | complete(data); |
| | | break; |
| | | case "del": |
| | | var ids = [data.id]; |
| | | del(ids); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | /* 删除 */ |
| | | function del(ids) { |
| | | layer.confirm('确定要删除选中数据吗?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/pickout/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {ids: ids}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | /****************************************** 右边表 *************************************************/ |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#pickout', |
| | |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | // {type: 'checkbox'} |
| | | {field: 'wrkNo', align: 'center',title: '任务号'} |
| | | ,{field: 'id', align: 'center',title: '唯一ID'} |
| | | ,{field: 'hostId', align: 'center',title: '商户ID'} |
| | | ,{field: 'userId', align: 'center',title: '用户ID'} |
| | | ,{field: 'wrkNo', align: 'center',title: '工作号'} |
| | | ,{field: 'wrkSts', align: 'center',title: '工作状态'} |
| | | ,{field: 'zpallet', align: 'center',title: '条形码'} |
| | | ,{field: 'createTime$', align: 'center',title: ''} |
| | | ,{field: 'createBy', align: 'center',title: ''} |
| | | ,{field: 'updateTime$', align: 'center',title: ''} |
| | | ,{field: 'updateBy', align: 'center',title: ''} |
| | | ,{field: 'memo', align: 'center',title: ''} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} |
| | | ,{field: 'wrkSts$', align: 'center',title: '工作状态' ,templet: '#wrkStsTpl' , width: 100} |
| | | ,{field: 'zpallet', align: 'center',title: '条形码' , hide:true} |
| | | ,{field: 'createTime$', align: 'center',title: '', hide:true} |
| | | ,{field: 'createBy', align: 'center',title: '', hide:true} |
| | | ,{field: 'updateTime$', align: 'center',title: '', hide:true} |
| | | ,{field: 'updateBy', align: 'center',title: '', hide:true} |
| | | ,{field: 'memo', align: 'center',title: '', hide:true} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:180} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 监听行工具事件 |
| | | table.on('tool(pickout)', function(obj){ |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'edit': |
| | | showEditModel(data); |
| | | break; |
| | | case "del": |
| | | var ids = [data.id]; |
| | | del(ids); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | /* 弹窗 - 新增、修改 */ |
| | | function showEditModel(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '600px', |
| | | title: (mData ? '修改' : '添加') + '订单状态', |
| | | content: $('#editDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | layDateRender(); |
| | | form.val('detail', mData); |
| | | form.on('submit(editSubmit)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/pickout/"+(mData?'update':'add')+"/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.close(dIndex); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | /* 表格搜索 */ |
| | | form.on('submit(leftResearch)', function (data) { |
| | | insTb.reload({where: {doc_name: data.field.docName,doc_class:2}}); |
| | | return false; |
| | | }); |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /* 删除 */ |
| | | function del(ids) { |
| | | layer.confirm('确定要删除选中数据吗?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/pickout/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {ids: ids}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | // 搜索 |
| | | form.on('submit(search)', function (data) { |
| | |
| | | <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/common.css" media="all"> |
| | | <style> |
| | | body { |
| | | color: #595959; |
| | | background-color: #f5f7f9; |
| | | } |
| | | |
| | | /* 左表 */ |
| | | #docTypeTable + .layui-table-view .layui-table-tool-temp { |
| | | padding-right: 0; |
| | | } |
| | | |
| | | #docTypeTable + .layui-table-view .layui-table-body tbody > tr td { |
| | | cursor: pointer; |
| | | } |
| | | |
| | | #docTypeTable + .layui-table-view .layui-table-body tbody > tr.layui-table-click { |
| | | background-color: #fff3e0; |
| | | } |
| | | |
| | | #docTypeTable + .layui-table-view .layui-table-body tbody > tr.layui-table-click td:last-child > div:before { |
| | | position: absolute; |
| | | right: 6px; |
| | | content: "\e602"; |
| | | font-size: 12px; |
| | | font-style: normal; |
| | | font-family: layui-icon,serif !important; |
| | | -webkit-font-smoothing: antialiased; |
| | | -moz-osx-font-smoothing: grayscale; |
| | | } |
| | | |
| | | #left-table .layui-table-grid-down { |
| | | display: none; |
| | | } |
| | | |
| | | |
| | | .layui-form.layui-border-box.layui-table-view { |
| | | border-width: 1px; |
| | | } |
| | | #left-table .layui-table thead th { |
| | | /* font-weight: bold; */ |
| | | text-align: left; |
| | | } |
| | | </style> |
| | | </head> |
| | | <body> |
| | | |
| | | <!-- 搜索栏 --> |
| | | <div id="search-box" class="layui-form layui-card-header"> |
| | | <!-- 正文开始 --> |
| | | <div class="layui-fluid" style="padding-bottom: 0;"> |
| | | <div class="layui-row layui-col-space15"> |
| | | <div class="layui-col-md3" id="left-table"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body" style="padding: 10px;"> |
| | | <!-- 表格工具栏1 --> |
| | | <form class="layui-form toolbar"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline" style="max-width: 140px;"> |
| | | <input name="docName" class="layui-input" placeholder="请输入任务号"/> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <button class="layui-btn icon-btn" lay-filter="leftResearch" lay-submit> |
| | | <i class="layui-icon"></i>搜索 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <!-- 数据表格1 --> |
| | | <table id="leftTable" lay-filter="leftTable"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md9"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body" style="padding: 10px;"> |
| | | <!-- 表格工具栏2 --> |
| | | <form class="layui-form toolbar"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label">订单编号:</label> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off"> |
| | | <input name="id" class="layui-input"type="text" name="id" placeholder="编号" autocomplete="off"/> |
| | | </div> |
| | | </div> |
| | | <!-- 待添加 --> |
| | | <div id="data-search-btn" class="layui-btn-container layui-form-item"> |
| | | <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button> |
| | | <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button> |
| | | <div class="layui-inline">  |
| | | <button class="layui-btn icon-btn" lay-filter="search" lay-submit> |
| | | <i class="layui-icon"></i>搜索 |
| | | </button> |
| | | <button class="layui-btn icon-btn" lay-filter="reset" lay-submit> |
| | | <i class="layui-icon"></i>重置 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <!-- 数据表格2 --> |
| | | <table id="pickout" lay-filter="pickout"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 表格 --> |
| | | <div class="layui-form"> |
| | | <table class="layui-hide" id="pickout" lay-filter="pickout"></table> |
| | | </div> |
| | | <!--<!– 搜索栏 –>--> |
| | | <!--<div id="search-box" class="layui-form layui-card-header">--> |
| | | <!-- <div class="layui-inline">--> |
| | | <!-- <div class="layui-input-inline">--> |
| | | <!-- <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off">--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- <!– 待添加 –>--> |
| | | <!-- <div id="data-search-btn" class="layui-btn-container layui-form-item">--> |
| | | <!-- <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button>--> |
| | | <!-- <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button>--> |
| | | <!-- </div>--> |
| | | <!--</div>--> |
| | | |
| | | <!--<!– 表格 –>--> |
| | | <!--<div class="layui-form">--> |
| | | <!-- <table class="layui-hide" id="pickout" lay-filter="pickout"></table>--> |
| | | <!--</div>--> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button> |
| | | <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button> |
| | | <!-- <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>--> |
| | | <!-- <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button>--> |
| | | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">导出</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="operate"> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">删除</a> |
| | | {{#if (d.wrkSts == 1||d.wrkSts == 2){ }} |
| | | <a class="layui-btn layui-btn-xs btn-complete" lay-event="complete">完成</a> |
| | | {{# } }} |
| | | <!-- <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a>--> |
| | | {{#if (d.wrkSts == 1||d.wrkSts == 2){ }} |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">撤销</a> |
| | | {{# } }} |
| | | <!-- <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a>--> |
| | | |
| | | </script> |
| | | <script type="text/html" id="wrkStsTpl"> |
| | | <span name="wrkSts" |
| | | {{# if( d.wrkSts === 1){ }} |
| | | class="layui-badge layui-badge-blue" |
| | | {{# } else if(d.wrkSts === 2){ }} |
| | | class="layui-badge layui-badge-red" |
| | | {{# } else if(d.wrkSts === 3){ }} |
| | | class="layui-badge layui-badge-green" |
| | | {{# } }} |
| | | >{{d.wrkSts$}}</span> |
| | | </script> |
| | | |
| | | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> |