Merge pull request 'develop' (#94) from develop into master

Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/94
This commit is contained in:
heyu 2025-07-07 10:30:20 +08:00
commit 0209bd896f

View File

@ -234,10 +234,36 @@ public class EmisTmsSiteBatchController extends EmisBaseController
}
SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
for (EmisTmsSiteBatch batch : batchList) {
// 先查询数据库中的完整数据
EmisTmsSiteBatch dbBatch = emisTmsSiteBatchService.selectEmisTmsSiteBatchById(batch.getId());
if (dbBatch == null) {
return AjaxResult.error("批次ID " + batch.getId() + " 不存在");
}
// 使用前端传来的值更新数据库中的值
if (batch.getTransType() != null) {
dbBatch.setTransType(batch.getTransType());
}
if (batch.getStartSiteCode() != null) {
dbBatch.setStartSiteCode(batch.getStartSiteCode());
}
if (batch.getSupplierCode() != null) {
dbBatch.setSupplierCode(batch.getSupplierCode());
}
if (batch.getNextSiteCode() != null) {
dbBatch.setNextSiteCode(batch.getNextSiteCode());
}
if (batch.getEtd() != null) {
dbBatch.setEtd(batch.getEtd());
}
if (batch.getCarNo() != null) {
dbBatch.setCarNo(batch.getCarNo());
}
// 运输方式首字母
String prefix = "E";
if (batch.getTransType() != null) {
switch (batch.getTransType()) {
if (dbBatch.getTransType() != null) {
switch (dbBatch.getTransType()) {
case "1":
prefix = "E";
break;
@ -260,9 +286,9 @@ public class EmisTmsSiteBatchController extends EmisBaseController
}
// 起始网点三字码
String startSiteCode3 = "";
if (batch.getStartSiteCode() != null) {
if (dbBatch.getStartSiteCode() != null) {
EmisSite startSite = new EmisSite();
startSite.setSiteCode(batch.getStartSiteCode());
startSite.setSiteCode(dbBatch.getStartSiteCode());
List<EmisSite> startSites = emisSiteService.selectEmisSiteList(startSite);
if (!CollectionUtils.isEmpty(startSites)) {
startSiteCode3 = startSites.get(0).getSizeCode3();
@ -270,9 +296,9 @@ public class EmisTmsSiteBatchController extends EmisBaseController
}
// 供应商英文名
String supplierNameEn = "";
if (batch.getSupplierCode() != null) {
if (dbBatch.getSupplierCode() != null) {
EmisSupplier supplier = new EmisSupplier();
supplier.setCode(batch.getSupplierCode());
supplier.setCode(dbBatch.getSupplierCode());
List<EmisSupplier> suppliers = emisSupplierService.selectEmisSupplierList(supplier);
if (!CollectionUtils.isEmpty(suppliers)) {
supplierNameEn = suppliers.get(0).getNameEn();
@ -280,9 +306,9 @@ public class EmisTmsSiteBatchController extends EmisBaseController
}
// 下一网点三字码
String nextSiteCode3 = "";
if (batch.getNextSiteCode() != null) {
if (dbBatch.getNextSiteCode() != null) {
EmisSite nextSite = new EmisSite();
nextSite.setSiteCode(batch.getNextSiteCode());
nextSite.setSiteCode(dbBatch.getNextSiteCode());
List<EmisSite> nextSites = emisSiteService.selectEmisSiteList(nextSite);
if (!CollectionUtils.isEmpty(nextSites)) {
nextSiteCode3 = nextSites.get(0).getSizeCode3();
@ -290,15 +316,15 @@ public class EmisTmsSiteBatchController extends EmisBaseController
}
// etd日期
String etdStr = "";
if (batch.getEtd() != null) {
etdStr = sdf.format(batch.getEtd());
if (dbBatch.getEtd() != null) {
etdStr = sdf.format(dbBatch.getEtd());
}
// 车牌号
String carNo = batch.getCarNo() == null ? "" : batch.getCarNo();
String carNo = dbBatch.getCarNo() == null ? "" : dbBatch.getCarNo();
// 拼接batchName
String batchName = prefix + startSiteCode3 + supplierNameEn + nextSiteCode3 + etdStr + carNo;
batch.setBatchName(batchName);
emisTmsSiteBatchService.updateEmisTmsSiteBatch(batch);
dbBatch.setBatchName(batchName);
emisTmsSiteBatchService.updateEmisTmsSiteBatch(dbBatch);
}
return AjaxResult.success("批量修改成功");
}