| | |
| | | } |
| | | |
| | | /** |
| | | * 商品下载 |
| | | */ |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | public void updateMatExecute(){ |
| | | try { |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("Flag", 6); |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(URI) |
| | | .setPath(GET_BASIS) |
| | | .setJson(JSON.toJSONString(param)) |
| | | .build() |
| | | .doPost(); |
| | | if (!Cools.isEmpty(response)) { |
| | | // log.info(response); |
| | | Date now = new Date(); |
| | | Result result = JSON.parseObject(response, Result.class); |
| | | if (result.getCode() != 1) { |
| | | return; |
| | | } |
| | | List<GetBasisResult> list = JSON.parseArray(result.getData(), GetBasisResult.class); |
| | | Tag first = null; |
| | | for (GetBasisResult data : list) { |
| | | Mat mat = matService.selectByMatnr(data.getUserCode()); |
| | | String modifyDate = data.getModifyDate(); |
| | | Date updateTime = null; |
| | | if (!Cools.isEmpty(modifyDate)) { |
| | | updateTime = DateUtils.convert(data.getModifyDate()); |
| | | } |
| | | |
| | | // 分类 |
| | | Tag second = tagService.selectOne(new EntityWrapper<Tag>().eq("name", data.getYjfl()).eq("level", 2)); |
| | | if (second == null) { |
| | | if (first == null) { |
| | | first = tagService.selectOne(new EntityWrapper<Tag>().eq("level", 1)); |
| | | if (first == null) { |
| | | throw new CoolException("全部分类出错"); |
| | | } |
| | | } |
| | | NodeUtils nodeUtils = new NodeUtils(); |
| | | nodeUtils.executePath(first.getId()); |
| | | second = new Tag( |
| | | null, // 编号 |
| | | data.getYjfl(), // 名称 |
| | | first.getId(), // 父级 |
| | | first.getName(), // 父级名称 |
| | | nodeUtils.path.toString(), // 关联路径 |
| | | nodeUtils.pathName.toString(), // 关联路径名 |
| | | 0, // 类型 |
| | | null, // 负责人 |
| | | null, // 图片 |
| | | null, // 简要描述 |
| | | null, // 数量 |
| | | 2, // 等级 |
| | | null, // 排序 |
| | | 1, // 状态 |
| | | now, // 添加时间 |
| | | null, // 添加人员 |
| | | now, // 修改时间 |
| | | null, // 修改人员 |
| | | null // 备注 |
| | | ); |
| | | if (tagMapper.insert(second) == 0) { |
| | | throw new CoolException("插入分类失败"); |
| | | } |
| | | } |
| | | |
| | | Tag third = tagService.selectOne(new EntityWrapper<Tag>().eq("level", 3).eq("name", data.getEjfl()).eq("parent_name", data.getYjfl())); |
| | | if (third == null) { |
| | | NodeUtils nodeUtils = new NodeUtils(); |
| | | nodeUtils.executePath(second.getId()); |
| | | third = new Tag( |
| | | null, // 编号 |
| | | data.getEjfl(), // 名称 |
| | | second.getId(), // 父级 |
| | | second.getName(), // 父级名称 |
| | | nodeUtils.path.toString(), // 关联路径 |
| | | nodeUtils.pathName.toString(), // 关联路径名 |
| | | 0, // 类型 |
| | | null, // 负责人 |
| | | null, // 图片 |
| | | null, // 简要描述 |
| | | null, // 数量 |
| | | 3, // 等级 |
| | | null, // 排序 |
| | | 1, // 状态 |
| | | now, // 添加时间 |
| | | null, // 添加人员 |
| | | now, // 修改时间 |
| | | null, // 修改人员 |
| | | null // 备注 |
| | | ); |
| | | if (tagMapper.insert(third) == 0) { |
| | | throw new CoolException("插入分类失败"); |
| | | } |
| | | } |
| | | |
| | | if (null == mat) { |
| | | mat = new Mat( |
| | | String.valueOf(data.getRec()), // 编号 |
| | | null, // 所属区域 |
| | | third.getId(), // 所属归类 |
| | | data.getUserCode(), // 商品编号 |
| | | data.getFullName(), // 商品名称 |
| | | null, // 名称 |
| | | data.getStandard(), // 规格 |
| | | null, // 型号 |
| | | null, // 批号 |
| | | data.getUnit3(), // 单位 |
| | | data.getBarcode(), // 条码 |
| | | null, // 单据类型 |
| | | null, // 单据编号 |
| | | null, // 客户名称 |
| | | null, // 品项数 |
| | | null, // 库存余量 |
| | | null, // 重量 |
| | | 1, // |
| | | null, // 添加人员 |
| | | now, // 添加时间 |
| | | null, // 修改人员 |
| | | updateTime, // 修改时间 |
| | | null // 备注 |
| | | ); |
| | | matService.insert(mat); |
| | | } else { |
| | | mat.setUuid(String.valueOf(data.getRec())); |
| | | mat.setMatnr(data.getUserCode()); |
| | | mat.setMaktx(data.getFullName()); |
| | | mat.setSpecs(data.getStandard()); |
| | | mat.setUpdateTime(updateTime); |
| | | mat.setBarcode(data.getBarcode()); |
| | | mat.setUnit(data.getUnit3()); |
| | | matService.updateById(mat); |
| | | } |
| | | log.info("====>> 更新物料:{}", data.getUserCode()); |
| | | } |
| | | |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 客户下载 |
| | | */ |
| | | // @Scheduled(cron = "0/5 * * * * ? ") |
| | |
| | | package zy.cloud.wms.common.service.task; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import zy.cloud.wms.manager.entity.Order; |
| | | import zy.cloud.wms.manager.entity.Pakout; |
| | | import zy.cloud.wms.manager.service.OrderService; |
| | | import zy.cloud.wms.manager.service.PakoutService; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * Created by vincent on 2021/4/22 |
| | | */ |
| | | @Slf4j |
| | | //@Component |
| | | @Component |
| | | public class OrderScheduler { |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private PakoutService pakoutService; |
| | | |
| | | /** |
| | | * 取消订单处理器 |
| | |
| | | public void cancelOrderExecute(){ |
| | | List<Order> cancelOrders = orderService.selectList(new EntityWrapper<Order>().eq("settle", 5)); |
| | | for (Order order : cancelOrders) { |
| | | |
| | | |
| | | |
| | | if (!orderService.updateSettle(order.getOrderNo(), 3L)) { |
| | | throw new CoolException("修改订单状态失败"); |
| | | if (!pakoutService.delete(new EntityWrapper<Pakout>().eq("doc_num", order.getOrderNo()))) { |
| | | throw new CoolException("删除拣货单失败"); |
| | | } |
| | | // 取消销售订单 |
| | | List<Pakout> pakouts = pakoutService.selectList(new EntityWrapper<Pakout>().eq("doc_num", order.getOrderNo())); |
| | | if (Cools.isEmpty(pakouts)){ |
| | | // 修改单据状态 |
| | | if (!orderService.updateSettle(order.getOrderNo(), 3L)) { |
| | | throw new CoolException("修改单据状态失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/order/list/auth', |
| | | page: true, |
| | | limit: 10, |
| | | limit: 16, |
| | | limits: [16, 30, 50, 100, 200, 500], |
| | | toolbar: '#orderToolbar', |
| | | height: 'full-100', |