| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | |
| | | import com.zy.asrs.entity.result.WrkTraceVo; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.model.OrderDto; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | |
| | | private WrkMastLogService wrkMastLogService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private OrderLogService orderLogService; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | |
| | | List<WrkTraceVo> wrkTraceVos = new ArrayList<>(); |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNoGroupByMatnrOfSum(order.getOrderNo()); |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | if (isJSON(wrkDetl.getOrderNo())) { |
| | | List<OrderDto> orderDtoList = JSON.parseArray(wrkDetl.getOrderNo(), OrderDto.class); |
| | | for (OrderDto one : orderDtoList) { |
| | | if (one.getOrderNo().equals(order.getOrderNo())) { |
| | | wrkDetl.setAnfme(one.getAnfme()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", wrkDetl.getWrkNo()).eq("io_time", wrkDetl.getIoTime())); |
| | | if (wrkMast == null) { |
| | | WrkMastLog wrkMastLog = wrkMastLogService.selectOne(new EntityWrapper<WrkMastLog>().eq("wrk_no", wrkDetl.getWrkNo()).eq("io_time", wrkDetl.getIoTime())); |
| | |
| | | return R.ok(orderService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/order/list/log/auth") |
| | | @ManagerAuth |
| | | public R listLog(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<OrderLog> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){ |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } else { |
| | | wrapper.orderBy("create_time", false); |
| | | } |
| | | return R.ok(orderLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | |
| | | // } |
| | | // orderDetlService.modifyStatus(orderId, 0); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/order/exportOrder/auth") |
| | | @ManagerAuth(memo = "导出订单") |
| | | @Transactional |
| | | public R exportOrder(@RequestParam Long orderId){ |
| | | List<String> fields = new ArrayList<>(); |
| | | fields.add("orderNo"); |
| | | fields.add("matnr"); |
| | | fields.add("maktx"); |
| | | fields.add("specs"); |
| | | fields.add("anfme"); |
| | | fields.add("qty"); |
| | | EntityWrapper<OrderDetl> wrapper = new EntityWrapper<>(); |
| | | List<OrderDetl> orderDetls = orderDetlService.selectList(wrapper.eq("order_id",orderId)); |
| | | return R.ok(exportSupport(orderDetls, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/order/export/auth") |
| | |
| | | Double anfme = Double.parseDouble(dataFormatter.formatCellValue(row.getCell(3))); |
| | | // 下单时间 |
| | | String timeStr = dataFormatter.formatCellValue(row.getCell(4)); |
| | | |
| | | if (Cools.isEmpty(timeStr)) { |
| | | timeStr = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(now); |
| | | } |
| | | // 单据类型 |
| | | Long orderType = Long.parseLong(dataFormatter.formatCellValue(row.getCell(5))); |
| | | Date time = null; |
| | | try { |
| | | time = DateUtils.convert(timeStr, DateUtils.yyyyMMddHHmmss_F); |
| | |
| | | String.valueOf(snowflakeIdWorker.nextId()), // 编号[非空] |
| | | uuid, // 订单编号 |
| | | timeStr, // 单据日期 |
| | | 14L, // 单据类型 |
| | | orderType, // 单据类型 |
| | | null, // 项目编号 |
| | | null, // |
| | | null, // 调拨项目编号 |
| | |
| | | } |
| | | return R.ok("导入成功"); |
| | | } |
| | | |
| | | } |