| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.core.common.*; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.WorkServiceImpl; |
| | | import com.zy.asrs.utils.OutboundAllocationUtil; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.model.LocDto; |
| | | import com.zy.common.model.TaskDto; |
| | | import com.zy.common.web.BaseController; |
| | |
| | | private WorkService workService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | |
| | | @PostMapping("/out/pakout/orderDetlIds/auth") |
| | |
| | | LocDto locDto = new LocDto(orderDetl.getManu(), orderDetl.getMatnr(), orderDetl.getMaktx(),orderDetl.getModel(),orderDetl.getSpecs(), |
| | | orderDetl.getBatch(),orderDetl.getBrand(),orderDetl.getBarcode(), orderDetl.getOrderNo(),orderDetl.getAnfme()); |
| | | locDto.setOrderDetlId(orderDetl.getId()); |
| | | locDto.setTkType(orderDetl.getTkType()); |
| | | locDtos.add(locDto); |
| | | } |
| | | |
| | |
| | | LocDto locDto = new LocDto(orderDetl.getManu(), orderDetl.getMatnr(), orderDetl.getMaktx(),orderDetl.getModel(),orderDetl.getSpecs(), |
| | | orderDetl.getBatch(),orderDetl.getBrand(),orderDetl.getBarcode(), orderDetl.getOrderNo(),orderDetl.getAnfme()); |
| | | locDto.setOrderDetlId(orderDetl.getId()); |
| | | locDto.setTkType(orderDetl.getTkType()); |
| | | locDtos.add(locDto); |
| | | } |
| | | } |
| | |
| | | @PostMapping("/out/refund/loc/auth") |
| | | @ManagerAuth(memo = "订单出库") |
| | | public synchronized R refundLoc(@RequestBody List<LocDto> locDtos) throws InterruptedException { |
| | | System.out.println(locDtos); |
| | | Long userId = getUserId(); |
| | | DocType docType = docTypeService.selectOrAdd("退货入库单", Boolean.TRUE); |
| | | Date now = new Date(); |
| | | long nowOrderNo = System.currentTimeMillis(); |
| | | Order order = new Order( |
| | | String.valueOf(snowflakeIdWorker.nextId()), // 编号[非空] |
| | | "TK"+nowOrderNo, // 订单编号 |
| | | DateUtils.convert(now), // 单据日期 |
| | | docType.getDocId(), // 单据类型 |
| | | null, // 项目编号 |
| | | null, // |
| | | null, // 调拨项目编号 |
| | | null, // 初始票据号 |
| | | null, // 票据号 |
| | | null, // 客户编号 |
| | | null, // 客户 |
| | | null, // 联系方式 |
| | | null, // 操作人员 |
| | | null, // 合计金额 |
| | | null, // 优惠率 |
| | | null, // 优惠金额 |
| | | null, // 销售或采购费用合计 |
| | | null, // 实付金额 |
| | | null, // 付款类型 |
| | | null, // 业务员 |
| | | null, // 结算天数 |
| | | null, // 邮费支付类型 |
| | | null, // 邮费 |
| | | null, // 付款时间 |
| | | null, // 发货时间 |
| | | null, // 物流名称 |
| | | null, // 物流单号 |
| | | // 2L, // 订单状态 |
| | | 1L, // 订单状态 |
| | | 1, // 状态 |
| | | userId, // 添加人员 |
| | | now, // 添加时间 |
| | | userId, // 修改人员 |
| | | now, // 修改时间 |
| | | null // 备注 |
| | | ); |
| | | if (!orderService.insert(order)) { |
| | | throw new CoolException("保存订单主档失败"); |
| | | } |
| | | // 单据明细档 |
| | | int i=0; |
| | | for (LocDto locDto : locDtos) { |
| | | i++; |
| | | Mat mat = matService.selectByMatnr(locDto.getMatnr()); |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(locDto.getMatnr() + "物料编码检索失败,请先添加商品"); |
| | | } |
| | | OrderDetl orderDetl = new OrderDetl(); |
| | | orderDetl.sync(mat); |
| | | orderDetl.setSuppCode(String.valueOf(i)); // 行号 |
| | | orderDetl.setManu(locDto.getLocNo()); //库位号 |
| | | orderDetl.setBatch(locDto.getBatch()); //木箱编码 |
| | | orderDetl.setAnfme(locDto.getAnfme());//出库数量 |
| | | orderDetl.setModel(locDto.getModel());//批次 |
| | | orderDetl.setSpecs(locDto.getSpecs());//规格 |
| | | orderDetl.setBrand(locDto.getBrand());//木箱类型 |
| | | orderDetl.setBarcode(locDto.getZpallet());//木箱类型 |
| | | // orderDetl.setWorkQty(locDetl.getAnfme()); |
| | | orderDetl.setWorkQty(0.0); |
| | | orderDetl.setOrderId(order.getId()); |
| | | orderDetl.setOrderNo(order.getOrderNo()); |
| | | orderDetl.setCreateBy(userId); |
| | | orderDetl.setCreateTime(now); |
| | | orderDetl.setUpdateBy(userId); |
| | | orderDetl.setUpdateTime(now); |
| | | orderDetl.setStatus(1); |
| | | orderDetl.setQty(0.0D); |
| | | if (!orderDetlService.insert(orderDetl)) { |
| | | throw new CoolException("生成单据明细失败,请联系管理员"); |
| | | } |
| | | |
| | | OrderDetl orderDetl1 = orderDetlService.selectById(locDto.getOrderDetlId()); |
| | | orderDetl1.setTkType(1); |
| | | orderDetlService.updateById(orderDetl1); |
| | | |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | public String getTkType(){ |
| | | DocTypeService service = SpringUtils.getBean(DocTypeService.class); |
| | | DocType docType = service.selectById(this.docType); |
| | | if (!Cools.isEmpty(docType)){ |
| | | return docType.getPakout().toString(); |
| | | } |
| | | return "0"; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | @ApiModelProperty(value = "退库标记") |
| | | @TableField("tk_type") |
| | | private Integer tkType; |
| | | |
| | | public OrderDetl() {} |
| | | |
| | | public OrderDetl(Long orderId, String orderNo, Double anfme, Double qty, String matnr, String maktx, String batch, String specs, String model, String color, String brand, String unit, Double price, String sku, Double units, String barcode, String origin, String manu, String manuDate, String itemNum, Double safeQty, Double weight, Double length, Double volume, String threeCode, String supp, String suppCode, Integer beBatch, String deadTime, Integer deadWarn, Integer source, Integer inspect, Integer danger, Integer status, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo) { |
| | |
| | | } |
| | | } |
| | | |
| | | public String getTkType$(){ |
| | | if (null == this.tkType) return "正常"; |
| | | if (this.tkType == 1) { |
| | | return "退库"; |
| | | } |
| | | return "正常"; |
| | | } |
| | | |
| | | public String getDanger$(){ |
| | | if (null == this.danger){ return null; } |
| | | switch (this.danger){ |
| | |
| | | private List<Integer> staNos; |
| | | |
| | | private Integer staNo; |
| | | private Integer tkType; |
| | | |
| | | public LocDto() { |
| | | } |
| | |
| | | this.count=anfme; |
| | | } |
| | | |
| | | public String getTkType$(){ |
| | | if (null == this.tkType) return "正常"; |
| | | if (this.tkType == 1) { |
| | | return "退库"; |
| | | } |
| | | return "正常"; |
| | | } |
| | | |
| | | } |
| | |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="memo" property="memo" /> |
| | | <result column="tk_type" property="tkType" /> |
| | | |
| | | </resultMap> |
| | | |
| | |
| | | {type: 'numbers'}, |
| | | {field: 'orderNo', title: '单据编号', templet: '#orderNoTpl'}, |
| | | {field: 'docType$', align: 'center', title: '类型', minWidth: 160, width: 160}, |
| | | {field: 'tkType', align: 'center', title: 'TK', minWidth: 160, width: 160,hide: true}, |
| | | {align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160}, |
| | | {field: 'createTime$', title: '创建时间', minWidth: 200, width: 200}, |
| | | {field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl', minWidth: 160, width: 160}, |
| | |
| | | {field: 'anfme', title: '木箱中铜箔数量', align: 'center', width: 90, style: 'font-weight: bold'}, |
| | | {field: 'count', title: '木箱中铜箔数量', align: 'center', width: 90, style: 'font-weight: bold'}, |
| | | {field: 'locNo', title: '货位', align: 'center', width: 100, templet: '#locNoTpl'}, |
| | | {field: 'tkType$', title: 'TK标记', align: 'center', width: 100}, |
| | | // {field: 'staNos', align: 'center', title: '出库站', merge: ['locNo'], templet: '#tbBasicTbStaNos'}, |
| | | // {type: 'checkbox', merge: ['locNo']}, |
| | | ]], |
| | |
| | | <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="labelUp">上传标签</a> |
| | | <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="complete">完结</a> |
| | | {{# } }} |
| | | {{# if (d.settle == 4) { }} |
| | | {{# if (d.settle == 4 && d.tkType=='1') { }} |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs btn-delete" lay-event="refundLoc">退库</a> |
| | | {{# } }} |
| | | </script> |