|
@@ -128,7 +128,7 @@ public class SaleDeliveryController {
|
|
|
//@AutoLog(value = "发货通知单(delivery notice)-分页列表查询")
|
|
|
@ApiOperation(value = "发货通知单(delivery notice)-分页列表查询", notes = "发货通知单(delivery notice)-分页列表查询")
|
|
|
@GetMapping(value = "/list")
|
|
|
- @PermissionData(pageComponent="saleCode/deliveryNotice/deliveryNoticeList")
|
|
|
+ @PermissionData(pageComponent = "saleCode/deliveryNotice/deliveryNoticeList")
|
|
|
public Result<IPage<SaleDelivery>> queryPageList(SaleDelivery saleDelivery,
|
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
@@ -151,19 +151,37 @@ public class SaleDeliveryController {
|
|
|
//@AutoLog(value = "发货通知单(delivery notice)-分页列表查询")
|
|
|
@ApiOperation(value = "发货通知单(delivery notice)-分页列表查询", notes = "发货通知单(delivery notice)-分页列表查询")
|
|
|
@GetMapping(value = "/listAlert")
|
|
|
- @PermissionData(pageComponent="saleCode/deliveryNotice/deliveryNoticeList")
|
|
|
+ @PermissionData(pageComponent = "saleCode/deliveryNotice/deliveryNoticeList")
|
|
|
public Result<IPage<SaleDelivery>> queryPageListAlert(SaleDelivery saleDelivery,
|
|
|
- @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
- @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
QueryWrapper<SaleDelivery> queryWrapper = QueryGenerator.initQueryWrapper(saleDelivery, req.getParameterMap());
|
|
|
Page<SaleDelivery> page = new Page<SaleDelivery>(pageNo, pageSize);
|
|
|
- IPage<SaleDelivery> pageList = saleDeliveryService.page(page, queryWrapper);
|
|
|
+
|
|
|
+ Page<SaleDeliveryAlert> page2 = new Page<SaleDeliveryAlert>(-1, -1);
|
|
|
+ QueryWrapper<SaleDeliveryAlert> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.apply("quantity > IFNULL(delivery_quantity, 0)");
|
|
|
+ if (saleDelivery != null && StringUtils.isNotBlank(saleDelivery.getProject())) {
|
|
|
+ queryWrapper1.eq("project", saleDelivery.getProject());
|
|
|
+ }
|
|
|
+ IPage<SaleDelivery> pageList = new Page<>();
|
|
|
+
|
|
|
+ IPage<SaleDeliveryAlert> pageList2 = saleDeliveryDetailsService.selectSaleDeliveryAlert(page2, queryWrapper1);
|
|
|
+ if (pageList2.getRecords().size() > 0) {
|
|
|
+ List<String> codeList = pageList2.getRecords().stream().map(SaleDeliveryAlert::getHeadId).collect(Collectors.toList());
|
|
|
+ queryWrapper.in("id", codeList);
|
|
|
+ } else {
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ pageList = saleDeliveryService.page(page, queryWrapper);
|
|
|
return Result.OK(pageList);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 不在使用
|
|
|
+ *
|
|
|
* @param saleInquiryForm
|
|
|
* @param pageNo
|
|
|
* @param pageSize
|
|
@@ -172,7 +190,7 @@ public class SaleDeliveryController {
|
|
|
*/
|
|
|
@ApiOperation(value = "发货通知单弹框明细-销售出库单使用", notes = "发货通知单弹框明细-销售出库单使用")
|
|
|
@GetMapping(value = "/selectSaleDeliveryAlert")
|
|
|
- @PermissionData(pageComponent="saleCode/deliveryNotice/deliveryNoticeList")
|
|
|
+ @PermissionData(pageComponent = "saleCode/deliveryNotice/deliveryNoticeList")
|
|
|
public Result<IPage<SaleDeliveryAlert>> selectSaleDeliveryAlert(SaleDeliveryAlert saleInquiryForm,
|
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
@@ -187,6 +205,7 @@ public class SaleDeliveryController {
|
|
|
|
|
|
/**
|
|
|
* 销售发票使用
|
|
|
+ *
|
|
|
* @param saleInquiryForm
|
|
|
* @param pageNo
|
|
|
* @param pageSize
|
|
@@ -195,11 +214,11 @@ public class SaleDeliveryController {
|
|
|
*/
|
|
|
@ApiOperation(value = "发货通知单弹框明细-销售发票使用", notes = "发货通知单弹框明细-销售发票使用")
|
|
|
@GetMapping(value = "/selectSaleDeliveryAlertInvoice")
|
|
|
- @PermissionData(pageComponent="saleCode/deliveryNotice/deliveryNoticeList")
|
|
|
+ @PermissionData(pageComponent = "saleCode/deliveryNotice/deliveryNoticeList")
|
|
|
public Result<IPage<SaleDeliveryAlert>> selectSaleDeliveryAlertInvoice(SaleDeliveryAlert saleInquiryForm,
|
|
|
- @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
- @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
|
|
|
QueryWrapper<SaleDeliveryAlert> queryWrapper = QueryGenerator.initQueryWrapper(saleInquiryForm, req.getParameterMap());
|
|
|
Page<SaleDeliveryAlert> page = new Page<SaleDeliveryAlert>(pageNo, pageSize);
|
|
@@ -211,9 +230,9 @@ public class SaleDeliveryController {
|
|
|
@ApiOperation(value = "发货通知单弹框明细(运费采购订单) 无用,运费改成整单选择", notes = "发货通知单弹框明细")
|
|
|
@GetMapping(value = "/selectSaleDeliveryAlertFee")
|
|
|
public Result<IPage<SaleDeliveryAlert>> selectSaleDeliveryAlertFee(SaleDeliveryAlert saleInquiryForm,
|
|
|
- @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
- @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
|
|
|
saleInquiryForm.setOtherFee("是");
|
|
|
saleInquiryForm.setCarriageUsed("否");
|
|
@@ -348,7 +367,7 @@ public class SaleDeliveryController {
|
|
|
@AutoLog(value = "发货通知单-批量关闭")
|
|
|
@ApiOperation(value = "发货通知单-批量关闭", notes = "发货通知单-批量关闭")
|
|
|
@GetMapping(value = "/closeBatch")
|
|
|
- public Result<String> closeBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+ public Result<String> closeBatch(@RequestParam(name = "ids", required = true) String ids,String closeReason) {
|
|
|
|
|
|
QueryWrapper<SaleDelivery> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.in("id", Arrays.asList(ids.split(",")));
|
|
@@ -363,11 +382,16 @@ public class SaleDeliveryController {
|
|
|
// 1-已关闭,0-未关闭
|
|
|
String close = o.getClose();
|
|
|
String code = o.getBillCode();
|
|
|
+ String submit = o.getSubmit();//提交(submit)1是0否
|
|
|
|
|
|
if (close != null && close != "" && close.equals("1")) {
|
|
|
sb.append("单据编码" + code).append("已关闭,请勿再次关闭;");
|
|
|
continue;
|
|
|
}
|
|
|
+ if (StringUtils.isBlank(submit) || submit.equals("0")) {
|
|
|
+ sb.append("单据编码" + code).append("还未提交,无需关闭;");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(sb.toString())) {
|
|
@@ -377,6 +401,7 @@ public class SaleDeliveryController {
|
|
|
|
|
|
SaleDelivery ent = new SaleDelivery();
|
|
|
ent.setClose("1");
|
|
|
+ ent.setCloseReason(closeReason);
|
|
|
saleDeliveryService.update(ent, queryWrapper);
|
|
|
|
|
|
return Result.OK("提交关闭!");
|
|
@@ -472,10 +497,10 @@ public class SaleDeliveryController {
|
|
|
querySaleInvoice.eq("del_flag", "0");
|
|
|
|
|
|
List<SaleInvoice> listSaleInvoice = saleInvoiceService.list(querySaleInvoice);
|
|
|
- if(listSaleInvoice.size() > 0){
|
|
|
+ if (listSaleInvoice.size() > 0) {
|
|
|
List<String> codeList = listSaleInvoice.stream().map(SaleInvoice::getInvoiceCode).collect(Collectors.toList());
|
|
|
String codes = StringUtils.join(codeList.toArray(), ",");
|
|
|
- sb.append("单号" + code).append("已被销售发票使用,请勿取消提交"+codes+";");
|
|
|
+ sb.append("单号" + code).append("已被销售发票使用,请勿取消提交" + codes + ";");
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -484,10 +509,10 @@ public class SaleDeliveryController {
|
|
|
queryStoreSaleOut.eq("del_flag", "0");
|
|
|
|
|
|
List<StoreSaleOut> listStoreSaleOut = storeSaleOutService.list(queryStoreSaleOut);
|
|
|
- if(listStoreSaleOut.size() > 0){
|
|
|
+ if (listStoreSaleOut.size() > 0) {
|
|
|
List<String> codeList = listStoreSaleOut.stream().map(StoreSaleOut::getBillCode).collect(Collectors.toList());
|
|
|
String codes = StringUtils.join(codeList.toArray(), ",");
|
|
|
- sb.append("单号" + code).append("已被销售出库使用,请勿取消提交"+codes+";");
|
|
|
+ sb.append("单号" + code).append("已被销售出库使用,请勿取消提交" + codes + ";");
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -635,9 +660,9 @@ public class SaleDeliveryController {
|
|
|
}
|
|
|
return Result.OK("文件导入失败!");
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 导出箱单
|
|
|
- *
|
|
|
*/
|
|
|
@RequestMapping(value = "/exportDeliverBillXls")
|
|
|
public void exportDeliverBillXls(HttpServletResponse response, SaleDelivery saleDelivery) throws Exception {
|
|
@@ -646,7 +671,6 @@ public class SaleDeliveryController {
|
|
|
|
|
|
/**
|
|
|
* 导出随货发票
|
|
|
- *
|
|
|
*/
|
|
|
@RequestMapping(value = "/exportInvoiceBillXls")
|
|
|
public void exportInvoiceBillXls(HttpServletResponse response, SaleDelivery saleDelivery) throws Exception {
|
|
@@ -655,7 +679,6 @@ public class SaleDeliveryController {
|
|
|
|
|
|
/**
|
|
|
* 导出签单
|
|
|
- *
|
|
|
*/
|
|
|
@RequestMapping(value = "/exportSignBillXls")
|
|
|
public void exportSignBillXls(HttpServletResponse response, SaleDelivery saleDelivery) throws Exception {
|
|
@@ -664,13 +687,12 @@ public class SaleDeliveryController {
|
|
|
|
|
|
/**
|
|
|
* 导出唛头
|
|
|
- *
|
|
|
*/
|
|
|
@RequestMapping(value = "/exportShippingBillXls")
|
|
|
public void exportShippingBillXls(HttpServletResponse response, SaleDelivery saleDelivery1) throws Exception {
|
|
|
|
|
|
String templateName = "唛头";
|
|
|
- String id=saleDelivery1.getId();
|
|
|
+ String id = saleDelivery1.getId();
|
|
|
|
|
|
BaseTemplates templates = baseTemplatesService.getByTemplateType(templateName);
|
|
|
SaleDelivery saleDelivery = saleDeliveryService.getById(id);
|
|
@@ -707,24 +729,24 @@ public class SaleDeliveryController {
|
|
|
}
|
|
|
// 获取计产品档案
|
|
|
List<BaseProductArchive> productArchiveList = new ArrayList<>();
|
|
|
- if (oConvertUtils.listIsNotEmpty(deliveryDetailsList)){
|
|
|
+ if (oConvertUtils.listIsNotEmpty(deliveryDetailsList)) {
|
|
|
LambdaQueryWrapper<BaseProductArchive> productWrapper = new LambdaQueryWrapper<>();
|
|
|
productWrapper.in(BaseProductArchive::getId, deliveryDetailsList.stream().map(SaleDeliveryDetails::getProductId).collect(Collectors.toList()));
|
|
|
productArchiveList = baseProductArchiveService.list(productWrapper);
|
|
|
}
|
|
|
// 获取销售订单行
|
|
|
List<SaleOrderProduct> saleOrderProductList = new ArrayList<>();
|
|
|
- if (oConvertUtils.listIsNotEmpty(deliveryDetailsList)){
|
|
|
+ if (oConvertUtils.listIsNotEmpty(deliveryDetailsList)) {
|
|
|
LambdaQueryWrapper<SaleOrderProduct> productWrapper = new LambdaQueryWrapper<>();
|
|
|
productWrapper.in(SaleOrderProduct::getId, deliveryDetailsList.stream().map(SaleDeliveryDetails::getSourceId).collect(Collectors.toList()));
|
|
|
saleOrderProductList = saleOrderProductService.list(productWrapper);
|
|
|
}
|
|
|
// 获取销售订单
|
|
|
- if (oConvertUtils.isNotEmpty(saleDelivery.getSourceCode())){
|
|
|
+ if (oConvertUtils.isNotEmpty(saleDelivery.getSourceCode())) {
|
|
|
LambdaQueryWrapper<SaleOrder> orderLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
orderLambdaQueryWrapper.eq(SaleOrder::getBillCode, saleDelivery.getSourceCode());
|
|
|
SaleOrder saleOrder = saleOrderService.getOne(orderLambdaQueryWrapper);
|
|
|
- if (saleOrder != null){
|
|
|
+ if (saleOrder != null) {
|
|
|
saleDelivery.setPaymentTerms(saleOrder.getPaymentTerms());
|
|
|
saleDelivery.setOrderNumber(saleOrder.getCustomerOrder());
|
|
|
saleDelivery.setAgreementTerms(saleOrder.getAgreementTerms());
|
|
@@ -740,28 +762,28 @@ public class SaleDeliveryController {
|
|
|
// 产品设置
|
|
|
int rowNum = 1;
|
|
|
BigDecimal deliverMoney = BigDecimal.ZERO;
|
|
|
- for(SaleDeliveryDetails o:deliveryDetailsList){
|
|
|
- BigDecimal amount = o.getMoney() == null ? BigDecimal.ZERO: o.getMoney();
|
|
|
+ for (SaleDeliveryDetails o : deliveryDetailsList) {
|
|
|
+ BigDecimal amount = o.getMoney() == null ? BigDecimal.ZERO : o.getMoney();
|
|
|
deliverMoney = deliverMoney.add(amount);
|
|
|
o.setRowNumber(rowNum++);
|
|
|
- if (o.getDeliveryTime() != null){
|
|
|
+ if (o.getDeliveryTime() != null) {
|
|
|
o.setDeliverDateText(DateUtils.date2Str(o.getDeliveryTime(), DateUtils.date_sdf.get()));
|
|
|
}
|
|
|
|
|
|
- BaseProductArchive findProduct = productArchiveList.stream().filter(e->e.getId().equals(o.getProductId())).findFirst().orElse(null);
|
|
|
- if (findProduct != null){
|
|
|
+ BaseProductArchive findProduct = productArchiveList.stream().filter(e -> e.getId().equals(o.getProductId())).findFirst().orElse(null);
|
|
|
+ if (findProduct != null) {
|
|
|
o.setUnit(findProduct.getMeasurementUnit());
|
|
|
- if (findProduct.getMeasurementUnit() != null){
|
|
|
- DictModel findDict = unitDictList.stream().filter(d->d.getValue().equals(findProduct.getMeasurementUnit())).findFirst().orElse(null);
|
|
|
- if (findDict != null){
|
|
|
+ if (findProduct.getMeasurementUnit() != null) {
|
|
|
+ DictModel findDict = unitDictList.stream().filter(d -> d.getValue().equals(findProduct.getMeasurementUnit())).findFirst().orElse(null);
|
|
|
+ if (findDict != null) {
|
|
|
o.setUnit(findDict.getText());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- SaleOrderProduct saleOrderProduct = saleOrderProductList.stream().filter(e->e.getId().equals(o.getSourceId())).findFirst().orElse(null);
|
|
|
- if (saleOrderProduct != null){
|
|
|
- if (oConvertUtils.isNotEmpty(saleOrderProduct.getDiscount()) && saleOrderProduct.getDiscount().intValue() != 0){
|
|
|
- o.setDiscountText(saleOrderProduct.getDiscount().intValue()+"%");
|
|
|
+ SaleOrderProduct saleOrderProduct = saleOrderProductList.stream().filter(e -> e.getId().equals(o.getSourceId())).findFirst().orElse(null);
|
|
|
+ if (saleOrderProduct != null) {
|
|
|
+ if (oConvertUtils.isNotEmpty(saleOrderProduct.getDiscount()) && saleOrderProduct.getDiscount().intValue() != 0) {
|
|
|
+ o.setDiscountText(saleOrderProduct.getDiscount().intValue() + "%");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -771,30 +793,30 @@ public class SaleDeliveryController {
|
|
|
String shipname = "";
|
|
|
String imo = "";
|
|
|
|
|
|
- if(oConvertUtils.listIsNotEmpty(deliveryShipList)){
|
|
|
+ if (oConvertUtils.listIsNotEmpty(deliveryShipList)) {
|
|
|
|
|
|
shipname = deliveryShipList.stream().map(SaleDeliveryShip::getShipName).distinct().collect(Collectors.joining());
|
|
|
|
|
|
LambdaQueryWrapper<BaseShipArchive> shipArchiveLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- shipArchiveLambdaQueryWrapper.in(BaseShipArchive::getId,deliveryShipList.stream().map(SaleDeliveryShip::getShipId).collect(Collectors.joining()));
|
|
|
+ shipArchiveLambdaQueryWrapper.in(BaseShipArchive::getId, deliveryShipList.stream().map(SaleDeliveryShip::getShipId).collect(Collectors.joining()));
|
|
|
List<BaseShipArchive> baseShipArchiveList = baseShipArchiveService.list(shipArchiveLambdaQueryWrapper);
|
|
|
|
|
|
- if(oConvertUtils.listIsNotEmpty(baseShipArchiveList)){
|
|
|
+ if (oConvertUtils.listIsNotEmpty(baseShipArchiveList)) {
|
|
|
imo = baseShipArchiveList.stream().map(BaseShipArchive::getImo).distinct().collect(Collectors.joining());
|
|
|
}
|
|
|
}
|
|
|
saleDelivery.setShipName(shipname);
|
|
|
saleDelivery.setImo(imo);
|
|
|
// 项目名称
|
|
|
- if (saleDelivery.getProject() != null){
|
|
|
+ if (saleDelivery.getProject() != null) {
|
|
|
BaseProjectArchive projectArchive = baseProjectArchiveService.getById(saleDelivery.getProject());
|
|
|
- if (projectArchive != null){
|
|
|
+ if (projectArchive != null) {
|
|
|
saleDelivery.setContactsNo(projectArchive.getName());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(deliveryDetailsList.size() > 0){
|
|
|
+ if (deliveryDetailsList.size() > 0) {
|
|
|
|
|
|
saleDelivery.setQualityGrade(deliveryDetailsList.get(0).getQualityGrade());
|
|
|
}
|
|
@@ -819,7 +841,7 @@ public class SaleDeliveryController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void exportByDeliver(String templateName, String id, HttpServletResponse response){
|
|
|
+ private void exportByDeliver(String templateName, String id, HttpServletResponse response) {
|
|
|
BaseTemplates templates = baseTemplatesService.getByTemplateType(templateName);
|
|
|
SaleDelivery saleDelivery = saleDeliveryService.getById(id);
|
|
|
List<SaleDeliveryDetails> deliveryDetailsList = saleDeliveryDetailsService.selectByMainId(id);
|
|
@@ -850,24 +872,24 @@ public class SaleDeliveryController {
|
|
|
}
|
|
|
// 获取计产品档案
|
|
|
List<BaseProductArchive> productArchiveList = new ArrayList<>();
|
|
|
- if (oConvertUtils.listIsNotEmpty(deliveryDetailsList)){
|
|
|
+ if (oConvertUtils.listIsNotEmpty(deliveryDetailsList)) {
|
|
|
LambdaQueryWrapper<BaseProductArchive> productWrapper = new LambdaQueryWrapper<>();
|
|
|
productWrapper.in(BaseProductArchive::getId, deliveryDetailsList.stream().map(SaleDeliveryDetails::getProductId).collect(Collectors.toList()));
|
|
|
productArchiveList = baseProductArchiveService.list(productWrapper);
|
|
|
}
|
|
|
// 获取销售订单行
|
|
|
List<SaleOrderProduct> saleOrderProductList = new ArrayList<>();
|
|
|
- if (oConvertUtils.listIsNotEmpty(deliveryDetailsList)){
|
|
|
+ if (oConvertUtils.listIsNotEmpty(deliveryDetailsList)) {
|
|
|
LambdaQueryWrapper<SaleOrderProduct> productWrapper = new LambdaQueryWrapper<>();
|
|
|
productWrapper.in(SaleOrderProduct::getId, deliveryDetailsList.stream().map(SaleDeliveryDetails::getSourceId).collect(Collectors.toList()));
|
|
|
saleOrderProductList = saleOrderProductService.list(productWrapper);
|
|
|
}
|
|
|
// 获取销售订单
|
|
|
- if (oConvertUtils.isNotEmpty(saleDelivery.getSourceCode())){
|
|
|
+ if (oConvertUtils.isNotEmpty(saleDelivery.getSourceCode())) {
|
|
|
LambdaQueryWrapper<SaleOrder> orderLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
orderLambdaQueryWrapper.eq(SaleOrder::getBillCode, saleDelivery.getSourceCode());
|
|
|
SaleOrder saleOrder = saleOrderService.getOne(orderLambdaQueryWrapper);
|
|
|
- if (saleOrder != null){
|
|
|
+ if (saleOrder != null) {
|
|
|
saleDelivery.setPaymentTerms(saleOrder.getPaymentTerms());
|
|
|
saleDelivery.setOrderNumber(saleOrder.getCustomerOrder());
|
|
|
saleDelivery.setAgreementTerms(saleOrder.getAgreementTerms());
|
|
@@ -883,28 +905,28 @@ public class SaleDeliveryController {
|
|
|
// 产品设置
|
|
|
int rowNum = 1;
|
|
|
BigDecimal deliverMoney = BigDecimal.ZERO;
|
|
|
- for(SaleDeliveryDetails o:deliveryDetailsList){
|
|
|
- BigDecimal amount = o.getMoney() == null ? BigDecimal.ZERO: o.getMoney();
|
|
|
+ for (SaleDeliveryDetails o : deliveryDetailsList) {
|
|
|
+ BigDecimal amount = o.getMoney() == null ? BigDecimal.ZERO : o.getMoney();
|
|
|
deliverMoney = deliverMoney.add(amount);
|
|
|
o.setRowNumber(rowNum++);
|
|
|
- if (o.getDeliveryTime() != null){
|
|
|
+ if (o.getDeliveryTime() != null) {
|
|
|
o.setDeliverDateText(DateUtils.date2Str(o.getDeliveryTime(), DateUtils.date_sdf.get()));
|
|
|
}
|
|
|
|
|
|
- BaseProductArchive findProduct = productArchiveList.stream().filter(e->e.getId().equals(o.getProductId())).findFirst().orElse(null);
|
|
|
- if (findProduct != null){
|
|
|
+ BaseProductArchive findProduct = productArchiveList.stream().filter(e -> e.getId().equals(o.getProductId())).findFirst().orElse(null);
|
|
|
+ if (findProduct != null) {
|
|
|
o.setUnit(findProduct.getMeasurementUnit());
|
|
|
- if (findProduct.getMeasurementUnit() != null){
|
|
|
- DictModel findDict = unitDictList.stream().filter(d->d.getValue().equals(findProduct.getMeasurementUnit())).findFirst().orElse(null);
|
|
|
- if (findDict != null){
|
|
|
+ if (findProduct.getMeasurementUnit() != null) {
|
|
|
+ DictModel findDict = unitDictList.stream().filter(d -> d.getValue().equals(findProduct.getMeasurementUnit())).findFirst().orElse(null);
|
|
|
+ if (findDict != null) {
|
|
|
o.setUnit(findDict.getText());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- SaleOrderProduct saleOrderProduct = saleOrderProductList.stream().filter(e->e.getId().equals(o.getSourceId())).findFirst().orElse(null);
|
|
|
- if (saleOrderProduct != null){
|
|
|
- if (oConvertUtils.isNotEmpty(saleOrderProduct.getDiscount()) && saleOrderProduct.getDiscount().intValue() != 0){
|
|
|
- o.setDiscountText(saleOrderProduct.getDiscount().intValue()+"%");
|
|
|
+ SaleOrderProduct saleOrderProduct = saleOrderProductList.stream().filter(e -> e.getId().equals(o.getSourceId())).findFirst().orElse(null);
|
|
|
+ if (saleOrderProduct != null) {
|
|
|
+ if (oConvertUtils.isNotEmpty(saleOrderProduct.getDiscount()) && saleOrderProduct.getDiscount().intValue() != 0) {
|
|
|
+ o.setDiscountText(saleOrderProduct.getDiscount().intValue() + "%");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -914,30 +936,30 @@ public class SaleDeliveryController {
|
|
|
String shipname = "";
|
|
|
String imo = "";
|
|
|
|
|
|
- if(oConvertUtils.listIsNotEmpty(deliveryShipList)){
|
|
|
+ if (oConvertUtils.listIsNotEmpty(deliveryShipList)) {
|
|
|
|
|
|
shipname = deliveryShipList.stream().map(SaleDeliveryShip::getShipName).distinct().collect(Collectors.joining());
|
|
|
|
|
|
LambdaQueryWrapper<BaseShipArchive> shipArchiveLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- shipArchiveLambdaQueryWrapper.in(BaseShipArchive::getId,deliveryShipList.stream().map(SaleDeliveryShip::getShipId).collect(Collectors.joining()));
|
|
|
+ shipArchiveLambdaQueryWrapper.in(BaseShipArchive::getId, deliveryShipList.stream().map(SaleDeliveryShip::getShipId).collect(Collectors.joining()));
|
|
|
List<BaseShipArchive> baseShipArchiveList = baseShipArchiveService.list(shipArchiveLambdaQueryWrapper);
|
|
|
|
|
|
- if(oConvertUtils.listIsNotEmpty(baseShipArchiveList)){
|
|
|
+ if (oConvertUtils.listIsNotEmpty(baseShipArchiveList)) {
|
|
|
imo = baseShipArchiveList.stream().map(BaseShipArchive::getImo).distinct().collect(Collectors.joining());
|
|
|
}
|
|
|
}
|
|
|
saleDelivery.setShipName(shipname);
|
|
|
saleDelivery.setImo(imo);
|
|
|
// 项目名称
|
|
|
- if (saleDelivery.getProject() != null){
|
|
|
+ if (saleDelivery.getProject() != null) {
|
|
|
BaseProjectArchive projectArchive = baseProjectArchiveService.getById(saleDelivery.getProject());
|
|
|
- if (projectArchive != null){
|
|
|
+ if (projectArchive != null) {
|
|
|
saleDelivery.setContactsNo(projectArchive.getName());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(deliveryDetailsList.size() > 0){
|
|
|
+ if (deliveryDetailsList.size() > 0) {
|
|
|
|
|
|
saleDelivery.setQualityGrade(deliveryDetailsList.get(0).getQualityGrade());
|
|
|
}
|
|
@@ -946,10 +968,10 @@ public class SaleDeliveryController {
|
|
|
|
|
|
// 账期
|
|
|
saleDelivery.setDueDateText(saleDelivery.getBillDateText());
|
|
|
- if (oConvertUtils.isNotEmpty(paymentTermsText)){
|
|
|
- if (paymentTermsText.indexOf(" ")>-1){
|
|
|
+ if (oConvertUtils.isNotEmpty(paymentTermsText)) {
|
|
|
+ if (paymentTermsText.indexOf(" ") > -1) {
|
|
|
String[] split = paymentTermsText.split(" ");
|
|
|
- if (oConvertUtils.getInt(split[0], 0)>0) {
|
|
|
+ if (oConvertUtils.getInt(split[0], 0) > 0) {
|
|
|
saleDelivery.setDueDateText(DateUtils.date2Str(DateUtils.dateAdd(saleDelivery.getDeliveryDate(), Calendar.DATE, Integer.parseInt(split[0])), DateUtils.date_sdf.get()));
|
|
|
}
|
|
|
}
|
|
@@ -960,7 +982,7 @@ public class SaleDeliveryController {
|
|
|
saleDelivery.setSalesEmail(sysUser.getEmail());
|
|
|
|
|
|
String templateFilePath = uploadpath + templates.getTemplateFile();
|
|
|
- String tempFilePath = uploadpath + "/"+ UUIDGenerator.generate()+".xlsx";
|
|
|
+ String tempFilePath = uploadpath + "/" + UUIDGenerator.generate() + ".xlsx";
|
|
|
|
|
|
try (ExcelWriter excelWriter = EasyExcel.write(tempFilePath).withTemplate(templateFilePath).build()) {
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
|
@@ -969,17 +991,16 @@ public class SaleDeliveryController {
|
|
|
excelWriter.fill(saleDelivery, writeSheet);
|
|
|
}
|
|
|
List<String> noteList = new ArrayList<>();
|
|
|
- deliveryDetailsList.forEach(p->noteList.add(p.getNotes()));
|
|
|
+ deliveryDetailsList.forEach(p -> noteList.add(p.getNotes()));
|
|
|
|
|
|
int startIndex = 18;
|
|
|
- if ("随货发票".equals(templateName)){
|
|
|
+ if ("随货发票".equals(templateName)) {
|
|
|
startIndex = 19;
|
|
|
}
|
|
|
- ExcelExportUtils.excelInsertRowNotes(getOutputStream(saleDelivery.getBillCode()+".xlsx", response),
|
|
|
+ ExcelExportUtils.excelInsertRowNotes(getOutputStream(saleDelivery.getBillCode() + ".xlsx", response),
|
|
|
tempFilePath, startIndex, noteList, 2, 4);
|
|
|
|
|
|
|
|
|
-
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
}
|