|
@@ -11,6 +11,8 @@ import com.lframework.starter.web.inner.service.system.SysDeptService; |
|
@@ -11,6 +11,8 @@ import com.lframework.starter.web.inner.service.system.SysDeptService; |
|
11
|
import com.lframework.starter.web.inner.service.system.SysRoleService;
|
11
|
import com.lframework.starter.web.inner.service.system.SysRoleService;
|
|
12
|
import com.lframework.starter.web.inner.service.system.SysUserDeptService;
|
12
|
import com.lframework.starter.web.inner.service.system.SysUserDeptService;
|
|
13
|
import com.lframework.starter.web.inner.service.system.SysUserService;
|
13
|
import com.lframework.starter.web.inner.service.system.SysUserService;
|
|
|
|
14
|
+import com.lframework.xingyun.basedata.entity.Workshop;
|
|
|
|
15
|
+import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
|
|
14
|
import com.lframework.xingyun.sc.bo.shipments.order.GetShipmentsOrderInfoBo;
|
16
|
import com.lframework.xingyun.sc.bo.shipments.order.GetShipmentsOrderInfoBo;
|
|
15
|
import com.lframework.xingyun.sc.bo.shipments.order.QueryShipmentsOrderInfoBo;
|
17
|
import com.lframework.xingyun.sc.bo.shipments.order.QueryShipmentsOrderInfoBo;
|
|
16
|
import com.lframework.xingyun.sc.bo.shipments.plan.ShipmentsPlanDetailBo;
|
18
|
import com.lframework.xingyun.sc.bo.shipments.plan.ShipmentsPlanDetailBo;
|
|
@@ -42,8 +44,13 @@ import io.swagger.annotations.Api; |
|
@@ -42,8 +44,13 @@ import io.swagger.annotations.Api; |
|
42
|
import lombok.extern.slf4j.Slf4j;
|
44
|
import lombok.extern.slf4j.Slf4j;
|
|
43
|
import org.apache.commons.collections4.CollectionUtils;
|
45
|
import org.apache.commons.collections4.CollectionUtils;
|
|
44
|
import org.apache.commons.lang3.StringUtils;
|
46
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
47
|
+import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
48
|
+import org.apache.poi.ss.usermodel.CellStyle;
|
|
|
|
49
|
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
|
|
|
50
|
+import org.apache.poi.ss.usermodel.Row;
|
|
45
|
import org.apache.poi.ss.usermodel.Sheet;
|
51
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
46
|
import org.apache.poi.ss.usermodel.Workbook;
|
52
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
53
|
+import org.apache.poi.ss.util.CellRangeAddress;
|
|
47
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
54
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
48
|
import org.springframework.data.redis.core.RedisTemplate;
|
55
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
49
|
import org.springframework.scheduling.annotation.Scheduled;
|
56
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
@@ -103,6 +110,8 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
@@ -103,6 +110,8 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
103
|
private ContractDistributorLineService contractDistributorLineService;
|
110
|
private ContractDistributorLineService contractDistributorLineService;
|
|
104
|
@Resource
|
111
|
@Resource
|
|
105
|
private ContractStdProcessingLineService contractStdProcessingLineService;
|
112
|
private ContractStdProcessingLineService contractStdProcessingLineService;
|
|
|
|
113
|
+ @Resource
|
|
|
|
114
|
+ private WorkshopService workshopService;
|
|
106
|
|
115
|
|
|
107
|
|
116
|
|
|
108
|
/**
|
117
|
/**
|
|
@@ -115,6 +124,10 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
@@ -115,6 +124,10 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
115
|
// 业务员、办事处内勤、办事处主管按区域/办事处查看数据
|
124
|
// 业务员、办事处内勤、办事处主管按区域/办事处查看数据
|
|
116
|
PageResult<ShipmentsOrderInfo> pageResult;
|
125
|
PageResult<ShipmentsOrderInfo> pageResult;
|
|
117
|
List<String> roleCodes = getCurrentUserRoleCodes();
|
126
|
List<String> roleCodes = getCurrentUserRoleCodes();
|
|
|
|
127
|
+ // 门卫只能查看已推送出门凭证的发货单
|
|
|
|
128
|
+ if (roleCodes.contains("mw")) {
|
|
|
|
129
|
+ vo.setPushed(true);
|
|
|
|
130
|
+ }
|
|
118
|
if (isDeptBasedRole(roleCodes)) {
|
131
|
if (isDeptBasedRole(roleCodes)) {
|
|
119
|
applyQueryPermission(vo, roleCodes);
|
132
|
applyQueryPermission(vo, roleCodes);
|
|
120
|
pageResult = shipmentsOrderInfoService.queryWithoutPermission(getPageIndex(vo), getPageSize(vo), vo);
|
133
|
pageResult = shipmentsOrderInfoService.queryWithoutPermission(getPageIndex(vo), getPageSize(vo), vo);
|
|
@@ -383,6 +396,17 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
@@ -383,6 +396,17 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
383
|
return InvokeResultBuilder.success();
|
396
|
return InvokeResultBuilder.success();
|
|
384
|
}
|
397
|
}
|
|
385
|
|
398
|
|
|
|
|
399
|
+ /**
|
|
|
|
400
|
+ * 推送发货单出门凭证(推送后门卫可见,并给门卫发送消息提醒)
|
|
|
|
401
|
+ */
|
|
|
|
402
|
+ @ApiOperation("推送发货单出门凭证")
|
|
|
|
403
|
+ @HasPermission({"shipping-plan-manage:invoice:push"})
|
|
|
|
404
|
+ @PostMapping("/push")
|
|
|
|
405
|
+ public InvokeResult<Void> push(@RequestBody List<String> ids) {
|
|
|
|
406
|
+ shipmentsOrderInfoService.push(ids);
|
|
|
|
407
|
+ return InvokeResultBuilder.success();
|
|
|
|
408
|
+ }
|
|
|
|
409
|
+
|
|
386
|
@ApiModelProperty("数据处理")
|
410
|
@ApiModelProperty("数据处理")
|
|
387
|
@GetMapping("/dataHandler")
|
411
|
@GetMapping("/dataHandler")
|
|
388
|
// @Scheduled(cron = "0 8 0 * * ?")
|
412
|
// @Scheduled(cron = "0 8 0 * * ?")
|
|
@@ -551,8 +575,8 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
@@ -551,8 +575,8 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
551
|
Set<String> set = new HashSet<>();
|
575
|
Set<String> set = new HashSet<>();
|
|
552
|
for (ShipmentsPlanDetail detail : detailList) {
|
576
|
for (ShipmentsPlanDetail detail : detailList) {
|
|
553
|
BigDecimal quantity = detail.getQuantity() == null ? BigDecimal.ZERO : detail.getQuantity();
|
577
|
BigDecimal quantity = detail.getQuantity() == null ? BigDecimal.ZERO : detail.getQuantity();
|
|
554
|
- BigDecimal actualQuantity = detail.getActualShipmentQuantity() == null ? BigDecimal.ZERO : new BigDecimal(detail.getActualShipmentQuantity());
|
|
|
|
555
|
- BigDecimal num = detail.getNum() == null ? BigDecimal.ZERO : new BigDecimal(detail.getNum());
|
578
|
+ BigDecimal actualQuantity = detail.getActualShipmentQuantity() == null ? BigDecimal.ZERO : BigDecimal.valueOf(detail.getActualShipmentQuantity());
|
|
|
|
579
|
+ BigDecimal num = detail.getNum() == null ? BigDecimal.ZERO : BigDecimal.valueOf(detail.getNum());
|
|
556
|
set.add(detail.getOrderSpecId());
|
580
|
set.add(detail.getOrderSpecId());
|
|
557
|
totalQuantity = totalQuantity.add(quantity);
|
581
|
totalQuantity = totalQuantity.add(quantity);
|
|
558
|
totalActualQuantity = totalActualQuantity.add(actualQuantity);
|
582
|
totalActualQuantity = totalActualQuantity.add(actualQuantity);
|
|
@@ -653,7 +677,27 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
@@ -653,7 +677,27 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
653
|
}
|
677
|
}
|
|
654
|
String latex = LatexFormulaExcelExporterUtil.convertToContractSpecLatexSingleLineFixed3(formulaComponentList);
|
678
|
String latex = LatexFormulaExcelExporterUtil.convertToContractSpecLatexSingleLineFixed3(formulaComponentList);
|
|
655
|
if (StringUtils.isNotBlank(latex)) {
|
679
|
if (StringUtils.isNotBlank(latex)) {
|
|
656
|
- LatexFormulaExcelExporterUtil.insertLatexImageToCellLeftAligned(workbook, sheet, latex, startRow, 2, 1, 7);
|
680
|
+ // 右侧预留 30px 给同列靠右展示的状态,避免图片遮挡
|
|
|
|
681
|
+ LatexFormulaExcelExporterUtil.insertLatexImageToCellLeftAligned(workbook, sheet, latex, startRow, 2, 1, 7, 30);
|
|
|
|
682
|
+ }
|
|
|
|
683
|
+ // 状态原值写入"规格状态"区域,右对齐到区域最右端(规格图片已预留右侧 30px,避免遮挡)
|
|
|
|
684
|
+ // 合并单元格的值只能写区域左上角(右对齐后显示在区域最右端);非合并直接写区域最后一列
|
|
|
|
685
|
+ int statusColIndex = 2 + 7 - 1;
|
|
|
|
686
|
+ for (int i = 0; i < sheet.getNumMergedRegions(); i++) {
|
|
|
|
687
|
+ CellRangeAddress merged = sheet.getMergedRegion(i);
|
|
|
|
688
|
+ if (merged.isInRange(startRow, 2)) {
|
|
|
|
689
|
+ statusColIndex = merged.getFirstColumn();
|
|
|
|
690
|
+ break;
|
|
|
|
691
|
+ }
|
|
|
|
692
|
+ }
|
|
|
|
693
|
+ ExcelUtil.setCellValue(sheet, startRow, statusColIndex, detail.getStatus());
|
|
|
|
694
|
+ Row statusRow = sheet.getRow(startRow);
|
|
|
|
695
|
+ Cell statusCell = statusRow.getCell(statusColIndex);
|
|
|
|
696
|
+ if (statusCell != null) {
|
|
|
|
697
|
+ CellStyle statusStyle = workbook.createCellStyle();
|
|
|
|
698
|
+ statusStyle.cloneStyleFrom(statusCell.getCellStyle());
|
|
|
|
699
|
+ statusStyle.setAlignment(HorizontalAlignment.RIGHT);
|
|
|
|
700
|
+ statusCell.setCellStyle(statusStyle);
|
|
657
|
}
|
701
|
}
|
|
658
|
String materialCode = resultMaterialMap.get(detail.getOrderSpecId());
|
702
|
String materialCode = resultMaterialMap.get(detail.getOrderSpecId());
|
|
659
|
ExcelUtil.setCellValue(sheet, startRow, 9, materialCode);
|
703
|
ExcelUtil.setCellValue(sheet, startRow, 9, materialCode);
|
|
@@ -722,6 +766,8 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
@@ -722,6 +766,8 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
722
|
} else {
|
766
|
} else {
|
|
723
|
dataMap.put("regionName", "");
|
767
|
dataMap.put("regionName", "");
|
|
724
|
}
|
768
|
}
|
|
|
|
769
|
+ // 按分厂与联次填充固定审核人(审批/复核/司磅/提货/审核)
|
|
|
|
770
|
+ dataMap.putAll(getFixedAuditors(orderInfo.getWorkshopId(), type));
|
|
725
|
// 处理模板中的占位符
|
771
|
// 处理模板中的占位符
|
|
726
|
ExcelUtil.processTemplate(workbook, dataMap);
|
772
|
ExcelUtil.processTemplate(workbook, dataMap);
|
|
727
|
// 生成文件名
|
773
|
// 生成文件名
|
|
@@ -739,6 +785,59 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
@@ -739,6 +785,59 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
|
739
|
}
|
785
|
}
|
|
740
|
|
786
|
|
|
741
|
/**
|
787
|
/**
|
|
|
|
788
|
+ * 按分厂与联次获取打印模板固定审核人(审批/复核/司磅/提货/审核):
|
|
|
|
789
|
+ * 司磅仅客户联有值;提货固定为空;未匹配的分厂全部为空
|
|
|
|
790
|
+ *
|
|
|
|
791
|
+ * @param workshopId 分厂ID
|
|
|
|
792
|
+ * @param type 打印类型 TYPE_1-记账联 TYPE_2-客户联
|
|
|
|
793
|
+ * @return approveUser/reviewUser/weighUser/pickupUser/auditUser
|
|
|
|
794
|
+ */
|
|
|
|
795
|
+ private Map<String, String> getFixedAuditors(String workshopId, String type) {
|
|
|
|
796
|
+ Map<String, String> auditors = new HashMap<>();
|
|
|
|
797
|
+ auditors.put("approveUser", "");
|
|
|
|
798
|
+ auditors.put("reviewUser", "");
|
|
|
|
799
|
+ auditors.put("weighUser", "");
|
|
|
|
800
|
+ auditors.put("pickupUser", "");
|
|
|
|
801
|
+ auditors.put("auditUser", "");
|
|
|
|
802
|
+
|
|
|
|
803
|
+ Workshop workshop = workshopService.findById(workshopId);
|
|
|
|
804
|
+ if (workshop == null || StringUtils.isBlank(workshop.getCode())) {
|
|
|
|
805
|
+ return auditors;
|
|
|
|
806
|
+ }
|
|
|
|
807
|
+ // 司磅:客户联有值,记账联为空
|
|
|
|
808
|
+ boolean isCustomer = "TYPE_2".equals(type);
|
|
|
|
809
|
+ switch (workshop.getCode()) {
|
|
|
|
810
|
+ case "yfc":
|
|
|
|
811
|
+ auditors.put("approveUser", "周维龙");
|
|
|
|
812
|
+ auditors.put("reviewUser", "许夕海");
|
|
|
|
813
|
+ auditors.put("weighUser", isCustomer ? "汪进" : "");
|
|
|
|
814
|
+ auditors.put("auditUser", "李春华");
|
|
|
|
815
|
+ break;
|
|
|
|
816
|
+ case "efc":
|
|
|
|
817
|
+ auditors.put("approveUser", "周维龙");
|
|
|
|
818
|
+ auditors.put("reviewUser", "杨学平");
|
|
|
|
819
|
+ auditors.put("weighUser", isCustomer ? "李飞飞" : "");
|
|
|
|
820
|
+ auditors.put("auditUser", "顾兵");
|
|
|
|
821
|
+ break;
|
|
|
|
822
|
+ case "sfc":
|
|
|
|
823
|
+ auditors.put("approveUser", "刘建新");
|
|
|
|
824
|
+ auditors.put("reviewUser", "汤宗保");
|
|
|
|
825
|
+ auditors.put("weighUser", isCustomer ? "周月" : "");
|
|
|
|
826
|
+ auditors.put("auditUser", "");
|
|
|
|
827
|
+ break;
|
|
|
|
828
|
+ case "ztfc":
|
|
|
|
829
|
+ auditors.put("approveUser", "胡勇");
|
|
|
|
830
|
+ auditors.put("reviewUser", "后承荣");
|
|
|
|
831
|
+ auditors.put("weighUser", isCustomer ? "秦升红" : "");
|
|
|
|
832
|
+ auditors.put("auditUser", "");
|
|
|
|
833
|
+ break;
|
|
|
|
834
|
+ default:
|
|
|
|
835
|
+ break;
|
|
|
|
836
|
+ }
|
|
|
|
837
|
+ return auditors;
|
|
|
|
838
|
+ }
|
|
|
|
839
|
+
|
|
|
|
840
|
+ /**
|
|
742
|
* 处理订单类型
|
841
|
* 处理订单类型
|
|
743
|
*
|
842
|
*
|
|
744
|
* @param contractType 合同类型
|
843
|
* @param contractType 合同类型
|