添加功能
This commit is contained in:
parent
32d51fdd61
commit
374ec166a2
|
|
@ -422,6 +422,10 @@ public class InProduceOrderController extends BaseController {
|
|||
}
|
||||
|
||||
private void syncStorage(WmsInProduceOrderItemVO it,Set<String> binNos){
|
||||
produceOrderItemService.lambdaUpdate()
|
||||
.set(WmsInProduceOrderItem::getBinNos, StrUtil.join(",", binNos))
|
||||
.eq(WmsInProduceOrderItem::getId, it.getId())
|
||||
.update();
|
||||
Set<String> dbMapBins = storageService.getBinNos(it.getMaterialNo(), it.getFactoryNo(), it.getWarehouseNo());
|
||||
if (!binNos.equals(dbMapBins)) {
|
||||
//调用SAP接口保存库位信息
|
||||
|
|
|
|||
|
|
@ -0,0 +1,218 @@
|
|||
package com.nflg.wms.admin.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.wms.admin.pojo.document.InventoryCheckTaskScanRecord;
|
||||
import com.nflg.wms.admin.repository.InventoryCheckTaskScanRecordResitory;
|
||||
import com.nflg.wms.admin.util.NoUtil;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import com.nflg.wms.common.pojo.PageData;
|
||||
import com.nflg.wms.common.pojo.dto.MaterialQRCodeContentDTO;
|
||||
import com.nflg.wms.common.pojo.qo.*;
|
||||
import com.nflg.wms.common.pojo.vo.InventoryCheckTaskItemVO;
|
||||
import com.nflg.wms.common.pojo.vo.InventoryCheckTaskVO;
|
||||
import com.nflg.wms.common.pojo.vo.WmsInventoryCheckTaskItemMaterialVO;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.WmsInventoryCheckTask;
|
||||
import com.nflg.wms.repository.entity.WmsInventoryCheckTaskItem;
|
||||
import com.nflg.wms.repository.entity.WmsInventoryCheckTaskItemMaterial;
|
||||
import com.nflg.wms.repository.service.IWmsInventoryCheckTaskItemMaterialService;
|
||||
import com.nflg.wms.repository.service.IWmsInventoryCheckTaskItemService;
|
||||
import com.nflg.wms.repository.service.IWmsInventoryCheckTaskService;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 库存相关
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/inventory")
|
||||
public class InventoryController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private IWmsInventoryCheckTaskService inventoryCheckTaskService;
|
||||
|
||||
@Resource
|
||||
private IWmsInventoryCheckTaskItemService inventoryCheckTaskItemService;
|
||||
|
||||
@Resource
|
||||
private InventoryCheckTaskScanRecordResitory inventoryCheckTaskScanRecordResitory;
|
||||
|
||||
@Resource
|
||||
private IWmsInventoryCheckTaskItemMaterialService inventoryCheckTaskItemMaterialService;
|
||||
|
||||
/**
|
||||
* 保存库存盘点任务
|
||||
* @param request 请求参数
|
||||
*/
|
||||
@PostMapping("save")
|
||||
public ApiResult<Void> save(@Valid @RequestBody InventoryCheckTaskSaveQO request) {
|
||||
inventoryCheckTaskService.save(request);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库存盘点任务
|
||||
* @param request 请求参数
|
||||
*/
|
||||
@PostMapping("search")
|
||||
public ApiResult<PageData<InventoryCheckTaskVO>> search(@Valid @RequestBody InventoryCheckTaskSearchQO request) {
|
||||
return ApiResult.success(inventoryCheckTaskService.search(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布库存盘点任务
|
||||
* @param id 任务id
|
||||
*/
|
||||
@PostMapping("publish")
|
||||
public ApiResult<Void> publish(@Valid @RequestParam @NotNull Long id) {
|
||||
inventoryCheckTaskService.publish(id);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库存盘点任务
|
||||
* @param id ID
|
||||
*/
|
||||
@PostMapping("delete")
|
||||
public ApiResult<Void> delete(@Valid @RequestParam @NotNull Long id) {
|
||||
inventoryCheckTaskService.delete(id);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户的盘点任务(PDA使用)
|
||||
* @param no 任务编号
|
||||
*/
|
||||
@GetMapping("getTaskByUser")
|
||||
public ApiResult<List<InventoryCheckTaskItemVO>> getTaskByUser(@Valid @RequestParam(required = false) String no) {
|
||||
return ApiResult.success(inventoryCheckTaskItemService.getTaskByUser(UserUtil.getUserId(), no));
|
||||
}
|
||||
|
||||
/**
|
||||
* 盘点任务扫码(PDA使用)
|
||||
* @param request 请求参数
|
||||
*/
|
||||
@PostMapping("scan")
|
||||
public ApiResult<Void> scan(@Valid @RequestBody InventoryCheckTaskScanQO request) {
|
||||
WmsInventoryCheckTaskItem item = inventoryCheckTaskItemService.getById(request.getId());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(item)).throwMessage("未找到数据");
|
||||
WmsInventoryCheckTask task = inventoryCheckTaskService.getById(item.getTaskId());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(task)).throwMessage("未找到任务");
|
||||
VUtil.trueThrowBusinessError(!Objects.equals(task.getState(), 2)).throwMessage("任务未开始或已完成");
|
||||
MaterialQRCodeContentDTO qrCode = NoUtil.getMaterialQRCodeContent(request.getQrCode());
|
||||
VUtil.trueThrowBusinessError(inventoryCheckTaskScanRecordResitory.existsByTaskIdAndUniqNo(item.getTaskId(), qrCode.getUniqNo()))
|
||||
.throwMessage("该二维码已盘点过了");
|
||||
inventoryCheckTaskScanRecordResitory.save(InventoryCheckTaskScanRecord.builder()
|
||||
.taskId(item.getTaskId())
|
||||
.itemId(item.getId())
|
||||
.uniqNo(qrCode.getUniqNo())
|
||||
.batchNo(qrCode.getBatchNo())
|
||||
.serialNo(qrCode.getSerialNo())
|
||||
.num(qrCode.getNum())
|
||||
.createBy(UserUtil.getUserName())
|
||||
.createTime(Instant.now())
|
||||
.build()
|
||||
);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存盘点结果(PDA使用)
|
||||
* @param request 请求参数
|
||||
*/
|
||||
@PostMapping("saveScan")
|
||||
public ApiResult<String> saveScan(@Valid @RequestBody InventoryCheckTaskScanSaveQO request) {
|
||||
InventoryCheckTaskItemVO item = inventoryCheckTaskItemService.getInfo(request.getId());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(item)).throwMessage("未找到数据");
|
||||
WmsInventoryCheckTask task = inventoryCheckTaskService.getById(item.getTaskId());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(task)).throwMessage("未找到任务");
|
||||
VUtil.trueThrowBusinessError(!Objects.equals(task.getState(), 2)).throwMessage("任务未开始或已完成");
|
||||
List<InventoryCheckTaskScanRecord> records = inventoryCheckTaskScanRecordResitory.findByTaskId(item.getTaskId());
|
||||
// request.getQrCodes().removeIf(qrCode -> records.stream().anyMatch(record -> StrUtil.equals(record.getUniqNo(), NoUtil.getMaterialQRCodeContent(qrCode).getUniqNo())));
|
||||
List<InventoryCheckTaskScanRecord> newRecords = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(request.getQrCodes())) {
|
||||
List<WmsInventoryCheckTaskItemMaterial> materials = new ArrayList<>();
|
||||
request.getQrCodes().forEach(qrCode -> {
|
||||
MaterialQRCodeContentDTO qrCodeContent = NoUtil.getMaterialQRCodeContent(qrCode);
|
||||
if (records.stream().noneMatch(record -> StrUtil.equals(record.getUniqNo(), qrCodeContent.getUniqNo()))) {
|
||||
WmsInventoryCheckTaskItemMaterial material = materials.stream().filter(mit -> StrUtil.equals(mit.getMaterialNo(), qrCodeContent.getMaterialNo())).findFirst().orElse(null);
|
||||
if (Objects.isNull(material)) {
|
||||
material = new WmsInventoryCheckTaskItemMaterial()
|
||||
.setId(IdUtil.getSnowflakeNextId())
|
||||
.setMaterialNo(qrCodeContent.getMaterialNo())
|
||||
.setMaterialDesc(qrCodeContent.getMaterialDesc())
|
||||
.setBatchNo(qrCodeContent.getBatchNo())
|
||||
.setItemId(item.getId())
|
||||
.setTaskId(item.getTaskId())
|
||||
.setNum(qrCodeContent.getNum());
|
||||
materials.add(material);
|
||||
} else {
|
||||
material.setNum(material.getNum().add(qrCodeContent.getNum()));
|
||||
}
|
||||
newRecords.add(InventoryCheckTaskScanRecord.builder()
|
||||
.taskId(item.getTaskId())
|
||||
.itemId(item.getId())
|
||||
.uniqNo(qrCodeContent.getUniqNo())
|
||||
.materialNo(qrCodeContent.getMaterialNo())
|
||||
.materialId(material.getId())
|
||||
.batchNo(qrCodeContent.getBatchNo())
|
||||
.serialNo(qrCodeContent.getSerialNo())
|
||||
.num(qrCodeContent.getNum())
|
||||
.createBy(UserUtil.getUserName())
|
||||
.createTime(Instant.now())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(materials)) {
|
||||
inventoryCheckTaskItemMaterialService.saveBatch(materials);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(newRecords)) {
|
||||
inventoryCheckTaskScanRecordResitory.saveAll(newRecords);
|
||||
}
|
||||
}
|
||||
return ApiResult.success("保存" + newRecords.size() + "条数据成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成盘点任务(PDA使用)
|
||||
* @param taskId 任务ID
|
||||
*/
|
||||
@PostMapping("complete")
|
||||
public ApiResult<Void> complete(@Valid @RequestParam @NotNull Long taskId) {
|
||||
inventoryCheckTaskService.complete(taskId);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看盘点结果
|
||||
* @param request 请求参数
|
||||
*/
|
||||
@PostMapping("getMatrials")
|
||||
public ApiResult<PageData<WmsInventoryCheckTaskItemMaterialVO>> getMatrials(@Valid @RequestBody InventoryCheckTaskMaterialsQO request) {
|
||||
return ApiResult.success(inventoryCheckTaskService.getMatrials(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物料扫码记录
|
||||
* @param materialId 物料记录id
|
||||
* @return 扫码记录列表
|
||||
*/
|
||||
@GetMapping("getScanRecords")
|
||||
public ApiResult<List<InventoryCheckTaskScanRecord>> getScanRecords(@Valid @RequestParam @NotNull Long materialId) {
|
||||
return ApiResult.success(inventoryCheckTaskScanRecordResitory.findByMaterialId(materialId));
|
||||
}
|
||||
}
|
||||
|
|
@ -112,4 +112,12 @@ public class WarehouseController extends BaseController {
|
|||
public void exportSearch(HttpServletResponse response,@Valid @RequestBody WarehouseSearchQO request) throws Exception {
|
||||
warehouseControllerService.exportSearch(response,request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取启用的仓库列表
|
||||
*/
|
||||
@GetMapping("getEnableList")
|
||||
public ApiResult<List<WarehouseVO>> getEnableList() {
|
||||
return ApiResult.success(warehouseControllerService.getEnableList());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
package com.nflg.wms.admin.pojo.document;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@Accessors(chain = true)
|
||||
@Document(collection = "InventoryCheckTaskScanRecord")
|
||||
public class InventoryCheckTaskScanRecord {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 任务项ID
|
||||
*/
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 唯一编号
|
||||
*/
|
||||
private String uniqNo;
|
||||
|
||||
/**
|
||||
* 物料id
|
||||
*/
|
||||
private Long materialId;
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String batchNo;
|
||||
|
||||
/**
|
||||
* 序列号
|
||||
*/
|
||||
private String serialNo;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Instant createTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.nflg.wms.admin.repository;
|
||||
|
||||
import com.nflg.wms.admin.pojo.document.InventoryCheckTaskScanRecord;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface InventoryCheckTaskScanRecordResitory extends MongoRepository<InventoryCheckTaskScanRecord, String> {
|
||||
|
||||
boolean existsByTaskIdAndUniqNo(Long taskId, String uniqNo);
|
||||
|
||||
List<InventoryCheckTaskScanRecord> findByTaskId(Long taskId);
|
||||
|
||||
List<InventoryCheckTaskScanRecord> findByMaterialId(@Valid @NotNull Long materialId);
|
||||
}
|
||||
|
|
@ -2,7 +2,9 @@ package com.nflg.wms.admin.repository;
|
|||
|
||||
import com.nflg.wms.admin.pojo.document.PackageMaterialScanRecord;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface PackageMaterialScanRecordRepository extends MongoRepository<PackageMaterialScanRecord, String> {
|
||||
|
||||
}
|
||||
|
|
@ -199,4 +199,8 @@ public class WarehouseControllerService {
|
|||
.addSheet(new ListSheet<>(datas))
|
||||
.writeTo(response.getOutputStream());
|
||||
}
|
||||
|
||||
public List<WarehouseVO> getEnableList() {
|
||||
return warehouseService.getEnableList();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InventoryCheckTaskMaterialsQO extends SearchBaseQO {
|
||||
|
||||
/**
|
||||
* 盘点任务ID
|
||||
*/
|
||||
private Long taskId;
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InventoryCheckTaskSaveItemQO {
|
||||
|
||||
/**
|
||||
* 仓库id
|
||||
*/
|
||||
@NotNull
|
||||
private Long warehouseId;
|
||||
|
||||
/**
|
||||
* 盘点负责人
|
||||
*/
|
||||
@NotBlank
|
||||
private String chargeUserName;
|
||||
|
||||
/**
|
||||
* 盘点负责人id
|
||||
*/
|
||||
@NotNull
|
||||
private Integer chargeUserId;
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class InventoryCheckTaskSaveQO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 任务开始时间
|
||||
*/
|
||||
@NotNull
|
||||
private LocalDate startTime;
|
||||
|
||||
/**
|
||||
* 任务结束时间
|
||||
*/
|
||||
@NotNull
|
||||
private LocalDate endTime;
|
||||
|
||||
/**
|
||||
* 财务负责人
|
||||
*/
|
||||
@NotBlank
|
||||
private String financeUserName;
|
||||
|
||||
/**
|
||||
* 任务说明
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
@Valid
|
||||
@NotEmpty
|
||||
private List<InventoryCheckTaskSaveItemQO> items;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InventoryCheckTaskScanQO {
|
||||
|
||||
@NotNull
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 二维码内容
|
||||
*/
|
||||
@NotBlank
|
||||
private String qrCode;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class InventoryCheckTaskScanSaveQO {
|
||||
|
||||
@NotNull
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 二维码列表
|
||||
*/
|
||||
@NotEmpty
|
||||
private List<String> qrCodes;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InventoryCheckTaskSearchQO extends SearchBaseQO {
|
||||
|
||||
/**
|
||||
* 盘点任务号
|
||||
*/
|
||||
private String no;
|
||||
|
||||
/**
|
||||
* 任务状态:0:未发布;1:已发布;2:进行中;3:已完成
|
||||
*/
|
||||
private Integer state;
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class InventoryCheckTaskItemVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 盘点任务id
|
||||
*/
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 盘点任务号
|
||||
*/
|
||||
private String taskNo;
|
||||
|
||||
/**
|
||||
* 任务开始时间
|
||||
*/
|
||||
private LocalDate startTime;
|
||||
|
||||
/**
|
||||
* 任务结束时间
|
||||
*/
|
||||
private LocalDate endTime;
|
||||
|
||||
/**
|
||||
* 财务负责人
|
||||
*/
|
||||
private String financeUserName;
|
||||
|
||||
/**
|
||||
* 工厂编号
|
||||
*/
|
||||
private String factoryNo;
|
||||
|
||||
/**
|
||||
* 仓库名称
|
||||
*/
|
||||
private String warehouseName;
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class InventoryCheckTaskVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 盘点任务号
|
||||
*/
|
||||
private String taskNo;
|
||||
|
||||
/**
|
||||
* 仓库编号
|
||||
*/
|
||||
private String warehouseNos;
|
||||
|
||||
/**
|
||||
* 任务状态:0:未发布;1:已发布;2:进行中;3:已完成
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 任务开始时间
|
||||
*/
|
||||
private LocalDate startTime;
|
||||
|
||||
/**
|
||||
* 任务结束时间
|
||||
*/
|
||||
private LocalDate endTime;
|
||||
|
||||
/**
|
||||
* 财务负责人
|
||||
*/
|
||||
private String financeUserName;
|
||||
|
||||
/**
|
||||
* 任务说明
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 最后更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
|
@ -9,6 +9,8 @@ import java.math.BigDecimal;
|
|||
@Accessors(chain = true)
|
||||
public class WmsInProduceOrderItemVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 父级id
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package com.nflg.wms.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class WmsInventoryCheckTaskItemMaterialVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 盘点任务id
|
||||
*/
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 盘点任务项id
|
||||
*/
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
private String materialDesc;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String batchNo;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
* 工厂编号
|
||||
*/
|
||||
private String factoryNo;
|
||||
|
||||
/**
|
||||
* 仓库编号
|
||||
*/
|
||||
private String warehouseNo;
|
||||
|
||||
/**
|
||||
* 储位编号
|
||||
*/
|
||||
private String binNos;
|
||||
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private BigDecimal inventoryNum;
|
||||
}
|
||||
|
|
@ -76,6 +76,11 @@ public class WmsInProduceOrderItem implements Serializable {
|
|||
*/
|
||||
private String warehouseNo;
|
||||
|
||||
/**
|
||||
* 储位
|
||||
*/
|
||||
private String binNos;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,83 @@
|
|||
package com.nflg.wms.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@TableName("wms_inventory_check_task")
|
||||
public class WmsInventoryCheckTask implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 盘点任务号
|
||||
*/
|
||||
private String taskNo;
|
||||
|
||||
/**
|
||||
* 任务状态:0:未发布;1:已发布;2:进行中;3:已完成
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 任务开始时间
|
||||
*/
|
||||
private LocalDate startTime;
|
||||
|
||||
/**
|
||||
* 任务结束时间
|
||||
*/
|
||||
private LocalDate endTime;
|
||||
|
||||
/**
|
||||
* 财务负责人
|
||||
*/
|
||||
private String financeUserName;
|
||||
|
||||
/**
|
||||
* 任务说明
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 最后更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.nflg.wms.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@TableName("wms_inventory_check_task_item")
|
||||
public class WmsInventoryCheckTaskItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 盘点任务id
|
||||
*/
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 仓库id
|
||||
*/
|
||||
private Long warehouseId;
|
||||
|
||||
/**
|
||||
* 盘点负责人
|
||||
*/
|
||||
private String chargeUserName;
|
||||
|
||||
/**
|
||||
* 盘点负责人id
|
||||
*/
|
||||
private Integer chargeUserId;
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.nflg.wms.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@TableName("wms_inventory_check_task_item_material")
|
||||
public class WmsInventoryCheckTaskItemMaterial implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 盘点任务id
|
||||
*/
|
||||
private Long taskId;
|
||||
|
||||
/**
|
||||
* 盘点任务项id
|
||||
*/
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
private String materialDesc;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String batchNo;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal num;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.nflg.wms.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.wms.common.pojo.vo.InventoryCheckTaskItemVO;
|
||||
import com.nflg.wms.repository.entity.WmsInventoryCheckTaskItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
public interface WmsInventoryCheckTaskItemMapper extends BaseMapper<WmsInventoryCheckTaskItem> {
|
||||
|
||||
List<InventoryCheckTaskItemVO> getTaskByUser(Long userId, String no);
|
||||
|
||||
InventoryCheckTaskItemVO getInfo(Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.nflg.wms.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.wms.repository.entity.WmsInventoryCheckTaskItemMaterial;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
public interface WmsInventoryCheckTaskItemMaterialMapper extends BaseMapper<WmsInventoryCheckTaskItemMaterial> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.nflg.wms.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.wms.common.pojo.qo.InventoryCheckTaskMaterialsQO;
|
||||
import com.nflg.wms.common.pojo.qo.InventoryCheckTaskSearchQO;
|
||||
import com.nflg.wms.common.pojo.vo.InventoryCheckTaskVO;
|
||||
import com.nflg.wms.common.pojo.vo.WmsInventoryCheckTaskItemMaterialVO;
|
||||
import com.nflg.wms.repository.entity.WmsInventoryCheckTask;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
public interface WmsInventoryCheckTaskMapper extends BaseMapper<WmsInventoryCheckTask> {
|
||||
IPage<InventoryCheckTaskVO> search(InventoryCheckTaskSearchQO request, Page<Object> objectPage);
|
||||
|
||||
IPage<WmsInventoryCheckTaskItemMaterialVO> getMatrials(InventoryCheckTaskMaterialsQO request, Page<?> objectPage);
|
||||
}
|
||||
|
|
@ -25,4 +25,8 @@ public interface WmsWarehouseMapper extends BaseMapper<WmsWarehouse> {
|
|||
List<WarehouseVO> getList(List<Long> ids);
|
||||
|
||||
List<WarehouseVO> searchNonPage(@Param("request") WarehouseSearchQO request);
|
||||
|
||||
List<WarehouseVO> getEnableList();
|
||||
|
||||
List<WarehouseVO> getListByIds(List<Long> list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
package com.nflg.wms.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.wms.repository.entity.WmsInventoryCheckTaskItemMaterial;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
public interface IWmsInventoryCheckTaskItemMaterialService extends IService<WmsInventoryCheckTaskItemMaterial> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.nflg.wms.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.wms.common.pojo.vo.InventoryCheckTaskItemVO;
|
||||
import com.nflg.wms.repository.entity.WmsInventoryCheckTaskItem;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
public interface IWmsInventoryCheckTaskItemService extends IService<WmsInventoryCheckTaskItem> {
|
||||
|
||||
void deleteByTaskId(Long id);
|
||||
|
||||
List<InventoryCheckTaskItemVO> getTaskByUser(Long userId, @Valid String no);
|
||||
|
||||
InventoryCheckTaskItemVO getInfo(@NotNull Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.nflg.wms.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.wms.common.pojo.qo.InventoryCheckTaskMaterialsQO;
|
||||
import com.nflg.wms.common.pojo.qo.InventoryCheckTaskSaveQO;
|
||||
import com.nflg.wms.common.pojo.qo.InventoryCheckTaskSearchQO;
|
||||
import com.nflg.wms.common.pojo.vo.InventoryCheckTaskVO;
|
||||
import com.nflg.wms.common.pojo.vo.WmsInventoryCheckTaskItemMaterialVO;
|
||||
import com.nflg.wms.repository.entity.WmsInventoryCheckTask;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
public interface IWmsInventoryCheckTaskService extends IService<WmsInventoryCheckTask> {
|
||||
|
||||
void save(InventoryCheckTaskSaveQO request);
|
||||
|
||||
IPage<InventoryCheckTaskVO> search(@Valid InventoryCheckTaskSearchQO request);
|
||||
|
||||
void delete(Long id);
|
||||
|
||||
void publish(@Valid @NotNull Long id);
|
||||
|
||||
void complete(@Valid @NotNull Long taskId);
|
||||
|
||||
IPage<WmsInventoryCheckTaskItemMaterialVO> getMatrials(@Valid InventoryCheckTaskMaterialsQO request);
|
||||
}
|
||||
|
|
@ -36,4 +36,8 @@ public interface IWmsWarehouseService extends IService<WmsWarehouse> {
|
|||
List<WmsWarehouse> getList();
|
||||
|
||||
List<WarehouseVO> searchNonPage(@Valid WarehouseSearchQO request);
|
||||
|
||||
List<WarehouseVO> getEnableList();
|
||||
|
||||
List<WarehouseVO> getListByIds(List<Long> list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
package com.nflg.wms.repository.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.wms.repository.entity.WmsInventoryCheckTaskItemMaterial;
|
||||
import com.nflg.wms.repository.mapper.WmsInventoryCheckTaskItemMaterialMapper;
|
||||
import com.nflg.wms.repository.service.IWmsInventoryCheckTaskItemMaterialService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Service
|
||||
public class WmsInventoryCheckTaskItemMaterialServiceImpl extends ServiceImpl<WmsInventoryCheckTaskItemMaterialMapper, WmsInventoryCheckTaskItemMaterial> implements IWmsInventoryCheckTaskItemMaterialService {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.nflg.wms.repository.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.wms.common.pojo.vo.InventoryCheckTaskItemVO;
|
||||
import com.nflg.wms.repository.entity.WmsInventoryCheckTaskItem;
|
||||
import com.nflg.wms.repository.mapper.WmsInventoryCheckTaskItemMapper;
|
||||
import com.nflg.wms.repository.service.IWmsInventoryCheckTaskItemService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Service
|
||||
public class WmsInventoryCheckTaskItemServiceImpl extends ServiceImpl<WmsInventoryCheckTaskItemMapper, WmsInventoryCheckTaskItem> implements IWmsInventoryCheckTaskItemService {
|
||||
|
||||
@Override
|
||||
public void deleteByTaskId(Long id) {
|
||||
remove(new LambdaQueryWrapper<WmsInventoryCheckTaskItem>().eq(WmsInventoryCheckTaskItem::getTaskId, id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InventoryCheckTaskItemVO> getTaskByUser(Long userId, String no) {
|
||||
return baseMapper.getTaskByUser(userId, no);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryCheckTaskItemVO getInfo(Long id) {
|
||||
return baseMapper.getInfo(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
package com.nflg.wms.repository.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.wms.common.pojo.qo.InventoryCheckTaskMaterialsQO;
|
||||
import com.nflg.wms.common.pojo.qo.InventoryCheckTaskSaveQO;
|
||||
import com.nflg.wms.common.pojo.qo.InventoryCheckTaskSearchQO;
|
||||
import com.nflg.wms.common.pojo.vo.InventoryCheckTaskVO;
|
||||
import com.nflg.wms.common.pojo.vo.WarehouseVO;
|
||||
import com.nflg.wms.common.pojo.vo.WmsInventoryCheckTaskItemMaterialVO;
|
||||
import com.nflg.wms.common.util.DateTimeUtil;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.nflg.wms.repository.entity.WmsInventoryCheckTask;
|
||||
import com.nflg.wms.repository.entity.WmsInventoryCheckTaskItem;
|
||||
import com.nflg.wms.repository.mapper.WmsInventoryCheckTaskMapper;
|
||||
import com.nflg.wms.repository.service.IWmsInventoryCheckTaskItemService;
|
||||
import com.nflg.wms.repository.service.IWmsInventoryCheckTaskService;
|
||||
import com.nflg.wms.repository.service.IWmsWarehouseService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Service
|
||||
public class WmsInventoryCheckTaskServiceImpl extends ServiceImpl<WmsInventoryCheckTaskMapper, WmsInventoryCheckTask> implements IWmsInventoryCheckTaskService {
|
||||
|
||||
@Resource
|
||||
private IWmsInventoryCheckTaskItemService inventoryCheckTaskItemService;
|
||||
|
||||
@Resource
|
||||
private IWmsWarehouseService warehouseService;
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void save(InventoryCheckTaskSaveQO request) {
|
||||
WmsInventoryCheckTask task;
|
||||
if (Objects.isNull(request.getId())) {
|
||||
task = new WmsInventoryCheckTask()
|
||||
.setTaskNo("ICT" + DateTimeUtil.format(LocalDateTime.now(), "yyyyMMddHHmmss"))
|
||||
.setRemark(request.getRemark())
|
||||
.setStartTime(request.getStartTime())
|
||||
.setEndTime(request.getEndTime())
|
||||
.setFinanceUserName(request.getFinanceUserName())
|
||||
.setCreateBy(UserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
save(task);
|
||||
} else {
|
||||
task = getById(request.getId());
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(task)).throwMessage("未找到盘点任务");
|
||||
VUtil.trueThrowBusinessError(!Objects.equals(task.getState(), 0)).throwMessage("未发布状态才能修改");
|
||||
task.setRemark(request.getRemark())
|
||||
.setStartTime(request.getStartTime())
|
||||
.setEndTime(request.getEndTime())
|
||||
.setFinanceUserName(request.getFinanceUserName())
|
||||
.setUpdateBy(UserUtil.getUserName())
|
||||
.setUpdateTime(LocalDateTime.now());
|
||||
updateById(task);
|
||||
inventoryCheckTaskItemService.remove(new LambdaQueryWrapper<WmsInventoryCheckTaskItem>().eq(WmsInventoryCheckTaskItem::getTaskId, request.getId()));
|
||||
}
|
||||
inventoryCheckTaskItemService.saveBatch(request.getItems().stream().map(item ->
|
||||
new WmsInventoryCheckTaskItem()
|
||||
.setTaskId(task.getId())
|
||||
.setWarehouseId(item.getWarehouseId())
|
||||
.setChargeUserName(item.getChargeUserName())
|
||||
.setChargeUserId(item.getChargeUserId())
|
||||
).toList()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<InventoryCheckTaskVO> search(InventoryCheckTaskSearchQO request) {
|
||||
IPage<InventoryCheckTaskVO> datas = baseMapper.search(request, new Page<>(request.getPage(), request.getPageSize()));
|
||||
datas.getRecords().forEach(it -> {
|
||||
List<WmsInventoryCheckTaskItem> items = inventoryCheckTaskItemService.lambdaQuery().eq(WmsInventoryCheckTaskItem::getTaskId, it.getId()).list();
|
||||
List<WarehouseVO> warehouseVOS = warehouseService.getListByIds(items.stream().map(WmsInventoryCheckTaskItem::getWarehouseId).toList());
|
||||
it.setWarehouseNos(StrUtil.join(",", warehouseVOS.stream().map(w -> w.getNo() + "【" + w.getFactoryName() + "】").toList()));
|
||||
});
|
||||
return datas;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
removeById(id);
|
||||
inventoryCheckTaskItemService.deleteByTaskId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publish(Long id) {
|
||||
WmsInventoryCheckTask task = getById(id);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(task)).throwMessage("未找到盘点任务");
|
||||
VUtil.trueThrowBusinessError(!Objects.equals(task.getState(), 0)).throwMessage("请勿重复发布");
|
||||
Integer state = task.getStartTime().isAfter(LocalDate.now()) ? 1 : 2;
|
||||
lambdaUpdate()
|
||||
.set(WmsInventoryCheckTask::getState, state)
|
||||
.set(WmsInventoryCheckTask::getUpdateBy, UserUtil.getUserName())
|
||||
.set(WmsInventoryCheckTask::getUpdateTime, LocalDateTime.now())
|
||||
.eq(WmsInventoryCheckTask::getId, id)
|
||||
.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(Long taskId) {
|
||||
WmsInventoryCheckTask task = getById(taskId);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(task)).throwMessage("未找到任务");
|
||||
VUtil.trueThrowBusinessError(!Objects.equals(task.getState(), 2)).throwMessage("任务未开始或已完成");
|
||||
lambdaUpdate()
|
||||
.set(WmsInventoryCheckTask::getState, 3)
|
||||
.set(WmsInventoryCheckTask::getUpdateBy, UserUtil.getUserName())
|
||||
.set(WmsInventoryCheckTask::getUpdateTime, LocalDateTime.now())
|
||||
.eq(WmsInventoryCheckTask::getId, taskId)
|
||||
.eq(WmsInventoryCheckTask::getState, 2)
|
||||
.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<WmsInventoryCheckTaskItemMaterialVO> getMatrials(InventoryCheckTaskMaterialsQO request) {
|
||||
return baseMapper.getMatrials(request, new Page<>(request.getPage(), request.getPageSize()));
|
||||
}
|
||||
}
|
||||
|
|
@ -104,4 +104,14 @@ public class WmsWarehouseServiceImpl extends ServiceImpl<WmsWarehouseMapper, Wms
|
|||
public List<WarehouseVO> searchNonPage(WarehouseSearchQO request) {
|
||||
return baseMapper.searchNonPage(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarehouseVO> getEnableList() {
|
||||
return baseMapper.getEnableList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarehouseVO> getListByIds(List<Long> list) {
|
||||
return baseMapper.getListByIds(list);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
<?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="com.nflg.wms.repository.mapper.WmsInventoryCheckTaskItemMapper">
|
||||
|
||||
<select id="getTaskByUser" resultType="com.nflg.wms.common.pojo.vo.InventoryCheckTaskItemVO">
|
||||
SELECT icti.id,ict.*,di."name" AS "factory_no",wh."name" AS "warehouse_name"
|
||||
FROM wms_inventory_check_task ict
|
||||
INNER JOIN wms_inventory_check_task_item icti ON ict."id"=icti.task_id
|
||||
LEFT JOIN wms_warehouse wh ON wh."id"=icti.warehouse_id
|
||||
LEFT JOIN dictionary_item di ON wh.factory_id=di."id"
|
||||
WHERE ict.state=2 and icti.charge_user_id=#{userId}
|
||||
<if test="no != null">
|
||||
AND ict."no" LIKE CONCAT('%',#{no},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getInfo" resultType="com.nflg.wms.common.pojo.vo.InventoryCheckTaskItemVO">
|
||||
SELECT icti.id,ict.*,di."name" AS "factory_no",wh."name" AS "warehouse_name"
|
||||
FROM wms_inventory_check_task ict
|
||||
INNER JOIN wms_inventory_check_task_item icti ON ict."id"=icti.task_id
|
||||
LEFT JOIN wms_warehouse wh ON wh."id"=icti.warehouse_id
|
||||
LEFT JOIN dictionary_item di ON wh.factory_id=di."id"
|
||||
WHERE icti.id=#{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?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="com.nflg.wms.repository.mapper.WmsInventoryCheckTaskItemMaterialMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?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="com.nflg.wms.repository.mapper.WmsInventoryCheckTaskMapper">
|
||||
|
||||
<select id="search" resultType="com.nflg.wms.common.pojo.vo.InventoryCheckTaskVO">
|
||||
select *
|
||||
from wms_inventory_check_task
|
||||
<where>
|
||||
<if test="request.state!=null">
|
||||
and state = #{request.state}
|
||||
</if>
|
||||
<if test="request.startDate!=null">
|
||||
and start_time >= #{request.startDate}
|
||||
</if>
|
||||
<if test="request.endDate!=null">
|
||||
and end_time <= #{request.endDate}
|
||||
</if>
|
||||
<if test="request.no!=null and request.no!=''">
|
||||
and task_no like concat('%', #{request.no}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getMatrials" resultType="com.nflg.wms.common.pojo.vo.WmsInventoryCheckTaskItemMaterialVO">
|
||||
SELECT ictim.*,di."name" AS "factory_no",wh."no" AS "warehouse_no",get_binnos(s.id) AS "bin_nos",i.num AS "inventory_num"
|
||||
FROM wms_inventory_check_task_item_material ictim
|
||||
LEFT JOIN wms_inventory_check_task_item icti ON ictim.item_id=icti."id"
|
||||
LEFT JOIN wms_warehouse wh ON icti.warehouse_id=wh."id"
|
||||
LEFT JOIN dictionary_item di ON di."id"=wh.factory_id
|
||||
LEFT JOIN wms_inventory i ON ictim.material_no=i.material_no and i.factory_no=di.code AND i.warehouse_no=wh."no" AND i.batch_number=ictim.batch_no
|
||||
LEFT JOIN wms_storage s ON s.material_no=ictim.material_no AND s.warehouse_id=icti.warehouse_id
|
||||
WHERE ictim.task_id=#{request.taskId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -39,4 +39,21 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getEnableList" resultType="com.nflg.wms.common.pojo.vo.WarehouseVO">
|
||||
select w.*, di.name as factory_name
|
||||
from wms_warehouse w
|
||||
left join dictionary_item di on w.factory_id = di.id
|
||||
where w.enable
|
||||
</select>
|
||||
|
||||
<select id="getListByIds" resultType="com.nflg.wms.common.pojo.vo.WarehouseVO">
|
||||
select w.*, di.name as factory_name
|
||||
from wms_warehouse w
|
||||
left join dictionary_item di on w.factory_id = di.id
|
||||
where w.id in
|
||||
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class CodeGeneratorTest {
|
|||
)
|
||||
.strategyConfig(builder -> {
|
||||
builder
|
||||
.addInclude("wms_in_produce_order_item") //只生成指定表
|
||||
.addInclude("wms_inventory_check_task_item_material") //只生成指定表
|
||||
.entityBuilder().idType(IdType.ASSIGN_ID)
|
||||
.enableLombok()
|
||||
.enableChainModel()
|
||||
|
|
|
|||
Loading…
Reference in New Issue