移除没用到的代码

This commit is contained in:
彭枝刚 2024-12-27 16:51:15 +08:00
parent 756b0aba0b
commit 49c93efdd2
3 changed files with 880 additions and 1171 deletions

View File

@ -25,7 +25,8 @@ import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@ -70,20 +71,6 @@ public class DocumentController {
return R.ok();
}
/**
* 调拨单提交
*
* @param documentDetailedList 单据表
* @return R
*/
@ApiOperation(value = "调拨单提交", notes = "调拨单提交")
@SysLog("调拨单提交")
@PostMapping("/transferSubmit")
@PreAuthorize("@pms.hasPermission('wms_document_save')")
public R transferSubmit(@RequestBody List<DocumentDetailedDto> documentDetailedList) {
return R.failed("后台无实际处理逻辑");
}
/**
* 通过行项目获取已领料数据
*
@ -120,18 +107,6 @@ public class DocumentController {
return R.ok(documentService.getSaleInventoryId(carrier));
}
/**
* 退料查询数量
*
* @param documentDetailed inventoryId
* @return R
*/
@ApiOperation(value = "通过库存查询", notes = "通过库存查询")
@GetMapping("/getInventoryOriginalQty")
public R getInventoryOriginalQty(DocumentDetailedDto documentDetailed) {
return R.failed("后台无实际处理逻辑");
}
/**
* 成品采购查询数量
*
@ -165,9 +140,7 @@ public class DocumentController {
@ApiOperation(value = "入库单提交", notes = "入库单提交")
@SysLog("入库单提交")
@PostMapping("/returnSubmit")
@PreAuthorize("@pms.hasPermission('wms_document_return')")
public R returnSubmit(@RequestBody List<DocumentDetailedDto> documentDetailedList) {
String site = TenantContextHolder.getTenantId();
List<String> printList = null;
String printer = documentDetailedList.get(0).getPrinter();
if (StrUtil.isBlank(printer)) {
@ -184,20 +157,6 @@ public class DocumentController {
return R.ok();
}
/**
* 成品入库提交
*
* @param documentDetailedList 单据表
* @return R
*/
@ApiOperation(value = "成品入库提交", notes = "成品入库提交")
@SysLog("成品入库提交")
@PostMapping("/finishedProductsWarehouseSubmit")
@PreAuthorize("@pms.hasPermission('wms_document_save')")
public R finishedProductsWarehouseSubmit(@RequestBody List<DocumentDetailedDto> documentDetailedList) {
return R.failed("后台无实际处理逻辑");
}
/**
* 成品采购提交
*
@ -207,25 +166,11 @@ public class DocumentController {
@ApiOperation(value = "成品采购提交", notes = "成品采购提交")
@SysLog("成品采购提交")
@PostMapping("/finishedProductsPurchaseSubmit")
@PreAuthorize("@pms.hasPermission('wms_document_save')")
public R finishedProductsPurchaseSubmit(@RequestBody List<DocumentDetailedDto> documentDetailedList) {
documentService.finishedProductsPurchaseSubmit(documentDetailedList);
return R.ok();
}
/**
* 销售退货提交
*
* @param documentDetailedList 单据表
* @return R
*/
@ApiOperation(value = "销售退货提交", notes = "销售退货提交")
@SysLog("销售退货提交")
@PostMapping("/saleReturn/submit")
public R saleReturn(@RequestBody List<DocumentDetailedDto> documentDetailedList) {
return R.failed("后台无实际处理逻辑");
}
/**
* 拣货提交
*
@ -235,37 +180,11 @@ public class DocumentController {
@ApiOperation(value = "拣货提交", notes = "拣货提交")
@SysLog("拣货提交")
@PostMapping("/pickingSubmit")
@PreAuthorize("@pms.hasPermission('wms_document_save')")
public R pickingSubmit(@RequestBody List<DocumentDetailedDto> documentDetailedList) {
documentService.pickingSubmit(documentDetailedList);
return R.ok();
}
/**
* 出库单提交
*
* @param documentDetailedList 单据表
* @return R
*/
@ApiOperation(value = "出库单提交", notes = "出库单提交")
@SysLog("出库单提交")
@PostMapping("/productionRequisitionSubmit")
@PreAuthorize("@pms.hasPermission('wms_document_save')")
public R save(@RequestBody List<DocumentDetailedDto> documentDetailedList) {
// documentService.productionRequisitionSubmit(documentDetailedList);
return R.failed("后台无实际处理逻辑");
}
@ApiOperation(value = "出库单提交(自选过账日期)", notes = "出库单提交(自选过账日期)")
@SysLog("出库单提交(自选过账日期)")
@PostMapping("/productionRequisitionSubmit/freePostDate")
@PreAuthorize("@pms.hasPermission('wms_document_save')")
public R save(@RequestBody ListWithDateDTO<DocumentDetailedDto> request) {
// documentService.productionRequisitionSubmit(request.getList(), request.getDate());
return R.failed("后台无实际处理逻辑");
}
/**
* 通过id查询单据表
*
@ -631,19 +550,6 @@ public class DocumentController {
return R.ok(documentService.getPickingInventoryQty(site, documentDetailed));
}
/**
* 送货单打印(PDF)
*
* @param documentNo
* @param addressType
*/
@ApiOperation(value = "送货单打印(PDF)", notes = "送货单打印(PDF)")
@GetMapping("/deliverOrderPrint")
public void deliverOrderPrint(String documentNo, String addressType) {
String site = TenantContextHolder.getTenantId();
documentService.deliverOrderPrint(site, documentNo, addressType);
}
@ApiOperation(value = "查询采购到货登记", notes = "查询采购到货登记")
@GetMapping("/purchase/pagePurchaseInToStorageReg")
public R pagePurchaseInToStorageReg(FrontPage frontPage, String poNumber, String documentNo, String customerNo) {
@ -651,25 +557,6 @@ public class DocumentController {
return R.ok(documentService.pagePurchaseInToStorageReg(frontPage, site, Constant.DOCUMENT_PROCUREMENT_STORAGE, poNumber, documentNo, customerNo));
}
@ApiOperation(value = "采购到货登记", notes = "采购到货登记")
@PostMapping("/purchase/registerSubmit")
public R procurementStorageRegister(@RequestBody List<PoOrderDetailDTO> poOrderDetailDTOList) {
/*String site = TenantContextHolder.getTenantId();
String user = SecurityUtils.getUserName();
documentService.procurementStorageRegister(site, user, poOrderDetailDTOList);*/
return R.failed("后台无实际处理逻辑");
}
@ApiOperation(value = "采购到货登记冲销", notes = "采购到货登记冲销")
@PostMapping("/purchase/registerCancel")
@SysLog("采购到货登记冲销")
public R procurementStorageRegisterCancel(@RequestBody PoOrderDetailDTO poOrderDetail) {
/*String site = TenantContextHolder.getTenantId();
String user = SecurityUtils.getUserName();
documentService.procurementStorageRegisterCancel(site, user, poOrderDetail);*/
return R.failed("后台无实际处理逻辑");
}
@ApiOperation(value = "查询可冲销单据", notes = "查询可冲销单据")
@GetMapping("/detail/pageForCancel")
public R pageForCancel(FrontPage frontPage, String documentNo) {
@ -872,6 +759,7 @@ public class DocumentController {
documentService.submitDocumentWithFile(dto);
return R.ok();
}
//-----------------------------------------------------------------------------------
//出库
@ApiOperation(value = "采购退货过账", notes = "采购退货过账")
@ -983,6 +871,7 @@ public class DocumentController {
documentService.postOutDocument(site, user, dto.getStr());
return R.ok();
}
//-----------------------------------------------------------------------------------------
//入库
@ApiOperation(value = "采购收货过账", notes = "采购收货过账")
@ -1072,6 +961,7 @@ public class DocumentController {
documentService.postInDocument(site, user, dto.getStr());
return R.ok();
}
//-----------------------------------------------------------------------------------------------
@ApiOperation(value = "生产领料单过账", notes = "生产领料单过账")
@PostMapping("/postTransfer/STORES_REQUISITION")
@ -1128,6 +1018,7 @@ public class DocumentController {
return R.ok();
}
//----------------------------------------------------------------------------------
/**
* 分页查询订单信息
*/

View File

@ -230,14 +230,6 @@ public interface DocumentService extends IService<Document> {
*/
String getCommentCode(String site, String dataField);
/**
* 送货单PDF
*
* @param documentNo
* @param addressType
*/
void deliverOrderPrint(String site, String documentNo, String addressType);
IPage<DocumentWithPoOrderDTO> pagePurchaseInToStorageReg(IPage iPage, String site, String documentType, String poNumber, String documentNo, String customerNo);
void iqcResult(String site, String user, List<DocumentIqcResultRequest> requestList);

View File

@ -2877,180 +2877,6 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
return getInventoryQtyNew(site, documentDetailed, false, false, true, false, false);
}
@Override
public void deliverOrderPrint(String site, String documentNo, String addressType) {
String fileName = documentNo + ".pdf";
Document document = super.getById(Document.genHandle(site, documentNo));
String dnNumber = document.getExternalDocumentNo();
document.setDocumentDetailedList(documentDetailedMapper.selecttable(documentNo, site));
List<DocumentDetailed> documentDetailedList = document.getDocumentDetailedList();
DnOrder dnOrder = Optional.ofNullable(dnOrderService.getOne(Wrappers.lambdaQuery(DnOrder.class)
.eq(DnOrder::getSite, site)
.eq(DnOrder::getDnNumber, dnNumber)
)).orElseThrow(() -> BusinessException.build("未能根据外部单号" + dnNumber + "获取到DN单"));
List<DnOrderDetail> dnOrderDetailList = dnOrderDetailService.list(Wrappers.lambdaQuery(DnOrderDetail.class)
.eq(DnOrderDetail::getDnOrderBo, dnOrder.getHandle()));
String customerName = Optional.ofNullable(customerService.getById(Customer.genHandle(site, dnOrder.getDeliveryParty())))
.orElseThrow(() -> BusinessException.build("未能找到" + dnOrder.getDeliveryParty() + "的客户主数据")).getCustomerName();
if (CollectionUtil.isEmpty(dnOrderDetailList)) {
throw BusinessException.build("DN单" + dnNumber + "明细丢失");
} else {
FastCodeDetail rule = null;
/*FastCodeDetail rule = Optional.ofNullable(fastCodeService.listFastCodeDetailsByFastCode(site, FastCodeConstant.DELIVER_ORDER_PRINT_RULE, addressType))
.orElseThrow(() -> BusinessException.build("未维护出货单打印规则快码"));*/
String addressText = "";
String title = "";
Map<String, DnOrderDetail> groupMap = dnOrderDetailList.stream().collect(Collectors.toMap(DnOrderDetail::getSeq, o -> o));
com.itextpdf.text.Document pdfDocument = new com.itextpdf.text.Document();
try {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletResponse response = attributes.getResponse();
response.setCharacterEncoding("utf-8");
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "inline;filename=" + fileName + ".pdf");
response.flushBuffer();
ServletOutputStream outputStream = response.getOutputStream();
PdfWriter.getInstance(pdfDocument, outputStream);
pdfDocument.open();
//打包部署到 docker 容器后 获取不到静态资源
ClassPathResource resource = new ClassPathResource("static/image/img.png");
InputStream is = resource.getInputStream();
ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
byte[] buff = new byte[1024];
int rc;
while ((rc = is.read(buff, 0, 1024)) > 0) {
swapStream.write(buff, 0, rc);
}
com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance(swapStream.toByteArray());
image.setAlignment(com.itextpdf.text.Image.ALIGN_LEFT);
image.scalePercent(40, 50); //依照比例缩放
BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
//字体
com.itextpdf.text.Font font = new com.itextpdf.text.Font(bfChinese, 8, com.itextpdf.text.Font.NORMAL);
com.itextpdf.text.Font pFont = new com.itextpdf.text.Font(bfChinese, 16, com.itextpdf.text.Font.NORMAL);
com.itextpdf.text.Font nFont = new com.itextpdf.text.Font(bfChinese, 9, com.itextpdf.text.Font.NORMAL);
com.itextpdf.text.Font hFont = new com.itextpdf.text.Font(bfChinese, 10, com.itextpdf.text.Font.BOLD);
PdfPCell cell = null;
//头图片条码表格
PdfPTable tableHead = new PdfPTable(3);
if (title.length() > 13) {
tableHead.setWidths(new float[]{0.35f, 0.55f, 0.20f});
} else {
tableHead.setWidths(new float[]{0.35f, 0.45f, 0.30f});
}
tableHead.setHorizontalAlignment(Element.ALIGN_CENTER);
tableHead.setWidthPercentage(100);
//-----------------------------------------------------------------------------------------------------
//Logo
cell = new PdfPCell(image);
cell.setHorizontalAlignment(Element.ALIGN_LEFT);
cell.disableBorderSide(15);
tableHead.addCell(cell);
//头信息
Paragraph companyName = new Paragraph(title, pFont);
Paragraph documentType = new Paragraph("送货单", pFont);
Paragraph address = new Paragraph("地址: " + addressText, nFont);
Paragraph telephone = new Paragraph("Tel: 0519-82988228", nFont);
Paragraph blank = new Paragraph(" ", font);
companyName.setAlignment(Element.ALIGN_LEFT);
documentType.setAlignment(Element.ALIGN_CENTER);
address.setAlignment(Element.ALIGN_LEFT);
telephone.setAlignment(Element.ALIGN_LEFT);
cell = new PdfPCell();
cell.addElement(companyName);
cell.addElement(documentType);
cell.addElement(blank);
cell.addElement(address);
cell.addElement(telephone);
cell.addElement(blank);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.disableBorderSide(15);
tableHead.addCell(cell);
cell = new PdfPCell();
cell.disableBorderSide(15);
tableHead.addCell(cell);
//-----------------------------------------------------------------------------------------------------
PdfPTable preTable = new PdfPTable(2);
preTable.setTotalWidth(550f);
preTable.setLockedWidth(true);
preTable.setWidths(new float[]{0.7f, 0.3f});
preTable.addCell(createCell("客户名称:\u00a0\u00a0\u00a0\u00a0" + customerName, nFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
preTable.addCell(createCell("送货单号:\u00a0\u00a0\u00a0\u00a0" + dnOrder.getDnNumber(), nFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
preTable.addCell(createCell("收货地址:\u00a0\u00a0\u00a0\u00a0" + dnOrder.getDeliveryPartyAddressd(), nFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
preTable.addCell(createCell("送货日期:\u00a0\u00a0\u00a0\u00a0" + dnOrder.getDeliveryPlanDate(), nFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
preTable.addCell(createCell("收货人/电话:\u00a0\u00a0\u00a0\u00a0" + dnOrder.getContact(), nFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
preTable.addCell(createCell(" ", nFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
//-----------------------------------------------------------------------------------------------------
PdfPTable mainTable = new PdfPTable(9);
mainTable.setTotalWidth(550f);
mainTable.setLockedWidth(true);
mainTable.setWidths(new int[]{70, 70, 70, 90, 70, 70, 55, 55, 55});
mainTable.addCell(createCell1("物料编码", nFont, Element.ALIGN_CENTER));
mainTable.addCell(createCell1("物料描述", nFont, Element.ALIGN_CENTER));
mainTable.addCell(createCell1("客户料号", nFont, Element.ALIGN_CENTER));
mainTable.addCell(createCell1("客户物料描述", nFont, Element.ALIGN_CENTER));
mainTable.addCell(createCell1("发货批次", nFont, Element.ALIGN_CENTER));
mainTable.addCell(createCell1("发货数量", nFont, Element.ALIGN_CENTER));
mainTable.addCell(createCell1("单位", nFont, Element.ALIGN_CENTER));
mainTable.addCell(createCell1("订单号", nFont, Element.ALIGN_CENTER));
mainTable.addCell(createCell1("备注", nFont, Element.ALIGN_CENTER));
for (DocumentDetailed detailed : documentDetailedList) {
String seq = String.valueOf(detailed.getSeq());
DnOrderDetail dnOrderDetail = groupMap.get(seq);
mainTable.addCell(createCell1(dnOrderDetail.getMaterial(), font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(dnOrderDetail.getMaterialDescription(), font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(dnOrderDetail.getCustomerItem(), font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(dnOrderDetail.getCustomerItemDesc(), font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(detailed.getSalesBatch(), font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(Optional.ofNullable(detailed.getActualQuantity()).orElse(BigDecimal.ZERO).stripTrailingZeros().toPlainString(), font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(detailed.getUnitOfMeasure(), font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(dnOrderDetail.getCustomerPoNumber(), font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(dnOrderDetail.getDeliveryLineRemarks(), font, Element.ALIGN_CENTER));
}
PdfPCell cell1 = createCell1("收件人: ", font, Element.ALIGN_LEFT);
cell1.setColspan(3);
mainTable.addCell(cell1);
cell1 = createCell1("送货人: ", font, Element.ALIGN_LEFT);
cell1.setColspan(3);
mainTable.addCell(cell1);
cell1 = createCell1("开单人: ", font, Element.ALIGN_LEFT);
cell1.setColspan(3);
mainTable.addCell(cell1);
//补充空行
/*for (int i = 0; i < 17 - documentDetailedList.size(); i++) {
mainTable.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
mainTable.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
}*/
//pdfDocument.add(image);
pdfDocument.add(tableHead);
pdfDocument.add(preTable);
pdfDocument.add(blank);
pdfDocument.add(mainTable);
pdfDocument.close();
outputStream.flush();
} catch (Exception e) {
throw BusinessException.build(e.getLocalizedMessage());
}
}
}
@Override
public IPage<DocumentWithPoOrderDTO> pagePurchaseInToStorageReg(IPage iPage, String site, String
documentType, String poNumber, String documentNo, String customerNo) {