Browse Source

拆单任务完成,待测试

dist.1.3.0
chenlong 8 months ago
parent
commit
c8ce500fab
  1. 11
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTrayServiceImpl.java
  2. 30
      blade-service/logpm-basicdata/src/main/resources/static/tray-pdf-template.html
  3. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionAddvalueAppController.java
  4. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionStockupAppController.java
  5. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java
  6. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java
  7. 47
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java

11
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTrayServiceImpl.java

@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.ibm.icu.impl.data.ResourceReader;
import com.itextpdf.html2pdf.ConverterProperties;
import com.itextpdf.html2pdf.HtmlConverter;
import com.itextpdf.kernel.geom.PageSize;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.font.FontProvider;
@ -279,10 +280,7 @@ public class BasicdataTrayServiceImpl extends BaseServiceImpl<BasicdataTrayMappe
StringBuilder PDFHtml = new StringBuilder();
String htmlTemplate = getTrayCodePdfTemplate();
int index = 0;
for (Long id : ids) {
index++;
WarehouseTrayQRCode trayQRCode = baseMapper.getTray(id);
String filename = QRCodeUtil.createCodeToFile(trayQRCode.getTrayCode());
String fileTypeName = QRCodeUtil.createCodeToFileType(trayQRCode.getTrayCode());
@ -297,13 +295,10 @@ public class BasicdataTrayServiceImpl extends BaseServiceImpl<BasicdataTrayMappe
.replaceAll("\\$\\{imgType}", QRCodeUtil.getEmpAutograph(fileTypeName));
PDFHtml.append(html);
if (index % 4 == 0) {
PDFHtml.append("<div style=\"page-break-before: always;\"></div>");
}
PDFHtml.append("<div style=\"page-break-before: always;\"></div>");
}
document.setDefaultPageSize(PageSize.A4.rotate());
HtmlConverter.convertToPdf(new ByteArrayInputStream(PDFHtml.toString().getBytes()), document, converterProperties);
document.close();

30
blade-service/logpm-basicdata/src/main/resources/static/tray-pdf-template.html

@ -1,22 +1,28 @@
<div>
<div>
<meta charset="UTF-8"/>
<meta charSet="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Document</title></div>
<table style="margin-bottom:50px;border-collapse: collapse;width: 100%;text-align: center;font-size: 17px;font-weight: bold;border-left: 1px dashed #000;border-top: 1px dashed #000;">
<tr> <!-- 二维码 -->
<title>Document</title>
</div>
<table
style="border-collapse: collapse;width: 100%;text-align: center;font-size: 17px;font-weight: bold;">
<tr style="border: 2px solid black; "> <!-- 二维码 -->
<td rowspan="3"
style="width: 50%;padding: 10px;border-right: 1px dashed #000;border-bottom: 1px dashed #000;">
<img style="width: 140px; height: 140px" src="${qrCode}"/>
<div style="text-align: center">${trayCode}</div>
style="width: 50%;padding: 10px;border: 1px solid black; ">
<img style="width: 550px; height: 550px" src="${qrCode}"/>
<div style="text-align: center;font-size: 50px;line-height: 100px">${trayCode}</div>
</td>
<td style="font-size: 50px;height:224px;font-weight: bold;border: 2px solid black; ">
<div style="font-size: 50px;font-weight: bold;text-align: center;">
<img src="http://htys.oss-cn-chengdu.aliyuncs.com/htys/ca53af052e7494504f1e4be3f8a1701e.jpg" style="width: 100%" alt="">
</div>
</td>
<td style="border-right: 1px dashed #000; height:58px;border-bottom: 1px dashed #000">${tenant}</td>
</tr>
<tr>
<td style="border-right: 1px dashed #000; height:58px;border-bottom: 1px dashed #000"> ${warehouseName}</td>
<tr style="border: 2px solid black; ">
<td style="font-size: 50px;height:224px;font-weight: bold;border: 2px solid black; "> ${warehouseName}</td>
</tr>
<tr>
<td style="border-right: 1px dashed #000; height:58px;border-bottom: 1px dashed #000">${palletName}</td>
<tr style="border: 2px solid black; ">
<td style="font-size: 50px;height:224px;font-weight: bold;border: 2px solid black; ">${palletName}</td>
</tr>
</table>
</div>

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionAddvalueAppController.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.distribution.dto.DistributionAddvaluePackageDTO;
import com.logpm.distribution.dto.app.DistributionAppAddvalueDTO;
import com.logpm.distribution.service.IDistributionAddvalueService;
import com.logpm.distribution.service.impl.DistributionAddvalueServiceImpl;
import com.logpm.distribution.vo.DistributionAddvalueDetailVO;
import com.logpm.distribution.vo.DistributionAddvaluePackageVO;
@ -31,7 +32,7 @@ import java.util.List;
@Api(value = "配送管理", tags = "增值服务App接口")
public class DistributionAddvalueAppController {
private final DistributionAddvalueServiceImpl distributionAddvalueService;
private final IDistributionAddvalueService distributionAddvalueService;
/**

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionStockupAppController.java

@ -94,28 +94,20 @@ public class DistributionStockupAppController extends BladeController {
private final IDistributionReservationService distributionReservationService;
private final IBasicdataGoodsAreaClient basicdataGoodsAreaClient;
private final IDistrilbutionBillStockService distrilbutionBillStockService;
private final IBasicdataTrayClient basicdataTrayClient;
private final IDistributionStockService distributionStockService;
private final IDistributionStockArticleService distributionStockArticleService;
private final IDistributionParcelListService distributionParcelListService;
private final IDistributionReservationPackageService distributionReservationPackageService;
private final IDistributionReservationStocklistService distributionReservationStocklistService;
private final IWarehouseUpdownGoodsClient warehouseUpdownGoodsClient;
private final IWarehouseUpdownGoodsLogClient warehouseUpdownGoodsLogClient;
private final IWarehouseGoodsAllocationClient warehouseGoodsAllocationClient;
private final IWarehouseUpdownTypeClient warehouseUpdownTypeClient;
private final IDistributionAsyncService distributionAsyncService;
private final IDistributionDeliveryDetailsService distributionDeliveryDetailsService;
private final DistributionReservationMapper distributionReservationMapper;
private final IDisStockListDetailService disStockListDetailService;
private final IBasicdataWarehouseClient basicdataWarehouseClient;
private final RabbitTemplate rabbitTemplate;
private final BladeRedis bladeRedis;
private final DataSourceTransactionManager dataSourceTransactionManager;
private final TransactionDefinition transactionDefinition;
private final IDistributionStockListService distributionStockListService;

13
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java

@ -10,10 +10,8 @@ import com.logpm.distribution.service.IDistributionSplitOrderTaskService;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@ -34,10 +32,15 @@ public class DistributionSplitOrderTaskController {
}
@PostMapping("/batch-create-task")
public R<String> batchCreateTask(List<DistributionSplitOrderTaskEntity> distributionSplitOrderTaskList) {
public R<String> batchCreateTask(@RequestBody List<DistributionSplitOrderTaskEntity> distributionSplitOrderTaskList) {
return distributionSplitOrderTaskService.batchCreateTask(distributionSplitOrderTaskList);
}
@PostMapping("/add-task")
public R<String> addTask(Long allTaskId, List<DistributionSplitOrderTaskEntity> task) {
return distributionSplitOrderTaskService.addTask(allTaskId, task);
}
@PostMapping("/cancel-all-task")
public R<String> cancelAllTask(Long allTaskId) {
return distributionSplitOrderTaskService.cancelAllTask(allTaskId);

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java

@ -48,6 +48,13 @@ public interface IDistributionSplitOrderTaskService extends BaseService<Distribu
*/
R<String> batchCreateTask(List<DistributionSplitOrderTaskEntity> distributionSplitOrderTaskList);
/**
* 添加子任务
* @param distributionSplitOrderTaskList
* @return
*/
R<String> addTask(Long allTaskId, List<DistributionSplitOrderTaskEntity> distributionSplitOrderTaskList);
/**
* 更新任务
* @param distributionSplitOrderTaskEntity

47
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java

@ -130,7 +130,49 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
throw new CustomerException("系统错误");
}
return R.success("success");
return R.success("操作成功");
}
@Override
public R<String> addTask(Long allTaskId, List<DistributionSplitOrderTaskEntity> distributionSplitOrderTaskList) {
DistributionSplitOrderAllTaskEntity allTask = distributionSplitOrderAllTaskService.getById(allTaskId);
if (allTask == null) {
return R.fail("拆单任务不存在");
}
if (!allTask.getState().equals(OrderSplitStateConstant.InProgress.getValue())) {
return R.fail("拆单任务已完成或已撤销,无法添加");
}
if (distributionSplitOrderTaskList.isEmpty()) {
return R.fail("拆单任务不能为空");
}
try {
int currentNumber = getCurrentOrderCodeNumber(allTask.getStockArticleId());
for (DistributionSplitOrderTaskEntity distributionSplitOrderTaskEntity : distributionSplitOrderTaskList) {
String newOrderCode = getNewOrderCode(distributionSplitOrderTaskEntity.getOrderCode(), currentNumber++);
distributionSplitOrderTaskEntity.setNewOrderCode(newOrderCode);
distributionSplitOrderTaskEntity.setSplitOrderAllTaskId(allTask.getId());
distributionSplitOrderTaskEntity.setSplitOrderAllTaskNo(allTask.getNo());
save(distributionSplitOrderTaskEntity);
allTask.setNumber(allTask.getNumber() + 1);
allTask.setOrderPackageNumber(allTask.getOrderPackageNumber() + distributionSplitOrderTaskEntity.getTaskNumber());
distributionSplitOrderLogService.record(distributionSplitOrderTaskEntity, "新增拆单任务", AuthUtil.getUser().getUserName());
}
distributionSplitOrderAllTaskService.updateById(allTask);
} catch (Exception e) {
if (e instanceof CustomerException) {
throw new CustomerException(e.getMessage());
}
log.error("新增拆单系统错误", e);
throw new CustomerException("系统错误");
}
return R.success("操作成功");
}
private String getAllTaskNo() {
@ -769,7 +811,8 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
queryWrapper.eq(DistributionSplitOrderAllTaskEntity::getId, splitOrderAllTaskId);
}
distributionSplitOrderAllTaskService.list(page, queryWrapper);
List<DistributionSplitOrderAllTaskEntity> list = distributionSplitOrderAllTaskService.list(page, queryWrapper);
page.setRecords(list);
return R.data(page);
}

Loading…
Cancel
Save