skyouc
2024-12-26 32afdc40d71b62ed0a2e0693cd56564816b188e5
#添加HOST权限,如果授权为空,默认1
10个文件已修改
262 ■■■■■ 已修改文件
zy-asrs-admin/src/views/in/waitPakin/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-admin/src/views/out/wave/index.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/schedule/ScheduleJobs.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskLogTimer.java 182 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/java/com/zy/asrs/wms/common/config/MybatisPlusConfig.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/java/com/zy/asrs/wms/utils/LocUtils.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wms/src/main/resources/mapper/asrs/ViewLocDetlMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-admin/src/views/in/waitPakin/index.vue
@@ -338,8 +338,8 @@
            <DownOutlined />
          </a-button>
        </a-dropdown>
        <!--<a-button @click="generateTask()" type="primary">{{ formatMessage('page.generateTask', '生成任务') }}</a-button>-->
        <!--<a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '添加') }}</a-button>-->
        <a-button @click="generateTask()" type="primary">{{ formatMessage('page.generateTask', '生成任务') }}</a-button>
        <a-button @click="handleEdit(null)" type="primary">{{ formatMessage('page.add', '添加') }}</a-button>
        <a-button @click="handleExport">{{ formatMessage('page.export', '导出') }}</a-button>
      </div>
    </div>
zy-asrs-admin/src/views/out/wave/index.vue
@@ -41,11 +41,11 @@
let tableDataColSpan = []
const customColSpanProps = (index) => {
  let count = tableDataColSpan[index];
  console.log(index + ' ----=====-->' + count)
  // console.log(index + ' ----=====-->' + count)
  if (count == null || count == undefined) {
    count = 0;
  }
    console.log(' ----=====-->' + count)
    // console.log(' ----=====-->' + count)
    return {
    rowSpan: count,
  };
@@ -55,7 +55,7 @@
  {
    title: formatMessage('db.man_wave.wave_no', '波次号'),
    dataIndex: 'waveNo',
    width: 140,
    width: 180,
    ellipsis: true,
    ...getColumnSearchProps('waveNo'),
    customCell: (_, index) => {
@@ -65,7 +65,7 @@
  {
    title: formatMessage('db.man_wave.waveType$', '类型'),
    dataIndex: 'waveType$',
    width: 140,
    width: 110,
    ellipsis: true,
    ...getColumnSearchProps('waveType$'),
    customCell: (_, index) => {
@@ -75,7 +75,7 @@
  {
    title: formatMessage('db.man_wave.waveStatus$', '状态'),
    dataIndex: 'waveStatus$',
    width: 140,
    width: 120,
    ellipsis: true,
    ...getColumnSearchProps('waveStatus$'),
    customCell: (_, index) => {
@@ -85,14 +85,14 @@
  {
    title: formatMessage('db.man_wave.matnr', '商品编号'),
    dataIndex: ['mat$', 'matnr'],
    width: 140,
    width: 180,
    ellipsis: true,
    ...getColumnSearchProps('matnr'),
  },
  {
    title: formatMessage('db.man_wave.maktx', '商品名称'),
    dataIndex: ['mat$', 'maktx'],
    width: 140,
    width: 180,
    ellipsis: true,
    ...getColumnSearchProps('maktx'),
  },
@@ -166,9 +166,9 @@
      })
      tableDataColSpan = colSpan;
      console.log('=========>');
      console.log(tmp)
      console.log(tableDataColSpan);
      // console.log('=========>');
      // console.log(tmp)
      // console.log(tableDataColSpan);
      tableData.value = tmp;
      state.loading = false;
    } else if (result.code === 401) {
zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/schedule/ScheduleJobs.java
@@ -187,7 +187,7 @@
                        //流动通知下发完成后,修改任务状态为输送线流动中。。
                        taskService.update(new LambdaUpdateWrapper<Task>()
                                .eq(Task::getId, task.getId())
                                .set(Task::getTaskSts, TaskStsType.COMPLETE_OUT.id));
                                .set(Task::getTaskSts, TaskStsType.WAVE_SEED.id));
//                        log.info(task.getTaskNo() + "下发流动通知" + commonReponse.getMsg());
//                    } else {
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java
@@ -108,6 +108,11 @@
                    throw new CoolException("明细不存在");
                }
                OrderDetl orderDetl = orderDetlService.getById(detl.getOrderDetlId());
                if (orderDetl == null) {
                    throw new CoolException("明细不存在");
                }
                TaskDetl taskDetl = new TaskDetl();
                taskDetl.sync(locDetl);
                taskDetl.setTaskId(task.getId());
@@ -798,16 +803,13 @@
        List<Long> filterParamsList = new ArrayList<>();
        List<OrderOutMergeParam> filterParams = new ArrayList<>();
        for (OrderOutMergeParam param : params) {
            if (param.getLocId() == null) {
                continue;
            }
            if(!filterParamsList.contains(param.getLocId())){
                filterParamsList.add(param.getLocId());
                filterParams.add(param);
        params.forEach(action -> {
            if (action.getLocId() != null) {
                filterParamsList.add(action.getLocId());
                filterParams.add(action);
            }
        }
        });
        HashMap<String, Double> stockMap = new HashMap<>();
        for (OrderOutMergeParam param : filterParams) {
@@ -929,6 +931,7 @@
                    }
                }
                //TODO 确认后,需将注释打开
                String matUniqueKey = Utils.getMatUniqueKey(taskDetl.getMatnr(), taskDetl.getBatch(), taskDetl.getUniqueField());
//                WaveDetl waveDetl = waveDetlService.getOne(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getStockIndex, matUniqueKey).eq(WaveDetl::getWaveId, waveId));
@@ -943,6 +946,13 @@
                }
            }
            //库存更新逻辑
            List<Long> orderIds = dto.getList().stream().findFirst().get().getOrderIds();
            List<OrderDetl> orderDetls = orderDetlService.list(new LambdaQueryWrapper<OrderDetl>().in(OrderDetl::getOrderId, orderIds));
            orderDetls.forEach(orderDetl -> {
                orderUtils.updateWorkQty(orderDetl.getId(), orderDetl.getAnfme());
            });
            //库位F => R
            loc.setLocStsId(LocStsType.R.val());
            loc.setUpdateTime(new Date());
@@ -950,7 +960,6 @@
            if(!locUpdate){
                throw new CoolException("库位状态更新失败");
            }
        }
        Wave wave = waveService.getById(waveId);
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskLogTimer.java
@@ -1,6 +1,7 @@
package com.zy.asrs.wms.asrs.timer;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.plugins.IgnoreStrategy;
import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper;
import com.zy.asrs.framework.common.DateUtils;
@@ -17,8 +18,11 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component
public class TaskLogTimer {
@@ -44,7 +48,7 @@
    @Autowired
    private WaveService waveService;
    @Scheduled(cron = "0/30 * * * * ? ")
    @Scheduled(cron = "0/15 * * * * ? ")
    @Transactional(rollbackFor = Exception.class)
    public void inExecute() {
        InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build());
@@ -57,7 +61,6 @@
            for (Task task : list) {
                Long hostId = task.getHostId();
                //保存任务历史档
                TaskLog taskLog = new TaskLog();
                taskLog.sync(task);
@@ -65,17 +68,75 @@
                if (!taskLogService.save(taskLog)) {
                    throw new CoolException("保存任务历史档失败");
                }
                //保存任务明细历史档
                List<TaskDetl> taskDetls = taskDetlService.getTaskDetlByTaskId(task.getId());
                if (taskDetls.isEmpty()) {
                    throw new CoolException("任务明细不存在");
                } else { //XXX 先更新订单,后删除任务明细
                    if (task.getTaskType() == 53L) {
                        List<Long> waveIds = taskDetls.stream().map(TaskDetl::getWaveId).collect(Collectors.toList());
                        List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getWaveId, waveIds));
                        orders.forEach(order -> {
                        });
                    } else {
                    }
                        //任务类型为53,根据WaveId修改订单明细
                        for (TaskDetl taskDetl : taskDetls) {
                            if (task.getTaskType() == 53L) {
                                List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getWaveId, taskDetl.getWaveId()));
                                orders.forEach(order -> {
                                    List<OrderDetl> detls = orderDetlService.list(new LambdaQueryWrapper<OrderDetl>().eq(OrderDetl::getOrderId, order.getId()));
                                    if (!detls.isEmpty()) {
                                        detls.forEach(detl -> {
                                            detl.setWorkQty(detl.getWorkQty() - taskDetl.getAnfme());//工作中数量减少
                                            detl.setQty(detl.getQty() + taskDetl.getAnfme());//已完成数量增加
                                            detl.setUpdateTime(new Date());
                                        });
                                    }
                                });
                            } else {
                                if (taskDetl.getDetlId() == null) {
                                    continue;
                                }
                                OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId());
                                if (orderDetl == null) {
                                    throw new CoolException("订单明细不存在");
                                }
                                orderDetl.setWorkQty(orderDetl.getWorkQty() - taskDetl.getAnfme());//工作中数量减少
                                orderDetl.setQty(orderDetl.getQty() + taskDetl.getAnfme());//已完成数量增加
                                orderDetl.setUpdateTime(new Date());
                                if (!orderDetlService.updateById(orderDetl)) {
                                    throw new CoolException("更新订单明细失败");
                                }
                                //检测订单是否完成
                                boolean checkOrderComplete = orderService.checkOrderComplete(orderDetl.getOrderId());
                                if (checkOrderComplete) {
                                    //订单已经完成
                                    Order order = orderService.getById(orderDetl.getOrderId());
                                    if (order == null) {
                                        throw new CoolException("订单不存在");
                                    }
                                    order.setOrderSettle(OrderSettleType.COMPLETE.val());
                                    order.setUpdateTime(new Date());
                                    if (!orderService.updateById(order)) {
                                        throw new CoolException("订单更新失败");
                                    }
                                }
                            }
                        }
                }
                //删除任务历史档案
                if (!taskService.removeById(task.getId())) {
                    throw new CoolException("删除任务档失败");
                }
                //保存任务明细历史档
                List<TaskDetl> taskDetls = taskDetlService.getTaskDetlByTaskId(task.getId());
                if (taskDetls.isEmpty()) {
                    throw new CoolException("任务明细不存在");
                }
                for (TaskDetl taskDetl : taskDetls) {
                    TaskDetlLog taskDetlLog = new TaskDetlLog();
                    taskDetlLog.sync(taskDetl);
@@ -111,42 +172,6 @@
                    }
                }
                //更新订单信息
                for (TaskDetl taskDetl : taskDetls) {
                    if (taskDetl.getDetlId() == null) {
                        continue;
                    }
                    OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId());
                    if (orderDetl == null) {
                        throw new CoolException("订单明细不存在");
                    }
                    orderDetl.setWorkQty(orderDetl.getWorkQty() - taskDetl.getAnfme());//工作中数量减少
                    orderDetl.setQty(orderDetl.getQty() + taskDetl.getAnfme());//已完成数量增加
                    orderDetl.setUpdateTime(new Date());
                    if (!orderDetlService.updateById(orderDetl)) {
                        throw new CoolException("更新订单明细失败");
                    }
                    //检测订单是否完成
                    boolean checkOrderComplete = orderService.checkOrderComplete(orderDetl.getOrderId());
                    if (checkOrderComplete) {
                        //订单已经完成
                        Order order = orderService.getById(orderDetl.getOrderId());
                        if (order == null) {
                            throw new CoolException("订单不存在");
                        }
                        order.setOrderSettle(OrderSettleType.COMPLETE.val());
                        order.setUpdateTime(new Date());
                        if (!orderService.updateById(order)) {
                            throw new CoolException("订单更新失败");
                        }
                    }
                }
            }
        } catch (Exception e) {
@@ -157,7 +182,7 @@
        }
    }
    @Scheduled(cron = "0/3 * * * * ? ")
    @Scheduled(cron = "0/10 * * * * ? ")
    @Transactional(rollbackFor = Exception.class)
    public void outExecute() {
        InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build());
@@ -213,6 +238,39 @@
                taskLog.setId(null);
                if (!taskLogService.save(taskLog)) {
                    throw new CoolException("保存任务历史档失败");
                } else { //fixme 历史任务档保存后,修改订单状态信息后,再删除任务档
                    //更新订单信息
                    taskDetls.forEach(taskDetl -> {
                        if (taskDetl.getDetlId() != null) {
                            OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId());
                            if (orderDetl == null) {
                                throw new CoolException("订单明细不存在");
                            }
                            orderDetl.setWorkQty(orderDetl.getWorkQty() - taskDetl.getAnfme());//工作中数量减少
                            orderDetl.setQty(orderDetl.getQty() + taskDetl.getAnfme());//已完成数量增加
                            orderDetl.setUpdateTime(new Date());
                            if (!orderDetlService.updateById(orderDetl)) {
                                throw new CoolException("更新订单明细失败");
                            }
                            //检测订单是否完成
                            boolean checkOrderComplete = orderService.checkOrderComplete(orderDetl.getOrderId());
                            if (checkOrderComplete) {
                                //订单已经完成
                                Order order = orderService.getById(orderDetl.getOrderId());
                                if (order == null) {
                                    throw new CoolException("订单不存在");
                                }
                                order.setOrderSettle(OrderSettleType.COMPLETE.val());
                                order.setUpdateTime(new Date());
                                if (!orderService.updateById(order)) {
                                    throw new CoolException("订单更新失败");
                                }
                            }
                        }
                    });
                }
                //删除任务历史档案
@@ -254,42 +312,6 @@
                        throw new CoolException("明细删除失败");
                    }
                }
                //更新订单信息
                for (TaskDetl taskDetl : taskDetls) {
                    if (taskDetl.getDetlId() == null) {
                        continue;
                    }
                    OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId());
                    if (orderDetl == null) {
                        throw new CoolException("订单明细不存在");
                    }
                    orderDetl.setWorkQty(orderDetl.getWorkQty() - taskDetl.getAnfme());//工作中数量减少
                    orderDetl.setQty(orderDetl.getQty() + taskDetl.getAnfme());//已完成数量增加
                    orderDetl.setUpdateTime(new Date());
                    if (!orderDetlService.updateById(orderDetl)) {
                        throw new CoolException("更新订单明细失败");
                    }
                    //检测订单是否完成
                    boolean checkOrderComplete = orderService.checkOrderComplete(orderDetl.getOrderId());
                    if (checkOrderComplete) {
                        //订单已经完成
                        Order order = orderService.getById(orderDetl.getOrderId());
                        if (order == null) {
                            throw new CoolException("订单不存在");
                        }
                        order.setOrderSettle(OrderSettleType.COMPLETE.val());
                        order.setUpdateTime(new Date());
                        if (!orderService.updateById(order)) {
                            throw new CoolException("订单更新失败");
                        }
                    }
                }
            }
        } catch (Exception e) {
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java
@@ -160,8 +160,8 @@
    private void executeTask1(Task task) {
        Long hostId = task.getHostId();
        //fixme 暂时关闭HOSTID
//        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()).eq(Loc::getHostId, hostId));
        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()));
        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()).eq(Loc::getHostId, hostId));
//        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()));
        if (loc == null) {
            log.info("库位不存在" + "=======>" + task.getTargetLoc());
            throw new CoolException("库位不存在");
@@ -223,6 +223,7 @@
        for (WaitPakin waitPakin : waitPakins) {
            WaitPakinLog waitPakinLog = new WaitPakinLog();
            waitPakinLog.sync(waitPakin);
            waitPakinLog.setId(null);
            if (!waitPakinLogService.save(waitPakinLog)) {
                throw new CoolException("组托通知档转历史档失败");
            }
zy-asrs-wms/src/main/java/com/zy/asrs/wms/common/config/MybatisPlusConfig.java
@@ -24,7 +24,7 @@
 * @author vincent
 * @since 2018-02-22 11:29:28
 */
//@Configuration
@Configuration
public class MybatisPlusConfig {
@@ -39,10 +39,10 @@
                return getLoginUserTenantId();
            }
//            @Override
//            public String getTenantIdColumn() {
//                return "host_id";
//            }
            @Override
            public String getTenantIdColumn() {
                return "host_id";
            }
            @Override
            public boolean ignoreTable(String tableName) {
@@ -87,6 +87,8 @@
                if (object instanceof UserLogin) {
                    return new LongValue(((UserLogin) object).getHostId());
                }
            } else {
                return  new LongValue(1);
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
zy-asrs-wms/src/main/java/com/zy/asrs/wms/utils/LocUtils.java
@@ -51,7 +51,7 @@
        List<Loc> locs = new ArrayList<>();
        List<Map<String, Object>> list = viewTaskDetlMapper.getList(mat.getMatnr(), batch, uniqueFields);
        for (Map<String, Object> map : list) {
            Task task = taskService.getById(map.get("task_id").toString());
            Task task = taskService.getById(map.get("taskId").toString());
            if (task == null) {
                continue;
            }
@@ -73,7 +73,7 @@
        List<Loc> locs2 = new ArrayList<>();
        List<Map<String, Object>> list2 = viewLocDetlMapper.getList(mat.getMatnr(), batch, uniqueFields, null);
        for (Map<String, Object> map : list2) {
            Loc one = locService.getById(map.get("loc_id").toString());
            Loc one = locService.getById(map.get("locId").toString());
            if (one == null) {
                continue;
            }
zy-asrs-wms/src/main/resources/application.yml
@@ -37,7 +37,7 @@
  #  global-config:
  #    field-strategy: 0
  configuration:
#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    map-underscore-to-camel-case: true
    cache-enabled: true
  global-config:
zy-asrs-wms/src/main/resources/mapper/asrs/ViewLocDetlMapper.xml
@@ -6,9 +6,7 @@
        select * from view_man_loc_detl ld
        where matnr = #{matnr}
        and freeze = 0
        <if test="batch != null and batch != ''">
            and batch = #{batch}
        </if>
        and batch = #{batch}
        <if test="param!=null and param.size()>0">
            <foreach item="item" collection="param" index="index">
                <if test="item.value!=null and item.value != ''">