38 changed files with 2731 additions and 24 deletions
@ -0,0 +1,42 @@ |
|||
package org.nl.wms.sch_manage.enums; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Getter; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.MapOf; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 任务枚举类 |
|||
* |
|||
* @author Liuxy |
|||
* @Date 2025/05/26 |
|||
*/ |
|||
@AllArgsConstructor |
|||
@Getter |
|||
public enum TaskEnum { |
|||
|
|||
// ACS有限级别
|
|||
ACS_PRIORITY(MapOf.of("1", "1", "2", "2", "3", "4")) |
|||
; |
|||
|
|||
private Map<String, String> code; |
|||
|
|||
public String code(String desc) { |
|||
String code = this.getCode().get(desc); |
|||
if (StringUtils.isNotEmpty(code)) { |
|||
return code; |
|||
} |
|||
throw new BadRequestException(this.name() + "对应类型" + desc + "未定义"); |
|||
} |
|||
|
|||
public String check(String code) { |
|||
for (Map.Entry<String, String> entry : this.getCode().entrySet()) |
|||
if (entry.getValue().equals("code")) { |
|||
return entry.getValue(); |
|||
} |
|||
throw new BadRequestException(this.name() + "对应类型" + code + "未定义"); |
|||
} |
|||
} |
@ -0,0 +1,162 @@ |
|||
package org.nl.wms.sch_manage.service.util.tasks; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.config.IdUtil; |
|||
import org.nl.wms.sch_manage.enums.TaskStatus; |
|||
import org.nl.wms.sch_manage.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch_manage.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch_manage.service.util.AbstractTask; |
|||
import org.nl.wms.sch_manage.service.util.AcsTaskDto; |
|||
import org.nl.wms.sch_manage.service.util.TaskType; |
|||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvService; |
|||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvdtlService; |
|||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinvdtl; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
/** |
|||
* @Author: Liuxy |
|||
* @Description: 移库任务类 |
|||
* @Date: 2025/5/25 |
|||
*/ |
|||
@Component(value = "MoveTask") |
|||
@TaskType("MoveTask") |
|||
public class MoveTask extends AbstractTask { |
|||
|
|||
/** |
|||
* 任务服务类 |
|||
*/ |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
|
|||
/** |
|||
* 移库主表服务类 |
|||
*/ |
|||
@Autowired |
|||
private IStIvtMoveinvService iStIvtMoveinvService; |
|||
|
|||
/** |
|||
* 移库明细服务类 |
|||
*/ |
|||
@Autowired |
|||
private IStIvtMoveinvdtlService iStIvtMoveinvdtlService; |
|||
|
|||
@Override |
|||
public String create(JSONObject json) { |
|||
SchBaseTask task = new SchBaseTask(); |
|||
task.setTask_id(IdUtil.getStringId()); |
|||
task.setTask_code(IdUtil.getStringId()); |
|||
task.setTask_status(TaskStatus.CREATE.getCode()); |
|||
task.setConfig_code(json.getString("config_code")); |
|||
task.setPoint_code1(json.getString("point_code1")); |
|||
task.setPoint_code2(json.getString("point_code2")); |
|||
task.setVehicle_code(json.getString("vehicle_code")); |
|||
task.setRequest_param(json.toString()); |
|||
task.setPriority(json.getString("Priority")); |
|||
task.setCreate_id(SecurityUtils.getCurrentUserId()); |
|||
task.setCreate_name(SecurityUtils.getCurrentNickName()); |
|||
task.setCreate_time(DateUtil.now()); |
|||
taskService.save(task); |
|||
return task.getTask_id(); |
|||
} |
|||
|
|||
@Override |
|||
public AcsTaskDto sendAcsParam(String taskId) { |
|||
SchBaseTask taskDao = taskService.getById(taskId); |
|||
|
|||
// 组织下发给acs的数据
|
|||
AcsTaskDto acsTaskDto = new AcsTaskDto(); |
|||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id()); |
|||
acsTaskDto.setTask_code(taskDao.getTask_code()); |
|||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1()); |
|||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2()); |
|||
acsTaskDto.setPriority(taskDao.getPriority()); |
|||
acsTaskDto.setTask_type("1"); |
|||
return acsTaskDto; |
|||
} |
|||
|
|||
@Override |
|||
protected void updateStatus(String task_code, TaskStatus status) { |
|||
// 校验任务
|
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("该任务已完成!"); |
|||
} |
|||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { |
|||
throw new BadRequestException("该任务已取消!"); |
|||
} |
|||
// 根据传来的类型去对任务进行操作
|
|||
if (status.equals(TaskStatus.EXECUTING)) { |
|||
// 更新明细状态
|
|||
iStIvtMoveinvService.executing(taskObj); |
|||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); |
|||
taskObj.setRemark("执行中"); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
if (status.equals(TaskStatus.FINISHED)) { |
|||
this.finishTask(taskObj); |
|||
} |
|||
if (status.equals(TaskStatus.CANCELED)) { |
|||
this.cancelTask(taskObj); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
this.finishTask(taskObj); |
|||
} |
|||
|
|||
@Override |
|||
public void cancel(String task_code) { |
|||
SchBaseTask taskObj = taskService.getByCode(task_code); |
|||
if (ObjectUtil.isEmpty(taskObj)) { |
|||
throw new BadRequestException("该任务不存在"); |
|||
} |
|||
if (Integer.parseInt(taskObj.getTask_status()) > Integer.parseInt(TaskStatus.CREATE.getCode())) { |
|||
throw new BadRequestException("只能取消生成中的任务!"); |
|||
} |
|||
this.cancelTask(taskObj); |
|||
} |
|||
|
|||
@Override |
|||
public void backMes(String task_code) { |
|||
} |
|||
|
|||
@Transactional |
|||
public void finishTask(SchBaseTask taskObj) { |
|||
// 完成任务
|
|||
StIvtMoveinvdtl dtlDao = iStIvtMoveinvdtlService.getOne( |
|||
new QueryWrapper<StIvtMoveinvdtl>().lambda() |
|||
.eq(StIvtMoveinvdtl::getTask_id, taskObj.getTask_id()) |
|||
); |
|||
iStIvtMoveinvService.confirmTask(dtlDao); |
|||
// 更新任务状态
|
|||
taskObj.setRemark("已完成"); |
|||
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
|
|||
@Transactional |
|||
public void cancelTask(SchBaseTask taskObj) { |
|||
// 删除任务
|
|||
StIvtMoveinvdtl dtlDao = iStIvtMoveinvdtlService.getOne( |
|||
new QueryWrapper<StIvtMoveinvdtl>().lambda() |
|||
.eq(StIvtMoveinvdtl::getTask_id, taskObj.getTask_id()) |
|||
); |
|||
iStIvtMoveinvService.cancelTask(dtlDao); |
|||
// 更新任务状态
|
|||
taskObj.setRemark("已取消"); |
|||
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
|||
taskService.updateById(taskObj); |
|||
} |
|||
} |
@ -0,0 +1,84 @@ |
|||
package org.nl.wms.warehouse_management.controller; |
|||
|
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvService; |
|||
import org.nl.wms.warehouse_management.service.dto.MoveInsertDto; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 基础分类表 控制层 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-05-26 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/api/moveStor") |
|||
@Slf4j |
|||
public class MoveStorController { |
|||
|
|||
@Autowired |
|||
private IStIvtMoveinvService iStIvtMoveinvService; |
|||
|
|||
@GetMapping |
|||
@Log("查询移库单") |
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(iStIvtMoveinvService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增移库单") |
|||
public ResponseEntity<Object> create(@Validated @RequestBody MoveInsertDto dto) { |
|||
iStIvtMoveinvService.create(dto); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改移库单") |
|||
public ResponseEntity<Object> update(@Validated @RequestBody MoveInsertDto dto) { |
|||
iStIvtMoveinvService.update(dto); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
@Log("删除移库单") |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
iStIvtMoveinvService.delete(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@GetMapping("/getMoveDtl") |
|||
@Log("查询移库单明细") |
|||
public ResponseEntity<Object> getMoveDtl(@RequestParam Map whereJson) { |
|||
return new ResponseEntity<>(iStIvtMoveinvService.getMoveDtl(whereJson), HttpStatus.OK); |
|||
} |
|||
|
|||
@GetMapping("/getCanuseIvt") |
|||
@Log("获取可用库存物料") |
|||
public ResponseEntity<Object> getCanuseIvt(@RequestParam Map whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(iStIvtMoveinvService.getCanuseIvt(whereJson,page)),HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/confirm") |
|||
@Log("强制确认") |
|||
public ResponseEntity<Object> confirm(@RequestBody MoveInsertDto dto) { |
|||
iStIvtMoveinvService.confirm(dto); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,100 @@ |
|||
package org.nl.wms.warehouse_management.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.wms.sch_manage.service.dao.SchBaseTask; |
|||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinv; |
|||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinvdtl; |
|||
import org.nl.wms.warehouse_management.service.dto.MoveInsertDto; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 移库单主表 服务类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-05-26 |
|||
*/ |
|||
public interface IStIvtMoveinvService extends IService<StIvtMoveinv> { |
|||
|
|||
/** |
|||
* 分页查询 |
|||
* @param whereJson : {查询参数} |
|||
* @param page : 分页对象 |
|||
* @return 返回结果 |
|||
*/ |
|||
IPage<JSONObject> queryAll(Map whereJson, PageQuery page); |
|||
|
|||
/** |
|||
* 新增移库单 |
|||
* @param dto:新增修改dto实体类 |
|||
*/ |
|||
void create(MoveInsertDto dto); |
|||
|
|||
/** |
|||
* 修改移库单 |
|||
* @param dto:新增修改dto实体类 |
|||
*/ |
|||
void update(MoveInsertDto dto); |
|||
|
|||
/** |
|||
* 删除移库单据 |
|||
* @param ids 标识id集合 |
|||
*/ |
|||
void delete(Set<String> ids); |
|||
|
|||
/** |
|||
* 查询移库单明细 |
|||
* @param whereJson |
|||
* { |
|||
* moveinv_id 移库单标识 |
|||
* } |
|||
* @return List<JSONObject> |
|||
*/ |
|||
List<JSONObject> getMoveDtl(Map whereJson); |
|||
|
|||
/** |
|||
* 获取可用库存物料 |
|||
* @param whereJson : { |
|||
* 分页参数:page,size |
|||
* stor_id: 仓库id |
|||
* sect_id: 库区id |
|||
* struct_code: 货位编码 |
|||
* material_code: 物料编码 |
|||
* pcsn: 批次 |
|||
* } |
|||
* @param page : 分页对象 |
|||
* @return 返回结果 |
|||
*/ |
|||
IPage<JSONObject> getCanuseIvt(Map whereJson, PageQuery page); |
|||
|
|||
/** |
|||
* 取消任务 |
|||
* @param dtlDao 明细实体类 |
|||
*/ |
|||
void cancelTask(StIvtMoveinvdtl dtlDao); |
|||
|
|||
/** |
|||
* 完成任务 |
|||
* @param dtlDao 明细实体类 |
|||
*/ |
|||
void confirmTask(StIvtMoveinvdtl dtlDao); |
|||
|
|||
/** |
|||
* 执行任务 |
|||
* @param taskObj 任务明细 |
|||
*/ |
|||
void executing(SchBaseTask taskObj); |
|||
|
|||
/** |
|||
* 强制确认 |
|||
* @param dto 新增修改dto实体类 |
|||
*/ |
|||
void confirm(MoveInsertDto dto); |
|||
} |
@ -0,0 +1,41 @@ |
|||
package org.nl.wms.warehouse_management.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinvdtl; |
|||
import org.nl.wms.warehouse_management.service.dto.MoveInsertDto; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* <p> |
|||
* 移库单明细表 服务类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-05-26 |
|||
*/ |
|||
public interface IStIvtMoveinvdtlService extends IService<StIvtMoveinvdtl> { |
|||
|
|||
/** |
|||
* 新增移库明细 |
|||
* @param dto 新增修改dto实体类 |
|||
*/ |
|||
void createMoveDtl(MoveInsertDto dto); |
|||
|
|||
/** |
|||
* 查询移库单明细 |
|||
* @param whereJson { |
|||
* moveinv_id 移库单标识 |
|||
* } |
|||
* @return List<JSONObject> |
|||
*/ |
|||
List<JSONObject> getMoveDtl(Map whereJson); |
|||
|
|||
/** |
|||
* 删除明细以及任务 |
|||
* @param dto 新增修改dto实体类 |
|||
*/ |
|||
void deleteDtl(MoveInsertDto dto); |
|||
} |
@ -0,0 +1,133 @@ |
|||
package org.nl.wms.warehouse_management.service.dao; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* <p> |
|||
* 移库单主表 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-05-26 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("st_ivt_moveinv") |
|||
public class StIvtMoveinv implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 移库单标识 |
|||
*/ |
|||
@TableId(value = "moveinv_id") |
|||
private String moveinv_id; |
|||
|
|||
/** |
|||
* 单据编号 |
|||
*/ |
|||
private String bill_code; |
|||
|
|||
/** |
|||
* 单据类型 |
|||
*/ |
|||
private String bill_type; |
|||
|
|||
/** |
|||
* 业务日期 |
|||
*/ |
|||
private String biz_date; |
|||
|
|||
/** |
|||
* 仓库标识 |
|||
*/ |
|||
private String stor_id; |
|||
|
|||
/** |
|||
* 总数量 |
|||
*/ |
|||
private BigDecimal total_qty; |
|||
|
|||
/** |
|||
* 明细数 |
|||
*/ |
|||
private BigDecimal detail_count; |
|||
|
|||
/** |
|||
* 单据状态 |
|||
*/ |
|||
private String bill_status; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 生成方式 |
|||
*/ |
|||
private String create_mode; |
|||
|
|||
/** |
|||
* 制单人 |
|||
*/ |
|||
private String input_optid; |
|||
|
|||
/** |
|||
* 制单人姓名 |
|||
*/ |
|||
private String input_optname; |
|||
|
|||
/** |
|||
* 制单时间 |
|||
*/ |
|||
private String input_time; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_optid; |
|||
|
|||
/** |
|||
* 修改人姓名 |
|||
*/ |
|||
private String update_optname; |
|||
|
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private String update_time; |
|||
|
|||
/** |
|||
* 确认人 |
|||
*/ |
|||
private String confirm_optid; |
|||
|
|||
/** |
|||
* 确认人姓名 |
|||
*/ |
|||
private String confirm_optname; |
|||
|
|||
/** |
|||
* 确认时间 |
|||
*/ |
|||
private String confirm_time; |
|||
|
|||
/** |
|||
* 确认说明 |
|||
*/ |
|||
private String confirm_info; |
|||
|
|||
/** |
|||
* 是否删除 |
|||
*/ |
|||
private String is_delete; |
|||
|
|||
|
|||
} |
@ -0,0 +1,118 @@ |
|||
package org.nl.wms.warehouse_management.service.dao; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* <p> |
|||
* 移库单明细表 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-05-26 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("st_ivt_moveinvdtl") |
|||
public class StIvtMoveinvdtl implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 移库单明细标识 |
|||
*/ |
|||
@TableId(value = "moveinvdtl_id") |
|||
private String moveinvdtl_id; |
|||
|
|||
/** |
|||
* 移库单标识 |
|||
*/ |
|||
private String moveinv_id; |
|||
|
|||
/** |
|||
* 明细序号 |
|||
*/ |
|||
private BigDecimal seq_no; |
|||
|
|||
/** |
|||
* 转出库区编码 |
|||
*/ |
|||
private String turnout_sect_code; |
|||
|
|||
/** |
|||
* 转出仓位编码 |
|||
*/ |
|||
private String turnout_struct_code; |
|||
|
|||
/** |
|||
* 物料编码 |
|||
*/ |
|||
private String material_code; |
|||
|
|||
/** |
|||
* 批次 |
|||
*/ |
|||
private String pcsn; |
|||
|
|||
/** |
|||
* 数量计量单位标识 |
|||
*/ |
|||
private String qty_unit_id; |
|||
|
|||
/** |
|||
* 数量计量单位名称 |
|||
*/ |
|||
private String qty_unit_name; |
|||
|
|||
/** |
|||
* 数量 |
|||
*/ |
|||
private BigDecimal qty; |
|||
|
|||
/** |
|||
* 转入库区编码 |
|||
*/ |
|||
private String turnin_sect_code; |
|||
|
|||
/** |
|||
* 转入仓位编码 |
|||
*/ |
|||
private String turnin_struct_code; |
|||
|
|||
/** |
|||
* 执行状态 |
|||
*/ |
|||
private String work_status; |
|||
|
|||
/** |
|||
* 任务标识 |
|||
*/ |
|||
private String task_id; |
|||
|
|||
/** |
|||
* 存储载具编码 |
|||
*/ |
|||
private String storagevehicle_code; |
|||
|
|||
/** |
|||
* 是否已下发 |
|||
*/ |
|||
private String is_issued; |
|||
|
|||
/** |
|||
* 来源单编号 |
|||
*/ |
|||
private String source_bill_code; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
package org.nl.wms.warehouse_management.service.dao.mapper; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinv; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* <p> |
|||
* 移库单主表 Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-05-26 |
|||
*/ |
|||
public interface StIvtMoveinvMapper extends BaseMapper<StIvtMoveinv> { |
|||
|
|||
/** |
|||
* 分页查询 |
|||
* @param page 分页条件 |
|||
* @param whereJson 查询条件 |
|||
* @return IPage<StIvtMoveinv> |
|||
*/ |
|||
IPage<JSONObject> queryAllByPage(Page<StIvtMoveinv> page, @Param("param") Map whereJson); |
|||
} |
@ -0,0 +1,57 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.nl.wms.warehouse_management.service.dao.mapper.StIvtMoveinvMapper"> |
|||
|
|||
<select id="queryAllByPage" resultType="com.alibaba.fastjson.JSONObject"> |
|||
SELECT |
|||
ios.*, |
|||
attr.stor_name |
|||
FROM |
|||
st_ivt_moveinv ios |
|||
LEFT JOIN st_ivt_moveinvdtl dtl ON ios.moveinv_id = dtl.moveinv_id |
|||
LEFT JOIN st_ivt_bsrealstorattr attr ON ios.stor_id = attr.stor_id |
|||
<where> |
|||
ios.is_delete = '0' |
|||
<if test="param.bill_code != null and param.bill_code != ''"> |
|||
AND |
|||
ios.bill_code LIKE #{param.bill_code} |
|||
</if> |
|||
|
|||
<if test="param.stor_id != null and param.stor_id != ''"> |
|||
AND |
|||
ios.stor_id = #{param.stor_id} |
|||
</if> |
|||
|
|||
<if test="param.material_code != null and param.material_code != ''"> |
|||
AND |
|||
dtl.material_code LIKE #{param.material_code} |
|||
</if> |
|||
|
|||
<if test="param.create_mode != null and param.create_mode != ''"> |
|||
AND |
|||
ios.create_mode = #{param.create_mode} |
|||
</if> |
|||
|
|||
<if test="param.bill_status != null and param.bill_status != ''"> |
|||
AND |
|||
ios.bill_status = #{param.bill_status} |
|||
</if> |
|||
|
|||
<if test="param.bill_type != null and param.bill_type != ''"> |
|||
AND |
|||
ios.bill_type = #{param.bill_type} |
|||
</if> |
|||
|
|||
<if test="param.begin_time != null and param.begin_time != ''"> |
|||
AND |
|||
ios.input_time >= #{param.begin_time} |
|||
</if> |
|||
<if test="param.end_time != null and param.end_time != ''"> |
|||
AND |
|||
#{param.end_time} >= ios.input_time |
|||
</if> |
|||
</where> |
|||
ORDER BY ios.input_time Desc |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,29 @@ |
|||
package org.nl.wms.warehouse_management.service.dao.mapper; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinvdtl; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* <p> |
|||
* 移库单明细表 Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-05-26 |
|||
*/ |
|||
public interface StIvtMoveinvdtlMapper extends BaseMapper<StIvtMoveinvdtl> { |
|||
|
|||
/** |
|||
* 查询移库单明细 |
|||
* @param whereJson { |
|||
* moveinv_id 移库单标识 |
|||
* } |
|||
* @return List<JSONObject> |
|||
*/ |
|||
List<JSONObject> getMoveDtl(@Param("param") Map whereJson); |
|||
} |
@ -0,0 +1,38 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.nl.wms.warehouse_management.service.dao.mapper.StIvtMoveinvdtlMapper"> |
|||
|
|||
|
|||
<select id="getMoveDtl" resultType="com.alibaba.fastjson.JSONObject"> |
|||
SELECT |
|||
dtl.moveinvdtl_id, |
|||
dtl.work_status, |
|||
material.material_id, |
|||
material.material_code, |
|||
material.material_name, |
|||
dtl.pcsn, |
|||
dtl.qty, |
|||
dtl.qty_unit_id, |
|||
dtl.qty_unit_name, |
|||
dtl.storagevehicle_code, |
|||
attrout.sect_name AS turnout_sect_name, |
|||
attrout.sect_code AS turnout_sect_code, |
|||
attrout.struct_code AS turnout_struct_code, |
|||
attrin.sect_name AS turnin_sect_name, |
|||
attrin.sect_code AS turnin_sect_code, |
|||
attrin.struct_code AS turnin_struct_code |
|||
FROM |
|||
st_ivt_moveinvdtl dtl |
|||
LEFT JOIN st_ivt_moveinv ios ON ios.moveinv_id = dtl.moveinv_id |
|||
LEFT JOIN md_me_materialbase material ON material.material_code = dtl.material_code |
|||
LEFT JOIN st_ivt_structattr attrout ON attrout.struct_code = dtl.turnout_struct_code |
|||
LEFT JOIN st_ivt_structattr attrin ON attrin.struct_code = dtl.turnin_struct_code |
|||
<where> |
|||
ios.is_delete = '0' |
|||
<if test="param.moveinv_id != null and param.moveinv_id != ''"> |
|||
AND |
|||
ios.moveinv_id = #{param.moveinv_id} |
|||
</if> |
|||
</where> |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,82 @@ |
|||
package org.nl.wms.warehouse_management.service.dto; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 新增修改dto实体类 |
|||
* @author Liuxy |
|||
* 2025/5/26 |
|||
*/ |
|||
@Data |
|||
public class MoveInsertDto { |
|||
|
|||
/** |
|||
* 单据标识 |
|||
*/ |
|||
private String moveinv_id; |
|||
|
|||
/** |
|||
* 单据状态 |
|||
*/ |
|||
private String bill_status; |
|||
|
|||
/** |
|||
* 单据类型 |
|||
*/ |
|||
private String bill_type; |
|||
|
|||
/** |
|||
* 业务日期 |
|||
*/ |
|||
private String biz_date; |
|||
|
|||
/** |
|||
* 明细数 |
|||
*/ |
|||
private BigDecimal detail_count; |
|||
|
|||
/** |
|||
* 仓库标识 |
|||
*/ |
|||
private String stor_id; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 总数量 |
|||
*/ |
|||
private BigDecimal total_qty; |
|||
|
|||
/** |
|||
* 任务id(取消任务时用到) |
|||
*/ |
|||
private BigDecimal task_id; |
|||
|
|||
/** |
|||
* 明细数据: |
|||
* { |
|||
* material_code 物料编码 |
|||
* material_id 物料id |
|||
* material_name 物料名称 |
|||
* pcsn 批次 |
|||
* qty 数量 |
|||
* qty_unit_id 计量单位标识 |
|||
* qty_unit_name 计量单位名称 |
|||
* storagevehicle_code 载具编码 |
|||
* turnin_sect_code 移入库区 |
|||
* turnin_struct_code 移入仓位 |
|||
* turnout_sect_code 移出库区 |
|||
* turnout_struct_code 移出仓位 |
|||
* work_status 执行状态 |
|||
* remark 备注 |
|||
* } |
|||
*/ |
|||
private List<JSONObject> tableData; |
|||
} |
@ -0,0 +1,317 @@ |
|||
package org.nl.wms.warehouse_management.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.utils.CodeUtil; |
|||
import org.nl.common.utils.IdUtil; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService; |
|||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService; |
|||
import org.nl.wms.basedata_manage.service.IStructattrService; |
|||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase; |
|||
import org.nl.wms.basedata_manage.service.dao.Structattr; |
|||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper; |
|||
import org.nl.wms.sch_manage.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch_manage.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch_manage.service.util.tasks.MoveTask; |
|||
import org.nl.wms.warehouse_management.enums.IOSConstant; |
|||
import org.nl.wms.warehouse_management.enums.IOSEnum; |
|||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvService; |
|||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvdtlService; |
|||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinv; |
|||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinvdtl; |
|||
import org.nl.wms.warehouse_management.service.dao.mapper.StIvtMoveinvMapper; |
|||
import org.nl.wms.warehouse_management.service.dto.MoveInsertDto; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* <p> |
|||
* 移库单主表 服务实现类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-05-26 |
|||
*/ |
|||
@Service |
|||
public class StIvtMoveinvServiceImpl extends ServiceImpl<StIvtMoveinvMapper, StIvtMoveinv> implements IStIvtMoveinvService { |
|||
|
|||
/** |
|||
* 载具扩展属性mapper |
|||
*/ |
|||
@Autowired |
|||
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper; |
|||
|
|||
/** |
|||
* 载具扩展属性服务类 |
|||
*/ |
|||
@Autowired |
|||
private IMdPbStoragevehicleextService iMdPbStoragevehicleextService; |
|||
|
|||
/** |
|||
* 移库单明细服务 |
|||
*/ |
|||
@Autowired |
|||
private IStIvtMoveinvdtlService iStIvtMoveinvdtlService; |
|||
|
|||
/** |
|||
* 物料服务 |
|||
*/ |
|||
@Autowired |
|||
private IMdMeMaterialbaseService iMdMeMaterialbaseService; |
|||
|
|||
/** |
|||
* 仓位服务 |
|||
*/ |
|||
@Autowired |
|||
private IStructattrService iStructattrService; |
|||
|
|||
/** |
|||
* 任务服务 |
|||
*/ |
|||
@Autowired |
|||
private ISchBaseTaskService iSchBaseTaskService; |
|||
|
|||
/** |
|||
* 移库任务配置类 |
|||
*/ |
|||
@Autowired |
|||
private MoveTask moveTask; |
|||
|
|||
@Override |
|||
public IPage<JSONObject> queryAll(Map whereJson, PageQuery page) { |
|||
return this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()), |
|||
whereJson); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void create(MoveInsertDto dto) { |
|||
// 主表数据
|
|||
StIvtMoveinv moveDao = new StIvtMoveinv(); |
|||
moveDao.setMoveinv_id(IdUtil.getStringId()); |
|||
moveDao.setBill_code(CodeUtil.getNewCode("MOVE_STORE_CODE")); |
|||
moveDao.setBill_type(dto.getBill_type()); |
|||
moveDao.setBiz_date(dto.getBiz_date().substring(0, 10)); |
|||
moveDao.setStor_id(dto.getStor_id()); |
|||
moveDao.setTotal_qty(dto.getTotal_qty()); |
|||
moveDao.setDetail_count(dto.getDetail_count()); |
|||
moveDao.setBill_status(dto.getBill_status()); |
|||
moveDao.setRemark(dto.getRemark()); |
|||
moveDao.setCreate_mode(IOSEnum.CREATE_MODE.code("PC产生")); |
|||
moveDao.setInput_optid(SecurityUtils.getCurrentUserId()); |
|||
moveDao.setInput_optname(SecurityUtils.getCurrentNickName()); |
|||
moveDao.setInput_time(DateUtil.now()); |
|||
this.save(moveDao); |
|||
|
|||
// 新增明细以及任务
|
|||
dto.setMoveinv_id(moveDao.getMoveinv_id()); |
|||
iStIvtMoveinvdtlService.createMoveDtl(dto); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void update(MoveInsertDto dto) { |
|||
StIvtMoveinv moveDao = this.baseMapper.selectById(dto.getMoveinv_id()); |
|||
moveDao.setStor_id(dto.getStor_id()); |
|||
moveDao.setBill_type(dto.getBill_type()); |
|||
moveDao.setBiz_date(dto.getBiz_date().substring(0, 10)); |
|||
moveDao.setTotal_qty(dto.getTotal_qty()); |
|||
moveDao.setRemark(dto.getRemark()); |
|||
moveDao.setUpdate_optid(SecurityUtils.getCurrentUserId()); |
|||
moveDao.setUpdate_optname(SecurityUtils.getCurrentNickName()); |
|||
moveDao.setUpdate_time(DateUtil.now()); |
|||
this.updateById(moveDao); |
|||
// 删除明细以及任务
|
|||
iStIvtMoveinvdtlService.deleteDtl(dto); |
|||
// 新增明细以及任务
|
|||
iStIvtMoveinvdtlService.createMoveDtl(dto); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void delete(Set<String> ids) { |
|||
for(String moveinv_id : ids) { |
|||
JSONObject json = new JSONObject(); |
|||
json.put("moveinv_id",moveinv_id); |
|||
List<JSONObject> moveDtl = iStIvtMoveinvdtlService.getMoveDtl(json); |
|||
|
|||
// 组织删除参数
|
|||
MoveInsertDto moveInsertDto = new MoveInsertDto(); |
|||
moveInsertDto.setMoveinv_id(moveinv_id); |
|||
moveInsertDto.setTableData(moveDtl); |
|||
iStIvtMoveinvdtlService.deleteDtl(moveInsertDto); |
|||
} |
|||
// 删除
|
|||
this.removeByIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
public List<JSONObject> getMoveDtl(Map whereJson) { |
|||
return iStIvtMoveinvdtlService.getMoveDtl(whereJson); |
|||
} |
|||
|
|||
@Override |
|||
public IPage<JSONObject> getCanuseIvt(Map whereJson, PageQuery page) { |
|||
return mdPbStoragevehicleextMapper.getCanuseIvt(new Page<>(page.getPage() + 1, page.getSize()), |
|||
whereJson); |
|||
} |
|||
|
|||
@Override |
|||
public void cancelTask(StIvtMoveinvdtl dtlDao) { |
|||
// 查询此单据下是否只有当前一条明细
|
|||
int count = iStIvtMoveinvdtlService.count( |
|||
new QueryWrapper<StIvtMoveinvdtl>().lambda() |
|||
.eq(StIvtMoveinvdtl::getMoveinv_id, dtlDao.getMoveinv_id()) |
|||
); |
|||
if (count == 1) { |
|||
// 直接删除单据
|
|||
Set<String> idsList = new HashSet<>(); |
|||
idsList.add(dtlDao.getMoveinv_id()); |
|||
delete(idsList); |
|||
} else { |
|||
// 删除当前一条明细
|
|||
List<JSONObject> moveDtl = iStIvtMoveinvdtlService.getMoveDtl(JSONObject.parseObject(JSONObject.toJSONString(dtlDao),JSONObject.class)); |
|||
// 过滤当前明细
|
|||
List<JSONObject> paramList = moveDtl.stream() |
|||
.filter(row -> row.getString("moveinvdtl_id").equals(dtlDao.getMoveinvdtl_id())) |
|||
.collect(Collectors.toList()); |
|||
// 组织删除参数
|
|||
MoveInsertDto moveInsertDto = new MoveInsertDto(); |
|||
moveInsertDto.setMoveinv_id(dtlDao.getMoveinv_id()); |
|||
moveInsertDto.setTableData(paramList); |
|||
iStIvtMoveinvdtlService.deleteDtl(moveInsertDto); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void confirmTask(StIvtMoveinvdtl dtlDao) { |
|||
// 需要更新库存集合
|
|||
List<JSONObject> updateIvtList = new ArrayList<>(); |
|||
// 查询物料
|
|||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getOne( |
|||
new QueryWrapper<MdMeMaterialbase>().lambda() |
|||
.eq(MdMeMaterialbase::getMaterial_code, dtlDao.getMaterial_code()) |
|||
); |
|||
|
|||
JSONObject jsonIvt = new JSONObject(); |
|||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN); |
|||
jsonIvt.put("storagevehicle_code", dtlDao.getStoragevehicle_code()); |
|||
jsonIvt.put("material_id", materDao.getMaterial_id()); |
|||
jsonIvt.put("pcsn", dtlDao.getPcsn()); |
|||
jsonIvt.put("qty_unit_id", dtlDao.getQty_unit_id()); |
|||
jsonIvt.put("qty_unit_name", dtlDao.getQty_unit_name()); |
|||
jsonIvt.put("change_qty", dtlDao.getQty()); |
|||
updateIvtList.add(jsonIvt); |
|||
JSONObject jsonIvtTwo = new JSONObject(); |
|||
jsonIvtTwo.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_CANUSE); |
|||
jsonIvtTwo.put("storagevehicle_code", dtlDao.getStoragevehicle_code()); |
|||
jsonIvtTwo.put("material_id", materDao.getMaterial_id()); |
|||
jsonIvtTwo.put("pcsn", dtlDao.getPcsn()); |
|||
jsonIvtTwo.put("qty_unit_id", dtlDao.getQty_unit_id()); |
|||
jsonIvtTwo.put("qty_unit_name", dtlDao.getQty_unit_name()); |
|||
jsonIvtTwo.put("change_qty", dtlDao.getQty()); |
|||
updateIvtList.add(jsonIvtTwo); |
|||
iMdPbStoragevehicleextService.updateIvt(updateIvtList); |
|||
|
|||
// 更新起点
|
|||
iStructattrService.update( |
|||
new UpdateWrapper<Structattr>().lambda() |
|||
.eq(Structattr::getStruct_code, dtlDao.getTurnout_struct_code()) |
|||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定")) |
|||
.set(Structattr::getStoragevehicle_code, null) |
|||
); |
|||
// 更新终点
|
|||
iStructattrService.update( |
|||
new UpdateWrapper<Structattr>().lambda() |
|||
.eq(Structattr::getStruct_code, dtlDao.getTurnin_struct_code()) |
|||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定")) |
|||
.set(Structattr::getStoragevehicle_code, dtlDao.getStoragevehicle_code()) |
|||
); |
|||
|
|||
// 更新明细状态
|
|||
dtlDao.setWork_status(IOSEnum.MOVE_DTL_STATUS.code("完成")); |
|||
iStIvtMoveinvdtlService.updateById(dtlDao); |
|||
|
|||
// 更新主表状态
|
|||
updateMstStatus(dtlDao.getMoveinv_id()); |
|||
} |
|||
|
|||
@Override |
|||
public void executing(SchBaseTask taskObj) { |
|||
StIvtMoveinvdtl dtlDao = iStIvtMoveinvdtlService.getOne( |
|||
new QueryWrapper<StIvtMoveinvdtl>().lambda() |
|||
.eq(StIvtMoveinvdtl::getTask_id, taskObj.getTask_id()) |
|||
); |
|||
dtlDao.setWork_status(IOSEnum.MOVE_DTL_STATUS.code("执行中")); |
|||
iStIvtMoveinvdtlService.updateById(dtlDao); |
|||
updateMstStatus(dtlDao.getMoveinv_id()); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional |
|||
public void confirm(MoveInsertDto dto) { |
|||
// 查询所有明细
|
|||
List<StIvtMoveinvdtl> dtlDaoList = iStIvtMoveinvdtlService.list( |
|||
new QueryWrapper<StIvtMoveinvdtl>().lambda() |
|||
.eq(StIvtMoveinvdtl::getMoveinv_id, dto.getMoveinv_id()) |
|||
); |
|||
List<SchBaseTask> taskDaoList = iSchBaseTaskService.list( |
|||
new QueryWrapper<SchBaseTask>().lambda() |
|||
.in(SchBaseTask::getTask_id, |
|||
dtlDaoList.stream() |
|||
.map(StIvtMoveinvdtl::getTask_id) |
|||
.collect(Collectors.toList()) |
|||
) |
|||
); |
|||
|
|||
for (StIvtMoveinvdtl dao : dtlDaoList) { |
|||
SchBaseTask taskDao = taskDaoList.stream() |
|||
.filter(row -> row.getTask_id().equals(dao.getTask_id())) |
|||
.findFirst().orElse(null); |
|||
moveTask.finishTask(taskDao); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 更新主表状态 |
|||
* @param moveinv_id 移库单id |
|||
*/ |
|||
private void updateMstStatus(String moveinv_id) { |
|||
StIvtMoveinv mstDao = this.getById(moveinv_id); |
|||
// 查询所有明细
|
|||
List<StIvtMoveinvdtl> dtlDaoList = iStIvtMoveinvdtlService.list( |
|||
new QueryWrapper<StIvtMoveinvdtl>().lambda() |
|||
.eq(StIvtMoveinvdtl::getMoveinv_id, moveinv_id) |
|||
); |
|||
|
|||
// 如果全部为完成状态则主单据为完成
|
|||
boolean confirm_flag = dtlDaoList.stream() |
|||
.allMatch(row -> row.getWork_status().equals(IOSEnum.MOVE_DTL_STATUS.code("完成"))); |
|||
|
|||
boolean executing_flag = dtlDaoList.stream() |
|||
.anyMatch(row -> row.getWork_status().equals(IOSEnum.MOVE_DTL_STATUS.code("执行中"))); |
|||
|
|||
if (confirm_flag) { |
|||
mstDao.setBill_status(IOSEnum.MOVE_MST_STATUS.code("完成")); |
|||
|
|||
} else if (executing_flag) { |
|||
mstDao.setBill_status(IOSEnum.MOVE_MST_STATUS.code("执行中")); |
|||
} |
|||
mstDao.setUpdate_optid(SecurityUtils.getCurrentUserId()); |
|||
mstDao.setUpdate_optname(SecurityUtils.getCurrentNickName()); |
|||
mstDao.setUpdate_time(DateUtil.now()); |
|||
this.updateById(mstDao); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,207 @@ |
|||
package org.nl.wms.warehouse_management.service.impl; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.common.utils.IdUtil; |
|||
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService; |
|||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService; |
|||
import org.nl.wms.basedata_manage.service.IStructattrService; |
|||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase; |
|||
import org.nl.wms.basedata_manage.service.dao.Structattr; |
|||
import org.nl.wms.sch_manage.enums.TaskEnum; |
|||
import org.nl.wms.sch_manage.service.ISchBaseTaskService; |
|||
import org.nl.wms.sch_manage.service.dao.SchBaseTask; |
|||
import org.nl.wms.sch_manage.service.util.tasks.MoveTask; |
|||
import org.nl.wms.warehouse_management.enums.IOSConstant; |
|||
import org.nl.wms.warehouse_management.enums.IOSEnum; |
|||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvdtlService; |
|||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinvdtl; |
|||
import org.nl.wms.warehouse_management.service.dao.mapper.StIvtMoveinvdtlMapper; |
|||
import org.nl.wms.warehouse_management.service.dto.MoveInsertDto; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* <p> |
|||
* 移库单明细表 服务实现类 |
|||
* </p> |
|||
* |
|||
* @author Liuxy |
|||
* @since 2025-05-26 |
|||
*/ |
|||
@Service |
|||
public class StIvtMoveinvdtlServiceImpl extends ServiceImpl<StIvtMoveinvdtlMapper, StIvtMoveinvdtl> implements IStIvtMoveinvdtlService { |
|||
|
|||
/** |
|||
* 载具扩展属性服务 |
|||
*/ |
|||
@Autowired |
|||
private IMdPbStoragevehicleextService iMdPbStoragevehicleextService; |
|||
|
|||
/** |
|||
* 仓位服务 |
|||
*/ |
|||
@Autowired |
|||
private IStructattrService iStructattrService; |
|||
|
|||
/** |
|||
* 任务服务 |
|||
*/ |
|||
@Autowired |
|||
private ISchBaseTaskService iSchBaseTaskService; |
|||
|
|||
/** |
|||
* 物料服务 |
|||
*/ |
|||
@Autowired |
|||
private IMdMeMaterialbaseService iMdMeMaterialbaseService; |
|||
|
|||
/** |
|||
* 移库任务配置类 |
|||
*/ |
|||
@Autowired |
|||
private MoveTask moveTask; |
|||
|
|||
@Override |
|||
public void createMoveDtl(MoveInsertDto dto) { |
|||
// 批量插入明细集合
|
|||
List<StIvtMoveinvdtl> moveDtlList = new ArrayList<>(); |
|||
// 批量更新库存集合
|
|||
List<JSONObject> updateIvtList = new ArrayList<>(); |
|||
// 批量更新仓位
|
|||
List<JSONObject> updateAttrList = new ArrayList<>(); |
|||
// 处理明细数据
|
|||
List<JSONObject> tableData = dto.getTableData(); |
|||
for (int i = 0; i < tableData.size(); i++) { |
|||
JSONObject json = tableData.get(i); |
|||
// 组织任务数据
|
|||
JSONObject jsonTask = new JSONObject(); |
|||
jsonTask.put("config_code", IOSConstant.MOVE_CONFIG_TASK); |
|||
jsonTask.put("point_code1",json.getString("turnout_struct_code")); |
|||
jsonTask.put("point_code2",json.getString("turnin_struct_code")); |
|||
jsonTask.put("vehicle_code",json.getString("storagevehicle_code")); |
|||
jsonTask.put("Priority", TaskEnum.ACS_PRIORITY.code("1")); |
|||
String task_id = moveTask.create(jsonTask); |
|||
// 明细数据
|
|||
StIvtMoveinvdtl dtlDao = new StIvtMoveinvdtl(); |
|||
dtlDao.setMoveinvdtl_id(IdUtil.getStringId()); |
|||
dtlDao.setMoveinv_id(dto.getMoveinv_id()); |
|||
dtlDao.setSeq_no(BigDecimal.valueOf(i+1)); |
|||
dtlDao.setTurnout_sect_code(json.getString("turnout_sect_code")); |
|||
dtlDao.setTurnout_struct_code(json.getString("turnout_struct_code")); |
|||
dtlDao.setMaterial_code(json.getString("material_code")); |
|||
dtlDao.setPcsn(json.getString("pcsn")); |
|||
dtlDao.setQty_unit_id(json.getString("qty_unit_id")); |
|||
dtlDao.setQty_unit_name(json.getString("qty_unit_name")); |
|||
dtlDao.setQty(json.getBigDecimal("qty")); |
|||
dtlDao.setTurnin_sect_code(json.getString("turnin_sect_code")); |
|||
dtlDao.setTurnin_struct_code(json.getString("turnin_struct_code")); |
|||
dtlDao.setWork_status(json.getString("work_status")); |
|||
dtlDao.setStoragevehicle_code(json.getString("storagevehicle_code")); |
|||
dtlDao.setRemark(json.getString("remark")); |
|||
dtlDao.setTask_id(task_id); |
|||
moveDtlList.add(dtlDao); |
|||
// 组织要更新库存的数据
|
|||
JSONObject jsonIvt = new JSONObject(); |
|||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_FROZEN); |
|||
jsonIvt.put("storagevehicle_code", dtlDao.getStoragevehicle_code()); |
|||
jsonIvt.put("material_id", json.getString("material_id")); |
|||
jsonIvt.put("pcsn", dtlDao.getPcsn()); |
|||
jsonIvt.put("qty_unit_id", dtlDao.getQty_unit_id()); |
|||
jsonIvt.put("qty_unit_name", dtlDao.getQty_unit_name()); |
|||
jsonIvt.put("change_qty", dtlDao.getQty()); |
|||
jsonIvt.put("struct_code_out", dtlDao.getTurnout_struct_code()); |
|||
jsonIvt.put("struct_code_in", dtlDao.getTurnin_struct_code()); |
|||
updateIvtList.add(jsonIvt); |
|||
// 组织要更新仓位的数据
|
|||
JSONObject jsonAttrIn = new JSONObject(); |
|||
jsonAttrIn.put("struct_code",dtlDao.getTurnin_struct_code()); |
|||
jsonAttrIn.put("lock_type",IOSEnum.LOCK_TYPE.code("移入锁")); |
|||
updateAttrList.add(jsonAttrIn); |
|||
JSONObject jsonAttrOut = new JSONObject(); |
|||
jsonAttrOut.put("struct_code",dtlDao.getTurnout_struct_code()); |
|||
jsonAttrOut.put("lock_type",IOSEnum.LOCK_TYPE.code("移出锁")); |
|||
updateAttrList.add(jsonAttrOut); |
|||
} |
|||
this.saveBatch(moveDtlList); |
|||
iMdPbStoragevehicleextService.updateIvt(updateIvtList); |
|||
// 锁定仓位
|
|||
iStructattrService.updateLock(updateAttrList); |
|||
} |
|||
|
|||
@Override |
|||
public List<JSONObject> getMoveDtl(Map whereJson) { |
|||
return this.baseMapper.getMoveDtl(whereJson); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteDtl(MoveInsertDto dto) { |
|||
// 根据id/任务id查询的所有明细
|
|||
LambdaQueryWrapper<StIvtMoveinvdtl> lambda = new QueryWrapper<StIvtMoveinvdtl>().lambda(); |
|||
lambda.eq(StIvtMoveinvdtl::getMoveinv_id, dto.getMoveinv_id()); |
|||
if (ObjectUtil.isNotEmpty(dto.getTask_id())) { |
|||
lambda.eq(StIvtMoveinvdtl::getTask_id, dto.getTask_id()); |
|||
} |
|||
List<StIvtMoveinvdtl> oldDtlDao = this.list(lambda); |
|||
// 查询物料
|
|||
List<MdMeMaterialbase> materialList = iMdMeMaterialbaseService.list( |
|||
new QueryWrapper<MdMeMaterialbase>().lambda() |
|||
.in(MdMeMaterialbase::getMaterial_code, |
|||
oldDtlDao.stream() |
|||
.map(StIvtMoveinvdtl::getMaterial_code) |
|||
.collect(Collectors.toList()) |
|||
) |
|||
); |
|||
|
|||
// 需要删除的任务
|
|||
List<String> taskDeleteList = new ArrayList<>(); |
|||
// 需要更新的库存集合
|
|||
List<JSONObject> updateIvtList = new ArrayList<>(); |
|||
// 需要更新的仓位集合
|
|||
List<String> updateAttrList = new ArrayList<>(); |
|||
for (StIvtMoveinvdtl dao : oldDtlDao) { |
|||
taskDeleteList.add(dao.getTask_id()); |
|||
|
|||
// 更新库存数据组织
|
|||
JSONObject jsonIvt = new JSONObject(); |
|||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE); |
|||
jsonIvt.put("storagevehicle_code", dao.getStoragevehicle_code()); |
|||
MdMeMaterialbase materDao = materialList.stream() |
|||
.filter(row -> row.getMaterial_code().equals(dao.getMaterial_code())) |
|||
.findFirst().orElse(null); |
|||
jsonIvt.put("material_id", materDao.getMaterial_id()); |
|||
jsonIvt.put("pcsn", dao.getPcsn()); |
|||
jsonIvt.put("qty_unit_id", dao.getQty_unit_id()); |
|||
jsonIvt.put("qty_unit_name", dao.getQty_unit_name()); |
|||
jsonIvt.put("change_qty", dao.getQty()); |
|||
updateIvtList.add(jsonIvt); |
|||
|
|||
// 需要更新的仓位
|
|||
updateAttrList.add(dao.getTurnin_struct_code()); |
|||
updateAttrList.add(dao.getTurnout_struct_code()); |
|||
} |
|||
// 删除明细
|
|||
this.remove( |
|||
new QueryWrapper<StIvtMoveinvdtl>().lambda() |
|||
.eq(StIvtMoveinvdtl::getMoveinv_id, dto.getMoveinv_id()) |
|||
); |
|||
// 更新库存
|
|||
iMdPbStoragevehicleextService.updateIvt(updateIvtList); |
|||
// 更新仓位
|
|||
iStructattrService.update( |
|||
new UpdateWrapper<Structattr>().lambda() |
|||
.in(Structattr::getStruct_code, updateAttrList) |
|||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定")) |
|||
); |
|||
// 删除任务
|
|||
iSchBaseTaskService.removeByIds(taskDeleteList); |
|||
} |
|||
} |
@ -0,0 +1,473 @@ |
|||
<template> |
|||
<el-dialog |
|||
:title="crud.status.title" |
|||
append-to-body |
|||
fullscreen |
|||
:before-close="crud.cancelCU" |
|||
:visible.sync="crud.status.cu > 0 || crud.status.view > 0" |
|||
@open="open" |
|||
@close="close" |
|||
> |
|||
<el-row v-show="crud.status.cu > 0" :gutter="20"> |
|||
<el-col :span="20" style="border: 1px solid white"> |
|||
<span /> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<span> |
|||
<el-button |
|||
icon="el-icon-check" |
|||
size="mini" |
|||
:loading="crud.cu === 2" |
|||
type="primary" |
|||
@click="crud.submitCU" |
|||
>保存</el-button> |
|||
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button> |
|||
</span> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
<el-form |
|||
ref="form" |
|||
style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" |
|||
:inline="true" |
|||
:model="form" |
|||
:rules="rules" |
|||
size="mini" |
|||
label-width="85px" |
|||
label-suffix=":" |
|||
> |
|||
<el-input v-show="false" v-model="form.stor_code" placeholder="仓库编码" /> |
|||
<el-input v-show="false" v-model="form.stor_name" placeholder="仓库名称" /> |
|||
<el-form-item label="单据号" prop="bill_code"> |
|||
<label slot="label">单 据 号:</label> |
|||
<el-input v-model="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px" /> |
|||
</el-form-item> |
|||
<el-form-item label="仓库" prop="stor_id"> |
|||
<label slot="label">仓 库:</label> |
|||
<el-select |
|||
v-model="form.stor_id" |
|||
clearable |
|||
placeholder="仓库" |
|||
class="filter-item" |
|||
style="width: 210px" |
|||
:disabled="crud.status.view > 0" |
|||
@change="storChange" |
|||
> |
|||
<el-option |
|||
v-for="item in storlist" |
|||
:key="item.stor_id" |
|||
:label="item.stor_name" |
|||
:value="item.stor_id" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="业务类型" prop="bill_type"> |
|||
<el-select |
|||
v-model="form.bill_type" |
|||
placeholder="业务类型" |
|||
class="filter-item" |
|||
> |
|||
<el-option |
|||
v-for="item in dict.ST_INV_TYPE_MV" |
|||
:disabled="item.value === '21' || item.value === '31'" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="单据状态" prop="bill_status"> |
|||
<el-select |
|||
v-model="form.bill_status" |
|||
placeholder="单据状态" |
|||
class="filter-item" |
|||
:disabled="true" |
|||
> |
|||
<el-option |
|||
v-for="item in dict.move_bill_status" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="明细数" prop="detail_count"> |
|||
<label slot="label">明 细 数:</label> |
|||
<el-input v-model="form.detail_count" size="mini" disabled style="width: 210px" /> |
|||
</el-form-item> |
|||
<el-form-item label="总重量" prop="total_qty"> |
|||
<label slot="label">总 重 量:</label> |
|||
<el-input-number |
|||
v-model="form.total_qty" |
|||
:controls="false" |
|||
:precision="3" |
|||
:min="0" |
|||
disabled |
|||
style="width: 210px" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="业务日期" prop="biz_date"> |
|||
<el-date-picker |
|||
v-model="form.biz_date" |
|||
type="date" |
|||
placeholder="选择日期" |
|||
style="width: 210px" |
|||
value-format="yyyy-MM-dd" |
|||
:disabled="crud.status.view > 0" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="备注" prop="remark"> |
|||
<label slot="label">备 注:</label> |
|||
<el-input |
|||
v-model="form.remark" |
|||
style="width: 380px;" |
|||
rows="2" |
|||
type="textarea" |
|||
:disabled="crud.status.view > 0" |
|||
/> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<div class="crud-opts2"> |
|||
<span class="role-span">移库明细</span> |
|||
<span v-if="crud.status.cu > 0" class="crud-opts-right2"> |
|||
|
|||
<!--左侧插槽--> |
|||
<slot name="left" /> |
|||
<el-button |
|||
slot="left" |
|||
v-if="form.bill_type !== '30'" |
|||
class="filter-item" |
|||
type="primary" |
|||
icon="el-icon-plus" |
|||
size="mini" |
|||
@click="queryDtl()" |
|||
> |
|||
添加库存物料 |
|||
</el-button> |
|||
</span> |
|||
|
|||
</div> |
|||
<!--表格渲染--> |
|||
<el-table |
|||
ref="table" |
|||
:data="form.tableData" |
|||
style="width: 100%;" |
|||
border |
|||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}" |
|||
> |
|||
<el-table-column type="index" label="序号" width="50" align="center" /> |
|||
<el-table-column v-if="crud.status.add!==1" prop="work_status" label="状态" align="center" :formatter="bill_statusFormat" :min-width="flexWidth('work_status',crud.data,'状态')" /> |
|||
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" /> |
|||
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" /> |
|||
<el-table-column prop="pcsn" label="批次号" :min-width="flexWidth('pcsn',crud.data,'批次号')" /> |
|||
<el-table-column prop="qty" label="重量" :formatter="crud.formatNum3" align="center" :min-width="flexWidth('qty',crud.data,'重量')" /> |
|||
<el-table-column prop="qty_unit_name" label="单位" align="center" :min-width="flexWidth('qty_unit_name',crud.data,'单位')" /> |
|||
<el-table-column prop="storagevehicle_code" label="载具号" :min-width="flexWidth('storagevehicle_code',crud.data,'载具号')" /> |
|||
<el-table-column prop="turnout_sect_name" label="移出库区" :min-width="flexWidth('turnout_sect_name',crud.data,'移出库区')" /> |
|||
<el-table-column prop="turnout_struct_code" label="移出货位" :min-width="flexWidth('turnout_struct_code',crud.data,'移出货位')" /> |
|||
<el-table-column prop="turnin_sect_name" label="移入库区" :min-width="flexWidth('turnin_sect_name',crud.data,'移入库区')" /> |
|||
<el-table-column prop="turnin_struct_code" label="移入货位" :min-width="flexWidth('turnin_struct_code',crud.data,'移入货位')" align="center"> |
|||
<template scope="scope"> |
|||
<el-input v-show="!scope.row.edit" v-model="scope.row.turnin_struct_code" disabled class="input-with-select"> |
|||
<el-button slot="append" icon="el-icon-search" @click="queryStruct(scope.$index, scope.row)" /> |
|||
</el-input> |
|||
<span v-show="scope.row.edit">{{ scope.row.turnin_struct_code }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column v-if="crud.status.cu > 0" align="center" width="160" label="操作" fixed="right"> |
|||
<template scope="scope"> |
|||
<el-button |
|||
type="danger" |
|||
class="filter-item" |
|||
size="mini" |
|||
icon="el-icon-delete" |
|||
@click.native.prevent="deleteRow(scope.$index, form.tableData)" |
|||
/> |
|||
<el-button |
|||
v-show="!scope.row.edit" |
|||
type="primary" |
|||
class="filter-item" |
|||
size="mini" |
|||
icon="el-icon-edit" |
|||
@click="handleEdit(scope.$index, scope.row)" |
|||
>编辑 |
|||
</el-button> |
|||
<el-button |
|||
v-show="scope.row.edit" |
|||
type="success" |
|||
class="filter-item" |
|||
size="mini" |
|||
icon="el-icon-check" |
|||
@click="handleEdit(scope.$index, scope.row)" |
|||
>完成 |
|||
</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<AddDtl :dialog-show.sync="dtlShow" :stor-id="storId" @tableChanged="tableChanged" /> |
|||
<StructDiv ref="child" :stor-id="storId" :dialog-show.sync="structShow" @tableChanged="structChanged" /> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import CRUD, { crud, form } from '@crud/crud' |
|||
import AddDtl from '@/views/wms/st/movebill/AddDtl' |
|||
import movestor from '@/views/wms/st/movebill/movestor' |
|||
import StructDiv from '@/views/wms/pub/StructDialog' |
|||
import crudUserStor from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr' |
|||
|
|||
const defaultForm = { |
|||
bill_code: '', |
|||
stor_id: '1582991156504039424', |
|||
stor_code: 'AC01', |
|||
stor_name: '兰州仓库', |
|||
block_num: null, |
|||
bill_status: '10', |
|||
total_qty: '0', |
|||
detail_count: '0', |
|||
bill_type: '29', |
|||
remark: '', |
|||
biz_date: new Date(), |
|||
create_mode: '', |
|||
tableData: [] |
|||
} |
|||
export default { |
|||
name: 'AddDialog', |
|||
components: { AddDtl, StructDiv }, |
|||
mixins: [crud(), form(defaultForm)], |
|||
props: { |
|||
dialogShow: { |
|||
type: Boolean, |
|||
default: false |
|||
} |
|||
}, |
|||
dicts: ['move_bill_status', 'ST_INV_TYPE_MV', 'MOVE_WORK_STATUS'], |
|||
data() { |
|||
return { |
|||
dialogVisible: false, |
|||
dtlShow: false, |
|||
structShow: false, |
|||
structShow2: false, |
|||
flagnow: false, |
|||
nowrow: {}, |
|||
storId: null, |
|||
nowindex: '', |
|||
storlist: [], |
|||
invtypelist: [], |
|||
rules: { |
|||
stor_id: [ |
|||
{ required: true, message: '仓库不能为空', trigger: 'blur' } |
|||
], |
|||
bill_type: [ |
|||
{ required: true, message: '业务类型不能为空', trigger: 'blur' } |
|||
], |
|||
biz_date: [ |
|||
{ required: true, message: '业务日期不能为空', trigger: 'blur' } |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
watch: { |
|||
dialogShow: { |
|||
handler(newValue) { |
|||
this.dialogVisible = newValue |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
open() { |
|||
crudUserStor.getStor().then(res => { |
|||
this.storlist = res |
|||
}) |
|||
}, |
|||
close() { |
|||
this.$emit('AddChanged') |
|||
}, |
|||
[CRUD.HOOK.afterToEdit]() { |
|||
movestor.getMoveDtl({ 'moveinv_id': this.form.moveinv_id }).then(res => { |
|||
this.form.tableData = res |
|||
// 将明细变成不可编辑 |
|||
for (let i = 0; i < this.form.tableData.length; i++) { |
|||
const row = this.form.tableData[i] |
|||
row.edit = true |
|||
this.form.tableData.splice(i, 1, row) |
|||
} |
|||
}) |
|||
}, |
|||
[CRUD.HOOK.afterToView]() { |
|||
movestor.getMoveDtl({ 'moveinv_id': this.form.moveinv_id }).then(res => { |
|||
this.form.tableData = res |
|||
// 将明细变成不可编辑 |
|||
for (let i = 0; i < this.form.tableData.length; i++) { |
|||
const row = this.form.tableData[i] |
|||
row.edit = true |
|||
this.form.tableData.splice(i, 1, row) |
|||
} |
|||
}) |
|||
}, |
|||
bill_statusFormat(row) { |
|||
return this.dict.label.MOVE_WORK_STATUS[row.work_status] |
|||
}, |
|||
storChange(row) { |
|||
this.storlist.forEach((item) => { |
|||
if (item.stor_id === row) { |
|||
this.form.stor_code = item.stor_code |
|||
this.form.stor_name = item.stor_name |
|||
} |
|||
}) |
|||
this.form.tableData = [] |
|||
}, |
|||
async queryDtl() { |
|||
if (!this.form.stor_id) { |
|||
return this.crud.notify('请先选择仓库!', CRUD.NOTIFICATION_TYPE.INFO) |
|||
} |
|||
this.storId = this.form.stor_id |
|||
this.dtlShow = true |
|||
}, |
|||
async queryStruct(index, row) { |
|||
this.structShow = true |
|||
this.$refs.child.getMsg(false) |
|||
this.nowindex = index |
|||
this.nowrow = row |
|||
}, |
|||
tableChanged(rows) { |
|||
const tablemap = new Map() |
|||
rows.forEach((item) => { |
|||
if (this.form.tableData.length !== 0) { |
|||
this.flagnow = false |
|||
for (let i = 0; i < this.form.tableData.length; i++) { |
|||
if (this.form.tableData[i].stockrecord_id === item.stockrecord_id) { |
|||
this.flagnow = true |
|||
} |
|||
} |
|||
if (!this.flagnow) { |
|||
this.$set(item, 'edit', false) |
|||
this.$set(item, 'work_status', '10') |
|||
this.$set(item, 'turnin_sect_code', '') |
|||
this.$set(item, 'turnin_struct_code', '') |
|||
tablemap.set(item.stockrecord_id, item) |
|||
} |
|||
} else { |
|||
this.$set(item, 'edit', false) |
|||
this.$set(item, 'work_status', '10') |
|||
this.$set(item, 'turnin_sect_code', '') |
|||
this.$set(item, 'turnin_struct_code', '') |
|||
tablemap.set(item.stockrecord_id, item) |
|||
} |
|||
}) |
|||
for (const value of tablemap.values()) { |
|||
this.form.tableData.push(value) |
|||
} |
|||
this.form.detail_count = this.form.tableData.length |
|||
}, |
|||
structChanged(row) { |
|||
let structflag = false |
|||
for (let i = 0; i < this.form.tableData.length; i++) { |
|||
if ((this.form.tableData[i].turnin_struct_id === row.struct_id) || (this.form.tableData[i].turnout_struct_id === row.struct_id)) { |
|||
structflag = true |
|||
} |
|||
} |
|||
if (structflag) { |
|||
this.crud.notify('该货位已被设置,不允许重复设置!', CRUD.NOTIFICATION_TYPE.INFO) |
|||
return false |
|||
} |
|||
for (let i = 0; i < this.form.tableData.length; i++) { |
|||
if (this.form.tableData[i].storagevehicle_code === this.nowrow.storagevehicle_code) { |
|||
this.form.tableData[i].turnin_struct_id = row.struct_id |
|||
this.form.tableData[i].turnin_struct_code = row.struct_code |
|||
this.form.tableData[i].turnin_struct_name = row.struct_name |
|||
|
|||
this.form.tableData[i].turnin_sect_id = row.sect_id |
|||
this.form.tableData[i].turnin_sect_code = row.sect_code |
|||
this.form.tableData[i].turnin_sect_name = row.sect_name |
|||
this.form.tableData.splice(i, 1, this.form.tableData[i]) // 通过splice 替换数据 触发视图更新 |
|||
} |
|||
} |
|||
console.log(this.form.tableData) |
|||
}, |
|||
handleEdit(index, row) { |
|||
// 判断是否可以关闭编辑状态 |
|||
if (!row.edit) { |
|||
if (row.turnin_struct_id === '') { |
|||
this.crud.notify('请先选择载具:' + row.storagevehicle_code + '的移入货位!', CRUD.NOTIFICATION_TYPE.INFO) |
|||
return false |
|||
} |
|||
if (row.turnin_sect_id === '') { |
|||
this.crud.notify('请先选择载具:' + row.storagevehicle_code + '的移入库区!', CRUD.NOTIFICATION_TYPE.INFO) |
|||
return false |
|||
} |
|||
} |
|||
row.edit = !row.edit |
|||
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新 |
|||
if (row.edit) { |
|||
this.form.total_qty = 0 |
|||
this.form.tableData.forEach((item) => { |
|||
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(item.qty) |
|||
}) |
|||
} |
|||
}, |
|||
deleteRow(index, rows) { |
|||
const storagevehicle_code = rows[index].storagevehicle_code |
|||
let len = rows.length |
|||
while (len--) { |
|||
const obj = rows[len] |
|||
if (storagevehicle_code === obj.storagevehicle_code) { |
|||
const index = rows.indexOf(obj) |
|||
if (index > -1) { // 移除找到的指定元素 |
|||
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].qty) |
|||
rows.splice(index, 1) |
|||
this.nowindex = '' |
|||
this.nowrow = {} |
|||
this.form.detail_count = this.form.tableData.length |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
[CRUD.HOOK.beforeSubmit]() { |
|||
if (this.form.bill_type !== '30') { |
|||
if (this.form.tableData.length === 0) { |
|||
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO) |
|||
return false |
|||
} |
|||
for (let i = 0; i < this.form.tableData.length; i++) { |
|||
if (!this.form.tableData[i].edit) { |
|||
this.crud.notify('尚有未完成编辑的物料明细序号' + (i + 1) + ',请检查!') |
|||
return false |
|||
} |
|||
} |
|||
} else { |
|||
if (!this.form.block_num) { |
|||
this.crud.notify('请选择所属区域', CRUD.NOTIFICATION_TYPE.INFO) |
|||
return false |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.crud-opts2 { |
|||
padding: 0 0; |
|||
display: -webkit-flex; |
|||
display: flex; |
|||
align-items: center; |
|||
} |
|||
|
|||
.crud-opts2 .crud-opts-right2 { |
|||
margin-left: auto; |
|||
padding: 4px 4px; |
|||
} |
|||
|
|||
.input-with-select { |
|||
background-color: #fff; |
|||
} |
|||
</style> |
|||
|
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
::v-deep .el-dialog__body { |
|||
padding-top: 10px; |
|||
} |
|||
</style> |
@ -0,0 +1,207 @@ |
|||
<template> |
|||
<el-dialog |
|||
title="库存物料选择" |
|||
append-to-body |
|||
:visible.sync="dialogVisible" |
|||
destroy-on-close |
|||
:show-close="false" |
|||
width="1300px" |
|||
@close="close" |
|||
@open="open" |
|||
> |
|||
<!-- 搜索 --> |
|||
<el-form |
|||
:inline="true" |
|||
class="demo-form-inline" |
|||
label-position="right" |
|||
label-width="80px" |
|||
label-suffix=":" |
|||
> |
|||
<el-form-item label="库区查询"> |
|||
<el-cascader |
|||
v-model="defaultList" |
|||
placeholder="库区" |
|||
:options="sects" |
|||
:props="{ checkStrictly: true }" |
|||
clearable |
|||
@change="sectQueryChange" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="货位编码"> |
|||
<el-input |
|||
v-model="query.struct_code" |
|||
clearable |
|||
size="mini" |
|||
placeholder="货位号模糊查询" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
@keyup.enter.native="crud.toQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="物料编码"> |
|||
<el-input |
|||
v-model="query.material_code" |
|||
clearable |
|||
size="mini" |
|||
placeholder="物料" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
@keyup.enter.native="crud.toQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="批次"> |
|||
<el-input |
|||
v-model="query.pcsn" |
|||
clearable |
|||
size="mini" |
|||
placeholder="批次" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
@keyup.enter.native="crud.toQuery" |
|||
/> |
|||
</el-form-item> |
|||
<rrOperation /> |
|||
</el-form> |
|||
<!--表格渲染--> |
|||
<div style="padding: 10px" /> |
|||
<el-table |
|||
ref="table" |
|||
v-loading="crud.loading" |
|||
:data="crud.data" |
|||
style="width: 100%;" |
|||
border |
|||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}" |
|||
> |
|||
<el-table-column type="selection" width="55" /> |
|||
<el-table-column prop="turnout_sect_name" label="库区名称" :min-width="flexWidth('turnout_sect_name',crud.data,'库区名称')" /> |
|||
<el-table-column prop="turnout_struct_code" label="货位编码" :min-width="flexWidth('turnout_struct_code',crud.data,'货位编码')" /> |
|||
<el-table-column prop="storagevehicle_code" label="载具编码" :min-width="flexWidth('storagevehicle_code',crud.data,'载具编码')" /> |
|||
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" /> |
|||
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" /> |
|||
<el-table-column prop="pcsn" label="批次" :min-width="flexWidth('pcsn',crud.data,'批次')" /> |
|||
<el-table-column prop="qty" label="重量" :formatter="crud.formatNum3" :min-width="flexWidth('qty',crud.data,'重量')" /> |
|||
<el-table-column prop="qty_unit_name" label="重量单位" :min-width="flexWidth('qty_unit_name',crud.data,'重量单位')" /> |
|||
</el-table> |
|||
<!--分页组件--> |
|||
<pagination /> |
|||
<span slot="footer" class="dialog-footer"> |
|||
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button> |
|||
<el-button slot="left" type="primary" @click="submit">保存</el-button> |
|||
</span> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
|
|||
import CRUD, { header, presenter } from '@crud/crud' |
|||
import rrOperation from '@crud/RR.operation' |
|||
import pagination from '@crud/Pagination' |
|||
import movestor from '@/views/wms/st/movebill/movestor' |
|||
import crudSectattr from '@/views/wms/basedata/sectattr/sectattr' |
|||
|
|||
export default { |
|||
name: 'AddDtl', |
|||
components: { rrOperation, pagination }, |
|||
cruds() { |
|||
return CRUD({ title: '用户', idField: 'storagevehicleext_id', url: 'api/moveStor/getCanuseIvt', |
|||
query: { |
|||
struct_code: '', |
|||
remark: '', |
|||
sect_id: '', |
|||
stor_id: '' |
|||
}, |
|||
optShow: { |
|||
add: false, |
|||
edit: false, |
|||
del: false, |
|||
reset: true, |
|||
download: false |
|||
}}) |
|||
}, |
|||
mixins: [presenter(), header()], |
|||
props: { |
|||
dialogShow: { |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
openParam: { |
|||
type: String |
|||
}, |
|||
storId: { |
|||
type: String |
|||
} |
|||
}, |
|||
dicts: ['ST_QUALITY_SCODE', 'ST_IVT_LEVEL', 'is_usable'], |
|||
data() { |
|||
return { |
|||
dialogVisible: false, |
|||
opendtlParam: '', |
|||
sects: [], |
|||
rows: [], |
|||
defaultList: ['1582991156504039424', '1582991348217286656'] |
|||
} |
|||
}, |
|||
watch: { |
|||
dialogShow: { |
|||
handler(newValue, oldValue) { |
|||
this.dialogVisible = newValue |
|||
} |
|||
}, |
|||
openParam: { |
|||
handler(newValue, oldValue) { |
|||
this.opendtlParam = newValue |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
[CRUD.HOOK.beforeRefresh]() { |
|||
this.crud.query.stor_id = this.storId |
|||
if (this.storId === this.defaultList[0]) { |
|||
this.crud.query.sect_id = this.defaultList[1] |
|||
} |
|||
}, |
|||
open() { |
|||
crudSectattr.getSect({ 'stor_id': this.storId }).then(res => { |
|||
this.sects = res.content |
|||
}) |
|||
this.crud.toQuery() |
|||
}, |
|||
close() { |
|||
this.crud.resetQuery(false) |
|||
this.$emit('update:dialogShow', false) |
|||
}, |
|||
ivt_levelFormat(row, column) { |
|||
return this.dict.label.ST_IVT_LEVEL[row.ivt_level] |
|||
}, |
|||
is_activeFormat(row, column) { |
|||
return this.dict.label.is_usable[row.is_active] |
|||
}, |
|||
sectQueryChange(val) { |
|||
if (val.length === 1) { |
|||
this.crud.query.stor_id = val[0] |
|||
this.crud.query.sect_id = '' |
|||
} |
|||
if (val.length === 0) { |
|||
this.crud.query.sect_id = '' |
|||
this.crud.query.stor_id = '' |
|||
} |
|||
if (val.length === 2) { |
|||
this.crud.query.stor_id = val[0] |
|||
this.crud.query.sect_id = val[1] |
|||
} |
|||
this.crud.toQuery() |
|||
}, |
|||
submit() { |
|||
this.rows = this.$refs.table.selection |
|||
if (this.rows.length <= 0) { |
|||
this.$message('请先勾选物料') |
|||
return |
|||
} |
|||
this.$emit('update:dialogShow', false) |
|||
this.$emit('tableChanged', this.rows) |
|||
this.crud.resetQuery(false) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
@ -0,0 +1,341 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<!--工具栏--> |
|||
<div class="head-container"> |
|||
<div v-if="crud.props.searchToggle"> |
|||
<!-- 搜索 --> |
|||
<el-form |
|||
:inline="true" |
|||
class="demo-form-inline" |
|||
label-position="right" |
|||
label-width="80px" |
|||
label-suffix=":" |
|||
> |
|||
<el-form-item label="模糊查询"> |
|||
<el-input |
|||
v-model="query.bill_code" |
|||
size="mini" |
|||
clearable |
|||
placeholder="移库单号" |
|||
@keyup.enter.native="crud.toQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="所属仓库"> |
|||
<el-select |
|||
v-model="query.stor_id" |
|||
clearable |
|||
size="mini" |
|||
placeholder="全部" |
|||
class="filter-item" |
|||
@change="crud.toQuery" |
|||
> |
|||
<el-option |
|||
v-for="item in storlist" |
|||
:key="item.stor_id" |
|||
:label="item.stor_name" |
|||
:value="item.stor_id" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="物料查询"> |
|||
<el-input |
|||
v-model="query.material_code" |
|||
size="mini" |
|||
clearable |
|||
placeholder="物料编码" |
|||
@keyup.enter.native="crud.toQuery" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="生成方式"> |
|||
<el-select |
|||
v-model="query.create_mode" |
|||
clearable |
|||
size="mini" |
|||
placeholder="生成方式" |
|||
class="filter-item" |
|||
@change="crud.toQuery" |
|||
> |
|||
<el-option |
|||
v-for="item in dict.ST_CREATE_MODE" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="单据状态"> |
|||
<el-select |
|||
v-model="query.bill_status" |
|||
clearable |
|||
size="mini" |
|||
placeholder="单据状态" |
|||
class="filter-item" |
|||
@change="crud.toQuery" |
|||
> |
|||
<el-option |
|||
v-for="item in dict.move_bill_status" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="业务类型"> |
|||
<el-select |
|||
v-model="query.bill_type" |
|||
clearable |
|||
filterable |
|||
size="mini" |
|||
placeholder="业务类型" |
|||
class="filter-item" |
|||
@change="crud.toQuery" |
|||
> |
|||
<el-option |
|||
v-for="item in dict.ST_INV_TYPE_MV" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
|
|||
<el-form-item label="创建时间"> |
|||
<el-date-picker |
|||
v-model="query.createTime" |
|||
type="daterange" |
|||
value-format="yyyy-MM-dd HH:mm:ss" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期" |
|||
:default-time="['00:00:00', '23:59:59']" |
|||
@change="crud.toQuery" |
|||
/> |
|||
</el-form-item> |
|||
</el-form-item> |
|||
<rrOperation /> |
|||
</el-form> |
|||
</div> |
|||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
|||
<crudOperation :permission="permission"> |
|||
<el-button |
|||
slot="right" |
|||
class="filter-item" |
|||
type="warning" |
|||
:disabled="confirm_flag" |
|||
icon="el-icon-check" |
|||
size="mini" |
|||
@click="confirm" |
|||
> |
|||
强制确认 |
|||
</el-button> |
|||
</crudOperation> |
|||
<!--表格渲染--> |
|||
<el-table |
|||
ref="table" |
|||
v-loading="crud.loading" |
|||
size="mini" |
|||
:data="crud.data" |
|||
style="width: 100%;" |
|||
:highlight-current-row="true" |
|||
@selection-change="crud.selectionChangeHandler" |
|||
@current-change="handleCurrentChange" |
|||
@select="handleSelectionChange" |
|||
@select-all="onSelectAll" |
|||
> |
|||
<el-table-column |
|||
v-permission="['admin','movestor:del','movestor:edit']" |
|||
label="操作" |
|||
width="160" |
|||
align="center" |
|||
fixed="right" |
|||
> |
|||
<template slot-scope="scope"> |
|||
<udOperation |
|||
:data="scope.row" |
|||
:permission="permission" |
|||
:disabled-edit="canUd(scope.row)" |
|||
:disabled-dle="canUd(scope.row)" |
|||
/> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column :selectable="checkboxT" type="selection" /> |
|||
<el-table-column prop="bill_code" label="单据号" :min-width="flexWidth('bill_code',crud.data,'单据号')"> |
|||
<template slot-scope="scope"> |
|||
<el-link type="warning" @click="crud.toView(scope.row)">{{ scope.row.bill_code }}</el-link> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column :formatter="stateFormat" prop="bill_status" label="单据状态" :min-width="flexWidth('bill_status',crud.data,'单据状态')"/> |
|||
<el-table-column prop="stor_name" label="仓库" :min-width="flexWidth('stor_name',crud.data,'仓库')" /> |
|||
<el-table-column prop="bill_type" :formatter="bill_typeFormat" label="业务类型" :min-width="flexWidth('bill_type',crud.data,'业务类型')"/> |
|||
<el-table-column prop="biz_date" label="业务日期" :min-width="flexWidth('biz_date',crud.data,'业务日期')" /> |
|||
<el-table-column :formatter="create_modeFormat" prop="create_mode" label="生成方式" :min-width="flexWidth('create_mode',crud.data,'生成方式')"/> |
|||
<el-table-column label="明细数" prop="detail_count" :min-width="flexWidth('detail_count',crud.data,'明细数')" /> |
|||
<el-table-column prop="input_optname" label="创建人" :min-width="flexWidth('input_optname',crud.data,'创建人')" /> |
|||
<el-table-column prop="input_time" label="创建日期" :min-width="flexWidth('input_time',crud.data,'创建日期')" /> |
|||
<el-table-column prop="update_optname" label="修改人" :min-width="flexWidth('update_optname',crud.data,'修改人')" /> |
|||
<el-table-column prop="update_time" label="修改日期" :min-width="flexWidth('update_time',crud.data,'修改日期')" /> |
|||
</el-table> |
|||
<!--分页组件--> |
|||
<pagination /> |
|||
</div> |
|||
<AddDialog @AddChanged="querytable" /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import movestor from '@/views/wms/st/movebill/movestor' |
|||
import CRUD, { crud, header, presenter } from '@crud/crud' |
|||
import rrOperation from '@crud/RR.operation' |
|||
import crudOperation from '@crud/CRUD.operation' |
|||
import udOperation from '@crud/UD.operation' |
|||
import pagination from '@crud/Pagination' |
|||
import AddDialog from '@/views/wms/st/movebill/AddDialog' |
|||
import crudStorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr' |
|||
|
|||
export default { |
|||
name: 'Movestor', |
|||
components: { AddDialog, crudOperation, rrOperation, udOperation, pagination }, |
|||
cruds() { |
|||
return CRUD({ title: '移库单', idField: 'moveinv_id', url: 'api/moveStor', crudMethod: { ...movestor }, |
|||
optShow: { |
|||
add: true, |
|||
edit: false, |
|||
del: false, |
|||
reset: true, |
|||
download: false |
|||
}}) |
|||
}, |
|||
mixins: [presenter(), header(), crud()], |
|||
// 数据字典 |
|||
dicts: ['move_bill_status', 'ST_CREATE_MODE', 'ST_INV_TYPE_MV'], |
|||
data() { |
|||
return { |
|||
height: document.documentElement.clientHeight - 180 + 'px;', |
|||
permission: { |
|||
add: ['admin', 'movestor:add'], |
|||
edit: ['admin', 'movestor:edit'], |
|||
del: ['admin', 'movestor:del'] |
|||
}, |
|||
work_flag: true, |
|||
confirm_flag: true, |
|||
mstrow: {}, |
|||
currentRow: null, |
|||
storlist: [] |
|||
} |
|||
}, |
|||
mounted: function() { |
|||
const that = this |
|||
window.onresize = function temp() { |
|||
that.height = document.documentElement.clientHeight - 180 + 'px;' |
|||
} |
|||
}, |
|||
created() { |
|||
crudStorattr.getStor({}).then(res => { |
|||
this.storlist = res |
|||
}) |
|||
this.initQuery() |
|||
this.crud.toQuery() |
|||
}, |
|||
methods: { |
|||
initQuery() { |
|||
const end = new Date() |
|||
const start = new Date() |
|||
const endYear = end.getFullYear() |
|||
var endMonth = end.getMonth() + 1 |
|||
if (end.getMonth() + 1 < 10) { |
|||
endMonth = '0' + endMonth.toString() |
|||
} |
|||
var endDay = end.getDate() |
|||
if (end.getDate() < 10) { |
|||
endDay = '0' + endDay.toString() |
|||
} |
|||
const endDate = endYear + '-' + endMonth + '-' + endDay + ' 23:59:59' |
|||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) |
|||
const startYear = start.getFullYear() |
|||
var startMonth = start.getMonth() + 1 |
|||
if (start.getMonth() + 1 < 10) { |
|||
startMonth = '0' + startMonth.toString() |
|||
} |
|||
var startDay = start.getDate() |
|||
if (start.getDate() < 10) { |
|||
startDay = '0' + startDay.toString() |
|||
} |
|||
const startDate = startYear + '-' + startMonth + '-' + startDay + ' 00:00:00' |
|||
this.$set(this.query, 'createTime', [startDate, endDate]) |
|||
this.crud.toQuery() |
|||
}, |
|||
canUd(row) { |
|||
return row.bill_status !== '10' |
|||
}, |
|||
[CRUD.HOOK.beforeRefresh]() { |
|||
this.crud.query.buss_type = '' |
|||
this.handleCurrentChange(null) |
|||
}, |
|||
stateFormat(row) { |
|||
return this.dict.label.move_bill_status[row.bill_status] |
|||
}, |
|||
bill_typeFormat(row) { |
|||
return this.dict.label.ST_INV_TYPE_MV[row.bill_type] |
|||
}, |
|||
create_modeFormat(row) { |
|||
return this.dict.label.ST_CREATE_MODE[row.create_mode] |
|||
}, |
|||
handleSelectionChange(val, row) { |
|||
if (val.length > 1) { |
|||
this.$refs.table.clearSelection() |
|||
this.$refs.table.toggleRowSelection(val.pop()) |
|||
this.buttonChange(row) |
|||
} else if (val.length === 1) { |
|||
this.buttonChange(row) |
|||
} else { |
|||
this.handleCurrentChange(null) |
|||
} |
|||
}, |
|||
onSelectAll() { |
|||
this.$refs.table.clearSelection() |
|||
this.handleCurrentChange(null) |
|||
}, |
|||
buttonChange(current) { |
|||
if (current !== null) { |
|||
this.currentRow = current |
|||
if (current.bill_status === '10') { |
|||
this.work_flag = false |
|||
} else { |
|||
this.work_flag = true |
|||
} |
|||
if (current.bill_status !== '99') { |
|||
this.confirm_flag = false |
|||
} else { |
|||
this.confirm_flag = true |
|||
} |
|||
} |
|||
}, |
|||
handleCurrentChange(current) { |
|||
if (current === null) { |
|||
this.confirm_flag = true |
|||
this.work_flag = true |
|||
this.currentRow = {} |
|||
} |
|||
}, |
|||
checkboxT(row) { |
|||
return row.bill_status !== '99' |
|||
}, |
|||
confirm() { |
|||
movestor.confirm({ 'moveinv_id': this.currentRow.moveinv_id }).then(res => { |
|||
this.crud.notify('强制确认成功!', CRUD.NOTIFICATION_TYPE.SUCCESS) |
|||
this.querytable() |
|||
}) |
|||
}, |
|||
querytable() { |
|||
this.onSelectAll() |
|||
this.crud.toQuery() |
|||
this.handleCurrentChange(null) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style rel="stylesheet/scss" lang="scss" scoped> |
|||
::v-deep .el-dialog__body { |
|||
padding-top: 10px; |
|||
} |
|||
</style> |
@ -0,0 +1,43 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function add(data) { |
|||
return request({ |
|||
url: 'api/moveStor', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function del(ids) { |
|||
return request({ |
|||
url: 'api/moveStor/', |
|||
method: 'delete', |
|||
data: ids |
|||
}) |
|||
} |
|||
|
|||
export function edit(data) { |
|||
return request({ |
|||
url: 'api/moveStor', |
|||
method: 'put', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function getMoveDtl(params) { |
|||
return request({ |
|||
url: '/api/moveStor/getMoveDtl', |
|||
method: 'get', |
|||
params |
|||
}) |
|||
} |
|||
|
|||
export function confirm(data) { |
|||
return request({ |
|||
url: '/api/moveStor/confirm', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export default { add, edit, del, getMoveDtl, confirm } |
Loading…
Reference in new issue