|  |  |  | 
|---|
|  |  |  | <springfox.version>2.7.0</springfox.version> | 
|---|
|  |  |  | </properties> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <dependencies> | 
|---|
|  |  |  | <dependency> | 
|---|
|  |  |  | <groupId>javax.mail</groupId> | 
|---|
|  |  |  | <artifactId>mail</artifactId> | 
|---|
|  |  |  | <version>1.4.7</version> | 
|---|
|  |  |  | </dependency> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <dependency> | 
|---|
|  |  |  | <groupId>org.springframework.boot</groupId> | 
|---|
|  |  |  | <artifactId>spring-boot-starter-web</artifactId> | 
|---|
|  |  |  | </dependency> | 
|---|
|  |  |  | 
|---|
|  |  |  | private WrkDetlService wrkDetlService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private WaitPakinService waitPakinService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocDetlService locDetlService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/order/nav/list/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/order/form/add/authtest") | 
|---|
|  |  |  | @ManagerAuth(memo = "手动添加订单") | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public R formAddTest(@RequestBody OrderDomainParam param){ | 
|---|
|  |  |  | if(Cools.isEmpty(param.getOrderNo())){ | 
|---|
|  |  |  | String prefix = ""; | 
|---|
|  |  |  | DocType docType = docTypeService.selectById(param.getDocType()); | 
|---|
|  |  |  | if(!Cools.isEmpty(docType)){ | 
|---|
|  |  |  | prefix = docType.getPakin() == 1 ? "RK" : "CK"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | param.setOrderNo(prefix + snowflakeIdWorker.nextId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Order order = orderService.selectByNo(param.getOrderNo()); | 
|---|
|  |  |  | if (order != null) { | 
|---|
|  |  |  | return R.error("单据编号已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Date now = new Date(); | 
|---|
|  |  |  | order = new Order( | 
|---|
|  |  |  | String.valueOf(snowflakeIdWorker.nextId()),    // 编号[非空] | 
|---|
|  |  |  | param.getOrderNo(),    // 订单编号 | 
|---|
|  |  |  | DateUtils.convert(now),    // 单据日期 | 
|---|
|  |  |  | param.getDocType(),    // 单据类型 | 
|---|
|  |  |  | null,    // 项目编号 | 
|---|
|  |  |  | null,    // | 
|---|
|  |  |  | null,    // 调拨项目编号 | 
|---|
|  |  |  | null,    // 初始票据号 | 
|---|
|  |  |  | null,    // 票据号 | 
|---|
|  |  |  | null,    // 客户编号 | 
|---|
|  |  |  | null,    // 客户 | 
|---|
|  |  |  | null,    // 联系方式 | 
|---|
|  |  |  | null,    // 操作人员 | 
|---|
|  |  |  | null,    // 合计金额 | 
|---|
|  |  |  | null,    // 优惠率 | 
|---|
|  |  |  | null,    // 优惠金额 | 
|---|
|  |  |  | null,    // 销售或采购费用合计 | 
|---|
|  |  |  | null,    // 实付金额 | 
|---|
|  |  |  | null,    // 付款类型 | 
|---|
|  |  |  | null,    // 业务员 | 
|---|
|  |  |  | null,    // 结算天数 | 
|---|
|  |  |  | null,    // 邮费支付类型 | 
|---|
|  |  |  | null,    // 邮费 | 
|---|
|  |  |  | null,    // 付款时间 | 
|---|
|  |  |  | null,    // 发货时间 | 
|---|
|  |  |  | null,    // 物流名称 | 
|---|
|  |  |  | null,    // 物流单号 | 
|---|
|  |  |  | 1L,    // 订单状态 | 
|---|
|  |  |  | 1,    // 状态 | 
|---|
|  |  |  | getUserId(),    // 添加人员 | 
|---|
|  |  |  | now,    // 添加时间 | 
|---|
|  |  |  | getUserId(),    // 修改人员 | 
|---|
|  |  |  | now,    // 修改时间 | 
|---|
|  |  |  | null    // 备注 | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if (!orderService.insert(order)) { | 
|---|
|  |  |  | throw new CoolException("保存订单主档失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<DetlDto> list = new ArrayList<>(); | 
|---|
|  |  |  | for (OrderDetl orderDetl : param.getOrderDetlList()) { | 
|---|
|  |  |  | DetlDto dto = new DetlDto(orderDetl.getMatnr(), orderDetl.getBatch()); | 
|---|
|  |  |  | if (DetlDto.has(list, dto)) { | 
|---|
|  |  |  | OrderDetl item = orderDetlService.selectItem(order.getId(), orderDetl.getMatnr(), orderDetl.getBatch()); | 
|---|
|  |  |  | item.setAnfme(item.getAnfme() + orderDetl.getAnfme()); | 
|---|
|  |  |  | if (!orderDetlService.updateById(item)) { | 
|---|
|  |  |  | throw new CoolException("保存订单明细档失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | list.add(dto); | 
|---|
|  |  |  | orderDetl.setOrderId(order.getId()); | 
|---|
|  |  |  | orderDetl.setOrderNo(order.getOrderNo()); | 
|---|
|  |  |  | orderDetl.setCreateBy(getUserId()); | 
|---|
|  |  |  | orderDetl.setCreateTime(now); | 
|---|
|  |  |  | orderDetl.setUpdateBy(getUserId()); | 
|---|
|  |  |  | orderDetl.setUpdateTime(now); | 
|---|
|  |  |  | orderDetl.setStatus(1); | 
|---|
|  |  |  | orderDetl.setQty(0.0D); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //给添加子订单 | 
|---|
|  |  |  | Set<String> exist = new HashSet<>(); | 
|---|
|  |  |  | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!orderDetlService.insert(orderDetl)) { | 
|---|
|  |  |  | throw new CoolException("保存订单明细档失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok("订单添加成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | for (OrderDetl orderDetl : orderDetls) { | 
|---|
|  |  |  | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getQty()).orElse(0.0D); | 
|---|
|  |  |  | if (issued <= 0.0D) { continue; } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | System.out.println(locDetls); | 
|---|
|  |  |  | for (LocDetl locDetl : locDetls) { | 
|---|
|  |  |  | if (issued > 0) { | 
|---|
|  |  |  | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), | 
|---|
|  |  |  | 
|---|
|  |  |  | // 根据 (库位 & 出库站) 分组; 理想状态:一组为一次出库任务 | 
|---|
|  |  |  | for (LocDto locDto : locDtos) { | 
|---|
|  |  |  | if (locDto.isLack()) { continue; } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //添加部分:增加工作数量 | 
|---|
|  |  |  | // orderDetlService.increaseWorkQtytest(locDto.getOrderNo(),locDto.getMatnr(),locDto.getBatch(),locDto.getAnfme()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | TaskDto taskDto = new TaskDto(locDto.getLocNo(), locDto.getStaNo(), locDto); | 
|---|
|  |  |  | if (TaskDto.has(taskDtos, taskDto)) { | 
|---|
|  |  |  | TaskDto dto = TaskDto.find(taskDtos, taskDto); | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("/out/pakout/preview/authtest") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R pakoutPreviewtest(@RequestBody List<Long> ids) { | 
|---|
|  |  |  | if (Cools.isEmpty(ids)) { | 
|---|
|  |  |  | return R.parse(BaseRes.PARAM); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids); | 
|---|
|  |  |  | List<LocDto> locDtos = new ArrayList<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Set<String> exist = new HashSet<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (OrderDetl orderDetl : orderDetls) { | 
|---|
|  |  |  | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getQty()).orElse(0.0D); | 
|---|
|  |  |  | if (issued <= 0.0D) { continue; } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); | 
|---|
|  |  |  | //判断出库数量是否大于要出的物品 | 
|---|
|  |  |  | LocDto locDtoo = new LocDto(locDetls.get(0).getLocNo(), locDetls.get(0).getMatnr(), locDetls.get(0).getMaktx(), locDetls.get(0).getBatch(), orderDetl.getOrderNo(), | 
|---|
|  |  |  | issued >= locDetls.get(0).getAnfme() ? locDetls.get(0).getAnfme() : issued); | 
|---|
|  |  |  | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetls.get(0).getLocNo(), issued >= locDetls.get(0).getAnfme() ? 101 : 103); | 
|---|
|  |  |  | locDtoo.setStaNos(staNos); | 
|---|
|  |  |  | if(issued<locDetls.get(0).getAnfme()){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | locDtos.add(locDtoo); | 
|---|
|  |  |  | exist.add(locDetls.get(0).getLocNo()); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | }else if(issued==locDetls.get(0).getAnfme()){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | locDtos.add(locDtoo); | 
|---|
|  |  |  | exist.add(locDetls.get(0).getLocNo()); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | locDtos.add(locDtoo); | 
|---|
|  |  |  | exist.add(locDetls.get(0).getLocNo()); | 
|---|
|  |  |  | issued=issued-locDetls.get(0).getAnfme(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocDetl> locDetlList=locDetlService.queryStockOther(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist,locDetls.get(0).getLocNo()); | 
|---|
|  |  |  | for (LocDetl locDetl : locDetlList) { | 
|---|
|  |  |  | 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> staNoss = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); | 
|---|
|  |  |  | locDto.setStaNos(staNoss); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | locDtos.add(locDto); | 
|---|
|  |  |  | exist.add(locDetl.getLocNo()); | 
|---|
|  |  |  | // 剩余待出数量递减 | 
|---|
|  |  |  | issued = issued - locDetl.getAnfme(); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (issued > 0) { | 
|---|
|  |  |  | LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); | 
|---|
|  |  |  | locDto.setLack(Boolean.TRUE); | 
|---|
|  |  |  | locDtos.add(locDto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(locDtos); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 库位号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "库位号") | 
|---|
|  |  |  | @TableId(value = "loc_no", type = IdType.INPUT) | 
|---|
|  |  |  | @ApiModelProperty(value= "库位号") //参数类型为String,作用为此属性的简要描述。 | 
|---|
|  |  |  | @TableId(value = "loc_no", type = IdType.INPUT) // @TableId 注解的用法,该注解用于将某个成员变量指定为数据表主键 | 
|---|
|  |  |  | @TableField("loc_no") | 
|---|
|  |  |  | private String locNo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiModelProperty(value= "") | 
|---|
|  |  |  | private String mk; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiModelProperty(value= "") | 
|---|
|  |  |  | @ApiModelProperty(value= "条码号") | 
|---|
|  |  |  | private String barcode; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiModelProperty(value= "") | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocDetl> queryStock(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocDetl> queryStockOther(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos,@Param("locNo")String locNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Double queryStockAnfme(String matnr, String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<StockVo> queryStockTotal(); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 increaseWorkQtytest(@Param("orderNo")String orderNo, @Param("matnr")String matnr, @Param("batch")String batch, @Param("anfme")Double anfme); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.service.IService; | 
|---|
|  |  |  | import com.zy.asrs.entity.LocDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.result.StockVo; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Param; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<LocDetl> queryStockOther(String matnr, String batch, String orderNo, Set<String> locNos,String locNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Double queryStockAnfme(String matnr, String batch); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<StockVo> queryStockTotal(); | 
|---|
|  |  |  | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | boolean increaseWorkQty(Long orderId, String matnr, String batch, Double workQty); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | boolean increaseWorkQtytest(String orderNo, String matnr, String batch, Double anfme); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<LocDetl> queryStockOther(String matnr, String batch, String orderNo, Set<String> locNos,String locNo) { | 
|---|
|  |  |  | return this.baseMapper.queryStockOther(matnr, batch, orderNo, locNos,locNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Double queryStockAnfme(String matnr, String batch) { | 
|---|
|  |  |  | return this.baseMapper.queryStockAnfme(matnr, batch); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | public boolean increaseWorkQty(Long orderId, String matnr, String batch, Double workQty) { | 
|---|
|  |  |  | return this.baseMapper.increaseWorkQty(orderId, matnr, batch, workQty) > 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 入出库任务生成时,更新单据表中作业数量 | 
|---|
|  |  |  | * @param orderNo | 
|---|
|  |  |  | * @param matnr | 
|---|
|  |  |  | * @param batch | 
|---|
|  |  |  | * @param anfme | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public boolean increaseWorkQtytest(String orderNo, String matnr, String batch, Double anfme) { | 
|---|
|  |  |  | return this.baseMapper.increaseWorkQtytest(orderNo, matnr, batch, anfme) > 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if(wrkMast.getIoType() == 101 || wrkMast.getIoType() == 103) { | 
|---|
|  |  |  | 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())) { | 
|---|
|  |  |  | throw new CoolException("订单数据回滚失败"); | 
|---|
|  |  |  | 
|---|
|  |  |  | boolean flag = true; | 
|---|
|  |  |  | List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no",wrkDetl.getOrderNo())); | 
|---|
|  |  |  | for(OrderDetl orderDetl : orderDetls){ | 
|---|
|  |  |  | if(orderDetl.getWorkQty() > 0){ | 
|---|
|  |  |  | if(orderDetl.getQty() > 0){ | 
|---|
|  |  |  | flag = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private boolean lack = false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //目标站点 | 
|---|
|  |  |  | private List<Integer> staNos; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Integer staNo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public LocDto() { | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | enabled: false | 
|---|
|  |  |  | datasource: | 
|---|
|  |  |  | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | 
|---|
|  |  |  | url: jdbc:sqlserver://192.168.4.15:1433;databasename=hylyasrs | 
|---|
|  |  |  | url: jdbc:sqlserver://localhost:1433;databasename=hylyasrs | 
|---|
|  |  |  | username: sa | 
|---|
|  |  |  | password: sa@123 | 
|---|
|  |  |  | mvc: | 
|---|
|  |  |  | 
|---|
|  |  |  | desc | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="queryStockOther" resultMap="BaseResultMap"> | 
|---|
|  |  |  | select a.* | 
|---|
|  |  |  | from asr_loc_detl a | 
|---|
|  |  |  | left join asr_loc_mast b on a.loc_no = b.loc_no | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | and b.loc_sts = 'F' | 
|---|
|  |  |  | and a.matnr=  #{matnr} | 
|---|
|  |  |  | and a.loc_no !=  #{locNo} | 
|---|
|  |  |  | <if test="orderNo != null and orderNo != ''"> | 
|---|
|  |  |  | and a.order_no = #{orderNo} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="locNos != null and locNos.size > 0"> | 
|---|
|  |  |  | and b.loc_no not in | 
|---|
|  |  |  | <foreach item="item" collection="locNos" index="index"  separator="," open="(" close=")"> | 
|---|
|  |  |  | #{item} | 
|---|
|  |  |  | </foreach> | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | order by | 
|---|
|  |  |  | DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time), a.anfme | 
|---|
|  |  |  | desc, | 
|---|
|  |  |  | NEWID(), | 
|---|
|  |  |  | case | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '01') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '02') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '03') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '04') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '05') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '06') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '07') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '08') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '09') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '10') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '11') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '12') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '13') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '14') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '15') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '16') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '17') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '18') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '19') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '20') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '21') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '22') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '23') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '24') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '25') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '26') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '27') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '28') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '29') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '30') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '31') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '32') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '33') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '34') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '35') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '36') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '37') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '38') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '39') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '40') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '41') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '42') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '43') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '44') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '45') then 0 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '46') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '47') then 1 | 
|---|
|  |  |  | when (left(a.loc_no, 2) = '48') then 0 | 
|---|
|  |  |  | else 0 | 
|---|
|  |  |  | end | 
|---|
|  |  |  | desc; | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <select id="queryStockAnfme" resultType="java.lang.Double"> | 
|---|
|  |  |  | select sum(anfme) as count from man_loc_detl | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <update id="increase"> | 
|---|
|  |  |  | update man_order_detl | 
|---|
|  |  |  | set qty = qty + #{qty} | 
|---|
|  |  |  | set work_qty = work_qty + #{qty} | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | and order_id = #{orderId} | 
|---|
|  |  |  | and matnr = #{matnr} | 
|---|
|  |  |  | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | and order_no = #{orderNo} | 
|---|
|  |  |  | and matnr = #{matnr} | 
|---|
|  |  |  | <choose> | 
|---|
|  |  |  | <when test="batch != null and batch != ''"> | 
|---|
|  |  |  | and batch = #{batch} | 
|---|
|  |  |  | </when> | 
|---|
|  |  |  | <otherwise> | 
|---|
|  |  |  | and (batch IS NULL OR batch = '') | 
|---|
|  |  |  | </otherwise> | 
|---|
|  |  |  | </choose> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <update id="modifyStatus"> | 
|---|
|  |  |  | 
|---|
|  |  |  | </choose> | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <update id="increaseWorkQtytest"> | 
|---|
|  |  |  | update man_order_detl | 
|---|
|  |  |  | set work_qty = work_qty + #{anfme} | 
|---|
|  |  |  | where 1=1 | 
|---|
|  |  |  | and order_no = #{orderNo} | 
|---|
|  |  |  | and matnr = #{matnr}; | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | layer.load(2); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/order/form/" + (isExpAdd?"add":"modify") + "/auth", | 
|---|
|  |  |  | url: baseUrl+"/order/form/" + (isExpAdd?"add":"modify") + "/authtest", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: JSON.stringify({ | 
|---|
|  |  |  | orderId: Number(data.field.id), | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 弹窗不出现滚动条 | 
|---|
|  |  |  | $(layero).children('.layui-layer-content').css('overflow', 'visible'); | 
|---|
|  |  |  | layui.form.render('select'); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function pakoutPreview(ids) { | 
|---|
|  |  |  | let loadIndex = layer.load(2); | 
|---|
|  |  |  | console.log("1111") | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl + "/out/pakout/preview/auth", | 
|---|
|  |  |  | url: baseUrl + "/out/pakout/preview/authtest", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | contentType: 'application/json;charset=UTF-8', | 
|---|
|  |  |  | data: JSON.stringify(ids), | 
|---|
|  |  |  | 
|---|
|  |  |  | {field: 'anfme', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'}, | 
|---|
|  |  |  | {field: 'locNo', title: '货位', align: 'center', width: 100, templet: '#locNoTpl'}, | 
|---|
|  |  |  | {field: 'staNos', align: 'center', title: '出库站', merge: ['locNo'], templet: '#tbBasicTbStaNos'}, | 
|---|
|  |  |  | //{field: 'staState', title: '状态', align: 'center'}, | 
|---|
|  |  |  | {type: 'checkbox', merge: ['locNo']}, | 
|---|
|  |  |  | ]], | 
|---|
|  |  |  | done: function (res) { | 
|---|
|  |  |  | 
|---|
|  |  |  | var table = layui.table; | 
|---|
|  |  |  | var $ = layui.jquery; | 
|---|
|  |  |  | var layer = layui.layer; | 
|---|
|  |  |  | var layDate = layui.laydate; | 
|---|
|  |  |  | var layDate = layui.laydate;    //时间控件 | 
|---|
|  |  |  | var form = layui.form; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '.layui-laydate-range' | 
|---|
|  |  |  | ,type: 'datetime' | 
|---|
|  |  |  | ,range: true | 
|---|
|  |  |  | ,type: 'datetime'   //日期时间选择器 可选年、月、日、时、分、秒 | 
|---|
|  |  |  | ,range: true        //设置为true,默认采用“-”分割 | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 数据渲染 | 
|---|
|  |  |  | tableIns = table.render({ | 
|---|
|  |  |  | elem: '#stoQue', | 
|---|
|  |  |  | elem: '#stoQue',    //table id=“stoQue” | 
|---|
|  |  |  | headers: {token: localStorage.getItem('token')}, | 
|---|
|  |  |  | url: baseUrl+'/locMast/list/auth', | 
|---|
|  |  |  | page: true, | 
|---|
|  |  |  | page: true,     //开启分页 | 
|---|
|  |  |  | limit: 20, | 
|---|
|  |  |  | limits: [20, 30, 50, 100, 200, 500], | 
|---|
|  |  |  | even: true, | 
|---|
|  |  |  | 
|---|
|  |  |  | case 'refreshSto': // todo:luxiaotao | 
|---|
|  |  |  | alert("还没做"); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 'exportData': | 
|---|
|  |  |  | case 'exportData':    //导出Excel | 
|---|
|  |  |  | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ | 
|---|
|  |  |  | var titles=[]; | 
|---|
|  |  |  | var fields=[]; | 
|---|
|  |  |  | 
|---|
|  |  |  | 'fields': fields | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/wrkLastno/export/auth", | 
|---|
|  |  |  | url: baseUrl+"/locMast/export/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: JSON.stringify(param), | 
|---|
|  |  |  | dataType:'json', | 
|---|
|  |  |  | 
|---|
|  |  |  | <input id="username" class="input100" type="text" name="username" placeholder="username" autocomplete="off"> | 
|---|
|  |  |  | <span class="focus-input100"></span> | 
|---|
|  |  |  | <span class="symbol-input100"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <i class="fa fa-user"></i> | 
|---|
|  |  |  | </span> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | <div id="mat" name="mat"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div class="layui-form-item text-right" style="display: inline-block; margin-left: 35px"> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button> | 
|---|
|  |  |  | <button class="layui-btn" lay-filter="matEditSubmit" lay-submit>保存</button> | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 行工具栏 --> | 
|---|
|  |  |  | <script type="text/html" id="operate"> | 
|---|
|  |  |  | {{#if (d.anfme > d.qty){ }} | 
|---|
|  |  |  | {{#if (d.anfme > d.workQty){ }} | 
|---|
|  |  |  | <a class="layui-btn layui-btn-xs layui-btn-danger btn-pakoutPreview" lay-event="pakoutPreview"><i class="layui-icon layui-icon-prev-circle"></i>出库</a> | 
|---|
|  |  |  | {{# } }} | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | 
|---|
|  |  |  | var cols = [ | 
|---|
|  |  |  | {field: 'wrkNo', align: 'center',title: '工作号'} | 
|---|
|  |  |  | ,{field: 'ioTime$', align: 'center',title: '工作时间'} | 
|---|
|  |  |  | ,{field: 'orderNo', align: 'center',title: '单据编号'} | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | cols.push.apply(cols, detlCols); | 
|---|
|  |  |  | return cols; | 
|---|