Commit a32c7b1f5bf8cd9a197fa08f0d87962d338aa058

Authored by yeqianyong
2 parents f098e66d aaa4bf7c

Merge remote-tracking branch 'origin/master_sample_order' into master_sample_order

Showing 48 changed files with 557 additions and 61 deletions
... ... @@ -1097,6 +1097,70 @@ CREATE TABLE `pending_delivery_order` (
1097 1097 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='待交付订单'
1098 1098
1099 1099
  1100 +alter table shipments_order_info add column delivery_time datetime default null comment '签收时间';
  1101 +alter table shipments_plan add column auto_generate bool default true comment '是否系统自动生成';
  1102 +
  1103 +create table if not exists base_data_customer_short(
  1104 + id varchar(32) primary key comment 'ID',
  1105 + short_name varchar(32) not null comment '客户简称',
  1106 + customer_id varchar(32) not null comment '客户ID',
  1107 + type varchar(32) not null comment '客户类型',
  1108 + dept_id varchar(32) not null comment '办事处ID',
  1109 + region varchar(32) not null comment '区域ID',
  1110 + create_by_id varchar(32) not null comment '创建人ID',
  1111 + update_by_id varchar(32) not null comment '更新人ID',
  1112 + create_time datetime default now() comment '创建时间',
  1113 + update_time datetime default now() comment '更新时间'
  1114 +) comment '客户简称';
  1115 +
  1116 +-- 应收款台账明细数据
  1117 +CREATE TABLE `receipt_ledger_info` (
  1118 + `id` varchar(32) COLLATE utf8mb4_bin NOT NULL COMMENT 'ID',
  1119 + `customer_short_id` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '客户简称ID',
  1120 + `quota` decimal(15,4) DEFAULT NULL COMMENT '额度',
  1121 + `settle_term` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '结算期限',
  1122 + `dept_id` varchar(32) COLLATE utf8mb4_bin NOT NULL COMMENT '办事处ID',
  1123 + `region` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '区域',
  1124 + `stock_up_company_id` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '备货单位ID',
  1125 + `customer_id` varchar(32) COLLATE utf8mb4_bin NOT NULL COMMENT '客户ID',
  1126 + `factory_type` varchar(20) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '厂别',
  1127 + `shipment_date` date DEFAULT NULL COMMENT '发货日期',
  1128 + `start_account_receivable` decimal(15,4) DEFAULT NULL COMMENT '期初应收账款',
  1129 + `arrival_date` date DEFAULT NULL COMMENT '到货日期',
  1130 + `processed_date` date DEFAULT NULL COMMENT '应办理日期',
  1131 + `actual_returned_date` date DEFAULT NULL COMMENT '实际回笼日期',
  1132 + `returned_amount` decimal(15,4) DEFAULT NULL COMMENT '回笼金额',
  1133 + `end_account_receivable` decimal(15,4) DEFAULT NULL COMMENT '期末应收账款',
  1134 + `apply_status` varchar(20) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '申请状态',
  1135 + `coordinate_date` date DEFAULT NULL COMMENT '协调办理日期',
  1136 + `remark` varchar(200) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '备注',
  1137 + `second_coordinate_date` date DEFAULT NULL COMMENT '二次协调日期',
  1138 + `third_coordinate_date` date DEFAULT NULL COMMENT '三次协调日期',
  1139 + `fourth_coordinate_date` date DEFAULT NULL COMMENT '四次协调日期',
  1140 + `fifth_coordinate_date` date DEFAULT NULL COMMENT '五次协调日期',
  1141 + `description` varchar(200) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '说明',
  1142 + `del_flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
  1143 + `create_by_id` varchar(32) COLLATE utf8mb4_bin NOT NULL COMMENT '创建人ID',
  1144 + `update_by_id` varchar(32) COLLATE utf8mb4_bin NOT NULL COMMENT '更新人ID',
  1145 + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  1146 + `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  1147 + `parent_id` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '父ID',
  1148 + `debt_status` varchar(20) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '欠款状态',
  1149 + `type` varchar(10) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '类型:INSIDE-内贸;OUTSIDE-外贸',
  1150 + `shipment_order_id` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '发货单id',
  1151 + PRIMARY KEY (`id`)
  1152 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='应收款台账号明细表'
  1153 +
  1154 +alter table customer_develop_plan modify column monthly_usage varchar(50) comment '月用量';
  1155 +alter table customer_develop_plan modify column target_quantity varchar(50) comment '目标量';
  1156 +alter table customer_develop_plan modify column thickness varchar(50) comment '厚度';
  1157 +alter table customer_develop_plan modify column width varchar(50) comment '宽度';
  1158 +alter table customer_develop_plan modify column settle_days varchar(50) comment '结算天数';
  1159 +
  1160 +alter table draft_request_car_ticket add column freeze bool default false comment '是否冻结';
  1161 +alter table purchase_order_info add column freeze_count int default 0 comment '冻结次数';
  1162 +alter table draft_request_car_ticket add column freeze_count int default 0 comment '冻结次数';
  1163 +
1100 1164 create table if not exists sample_result_feedback(
1101 1165 id varchar(32) primary key comment 'ID',
1102 1166 customer_id varchar(32) not null comment '客户ID',
... ... @@ -1152,3 +1216,18 @@ create table if not exists sample_feedback_tracking_detail(
1152 1216 create_time datetime default now() comment '创建时间',
1153 1217 update_time datetime default now() comment '更新时间'
1154 1218 ) comment '样品反馈和追踪明细';
  1219 +
  1220 +--合同物料行新增字段
  1221 +ALTER TABLE tbl_contract_std_processing_line
  1222 + ADD COLUMN sample_order boolean DEFAULT FALSE COMMENT '是否为试样订单';
  1223 +
  1224 +ALTER TABLE tbl_contract_distributor_line
  1225 + ADD COLUMN sample_order boolean DEFAULT FALSE COMMENT '是否为试样订单';
  1226 +
  1227 +--订货单、订货单物料行新增字段
  1228 +ALTER TABLE purchase_order_info
  1229 + ADD COLUMN sample_order boolean DEFAULT FALSE COMMENT '是否为试样订单';
  1230 +
  1231 +ALTER TABLE tbl_purchase_order_line
  1232 + ADD COLUMN sample_order boolean DEFAULT FALSE COMMENT '是否为试样订单';
  1233 +
... ...
... ... @@ -96,7 +96,7 @@
96 96 </if>
97 97 </if>
98 98 </where>
99   - ORDER BY c.code
  99 + ORDER BY c.create_time desc
100 100 </select>
101 101
102 102 <select id="getByName" resultMap="CustomerDto">
... ... @@ -147,6 +147,6 @@
147 147 </choose>
148 148 </if>
149 149 </where>
150   - ORDER BY c.code
  150 + ORDER BY c.create_time desc
151 151 </select>
152 152 </mapper>
... ...
... ... @@ -171,6 +171,12 @@ public class GetContractDistributorLineBo extends BaseBo<ContractDistributorLine
171 171 @ApiModelProperty(value = "前端用ID")
172 172 private String itemId;
173 173
  174 + /**
  175 + * 是否为试样订单
  176 + */
  177 + @ApiModelProperty(value = "是否为试样订单")
  178 + private Boolean sampleOrder;
  179 +
174 180 public GetContractDistributorLineBo() {
175 181
176 182 }
... ...
... ... @@ -217,6 +217,12 @@ public class GetContractStdProcessingLineBo extends BaseBo<ContractStdProcessing
217 217 @ApiModelProperty("前端用ID")
218 218 private String itemId;
219 219
  220 + /**
  221 + * 是否为试样订单
  222 + */
  223 + @ApiModelProperty(value = "是否为试样订单")
  224 + private Boolean sampleOrder;
  225 +
220 226 public GetContractStdProcessingLineBo() {
221 227
222 228 }
... ...
... ... @@ -462,6 +462,12 @@ public class GetCustomerCreditBo extends BaseBo<CustomerCredit> implements BaseD
462 462 @ApiModelProperty(value = "是否展示审核按钮")
463 463 private Boolean showExamine;
464 464
  465 + /**
  466 + * 是否展示审核详情按钮(非持久化字段)
  467 + */
  468 + @ApiModelProperty(value = "是否展示审核按钮")
  469 + private Boolean showExamineDetail;
  470 +
465 471
466 472 /**
467 473 * 企业操作类型
... ...
... ... @@ -320,6 +320,12 @@ public class GetPurchaseOrderInfoBo extends BaseBo<PurchaseOrderInfo> {
320 320 @ApiModelProperty("是否冻结")
321 321 private boolean freeze;
322 322
  323 + /**
  324 + * 是否为试样订单
  325 + */
  326 + @ApiModelProperty("是否为试样订单")
  327 + private boolean sampleOrder;
  328 +
323 329
324 330 public GetPurchaseOrderInfoBo() {
325 331
... ...
... ... @@ -147,6 +147,18 @@ public class GetPurchaseOrderLineBo extends BaseBo<PurchaseOrderLine> {
147 147 @ApiModelProperty("包装费")
148 148 private BigDecimal packagingFee;
149 149
  150 + /**
  151 + * 是否已发货
  152 + */
  153 + @ApiModelProperty("是否已发货")
  154 + private Boolean shipment;
  155 +
  156 + /**
  157 + * 是否为试样订单
  158 + */
  159 + @ApiModelProperty("是否为试样订单")
  160 + private boolean sampleOrder;
  161 +
150 162 public GetPurchaseOrderLineBo() {
151 163
152 164 }
... ...
... ... @@ -128,7 +128,6 @@ public class GetReplenishmentOrderBo extends BaseBo<ReplenishmentOrder> {
128 128 */
129 129 @ApiModelProperty("状态名称")
130 130 private String statusName;
131   -
132 131 /**
133 132 * 是否展示审核按钮(非持久化字段)
134 133 */
... ...
... ... @@ -71,6 +71,12 @@ public class GetDelayedShipmentBo extends BaseBo<DelayedShipment> {
71 71 private Boolean showExamine;
72 72
73 73 /**
  74 + * 是否展示审核详情按钮(非持久化字段)
  75 + */
  76 + @ApiModelProperty("是否展示审核详情按钮")
  77 + private Boolean showExamineDetail;
  78 +
  79 + /**
74 80 * 是否是创建人(非持久化字段)
75 81 */
76 82 @ApiModelProperty("是否是创建人")
... ...
... ... @@ -98,6 +98,14 @@ public class ContractFrameworkController extends DefaultBaseController {
98 98
99 99 vo.setCustomerIdList(customerList.stream().map(Customer::getId).collect(Collectors.toList()));
100 100 }
  101 + if (vo != null && StringUtils.isNotBlank(vo.getKeyword())) {
  102 + QueryCustomerVo queryCustomerVo = new QueryCustomerVo();
  103 + queryCustomerVo.setName(vo.getKeyword());
  104 + List<Customer> customerList = customerService.query(queryCustomerVo);
  105 + if (CollectionUtils.isNotEmpty(customerList)) {
  106 + vo.setCustomerIdList(customerList.stream().map(Customer::getId).collect(Collectors.toList()));
  107 + }
  108 + }
101 109
102 110 PageResult<ContractFramework> pageResult = contractFrameworkService.query(getPageIndex(vo), getPageSize(vo), vo);
103 111
... ...
... ... @@ -4,7 +4,9 @@ import com.alibaba.excel.EasyExcel;
4 4 import com.alibaba.excel.ExcelWriter;
5 5 import com.alibaba.excel.write.metadata.WriteSheet;
6 6 import com.lframework.starter.bpm.dto.FlowTaskDto;
  7 +import com.lframework.starter.bpm.entity.FlowInstanceWrapper;
7 8 import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
  9 +import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
8 10 import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
9 11 import com.lframework.starter.common.utils.StringUtil;
10 12 import com.lframework.starter.web.core.annotations.security.HasPermission;
... ... @@ -86,6 +88,8 @@ public class CustomerCreditController extends DefaultBaseController {
86 88 private ContractDistributorStandardService contractDistributorStandardService;
87 89 @Resource
88 90 private FlowTaskWrapperMapper flowTaskWrapperMapper;
  91 + @Resource
  92 + private FlowInstanceWrapperService flowInstanceWrapperService;
89 93
90 94 /**
91 95 * 查询列表
... ... @@ -500,11 +504,24 @@ public class CustomerCreditController extends DefaultBaseController {
500 504 data.setSupervisorReviewName(sysUser.getName());
501 505 }
502 506 }
  507 +
  508 + //流程数据
  509 + List<String> ids = new ArrayList<>();
  510 + ids.add(credit.getId());
  511 + List<FlowInstanceWrapper> flowByBusinessIdList = flowInstanceWrapperService.getFlowByBusinessIdList(ids);
  512 + if (CollectionUtils.isNotEmpty(flowByBusinessIdList)) {
  513 + List<String> collect = flowByBusinessIdList.stream().map(FlowInstanceWrapper::getBusinessId).collect(Collectors.toList());
  514 + data.setShowExamineDetail(collect.contains(credit.getId()));
  515 + } else {
  516 + data.setShowExamineDetail(false);
  517 + }
503 518 // 获取当前人员的待办任务数据
504 519 List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
505 520 if (CollectionUtils.isNotEmpty(flowTaskList)) {
506 521 List<String> businessIds = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList());
507 522 data.setShowExamine(businessIds.contains(credit.getId()));
  523 + } else {
  524 + data.setShowExamine(false);
508 525 }
509 526 // enterpriseOperationType 转中文
510 527 String opType = data.getEnterpriseOperationType();
... ...
... ... @@ -415,6 +415,8 @@ public class PurchaseOrderInfoController extends DefaultBaseController {
415 415 dataMap.put("regionName", data.getRegionName() == null ? "" : data.getRegionName());
416 416 //备货单位名称
417 417 dataMap.put("stockUpCompanyName", data.getStockUpCompanyName() == null ? "" : data.getStockUpCompanyName());
  418 + //价格表编号
  419 + dataMap.put("priceListNo", data.getPriceListNo());
418 420
419 421 processTemplate(workbook, dataMap);
420 422
... ...
... ... @@ -2,12 +2,16 @@ package com.lframework.xingyun.sc.controller.shipments;
2 2
3 3 import com.baomidou.mybatisplus.core.conditions.Wrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.lframework.starter.bpm.dto.FlowTaskDto;
  6 +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
  7 +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
5 8 import com.lframework.starter.common.exceptions.impl.DefaultClientException;
6 9 import com.lframework.starter.common.utils.CollectionUtil;
7 10 import com.lframework.starter.web.core.annotations.security.HasPermission;
8 11 import com.lframework.starter.web.core.components.resp.InvokeResult;
9 12 import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
10 13 import com.lframework.starter.web.core.components.resp.PageResult;
  14 +import com.lframework.starter.web.core.components.security.SecurityUtil;
11 15 import com.lframework.starter.web.core.controller.DefaultBaseController;
12 16 import com.lframework.starter.web.core.utils.PageResultUtil;
13 17 import com.lframework.starter.web.inner.entity.SysDataDicItem;
... ... @@ -71,6 +75,8 @@ public class ReplenishmentOrderController extends DefaultBaseController {
71 75 private PurchaseOrderInfoService purchaseOrderInfoService;
72 76 @Resource
73 77 private ReplenishmentOrderLineService replenishmentOrderLineService;
  78 + @Resource
  79 + private FlowTaskWrapperMapper flowTaskWrapperMapper;
74 80
75 81
76 82 public static final String AUDIT_STATUS_DIC_CODE = "AUDIT_STATUS"; // 审核状态
... ... @@ -205,6 +211,12 @@ public class ReplenishmentOrderController extends DefaultBaseController {
205 211 });
206 212
207 213 result.setReplenishmentOrderLineList(lineBoList);
  214 + // 获取当前人员的待办任务数据
  215 + List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
  216 + if (org.apache.commons.collections.CollectionUtils.isNotEmpty(flowTaskList)) {
  217 + List<String> businessIds = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList());
  218 + result.setShowExamine(businessIds.contains(result.getId()));
  219 + }
208 220 return InvokeResultBuilder.success(result);
209 221 }
210 222
... ...
1 1 package com.lframework.xingyun.sc.controller.shipments.car;
2 2
  3 +import com.github.pagehelper.PageInfo;
  4 +import com.lframework.starter.bpm.dto.FlowTaskDto;
  5 +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
  6 +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
3 7 import com.lframework.starter.common.exceptions.impl.DefaultClientException;
4 8 import com.lframework.starter.common.utils.CollectionUtil;
5 9 import com.lframework.starter.web.core.annotations.security.HasPermission;
... ... @@ -18,6 +22,7 @@ import com.lframework.xingyun.sc.vo.shipments.car.*;
18 22 import io.swagger.annotations.Api;
19 23 import io.swagger.annotations.ApiImplicitParam;
20 24 import io.swagger.annotations.ApiOperation;
  25 +import org.apache.commons.collections.CollectionUtils;
21 26 import org.apache.commons.lang3.StringUtils;
22 27 import org.springframework.beans.factory.annotation.Autowired;
23 28 import org.springframework.validation.annotation.Validated;
... ... @@ -43,6 +48,8 @@ public class DraftRequestCarTicketController extends DefaultBaseController {
43 48 private DraftRequestCarTicketService draftRequestCarTicketService;
44 49 @Resource
45 50 private PurchaseOrderInfoService purchaseOrderInfoService;
  51 + @Resource
  52 + private FlowTaskWrapperMapper flowTaskWrapperMapper;
46 53 /**
47 54 * 查询列表
48 55 */
... ... @@ -104,6 +111,12 @@ public class DraftRequestCarTicketController extends DefaultBaseController {
104 111 result.setDraftCreateBy(true);
105 112 }
106 113 }
  114 + // 获取当前人员的待办任务数据
  115 + List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
  116 + if (CollectionUtils.isNotEmpty(flowTaskList)) {
  117 + List<String> businessIds = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList());
  118 + result.setShowExamine(businessIds.contains(result.getId()));
  119 + }
107 120
108 121 return InvokeResultBuilder.success(result);
109 122 }
... ...
1 1 package com.lframework.xingyun.sc.controller.shipments.delay;
2 2
3 3 import com.lframework.starter.bpm.dto.FlowTaskDto;
  4 +import com.lframework.starter.bpm.entity.FlowInstanceWrapper;
4 5 import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
  6 +import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
5 7 import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
6 8 import com.lframework.starter.web.core.annotations.security.HasPermission;
7 9 import com.lframework.starter.web.core.components.security.SecurityUtil;
... ... @@ -9,6 +11,7 @@ import com.lframework.starter.web.core.controller.DefaultBaseController;
9 11 import com.lframework.starter.web.core.utils.PageResultUtil;
10 12 import com.lframework.starter.web.core.components.resp.PageResult;
11 13 import com.lframework.starter.web.core.components.resp.InvokeResult;
  14 +
12 15 import javax.annotation.Resource;
13 16 import javax.validation.constraints.NotBlank;
14 17 import com.lframework.xingyun.sc.bo.shipments.delay.GetDelayedShipmentBo;
... ... @@ -32,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired;
32 35 import org.springframework.validation.annotation.Validated;
33 36 import org.springframework.web.bind.annotation.*;
34 37 import javax.validation.Valid;
  38 +import java.util.ArrayList;
35 39 import java.util.List;
36 40 import java.util.stream.Collectors;
37 41
... ... @@ -51,6 +55,8 @@ public class DelayedShipmentController extends DefaultBaseController {
51 55 private DelayedShipmentDetailService delayedShipmentDetailService;
52 56 @Resource
53 57 private FlowTaskWrapperMapper flowTaskWrapperMapper;
  58 + @Resource
  59 + private FlowInstanceWrapperService flowInstanceWrapperService;
54 60
55 61 /**
56 62 * 查询列表
... ... @@ -103,24 +109,25 @@ public class DelayedShipmentController extends DefaultBaseController {
103 109 QueryDelayedShipmentDetailVo vo = new QueryDelayedShipmentDetailVo();
104 110 vo.setDelayedShipmentId(id);
105 111 List<DelayedShipmentDetail> delayedShipmentDetailList = delayedShipmentDetailService.query(vo);
106   - String currentUserId = SecurityUtil.getCurrentUser().getId();
107   - // 判断 createById 是否等于当前用户 ID
108   - boolean isCreateBy = false;
109   - if (currentUserId.equals(data.getCreateById())) {
110   - isCreateBy = true;
111   - }
112   - result.setDelayedCreateBy(isCreateBy);
  112 + result.setDelayedShipmentDetailList(delayedShipmentDetailList);
113 113 // 获取当前人员的待办任务数据
114 114 List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
115 115 if (CollectionUtils.isNotEmpty(flowTaskList)) {
116   - List<String> ids = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList());
117   - if (ids.contains(data.getId())) {
118   - result.setShowExamine(true);
119   - } else {
120   - result.setShowExamine(false);
121   - }
  116 + List<String> businessIds = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList());
  117 + result.setShowExamine(businessIds.contains(result.getId()));
  118 + } else {
  119 + result.setShowExamine(false);
  120 + }
  121 + //流程数据
  122 + List<String> ids = new ArrayList<>();
  123 + ids.add(result.getId());
  124 + List<FlowInstanceWrapper> flowByBusinessIdList = flowInstanceWrapperService.getFlowByBusinessIdList(ids);
  125 + if (CollectionUtils.isNotEmpty(flowByBusinessIdList)) {
  126 + List<String> collect = flowByBusinessIdList.stream().map(FlowInstanceWrapper::getBusinessId).collect(Collectors.toList());
  127 + result.setShowExamineDetail(collect.contains(result.getId()));
  128 + } else {
  129 + result.setShowExamineDetail(false);
122 130 }
123   - result.setDelayedShipmentDetailList(delayedShipmentDetailList);
124 131
125 132 return InvokeResultBuilder.success(result);
126 133 }
... ...
... ... @@ -111,6 +111,11 @@ public class ContractDistributorLine extends BaseEntity implements BaseDto {
111 111 private String itemId;
112 112
113 113 /**
  114 + * 是否为试样订单
  115 + */
  116 + private Boolean sampleOrder;
  117 +
  118 + /**
114 119 * 创建人ID
115 120 */
116 121 @TableField(fill = FieldFill.INSERT)
... ...
... ... @@ -173,6 +173,11 @@ public class ContractStdProcessingLine extends BaseEntity implements BaseDto {
173 173 private String itemId;
174 174
175 175 /**
  176 + * 是否为试样订单
  177 + */
  178 + private Boolean sampleOrder;
  179 +
  180 + /**
176 181 * 创建人ID
177 182 */
178 183 @TableField(fill = FieldFill.INSERT)
... ...
... ... @@ -369,6 +369,12 @@ public class CustomerCredit extends BaseEntity implements BaseDto {
369 369 private Boolean showExamine = false;
370 370
371 371 /**
  372 + * 是否展示审核详情按钮(非持久化字段)
  373 + */
  374 + @TableField(exist = false)
  375 + private Boolean showExamineDetail;
  376 +
  377 + /**
372 378 * 流程发起人(非持久化字段)
373 379 */
374 380 @TableField(exist = false)
... ...
... ... @@ -72,6 +72,12 @@ public class DelayedShipment extends BaseEntity implements BaseDto {
72 72 private Boolean showExamine = false;
73 73
74 74 /**
  75 + * 是否展示审核按钮详情(非持久化字段)
  76 + */
  77 + @TableField(exist = false)
  78 + private Boolean showExamineDetail;
  79 +
  80 + /**
75 81 * 创建人ID
76 82 */
77 83 @TableField(fill = FieldFill.INSERT)
... ...
... ... @@ -280,6 +280,11 @@ public class PurchaseOrderInfo extends BaseEntity implements BaseDto {
280 280 private Integer freezeCount;
281 281
282 282 /**
  283 + * 是否为试样订单
  284 + */
  285 + private boolean sampleOrder;
  286 +
  287 + /**
283 288 * 下单人(非持久化字段)
284 289 */
285 290 @TableField(exist = false)
... ...
... ... @@ -265,6 +265,11 @@ public class PurchaseOrderLine extends BaseEntity implements BaseDto {
265 265 private Boolean delFlag;
266 266
267 267 /**
  268 + * 是否为试样订单
  269 + */
  270 + private boolean sampleOrder;
  271 +
  272 + /**
268 273 * 新增/删除/变更
269 274 */
270 275 @TableField(exist = false)
... ...
... ... @@ -35,6 +35,8 @@ import com.lframework.xingyun.sc.service.shipments.delay.DelayedShipmentDetailSe
35 35 import com.lframework.xingyun.sc.service.shipments.delay.DelayedShipmentService;
36 36 import com.lframework.xingyun.sc.vo.customer.credit.QueryCorePersonnelHistoryVo;
37 37 import com.lframework.xingyun.sc.vo.customer.credit.UpdateCustomerCreditVo;
  38 +import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderInfoVo;
  39 +import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo;
38 40 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo;
39 41 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderRevokeLineVo;
40 42 import com.lframework.xingyun.sc.vo.shipments.car.CreateCarRequestPlanVo;
... ... @@ -274,6 +276,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
274 276 if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus)
275 277 || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) {
276 278 purchaseOrderInfoService.updateStatus(businessId, "PASS");
  279 + //审核通过,物料行存在试样订单的需要对当前订单拆分
  280 + packPurchaseOrderInfo(businessId);
277 281 } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus)
278 282 || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus)
279 283 || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) {
... ... @@ -675,4 +679,100 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
675 679 messageHandler.sendMsg(null, roleCodes, businessType, businessId, null);
676 680 }
677 681 }
  682 +
  683 + /**
  684 + * 处理订货单数据
  685 + *
  686 + * @param businessId 订货单ID
  687 + */
  688 + private void packPurchaseOrderInfo(String businessId) {
  689 + PurchaseOrderInfo purchaseOrderInfo = purchaseOrderInfoService.findById(businessId);
  690 +
  691 + QueryPurchaseOrderLineVo vo1 = new QueryPurchaseOrderLineVo();
  692 + vo1.setPurchaseOrderId(purchaseOrderInfo.getId());
  693 + List<PurchaseOrderLine> lineVoList = purchaseOrderLineService.query(vo1);
  694 + if (CollectionUtils.isNotEmpty(lineVoList)) {
  695 + Map<Boolean, List<PurchaseOrderLine>> partitioned = lineVoList.stream()
  696 + .collect(Collectors.partitioningBy(PurchaseOrderLine::isSampleOrder));
  697 +
  698 + List<PurchaseOrderLine> sampleOrders = partitioned.get(true); // 是试样订单
  699 + if (CollectionUtils.isEmpty(sampleOrders)) {
  700 + return;
  701 + }
  702 +
  703 + CreatePurchaseOrderInfoVo vo = new CreatePurchaseOrderInfoVo();
  704 + vo.setContractId(purchaseOrderInfo.getContractId());
  705 + vo.setOrderNo(purchaseOrderInfo.getOrderNo() + "xp01");
  706 + vo.setSupplyUnit(purchaseOrderInfo.getSupplyUnit());
  707 + vo.setOrderingUnit(purchaseOrderInfo.getOrderingUnit());
  708 + vo.setOrderDate(purchaseOrderInfo.getOrderDate());
  709 + vo.setSettlementTerms(purchaseOrderInfo.getSettlementTerms());
  710 + vo.setDeliveryMethod(purchaseOrderInfo.getDeliveryMethod());
  711 + vo.setPriceListNo(purchaseOrderInfo.getPriceListNo());
  712 + vo.setExecutionStandard(purchaseOrderInfo.getExecutionStandard());
  713 + vo.setExecutionStandardRemarks(purchaseOrderInfo.getExecutionStandardRemarks());
  714 + vo.setInvoicingStatus(purchaseOrderInfo.getInvoicingStatus());
  715 + vo.setShippingCost(purchaseOrderInfo.getShippingCost());
  716 + vo.setPieceWeightHeader(purchaseOrderInfo.getPieceWeightHeader());
  717 + vo.setSurface(purchaseOrderInfo.getSurface());
  718 + vo.setTolerance(purchaseOrderInfo.getTolerance());
  719 + vo.setPerformance(purchaseOrderInfo.getPerformance());
  720 + vo.setElement(purchaseOrderInfo.getElement());
  721 + vo.setPackaging(purchaseOrderInfo.getPackaging());
  722 + vo.setRemarks(purchaseOrderInfo.getRemarks());
  723 + vo.setStatus(purchaseOrderInfo.getStatus());
  724 + vo.setExamineStatus(purchaseOrderInfo.getExamineStatus());
  725 + vo.setProductionProcess(purchaseOrderInfo.getProductionProcess());
  726 + vo.setDeptId(purchaseOrderInfo.getDeptId());
  727 + vo.setRegion(purchaseOrderInfo.getRegion());
  728 + vo.setStockUpCompanyId(purchaseOrderInfo.getStockUpCompanyId());
  729 + vo.setWorkshopId(purchaseOrderInfo.getWorkshopId());
  730 + vo.setType(purchaseOrderInfo.getType());
  731 + vo.setPackagingFee(purchaseOrderInfo.getPackagingFee());
  732 + vo.setContractCreateById(purchaseOrderInfo.getContractCreateById());
  733 + vo.setSampleOrder(true);
  734 + vo.setNoFlowInstance(true);
  735 +
  736 + List<CreatePurchaseOrderLineVo> list = new ArrayList<>();
  737 + BigDecimal totalQuantity = new BigDecimal(0);
  738 + for (PurchaseOrderLine purchaseOrderLine : sampleOrders) {
  739 + CreatePurchaseOrderLineVo createPurchaseOrderLineVo = new CreatePurchaseOrderLineVo();
  740 + createPurchaseOrderLineVo.setIndustry(purchaseOrderLine.getIndustry());
  741 + createPurchaseOrderLineVo.setQuality(purchaseOrderLine.getQuality());
  742 + createPurchaseOrderLineVo.setBrand(purchaseOrderLine.getBrand());
  743 + createPurchaseOrderLineVo.setThickness(purchaseOrderLine.getThickness());
  744 + createPurchaseOrderLineVo.setThicknessTolPos(purchaseOrderLine.getThicknessTolPos());
  745 + createPurchaseOrderLineVo.setThicknessTolNeg(purchaseOrderLine.getThicknessTolNeg());
  746 + createPurchaseOrderLineVo.setWidth(purchaseOrderLine.getWidth());
  747 + createPurchaseOrderLineVo.setWidthTolPos(purchaseOrderLine.getWidthTolPos());
  748 + createPurchaseOrderLineVo.setWidthTolNeg(purchaseOrderLine.getWidthTolNeg());
  749 + createPurchaseOrderLineVo.setLength(purchaseOrderLine.getLength());
  750 + createPurchaseOrderLineVo.setLengthTolPos(purchaseOrderLine.getLengthTolPos());
  751 + createPurchaseOrderLineVo.setLengthTolNeg(purchaseOrderLine.getLengthTolNeg());
  752 + createPurchaseOrderLineVo.setStatus(purchaseOrderLine.getStatus());
  753 + createPurchaseOrderLineVo.setQuantity(purchaseOrderLine.getQuantity());
  754 + createPurchaseOrderLineVo.setSalesPrice(purchaseOrderLine.getSalesPrice());
  755 + createPurchaseOrderLineVo.setDeliveryDate(purchaseOrderLine.getDeliveryDate());
  756 + createPurchaseOrderLineVo.setShowOrder(purchaseOrderLine.getShowOrder());
  757 + createPurchaseOrderLineVo.setAssessmentExceedsAgreement(purchaseOrderLine.getAssessmentExceedsAgreement());
  758 + createPurchaseOrderLineVo.setPackagingFee(purchaseOrderLine.getPackagingFee());
  759 + createPurchaseOrderLineVo.setSampleOrder(purchaseOrderLine.isSampleOrder());
  760 + list.add(createPurchaseOrderLineVo);
  761 +
  762 + totalQuantity = totalQuantity.add(purchaseOrderLine.getQuantity());
  763 + //删除原来的关联关系
  764 + purchaseOrderLineService.deleteById(purchaseOrderLine.getId());
  765 + }
  766 +
  767 + vo.setTotalQuantity(totalQuantity);
  768 + vo.setCreatePurchaseOrderLineVoList(list);
  769 + purchaseOrderInfoService.create(vo);
  770 +
  771 + //更新原来订货单总数量
  772 + if (purchaseOrderInfo.getTotalQuantity() != null) {
  773 + BigDecimal result = purchaseOrderInfo.getTotalQuantity().subtract(totalQuantity);
  774 + purchaseOrderInfoService.updateTotalQuantity(businessId, result);
  775 + }
  776 + }
  777 + }
678 778 }
... ...
... ... @@ -50,7 +50,6 @@ public class ContractDistributorLineServiceImpl extends BaseMpServiceImpl<Contra
50 50 return getBaseMapper().query(vo);
51 51 }
52 52
53   - @Cacheable(value = ContractDistributorLine.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null")
54 53 @Override
55 54 public ContractDistributorLine findById(String id) {
56 55
... ... @@ -87,6 +86,7 @@ public class ContractDistributorLineServiceImpl extends BaseMpServiceImpl<Contra
87 86 data.setLengthTolPos(vo.getLengthTolPos());
88 87 data.setLengthTolNeg(vo.getLengthTolNeg());
89 88 data.setItemId(vo.getItemId());
  89 + data.setSampleOrder(vo.getSampleOrder());
90 90
91 91 getBaseMapper().insert(data);
92 92
... ... @@ -130,6 +130,7 @@ public class ContractDistributorLineServiceImpl extends BaseMpServiceImpl<Contra
130 130 .set(ContractDistributorLine::getLengthTolPos, vo.getLengthTolPos())
131 131 .set(ContractDistributorLine::getLengthTolNeg, vo.getLengthTolNeg())
132 132 .set(ContractDistributorLine::getItemId, vo.getItemId())
  133 + .set(ContractDistributorLine::getSampleOrder, vo.getSampleOrder())
133 134 .eq(ContractDistributorLine::getId, vo.getId());
134 135
135 136 getBaseMapper().update(updateWrapper);
... ...
... ... @@ -731,6 +731,7 @@ public class ContractDistributorStandardServiceImpl extends
731 731 createPurchaseOrderLineVo.setSalesPrice(contractDistributorLine.getUnitPrice());
732 732 createPurchaseOrderLineVo.setDeliveryDate(contractDistributorLine.getDeliveryDate());
733 733 createPurchaseOrderLineVo.setShowOrder(contractDistributorLine.getShowOrder());
  734 + createPurchaseOrderLineVo.setSampleOrder(contractDistributorLine.getSampleOrder());
734 735 createPurchaseOrderLineVoList.add(createPurchaseOrderLineVo);
735 736 });
736 737 }
... ... @@ -755,6 +756,7 @@ public class ContractDistributorStandardServiceImpl extends
755 756 createPurchaseOrderLineVo.setSalesPrice(contractStdProcessingLine.getUnitPrice());
756 757 createPurchaseOrderLineVo.setDeliveryDate(contractStdProcessingLine.getDeliveryDate());
757 758 createPurchaseOrderLineVo.setShowOrder(contractStdProcessingLine.getShowOrder());
  759 + createPurchaseOrderLineVo.setSampleOrder(contractStdProcessingLine.getSampleOrder());
758 760 createPurchaseOrderLineVoList.add(createPurchaseOrderLineVo);
759 761 });
760 762 }
... ...
... ... @@ -50,7 +50,6 @@ public class ContractStdProcessingLineServiceImpl extends BaseMpServiceImpl<Cont
50 50 return getBaseMapper().query(vo);
51 51 }
52 52
53   - @Cacheable(value = ContractStdProcessingLine.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null")
54 53 @Override
55 54 public ContractStdProcessingLine findById(String id) {
56 55
... ... @@ -148,6 +147,7 @@ public class ContractStdProcessingLineServiceImpl extends BaseMpServiceImpl<Cont
148 147 if (!StringUtil.isBlank(vo.getItemId())) {
149 148 data.setItemId(vo.getItemId());
150 149 }
  150 + data.setSampleOrder(vo.getSampleOrder());
151 151
152 152 getBaseMapper().insert(data);
153 153
... ... @@ -196,6 +196,7 @@ public class ContractStdProcessingLineServiceImpl extends BaseMpServiceImpl<Cont
196 196 .set(ContractStdProcessingLine::getDeliveryDate, vo.getDeliveryDate() == null ? null : vo.getDeliveryDate())
197 197 .set(ContractStdProcessingLine::getShowOrder, vo.getShowOrder() == null ? null : vo.getShowOrder())
198 198 .set(ContractStdProcessingLine::getItemId, StringUtil.isBlank(vo.getItemId()) ? null : vo.getItemId())
  199 + .set(ContractStdProcessingLine::getSampleOrder, vo.getSampleOrder())
199 200 .eq(ContractStdProcessingLine::getId, vo.getId());
200 201
201 202 getBaseMapper().update(updateWrapper);
... ...
... ... @@ -7,6 +7,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
7 7 import com.fasterxml.jackson.databind.ObjectMapper;
8 8 import com.github.pagehelper.PageInfo;
9 9 import com.lframework.starter.bpm.dto.FlowTaskDto;
  10 +import com.lframework.starter.bpm.entity.FlowInstanceWrapper;
10 11 import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
11 12 import com.lframework.starter.bpm.service.FlowDefinitionWrapperService;
12 13 import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
... ... @@ -111,6 +112,19 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
111 112 PageHelperUtil.startPage(pageIndex, pageSize);
112 113 List<CustomerCredit> datas = this.query(vo);
113 114 if (CollectionUtils.isNotEmpty(datas)) {
  115 + //流程数据
  116 + List<FlowInstanceWrapper> flowByConditionList = flowInstanceWrapperService.getFlowByBusinessIdList(
  117 + datas.stream().map(CustomerCredit::getId).collect(Collectors.toList()));
  118 + if (CollectionUtils.isNotEmpty(flowByConditionList)) {
  119 + List<String> idList = flowByConditionList.stream().map(FlowInstanceWrapper::getBusinessId).collect(Collectors.toList());
  120 + for (CustomerCredit customerCredit : datas) {
  121 + if (idList.contains(customerCredit.getId())) {
  122 + customerCredit.setShowExamineDetail(true);
  123 + } else {
  124 + customerCredit.setShowExamineDetail(false);
  125 + }
  126 + }
  127 + }
114 128 // 获取当前人员的待办任务数据
115 129 List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
116 130 if (org.apache.commons.collections4.CollectionUtils.isEmpty(flowTaskList)) {
... ...
... ... @@ -240,6 +240,7 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
240 240 if (!StringUtil.isBlank(vo.getContractCreateById())) {
241 241 data.setContractCreateById(vo.getContractCreateById());
242 242 }
  243 + data.setSampleOrder(vo.isSampleOrder());
243 244
244 245
245 246 getBaseMapper().insert(data);
... ... @@ -263,7 +264,9 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
263 264 data.setWorkshopCode(workshop.getCode());
264 265 }
265 266 }
266   - flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, data);
  267 + if (!vo.isNoFlowInstance()) {
  268 + flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, data);
  269 + }
267 270
268 271 return data.getId();
269 272 }
... ...
... ... @@ -128,6 +128,7 @@ public class PurchaseOrderLineServiceImpl extends BaseMpServiceImpl<PurchaseOrde
128 128 if (vo.getPackagingFee() != null) {
129 129 data.setPackagingFee(vo.getPackagingFee());
130 130 }
  131 + data.setSampleOrder(vo.isSampleOrder());
131 132
132 133 getBaseMapper().insert(data);
133 134
... ... @@ -168,6 +169,7 @@ public class PurchaseOrderLineServiceImpl extends BaseMpServiceImpl<PurchaseOrde
168 169 .set(PurchaseOrderLine::getShowOrder, vo.getShowOrder() == null ? null : vo.getShowOrder())
169 170 .set(PurchaseOrderLine::getAssessmentExceedsAgreement, StringUtil.isBlank(vo.getAssessmentExceedsAgreement()) ? null : vo.getAssessmentExceedsAgreement())
170 171 .set(PurchaseOrderLine::getPackagingFee, vo.getPackagingFee() == null ? null : vo.getPackagingFee())
  172 + .set(PurchaseOrderLine::isSampleOrder, vo.isSampleOrder())
171 173 .eq(PurchaseOrderLine::getId, vo.getId());
172 174
173 175 getBaseMapper().update(updateWrapper);
... ...
... ... @@ -27,7 +27,10 @@ import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
27 27 import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
28 28 import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService;
29 29 import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService;
  30 +import com.lframework.xingyun.sc.service.shipments.delay.DelayedShipmentDetailService;
  31 +import com.lframework.xingyun.sc.service.shipments.delay.DelayedShipmentService;
30 32 import com.lframework.xingyun.sc.utils.CommonUtil;
  33 +import com.lframework.xingyun.sc.vo.shipments.delay.QueryDelayedShipmentVo;
31 34 import com.lframework.xingyun.sc.vo.shipments.plan.*;
32 35 import org.apache.commons.collections4.CollectionUtils;
33 36 import org.apache.commons.lang3.StringUtils;
... ... @@ -61,6 +64,11 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP
61 64 private SysRoleService sysRoleService;
62 65 @Resource
63 66 private SysUserDeptService sysUserDeptService;
  67 + @Resource
  68 + private DelayedShipmentService delayedShipmentService;
  69 + @Resource
  70 + private DelayedShipmentDetailService delayedShipmentDetailService;
  71 +
64 72
65 73
66 74 @Override
... ... @@ -208,12 +216,36 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP
208 216 existOrderSpecIds.addAll(orderSpecIds);
209 217 }
210 218 }
  219 + //延期发货单中审核中、审核驳回的数据不可被选择
  220 + QueryDelayedShipmentVo vo1 = new QueryDelayedShipmentVo();
  221 + vo1.setStatus("AUDIT");
  222 + List<DelayedShipment> query = delayedShipmentService.query(vo1);
  223 + List<String> ids = new ArrayList<>();
  224 + if (CollectionUtils.isNotEmpty(query)) {
  225 + ids = query.stream().map(DelayedShipment::getId).collect(Collectors.toList());
  226 + }
  227 + QueryDelayedShipmentVo vo2 = new QueryDelayedShipmentVo();
  228 + vo2.setStatus("REFUSE");
  229 + List<DelayedShipment> query1 = delayedShipmentService.query(vo2);
  230 + if (CollectionUtils.isNotEmpty(query1)) {
  231 + ids.addAll(query.stream().map(DelayedShipment::getId).collect(Collectors.toList()));
  232 + }
  233 + List<String> orderSpecIdList = new ArrayList<>();
  234 + if (CollectionUtils.isNotEmpty(ids)) {
  235 + List<DelayedShipmentDetail> delayedShipmentDetails = delayedShipmentDetailService.queryByList(ids);
  236 + if (CollectionUtils.isNotEmpty(delayedShipmentDetails)) {
  237 + orderSpecIdList = delayedShipmentDetails.stream().map(DelayedShipmentDetail::getOrderSpecId).collect(Collectors.toList());
  238 + }
  239 + }
211 240 List<String> orderSpecIds = vo.getOrderSpecIds();
212 241 if (CollectionUtils.isNotEmpty(orderSpecIds)) {
213 242 orderSpecIds.addAll(existOrderSpecIds);
214 243 } else {
215 244 orderSpecIds = existOrderSpecIds;
216 245 }
  246 + if (CollectionUtils.isNotEmpty(orderSpecIdList)) {
  247 + orderSpecIds.addAll(orderSpecIdList);
  248 + }
217 249 vo.setOrderSpecIds(orderSpecIds);
218 250 // 业务员做权限控制
219 251 List<String> userIds = new ArrayList<>();
... ...
1 1 package com.lframework.xingyun.sc.impl.shipments.delay;
2 2
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
3 4 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
4 5 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 6 import com.github.pagehelper.PageInfo;
... ... @@ -48,6 +49,14 @@ public class DelayedShipmentDetailServiceImpl extends BaseMpServiceImpl<DelayedS
48 49 }
49 50
50 51 @Override
  52 + public List<DelayedShipmentDetail> queryByList(List<String> delayedShipmentIds) {
  53 + LambdaQueryWrapper<DelayedShipmentDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(DelayedShipmentDetail.class);
  54 + lambdaQueryWrapper.in(DelayedShipmentDetail::getDelayedShipmentId, delayedShipmentIds);
  55 +
  56 + return getBaseMapper().selectList(lambdaQueryWrapper);
  57 + }
  58 +
  59 + @Override
51 60 public DelayedShipmentDetail findById(String id) {
52 61
53 62 return getBaseMapper().findById(id);
... ...
... ... @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 5 import com.github.pagehelper.PageInfo;
6 6 import com.lframework.starter.bpm.dto.FlowTaskDto;
  7 +import com.lframework.starter.bpm.entity.FlowInstanceWrapper;
7 8 import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
8 9 import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
9 10 import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
... ... @@ -29,10 +30,7 @@ import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto;
29 30 import com.lframework.starter.web.inner.dto.system.UserInfoDto;
30 31 import com.lframework.starter.web.inner.service.system.SysUserRoleService;
31 32 import com.lframework.starter.web.inner.service.system.SysUserService;
32   -import com.lframework.xingyun.sc.entity.DelayedShipment;
33   -import com.lframework.xingyun.sc.entity.DelayedShipmentDetail;
34   -import com.lframework.xingyun.sc.entity.PurchaseOrderInfo;
35   -import com.lframework.xingyun.sc.entity.RequestCarTicket;
  33 +import com.lframework.xingyun.sc.entity.*;
36 34 import com.lframework.xingyun.sc.handlers.TransactorHandler;
37 35 import com.lframework.xingyun.sc.mappers.DelayedShipmentMapper;
38 36 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
... ... @@ -93,6 +91,19 @@ public class DelayedShipmentServiceImpl extends BaseMpServiceImpl<DelayedShipmen
93 91 PageHelperUtil.startPage(pageIndex, pageSize);
94 92 List<DelayedShipment> datas = this.query(vo);
95 93 if (CollectionUtils.isNotEmpty(datas)) {
  94 + //流程数据
  95 + List<FlowInstanceWrapper> flowByConditionList = flowInstanceWrapperService.getFlowByBusinessIdList(
  96 + datas.stream().map(DelayedShipment::getId).collect(Collectors.toList()));
  97 + if (CollectionUtils.isNotEmpty(flowByConditionList)) {
  98 + List<String> idList = flowByConditionList.stream().map(FlowInstanceWrapper::getBusinessId).collect(Collectors.toList());
  99 + for (DelayedShipment delayedShipment : datas) {
  100 + if (idList.contains(delayedShipment.getId())) {
  101 + delayedShipment.setShowExamineDetail(true);
  102 + } else {
  103 + delayedShipment.setShowExamineDetail(false);
  104 + }
  105 + }
  106 + }
96 107 // 获取当前人员的待办任务数据
97 108 List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
98 109 if (org.apache.commons.collections4.CollectionUtils.isEmpty(flowTaskList)) {
... ... @@ -166,13 +177,16 @@ public class DelayedShipmentServiceImpl extends BaseMpServiceImpl<DelayedShipmen
166 177 LocalDate deliveryDate = createDelayedShipmentDetailVo.getDeliveryDate();
167 178 applyShipmentDate = createDelayedShipmentDetailVo.getApplyShipmentDate();
168 179 if (deliveryDate != null && applyShipmentDate != null) {
  180 + ShipmentsPlanDetail shipmentsPlanDetail = shipmentsPlanDetailService.findById(createDelayedShipmentDetailVo.getShipmentsPlanDetailId());
169 181 long daysBetween = Math.abs(ChronoUnit.DAYS.between(deliveryDate, applyShipmentDate));
170   - if (daysBetween > 1) {
171   - ids.add(createDelayedShipmentDetailVo.getShipmentsPlanDetailId());
172   - delayedExceedOneDay = true;
173   - } else {
174   - //延期等于1天的自动加入后日预发
  182 + if (daysBetween == 1 && StringUtil.isBlank(shipmentsPlanDetail.getShipmentOrderId())) {
  183 + // 延期1天且不是发货单:自动加入后日预发(发货计划)
175 184 shipmentsPlanDetailService.updateShipmentDate(createDelayedShipmentDetailVo.getShipmentsPlanDetailId(), applyShipmentDate);
  185 + } else {
  186 + ids.add(createDelayedShipmentDetailVo.getShipmentsPlanDetailId());
  187 + if (daysBetween > 1) {
  188 + delayedExceedOneDay = true;
  189 + }
176 190 }
177 191 }
178 192 }
... ... @@ -297,7 +311,7 @@ public class DelayedShipmentServiceImpl extends BaseMpServiceImpl<DelayedShipmen
297 311 if (CollectionUtils.isNotEmpty(userIds)) {
298 312 userIdList.addAll(userIds);
299 313 }
300   - } else if ("sfc".equals(workshopCode)) {
  314 + } else if ("ztfc".equals(workshopCode)) {
301 315 //经营办计划员、经营办发货员、经营办主管
302 316 codeList.add("ztfcjybjhy");
303 317 codeList.add("ztfcjybfhy");
... ...
... ... @@ -27,6 +27,13 @@ public interface DelayedShipmentDetailService extends BaseMpService<DelayedShipm
27 27 List<DelayedShipmentDetail> query(QueryDelayedShipmentDetailVo vo);
28 28
29 29 /**
  30 + * 根据延期发货单ids,查询
  31 + * @param delayedShipmentIds
  32 + * @return
  33 + */
  34 + List<DelayedShipmentDetail> queryByList(List<String> delayedShipmentIds);
  35 +
  36 + /**
30 37 * 根据ID查询
31 38 * @param id
32 39 * @return
... ...
... ... @@ -37,14 +37,14 @@ public class LatexFormulaExcelExporterUtil {
37 37 }
38 38
39 39 latex.append(formatScientificNotation(comp.getBase()));
40   - if (comp.getSup() != null && comp.getSup().compareTo(BigDecimal.ZERO) > 0) {
  40 + if (comp.getSup() != null && comp.getSup().compareTo(BigDecimal.ZERO) >= 0) {
41 41 latex.append("^{+").append(formatScientificNotation(comp.getSup())).append("}");
42 42 }
43 43 if (comp.getSup() != null && comp.getSup().compareTo(BigDecimal.ZERO) < 0) {
44 44 latex.append("^{").append(formatScientificNotation(comp.getSup())).append("}");
45 45 }
46 46
47   - if (comp.getSub() != null && comp.getSub().compareTo(BigDecimal.ZERO) > 0) {
  47 + if (comp.getSub() != null && comp.getSub().compareTo(BigDecimal.ZERO) >= 0) {
48 48 latex.append("_{+").append(formatScientificNotation(comp.getSub())).append("}");
49 49 }
50 50 if (comp.getSub() != null && comp.getSub().compareTo(BigDecimal.ZERO) < 0) {
... ...
... ... @@ -191,4 +191,10 @@ public class CreateContractDistributorLineVo implements BaseVo, Serializable {
191 191 */
192 192 @ApiModelProperty(value = "前端用ID")
193 193 private String itemId;
  194 +
  195 + /**
  196 + * 是否为试样订单
  197 + */
  198 + @ApiModelProperty(value = "是否为试样订单")
  199 + private Boolean sampleOrder;
194 200 }
... ...
... ... @@ -224,5 +224,11 @@ public class CreateContractStdProcessingLineVo implements BaseVo, Serializable {
224 224 @Length(message = "前端用ID最多允许50个字符!")
225 225 private String itemId;
226 226
  227 + /**
  228 + * 是否为试样订单
  229 + */
  230 + @ApiModelProperty(value = "是否为试样订单")
  231 + private Boolean sampleOrder;
  232 +
227 233 }
228 234
... ...
... ... @@ -92,4 +92,10 @@ public class QueryContractFrameworkVo extends PageVo implements BaseVo, Serializ
92 92 */
93 93 @ApiModelProperty("客户Id集合")
94 94 private List<String> customerIdList;
  95 +
  96 + /**
  97 + * 移动端搜索
  98 + */
  99 + @ApiModelProperty("移动端搜索")
  100 + private String keyword;
95 101 }
... ...
... ... @@ -194,5 +194,11 @@ public class UpdateContractDistributorLineVo implements BaseVo, Serializable {
194 194 */
195 195 @ApiModelProperty(value = "前端用ID")
196 196 private String itemId;
  197 +
  198 + /**
  199 + * 是否为试样订单
  200 + */
  201 + @ApiModelProperty(value = "是否为试样订单")
  202 + private Boolean sampleOrder;
197 203 }
198 204
... ...
... ... @@ -232,4 +232,11 @@ public class UpdateContractStdProcessingLineVo implements BaseVo, Serializable {
232 232 @Length(message = "前端用ID最多允许50个字符!")
233 233 private String itemId;
234 234
  235 + /**
  236 + * 是否为试样订单
  237 + */
  238 + @ApiModelProperty(value = "是否为试样订单")
  239 + private Boolean sampleOrder;
  240 +
  241 +
235 242 }
... ...
... ... @@ -237,4 +237,16 @@ public class CreatePurchaseOrderInfoVo implements BaseVo, Serializable {
237 237 @ApiModelProperty("合同创建人ID")
238 238 private String contractCreateById;
239 239
  240 + /**
  241 + * 是否为试样订单
  242 + */
  243 + @ApiModelProperty("是否为试样订单")
  244 + private boolean sampleOrder;
  245 +
  246 + /**
  247 + * 不走审核流程
  248 + */
  249 + @ApiModelProperty("不走审核流程")
  250 + private boolean noFlowInstance = false;
  251 +
240 252 }
... ...
... ... @@ -176,4 +176,10 @@ public class CreatePurchaseOrderLineVo implements BaseVo, Serializable {
176 176 @IsNumberPrecision(message = "包装费最多允许4位小数!", value = 4)
177 177 private BigDecimal packagingFee;
178 178
  179 + /**
  180 + * 是否为试样订单
  181 + */
  182 + @ApiModelProperty("是否为试样订单")
  183 + private boolean sampleOrder;
  184 +
179 185 }
... ...
... ... @@ -119,6 +119,12 @@ public class QueryPurchaseOrderInfoVo extends PageVo implements BaseVo, Serializ
119 119 private boolean freeze;
120 120
121 121 /**
  122 + * 是否为试样订单
  123 + */
  124 + @ApiModelProperty("是否为试样订单")
  125 + private boolean sampleOrder;
  126 +
  127 + /**
122 128 * 订货单位主键集合
123 129 */
124 130 @ApiModelProperty("订货单位主键集合")
... ...
... ... @@ -176,4 +176,10 @@ public class UpdatePurchaseOrderLineVo implements BaseVo, Serializable {
176 176 @IsNumberPrecision(message = "包装费最多允许4位小数!", value = 4)
177 177 private BigDecimal packagingFee;
178 178
  179 + /**
  180 + * 是否为试样订单
  181 + */
  182 + @ApiModelProperty("是否为试样订单")
  183 + private boolean sampleOrder;
  184 +
179 185 }
... ...
... ... @@ -33,6 +33,7 @@
33 33 <result column="length_tol_pos" property="lengthTolPos"/>
34 34 <result column="length_tol_neg" property="lengthTolNeg"/>
35 35 <result column="item_id" property="itemId"/>
  36 + <result column="sample_order" property="sampleOrder"/>
36 37 </resultMap>
37 38
38 39 <sql id="ContractDistributorLine_sql">
... ... @@ -65,7 +66,8 @@
65 66 tb.width_tol_neg,
66 67 tb.length_tol_pos,
67 68 tb.length_tol_neg,
68   - tb.item_id
  69 + tb.item_id,
  70 + tb.sample_order
69 71 FROM tbl_contract_distributor_line AS tb
70 72 </sql>
71 73
... ...
... ... @@ -32,6 +32,7 @@
32 32 <result column="delivery_date" property="deliveryDate"/>
33 33 <result column="show_order" property="showOrder"/>
34 34 <result column="item_id" property="itemId"/>
  35 + <result column="sample_order" property="sampleOrder"/>
35 36 <result column="create_by_id" property="createById"/>
36 37 <result column="create_by" property="createBy"/>
37 38 <result column="update_by_id" property="updateById"/>
... ... @@ -71,6 +72,7 @@
71 72 tb.delivery_date,
72 73 tb.show_order,
73 74 tb.item_id,
  75 + tb.sample_order,
74 76 tb.create_by_id,
75 77 tb.create_by,
76 78 tb.update_by_id,
... ...
... ... @@ -63,12 +63,31 @@
63 63 <if test="vo.validityTimeEnd != null">
64 64 AND tb.validity_time &lt;= #{vo.validityTimeEnd}
65 65 </if>
66   - <if test="vo.customerIdList != null and vo.customerIdList.size() > 0">
67   - AND tb.customer_id IN
68   - <foreach collection="vo.customerIdList" open="(" separator="," close=")" item="item">
69   - #{item}
70   - </foreach>
71   - </if>
  66 + <choose>
  67 + <!-- 情况1:customerIdList 和 keyword 都有值 -->
  68 + <when test="vo.customerIdList != null and vo.customerIdList.size() > 0 and vo.keyword != null and vo.keyword != ''">
  69 + AND (
  70 + tb.customer_id IN
  71 + <foreach collection="vo.customerIdList" open="(" separator="," close=")" item="item">
  72 + #{item}
  73 + </foreach>
  74 + OR tb.code LIKE CONCAT('%', #{vo.keyword}, '%')
  75 + )
  76 + </when>
  77 +
  78 + <!-- 情况2:只有 customerIdList 有值 -->
  79 + <when test="vo.customerIdList != null and vo.customerIdList.size() > 0">
  80 + AND tb.customer_id IN
  81 + <foreach collection="vo.customerIdList" open="(" separator="," close=")" item="item">
  82 + #{item}
  83 + </foreach>
  84 + </when>
  85 +
  86 + <!-- 情况3:只有 keyword 有值 -->
  87 + <when test="vo.keyword != null and vo.keyword != ''">
  88 + AND tb.code LIKE CONCAT('%', #{vo.keyword}, '%')
  89 + </when>
  90 + </choose>
72 91 </where>
73 92 order by tb.create_time desc
74 93 </select>
... ...
... ... @@ -46,6 +46,7 @@
46 46 <result column="packaging_fee" property="packagingFee"/>
47 47 <result column="contract_create_by_id" property="contractCreateById"/>
48 48 <result column="contract_create_by_name" property="contractCreateByName"/>
  49 + <result column="sample_order" property="sampleOrder"/>
49 50 <result column="create_by_id" property="createById"/>
50 51 <result column="create_by" property="createBy"/>
51 52 <result column="update_by_id" property="updateById"/>
... ... @@ -100,6 +101,7 @@
100 101 tb.contract_create_by_id,
101 102 su.name as contract_create_by_name,
102 103 tb.freeze,
  104 + tb.sample_order,
103 105 tb.create_by_id,
104 106 tb.create_by,
105 107 tb.update_by_id,
... ... @@ -157,6 +159,9 @@
157 159 <if test="vo.freeze != null and vo.freeze != ''">
158 160 AND tb.freeze = #{vo.freeze}
159 161 </if>
  162 + <if test="vo.sampleOrder != null and vo.sampleOrder != ''">
  163 + AND tb.sample_order = #{vo.sampleOrder}
  164 + </if>
160 165 <if test="vo.orderingUnitNameOrOrderNo != null and vo.orderingUnitNameOrOrderNo != ''">
161 166 AND (cu.name LIKE CONCAT('%', #{vo.orderingUnitNameOrOrderNo},'%')
162 167 or tb.order_no LIKE CONCAT('%', #{vo.orderingUnitNameOrOrderNo},'%'))
... ... @@ -191,6 +196,10 @@
191 196 <if test="vo.orderingUnitName != null and vo.orderingUnitName != ''">
192 197 AND cu.name LIKE CONCAT('%', #{vo.orderingUnitName},'%')
193 198 </if>
  199 + <if test="vo.searchKey != null and vo.searchKey != ''">
  200 + AND (cu.name LIKE CONCAT('%', #{vo.searchKey},'%')
  201 + or tb.order_no LIKE CONCAT('%', #{vo.searchKey},'%'))
  202 + </if>
194 203 <if test="vo.orderDateStart != null">
195 204 AND tb.order_date >= #{vo.orderDateStart}
196 205 </if>
... ... @@ -215,26 +224,29 @@
215 224 AND tb.workshop_id = #{vo.workshopId}
216 225 </if>
217 226 <choose>
218   - <when test="vo.queryType == 'REVOKE'">
219   - AND (tb.revoke_status = '' OR tb.revoke_status = null OR tb.revoke_status='CANCEL' OR
220   - tb.revoke_status='PARTIAL' OR tb.revoke_status IS NULL)
221   - AND (tb.status='ISSUED' OR tb.status='WAIT' OR tb.status='TRANSIT')
222   - AND tb.examine_status = 'PASS'
223   - AND (tb.spec_change_status != 'IN_PROGRESS' OR tb.spec_change_status IS NULL)
224   - </when>
225   - <when test="vo.queryType == 'CHANGE'">
226   - AND tb.examine_status = 'PASS'
227   - AND tb.status NOT IN ('SHIPPED', 'DELIVERED', 'CANCEL')
228   - AND (tb.revoke_status != 'UNDOING' OR tb.revoke_status IS NULL)
229   - AND (tb.spec_change_status != 'IN_PROGRESS' OR tb.spec_change_status IS NULL)
230   - </when>
231   - <when test="vo.queryType == 'REPLENISHMENT'">
232   - AND tb.examine_status = 'PASS'
233   - AND tb.status IN ('TRANSIT', 'SHIPPED', 'DELIVERED')
234   - </when>
235   - <otherwise>
236   - AND 1 = 0 <!-- 确保查询不到任何数据 -->
237   - </otherwise>
  227 + <when test="vo.queryType == 'REVOKE'">
  228 + AND (tb.revoke_status = '' OR tb.revoke_status = null OR tb.revoke_status='CANCEL' OR
  229 + tb.revoke_status='PARTIAL' OR tb.revoke_status IS NULL)
  230 + AND (tb.status='ISSUED' OR tb.status='WAIT' OR tb.status='TRANSIT')
  231 + AND tb.examine_status = 'PASS'
  232 + AND tb.sample_order = false
  233 + AND (tb.spec_change_status != 'IN_PROGRESS' OR tb.spec_change_status IS NULL)
  234 + </when>
  235 + <when test="vo.queryType == 'CHANGE'">
  236 + AND tb.examine_status = 'PASS'
  237 + AND tb.sample_order = false
  238 + AND tb.status NOT IN ('SHIPPED', 'DELIVERED', 'CANCEL')
  239 + AND (tb.revoke_status != 'UNDOING' OR tb.revoke_status IS NULL)
  240 + AND (tb.spec_change_status != 'IN_PROGRESS' OR tb.spec_change_status IS NULL)
  241 + </when>
  242 + <when test="vo.queryType == 'REPLENISHMENT'">
  243 + AND tb.examine_status = 'PASS'
  244 + AND tb.sample_order = false
  245 + AND tb.status IN ('TRANSIT', 'SHIPPED', 'DELIVERED')
  246 + </when>
  247 + <otherwise>
  248 + AND 1 = 0 <!-- 确保查询不到任何数据 -->
  249 + </otherwise>
238 250 </choose>
239 251 </where>
240 252 ORDER BY tb.update_time DESC
... ...
... ... @@ -25,6 +25,8 @@
25 25 <result column="show_order" property="showOrder"/>
26 26 <result column="assessment_exceeds_agreement" property="assessmentExceedsAgreement"/>
27 27 <result column="packaging_fee" property="packagingFee"/>
  28 + <result column="shipment" property="shipment"/>
  29 + <result column="sample_order" property="sampleOrder"/>
28 30 <result column="create_by_id" property="createById"/>
29 31 <result column="create_by" property="createBy"/>
30 32 <result column="update_by_id" property="updateById"/>
... ... @@ -57,6 +59,8 @@
57 59 tb.show_order,
58 60 tb.assessment_exceeds_agreement,
59 61 tb.packaging_fee,
  62 + tb.shipment,
  63 + tb.sample_order,
60 64 tb.create_by_id,
61 65 tb.create_by,
62 66 tb.update_by_id,
... ... @@ -94,7 +98,7 @@
94 98 length, length_tol_pos, length_tol_neg,
95 99 status, quantity, sales_price, delivery_date, show_order,
96 100 assessment_exceeds_agreement, create_by_id, create_by, update_by_id, update_by,
97   - create_time, update_time, parent_id,packaging_fee
  101 + create_time, update_time, parent_id,packaging_fee,sample_order
98 102 ) VALUES
99 103 <foreach collection="specList" item="item" separator=",">
100 104 (
... ... @@ -104,7 +108,7 @@
104 108 #{item.length}, #{item.lengthTolPos}, #{item.lengthTolNeg},
105 109 #{item.status}, #{item.quantity}, #{item.salesPrice}, #{item.deliveryDate}, #{item.showOrder},
106 110 #{item.assessmentExceedsAgreement}, #{item.createById}, #{item.createBy}, #{item.updateById}, #{item.updateBy},
107   - #{item.createTime}, #{item.updateTime}, #{item.parentId},#{item.packagingFee}
  111 + #{item.createTime}, #{item.updateTime}, #{item.parentId},#{item.packagingFee},#{sampleOrder}
108 112 )
109 113 </foreach>
110 114 </insert>
... ...