liweidong
liweidong-hj 5 days ago
commit 9f7d627ad3
  1. 5
      blade-service-api/blade-wms-api/src/main/java/org/springblade/wms/pojo/entity/StExpireSubmission.java
  2. 97
      blade-service/blade-desk/src/main/java/org/springblade/desk/efficiency/controller/BsEfficiencyTaskController.java
  3. 5
      blade-service/blade-desk/src/main/java/org/springblade/desk/efficiency/listener/ExcelMapListener.java
  4. 8
      blade-service/blade-desk/src/main/java/org/springblade/desk/efficiency/util/EasyExcelUtil.java
  5. 5
      blade-service/blade-wms/src/main/java/org/springblade/wms/service/impl/StBuyOrderServiceImpl.java
  6. 2
      blade-service/blade-wms/src/main/java/org/springblade/wms/service/impl/StExpireSubmissionServiceImpl.java

@ -44,6 +44,11 @@ public class StExpireSubmission extends TenantEntity {
*/ */
@Schema(description = "送检部门") @Schema(description = "送检部门")
private String esDept; private String esDept;
/**
* 送检部门
*/
@Schema(description = "送检部门")
private Long esDeptId;
/** /**
* 送检数量 * 送检数量
*/ */

@ -128,11 +128,13 @@ public class BsEfficiencyTaskController extends BladeController {
if (task.getStatus() == null || task.getStatus() != BsEfficiencyTaskEnum.STATUS_PENDING_APPROVAL.getCode()) { if (task.getStatus() == null || task.getStatus() != BsEfficiencyTaskEnum.STATUS_PENDING_APPROVAL.getCode()) {
R.fail("当前绩效任务不能审批"); R.fail("当前绩效任务不能审批");
} }
BsEfficiencyTaskEntity upd = new BsEfficiencyTaskEntity(); LambdaUpdateWrapper<BsEfficiencyTaskEntity> wrapper = new LambdaUpdateWrapper<>();
upd.setId(bsEfficiencyTask.getId()); wrapper.eq(BsEfficiencyTaskEntity::getId, bsEfficiencyTask.getId())
upd.setStatus(BsEfficiencyTaskEnum.STATUS_REJECTED.getCode()); .set(BsEfficiencyTaskEntity::getAttachId, null)
upd.setRemark(bsEfficiencyTask.getRemark()); .set(BsEfficiencyTaskEntity::getReportTime, null)
return R.status(bsEfficiencyTaskService.saveOrUpdate(upd)); .set(BsEfficiencyTaskEntity::getRemark, bsEfficiencyTask.getRemark())
.set(BsEfficiencyTaskEntity::getStatus, BsEfficiencyTaskEnum.STATUS_REJECTED.getCode());
return R.status(bsEfficiencyTaskService.update(null, wrapper));
} }
/** /**
@ -161,6 +163,7 @@ public class BsEfficiencyTaskController extends BladeController {
upd.setId(bsEfficiencyTask.getId()); upd.setId(bsEfficiencyTask.getId());
upd.setAttachId(bsEfficiencyTask.getAttachId()); upd.setAttachId(bsEfficiencyTask.getAttachId());
upd.setStatus(BsEfficiencyTaskEnum.STATUS_FINISHED.getCode()); upd.setStatus(BsEfficiencyTaskEnum.STATUS_FINISHED.getCode());
upd.setReportTime(new Date());
return R.status(bsEfficiencyTaskService.saveOrUpdate(upd)); return R.status(bsEfficiencyTaskService.saveOrUpdate(upd));
} }
@ -187,6 +190,7 @@ public class BsEfficiencyTaskController extends BladeController {
LambdaUpdateWrapper<BsEfficiencyTaskEntity> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<BsEfficiencyTaskEntity> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(BsEfficiencyTaskEntity::getId, bsEfficiencyTask.getId()) wrapper.eq(BsEfficiencyTaskEntity::getId, bsEfficiencyTask.getId())
.set(BsEfficiencyTaskEntity::getAttachId, null) .set(BsEfficiencyTaskEntity::getAttachId, null)
.set(BsEfficiencyTaskEntity::getReportTime, null)
.set(BsEfficiencyTaskEntity::getStatus, BsEfficiencyTaskEnum.STATUS_IN_PROGRESS.getCode()); .set(BsEfficiencyTaskEntity::getStatus, BsEfficiencyTaskEnum.STATUS_IN_PROGRESS.getCode());
return R.status(bsEfficiencyTaskService.update(null, wrapper)); return R.status(bsEfficiencyTaskService.update(null, wrapper));
} }
@ -247,53 +251,47 @@ public class BsEfficiencyTaskController extends BladeController {
return checkR; return checkR;
} }
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<LinkedHashMap<String, Object>> mapList = EasyExcelUtil.read(file); Map<String, Object> readResult = EasyExcelUtil.read(file);
List<LinkedHashMap<String, Object>> tableDataList = new ArrayList<>(); List<LinkedHashMap<String, Object>> mapList = (List<LinkedHashMap<String, Object>>) readResult.get("data");
Map<Integer, String> excelHeadMap = (Map<Integer, String>) readResult.get("head");
List<String> excelParamNames = excelHeadMap.entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.map(Map.Entry::getValue)
.toList();
if (excelParamNames.size() != paramNames.size()) {
return R.fail("上传文件与模板不一致!");
}
Set<String> paramSet = new HashSet<>(paramNames);
Set<String> excelParamSet = new HashSet<>(excelParamNames);
if (!paramSet.equals(excelParamSet)) {
return R.fail("上传文件与模板不一致!");
}
int num = 1;
LinkedHashMap<String, String> headMap = new LinkedHashMap<>();
for (String key : excelParamNames) {
if (this.EMPLOYEE_CODE.equals(key)) {
headMap.put(this.EMPLOYEE_CODE, "employeeCode");
} else if (this.EMPLOYEE_NAME.equals(key)) {
headMap.put(this.EMPLOYEE_NAME, "employeeName");
} else if (this.TOTAL_SCORE.equals(key)) {
headMap.put(this.TOTAL_SCORE, "totalScore");
} else {
headMap.put(key, "temp" + num);
num++;
}
}
List<LinkedHashMap<String, Object>> tableColumnList = new ArrayList<>(); List<LinkedHashMap<String, Object>> tableColumnList = new ArrayList<>();
for (Map.Entry<String, String> entry : headMap.entrySet()) {
LinkedHashMap<String, Object> tableColumn = new LinkedHashMap<>();
tableColumn.put("label", entry.getKey());
tableColumn.put("prop", entry.getValue());
tableColumnList.add(tableColumn);
}
List<LinkedHashMap<String, Object>> tableDataList = new ArrayList<>();
if (!CollectionUtils.isEmpty(mapList)) { if (!CollectionUtils.isEmpty(mapList)) {
LinkedHashMap<String, Object> firstMap = mapList.get(0);
int num = 1;
LinkedHashMap<String, String> headMap = new LinkedHashMap<>();
for (String key : firstMap.keySet()) {
if (this.EMPLOYEE_CODE.equals(key)) {
headMap.put(this.EMPLOYEE_CODE, "employeeCode");
} else if (this.EMPLOYEE_NAME.equals(key)) {
headMap.put(this.EMPLOYEE_NAME, "employeeName");
} else if (this.TOTAL_SCORE.equals(key)) {
headMap.put(this.TOTAL_SCORE, "totalScore");
} else {
headMap.put(key, "temp" + num);
num++;
}
}
List<String> missingFields = new ArrayList<>();
for (String requiredField : paramNames) {
if (!headMap.containsKey(requiredField)) {
missingFields.add(requiredField);
}
}
// 如果有缺失字段
if (!CollectionUtils.isEmpty(missingFields)) {
return R.fail("上传文件与模板不一致!");
}
for (Map.Entry<String, String> entry : headMap.entrySet()) {
String excelHeadName = entry.getKey();
if (!paramNames.contains(excelHeadName)) {
continue;
}
LinkedHashMap<String, Object> tableColumn = new LinkedHashMap<>();
tableColumn.put("label", entry.getKey());
tableColumn.put("prop", entry.getValue());
tableColumnList.add(tableColumn);
}
for (LinkedHashMap<String, Object> map : mapList) { for (LinkedHashMap<String, Object> map : mapList) {
LinkedHashMap<String, Object> tableData = new LinkedHashMap<>(); LinkedHashMap<String, Object> tableData = new LinkedHashMap<>();
for (Map.Entry<String, String> entry : headMap.entrySet()) { for (Map.Entry<String, String> entry : headMap.entrySet()) {
String excelHeadName = entry.getKey();
if (!paramNames.contains(excelHeadName)) {
continue;
}
tableData.put(entry.getValue(), map.get(entry.getKey())); tableData.put(entry.getValue(), map.get(entry.getKey()));
} }
R<UserInfo> userInfoResult = userClient.userInfoByCode((String) tableData.get("employeeCode")); R<UserInfo> userInfoResult = userClient.userInfoByCode((String) tableData.get("employeeCode"));
@ -304,9 +302,9 @@ public class BsEfficiencyTaskController extends BladeController {
} }
tableDataList.add(tableData); tableDataList.add(tableData);
} }
resultMap.put("tableColumn", tableColumnList);
resultMap.put("tableData", tableDataList);
} }
resultMap.put("tableColumn", tableColumnList);
resultMap.put("tableData", tableDataList);
return R.data(resultMap); return R.data(resultMap);
} }
@ -398,6 +396,7 @@ public class BsEfficiencyTaskController extends BladeController {
upd.setId(bsEfficiencyTask.getId()); upd.setId(bsEfficiencyTask.getId());
upd.setAttachId(bsEfficiencyTask.getAttachId()); upd.setAttachId(bsEfficiencyTask.getAttachId());
upd.setStatus(BsEfficiencyTaskEnum.STATUS_PENDING_APPROVAL.getCode()); upd.setStatus(BsEfficiencyTaskEnum.STATUS_PENDING_APPROVAL.getCode());
upd.setReportTime(new Date());
return R.status(bsEfficiencyTaskService.saveOrUpdate(upd)); return R.status(bsEfficiencyTaskService.saveOrUpdate(upd));
} }

@ -41,4 +41,9 @@ public class ExcelMapListener extends AnalysisEventListener<Map<Integer, Object>
public List<LinkedHashMap<String, Object>> getData() { public List<LinkedHashMap<String, Object>> getData() {
return resultList; return resultList;
} }
// 获取表头
public Map<Integer, String> getHeadMap() {
return headMap;
}
} }

@ -4,13 +4,14 @@ import com.alibaba.excel.EasyExcel;
import org.springblade.desk.efficiency.listener.ExcelMapListener; import org.springblade.desk.efficiency.listener.ExcelMapListener;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class EasyExcelUtil { public class EasyExcelUtil {
public static List<LinkedHashMap<String, Object>> read(MultipartFile file) { public static Map<String, Object> read(MultipartFile file) {
try { try {
ExcelMapListener listener = new ExcelMapListener(); ExcelMapListener listener = new ExcelMapListener();
@ -19,7 +20,10 @@ public class EasyExcelUtil {
.sheet() .sheet()
.doRead(); .doRead();
return listener.getData(); Map<String, Object> result = new HashMap<>();
result.put("data", listener.getData());
result.put("head", listener.getHeadMap());
return result;
} catch (Exception e) { } catch (Exception e) {
return null; return null;
} }

@ -157,6 +157,8 @@ public class StBuyOrderServiceImpl extends BaseServiceImpl<StBuyOrderMapper, StB
buyOrder.setNeedDate(sb.getNeedDate()); buyOrder.setNeedDate(sb.getNeedDate());
buyOrder.setSurDrawQty(buyOrder.getBuyQty()); buyOrder.setSurDrawQty(buyOrder.getBuyQty());
buyOrder.setGrade(buyOrder.getGrade()); buyOrder.setGrade(buyOrder.getGrade());
buyOrder.setBatchStatus("新建");
buyOrder.setPickStatus("新建");
if (buyOrder.getId() != null) { if (buyOrder.getId() != null) {
// 修改 // 修改
@ -293,7 +295,7 @@ public class StBuyOrderServiceImpl extends BaseServiceImpl<StBuyOrderMapper, StB
for (StBuyOrder bo : list) { for (StBuyOrder bo : list) {
StBuyOrder old = baseMapper.selectById(bo.getId()); StBuyOrder old = baseMapper.selectById(bo.getId());
old.setBoStatus(StBuyOrder.BOSTATUS_SUBMIT); old.setBoStatus(StBuyOrder.BOSTATUS_SUBMIT);
baseMapper.updateById(old); // 标准化 MyBatis-Plus 方法 baseMapper.updateById(old);
} }
} }
@ -303,6 +305,7 @@ public class StBuyOrderServiceImpl extends BaseServiceImpl<StBuyOrderMapper, StB
StBuyOrder oldBuyOrder = baseMapper.selectById(id); StBuyOrder oldBuyOrder = baseMapper.selectById(id);
oldBuyOrder.setExtraBill(extraBill); oldBuyOrder.setExtraBill(extraBill);
oldBuyOrder.setBoStatus(StBuyOrder.BOSTATUS_SUBMIT); oldBuyOrder.setBoStatus(StBuyOrder.BOSTATUS_SUBMIT);
baseMapper.updateById(oldBuyOrder);
} }
public StBuyOrder getByExtraBill(String extraBill) { public StBuyOrder getByExtraBill(String extraBill) {

@ -57,7 +57,7 @@ public class StExpireSubmissionServiceImpl extends BaseServiceImpl<StExpireSubmi
// 查询 StGoods,获取物料编码 goodsCode // 查询 StGoods,获取物料编码 goodsCode
StGoods stGoods = stGoodsService.getById(stock.getGoodsId()); StGoods stGoods = stGoodsService.getById(stock.getGoodsId());
String goodsCode = stGoods != null ? stGoods.getGoodsCode() : null; String goodsCode = stGoods != null ? stGoods.getGoodsCode() : null;
String userName = user.getUserName(); String userName = user.getNickName();
// 调 ERP 接口 // 调 ERP 接口
String esCode = baseMapper.sendStSubmission(stock, goodsCode, userName); String esCode = baseMapper.sendStSubmission(stock, goodsCode, userName);

Loading…
Cancel
Save