feat: 新增品质复判功能
This commit is contained in:
parent
fe9fab1267
commit
666ff9d28f
@ -2,6 +2,7 @@ package com.foreverwin.iep.qms.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
@ -10,7 +11,9 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 复判记录表
|
||||
@ -153,4 +156,16 @@ public class QmsRejudgmentLog extends Model<QmsRejudgmentLog> {
|
||||
@ApiModelProperty(value="更新人员")
|
||||
private String updater;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<QmsRejudgmentLog> list;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String inspecLevel;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String wmsInventoryIdBo;
|
||||
|
||||
@TableField(exist = false)
|
||||
private BigDecimal qtyOnHand;
|
||||
|
||||
}
|
||||
|
||||
@ -23,8 +23,8 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/qmsrejudgmentlog" )
|
||||
@Api(value = "qmsrejudgmentlog", tags = "复判记录表管理")
|
||||
@RequestMapping("/qms-rejudgment-log" )
|
||||
@Api(value = "qms-rejudgment-log", tags = "复判记录表管理")
|
||||
public class QmsRejudgmentLogController {
|
||||
|
||||
private final QmsRejudgmentLogService qmsRejudgmentLogService;
|
||||
@ -37,7 +37,6 @@ public class QmsRejudgmentLogController {
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('qms_qmsrejudgmentlog_view')" )
|
||||
public R getQmsRejudgmentLogPage(Page page, QmsRejudgmentLog qmsRejudgmentLog) {
|
||||
return R.ok(qmsRejudgmentLogService.page(page, Wrappers.query(qmsRejudgmentLog)));
|
||||
}
|
||||
@ -50,7 +49,6 @@ public class QmsRejudgmentLogController {
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@GetMapping("/{sid}" )
|
||||
@PreAuthorize("@pms.hasPermission('qms_qmsrejudgmentlog_view')" )
|
||||
public R getById(@PathVariable("sid" ) String sid) {
|
||||
return R.ok(qmsRejudgmentLogService.getById(sid));
|
||||
}
|
||||
@ -63,9 +61,9 @@ public class QmsRejudgmentLogController {
|
||||
@ApiOperation(value = "新增复判记录表", notes = "新增复判记录表")
|
||||
@SysLog("新增复判记录表" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('qms_qmsrejudgmentlog_add')" )
|
||||
public R save(@RequestBody QmsRejudgmentLog qmsRejudgmentLog) {
|
||||
return R.ok(qmsRejudgmentLogService.save(qmsRejudgmentLog));
|
||||
qmsRejudgmentLogService.saveAll(qmsRejudgmentLog);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,7 +74,6 @@ public class QmsRejudgmentLogController {
|
||||
@ApiOperation(value = "修改复判记录表", notes = "修改复判记录表")
|
||||
@SysLog("修改复判记录表" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('qms_qmsrejudgmentlog_edit')" )
|
||||
public R updateById(@RequestBody QmsRejudgmentLog qmsRejudgmentLog) {
|
||||
return R.ok(qmsRejudgmentLogService.updateById(qmsRejudgmentLog));
|
||||
}
|
||||
@ -89,21 +86,8 @@ public class QmsRejudgmentLogController {
|
||||
@ApiOperation(value = "通过id删除复判记录表", notes = "通过id删除复判记录表")
|
||||
@SysLog("通过id删除复判记录表" )
|
||||
@DeleteMapping("/{sid}" )
|
||||
@PreAuthorize("@pms.hasPermission('qms_qmsrejudgmentlog_del')" )
|
||||
public R removeById(@PathVariable String sid) {
|
||||
return R.ok(qmsRejudgmentLogService.removeById(sid));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param qmsRejudgmentLog 查询条件
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('qms_qmsrejudgmentlog_export')" )
|
||||
public List<QmsRejudgmentLog> export(QmsRejudgmentLog qmsRejudgmentLog) {
|
||||
return qmsRejudgmentLogService.list(Wrappers.query(qmsRejudgmentLog));
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,5 +10,5 @@ import com.foreverwin.iep.qms.entity.QmsRejudgmentLog;
|
||||
* @date 2024-11-28 13:50:54
|
||||
*/
|
||||
public interface QmsRejudgmentLogService extends IService<QmsRejudgmentLog> {
|
||||
|
||||
void saveAll(QmsRejudgmentLog qmsRejudgmentLog);
|
||||
}
|
||||
|
||||
@ -1,10 +1,21 @@
|
||||
package com.foreverwin.iep.qms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.iep.qms.entity.QmsRejudgmentLog;
|
||||
import com.foreverwin.iep.qms.mapper.QmsRejudgmentLogMapper;
|
||||
import com.foreverwin.iep.qms.service.QmsRejudgmentLogService;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import com.foreverwin.mom.wms.api.feign.RemoteWmsInventoryService;
|
||||
import com.foreverwin.mom.wms.entity.Inventory;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 复判记录表
|
||||
@ -13,6 +24,37 @@ import org.springframework.stereotype.Service;
|
||||
* @date 2024-11-28 13:50:54
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class QmsRejudgmentLogServiceImpl extends ServiceImpl<QmsRejudgmentLogMapper, QmsRejudgmentLog> implements QmsRejudgmentLogService {
|
||||
|
||||
private final RemoteWmsInventoryService remoteWmsInventoryService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void saveAll(QmsRejudgmentLog qmsRejudgmentLog) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
for (QmsRejudgmentLog detail : qmsRejudgmentLog.getList()) {
|
||||
List<QmsRejudgmentLog> list = super.list(Wrappers.lambdaQuery(QmsRejudgmentLog.class)
|
||||
.eq(QmsRejudgmentLog::getInventoryId, detail.getInventoryId()));
|
||||
if (!list.isEmpty()) {
|
||||
detail.setSeq(String.valueOf(list.size() + 1));
|
||||
detail.setDemotionProcessHistory(list.get(0).getRejudgLevel()+"->"+detail.getRejudgLevel());
|
||||
} else {
|
||||
detail.setSeq("1");
|
||||
detail.setDemotionProcessHistory(detail.getRejudgLevel());
|
||||
}
|
||||
if (detail.getNewItemBo() != null) {
|
||||
detail.setChangeItem("Y");
|
||||
} else {
|
||||
detail.setChangeItem("N");
|
||||
}
|
||||
detail.setType("SD");
|
||||
detail.setSid(UUID.randomUUID().toString());
|
||||
detail.setSite(site);
|
||||
detail.setOriginalLevel(qmsRejudgmentLog.getInspecLevel());
|
||||
detail.setCreator(SecurityUtils.getUserName());
|
||||
detail.setDateCreate(LocalDateTime.now());
|
||||
}
|
||||
super.saveBatch(qmsRejudgmentLog.getList());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user