Commit 29dadafb03b8fe6694fd616327b4640b1a97d958

Authored by yeqianyong
1 parent 55b62ada

楚江erp: 发货明细表相关接口开发

... ... @@ -25,11 +25,13 @@ import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService;
25 25 import com.lframework.xingyun.sc.service.purchase.PurchaseOrderService;
26 26 import com.lframework.xingyun.sc.service.purchase.ReceiveSheetService;
27 27 import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService;
  28 +import com.lframework.xingyun.sc.service.statistics.ShipmentDetailStatisticsService;
28 29 import com.lframework.xingyun.sc.service.stock.adjust.StockAdjustReasonService;
29 30 import com.lframework.xingyun.sc.service.stock.take.PreTakeStockSheetService;
30 31 import com.lframework.xingyun.sc.service.stock.take.TakeStockPlanService;
31 32 import com.lframework.xingyun.sc.vo.purchase.PurchaseOrderSelectorVo;
32 33 import com.lframework.xingyun.sc.vo.purchase.receive.ReceiveSheetSelectorVo;
  34 +import com.lframework.xingyun.sc.vo.statistics.shipmentDetail.QueryShipmentDetailStatisticsVo;
33 35 import com.lframework.xingyun.sc.vo.stock.adjust.stock.reason.StockAdjustReasonSelectorVo;
34 36 import com.lframework.xingyun.sc.vo.stock.take.plan.TakeStockPlanSelectorVo;
35 37 import com.lframework.xingyun.sc.vo.stock.take.pre.PreTakeStockSheetSelectorVo;
... ... @@ -91,6 +93,8 @@ public class ScSelectorController extends DefaultBaseController {
91 93 private SysDeptService sysDeptService;
92 94 @Resource
93 95 private ShipmentsPlanDetailService shipmentsPlanDetailService;
  96 + @Resource
  97 + private ShipmentDetailStatisticsService shipmentDetailStatisticsService;
94 98
95 99
96 100 /**
... ... @@ -448,4 +452,16 @@ public class ScSelectorController extends DefaultBaseController {
448 452 }
449 453 }
450 454 }
  455 +
  456 +
  457 + /**
  458 + * 根据ID加载发货明细数据
  459 + */
  460 + @ApiOperation("根据ID加载发货明细数据")
  461 + @PostMapping("/shipmentDetail/load")
  462 + public InvokeResult<List<ShipmentDetailStatistics>> loadShipmentDetail(@RequestBody(required = false) List<String> ids) {
  463 + QueryShipmentDetailStatisticsVo vo = new QueryShipmentDetailStatisticsVo();
  464 + vo.setIds(ids);
  465 + return InvokeResultBuilder.success(shipmentDetailStatisticsService.queryShipmentDetail(vo));
  466 + }
451 467 }
... ...
... ... @@ -83,12 +83,12 @@ public class ShipmentDetailStatisticsController extends DefaultBaseController {
83 83 }
84 84
85 85 /**
86   - * 根据发货单ID获取发货明细数据
  86 + * 查询发货明细数据
87 87 */
88   - @ApiOperation("根据发货单ID获取发货明细数据")
89   - @HasPermission({"statistics:shipmentDetail:modify"})
90   - @GetMapping("/getByShipmentOrderId")
91   - public InvokeResult<List<ShipmentDetailStatistics>> getByShipmentOrderId(@NotBlank(message = "id不能为空!") String shipmentOrderId) {
92   - return InvokeResultBuilder.success(shipmentDetailStatisticsService.getShipmentDetailInfo(shipmentOrderId));
  88 + @ApiOperation("查询发货明细数据")
  89 + @HasPermission({"statistics:shipmentDetail:add"})
  90 + @GetMapping("/queryShipmentDetail")
  91 + public InvokeResult<PageResult<ShipmentDetailStatistics>> queryShipmentDetail(QueryShipmentDetailStatisticsVo vo) {
  92 + return InvokeResultBuilder.success(shipmentDetailStatisticsService.pageShipmentDetail(getPageIndex(vo), getPageSize(vo), vo));
93 93 }
94 94 }
... ...
... ... @@ -35,6 +35,12 @@ public class ShipmentDetailStatistics extends BaseEntity implements BaseDto {
35 35 private String shipmentOrderNo;
36 36
37 37 /**
  38 + * 生产厂ID
  39 + */
  40 + @TableField(exist = false)
  41 + private String workshopId;
  42 +
  43 + /**
38 44 * 生产厂
39 45 */
40 46 private String workshopName;
... ... @@ -73,6 +79,18 @@ public class ShipmentDetailStatistics extends BaseEntity implements BaseDto {
73 79 private String orderingUnitName;
74 80
75 81 /**
  82 + * 合同ID
  83 + */
  84 + @TableField(exist = false)
  85 + private String contractId;
  86 +
  87 + /**
  88 + * 合同类型
  89 + */
  90 + @TableField(exist = false)
  91 + private String contractType;
  92 +
  93 + /**
76 94 * 牌号
77 95 */
78 96 private String brand;
... ... @@ -214,6 +232,18 @@ public class ShipmentDetailStatistics extends BaseEntity implements BaseDto {
214 232 private String settlementTerms;
215 233
216 234 /**
  235 + * 原材料与产品数量比
  236 + */
  237 + @TableField(exist = false)
  238 + private String materialProductRatio;
  239 +
  240 + /**
  241 + * 原材料与产品数量比备注
  242 + */
  243 + @TableField(exist = false)
  244 + private String materialProductRatioRemarks;
  245 +
  246 + /**
217 247 * 加工、经销
218 248 */
219 249 private String processingOrDistribution;
... ...
... ... @@ -3,10 +3,17 @@ package com.lframework.xingyun.sc.impl.statistics;
3 3 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 +import com.lframework.starter.web.inner.entity.SysDataDicItem;
6 7 import com.lframework.starter.web.inner.entity.SysDept;
  8 +import com.lframework.starter.web.inner.service.system.SysDataDicItemService;
7 9 import com.lframework.starter.web.inner.service.system.SysDeptService;
8 10 import com.lframework.xingyun.basedata.entity.Customer;
  11 +import com.lframework.xingyun.basedata.entity.CustomerShort;
  12 +import com.lframework.xingyun.basedata.entity.Workshop;
9 13 import com.lframework.xingyun.basedata.service.customer.CustomerService;
  14 +import com.lframework.xingyun.basedata.service.customer.CustomerShortService;
  15 +import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
  16 +import com.lframework.xingyun.sc.entity.CustomerCredit;
10 17 import com.lframework.xingyun.sc.entity.ShipmentDetailStatistics;
11 18 import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
12 19 import com.lframework.starter.web.core.utils.PageResultUtil;
... ... @@ -20,6 +27,8 @@ import com.lframework.starter.web.core.utils.PageHelperUtil;
20 27 import com.lframework.starter.common.utils.Assert;
21 28 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
22 29 import com.lframework.xingyun.sc.mappers.ShipmentDetailStatisticsMapper;
  30 +import com.lframework.xingyun.sc.service.contract.ContractStdProcessingLineService;
  31 +import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
23 32 import com.lframework.xingyun.sc.service.statistics.ShipmentDetailStatisticsService;
24 33 import com.lframework.xingyun.sc.vo.statistics.shipmentDetail.CreateShipmentDetailStatisticsVo;
25 34 import com.lframework.xingyun.sc.vo.statistics.shipmentDetail.QueryShipmentDetailStatisticsVo;
... ... @@ -41,6 +50,16 @@ public class ShipmentDetailStatisticsServiceImpl extends BaseMpServiceImpl<Shipm
41 50 private SysDeptService sysDeptService;
42 51 @Resource
43 52 private CustomerService customerService;
  53 + @Resource
  54 + private CustomerShortService customerShortService;
  55 + @Resource
  56 + private CustomerCreditService customerCreditService;
  57 + @Resource
  58 + private SysDataDicItemService sysDataDicItemService;
  59 + @Resource
  60 + private ContractStdProcessingLineService contractStdProcessingLineService;
  61 + @Resource
  62 + private WorkshopService workshopService;
44 63
45 64
46 65 @Override
... ... @@ -142,16 +161,26 @@ public class ShipmentDetailStatisticsServiceImpl extends BaseMpServiceImpl<Shipm
142 161 }
143 162
144 163 @Override
145   - public List<ShipmentDetailStatistics> getShipmentDetailInfo(String shipmentOrderId) {
146   - if (StringUtils.isBlank(shipmentOrderId)) {
147   - return Collections.emptyList();
148   - }
149   - List<ShipmentDetailStatistics> shipmentDetailInfo = getBaseMapper().getShipmentDetailInfo(shipmentOrderId);
  164 + public PageResult<ShipmentDetailStatistics> pageShipmentDetail(Integer pageIndex, Integer pageSize, QueryShipmentDetailStatisticsVo vo) {
  165 + Assert.greaterThanZero(pageIndex);
  166 + Assert.greaterThanZero(pageSize);
  167 +
  168 + PageHelperUtil.startPage(pageIndex, pageSize);
  169 + List<ShipmentDetailStatistics> dataList = this.queryShipmentDetail(vo);
  170 +
  171 + return PageResultUtil.convert(new PageInfo<>(dataList));
  172 + }
  173 +
  174 + @Override
  175 + public List<ShipmentDetailStatistics> queryShipmentDetail(QueryShipmentDetailStatisticsVo vo) {
  176 + List<ShipmentDetailStatistics> shipmentDetailInfo = getBaseMapper().getShipmentDetailInfo(vo);
150 177 if (CollectionUtils.isEmpty(shipmentDetailInfo)) {
151 178 return Collections.emptyList();
152 179 }
153 180 List<String> deptIds = new ArrayList<>();
154 181 List<String> customerIds = new ArrayList<>();
  182 + List<String> contractIds = new ArrayList<>();
  183 + List<String> workshopIds = new ArrayList<>();
155 184 for (ShipmentDetailStatistics detail : shipmentDetailInfo) {
156 185 if (StringUtils.isNotBlank(detail.getDeptId()) && !deptIds.contains(detail.getDeptId())) {
157 186 deptIds.add(detail.getDeptId());
... ... @@ -165,36 +194,87 @@ public class ShipmentDetailStatisticsServiceImpl extends BaseMpServiceImpl<Shipm
165 194 if (StringUtils.isNotBlank(detail.getStockUpCompany()) && !customerIds.contains(detail.getStockUpCompany())) {
166 195 customerIds.add(detail.getStockUpCompany());
167 196 }
  197 + if (StringUtils.isNotBlank(detail.getContractId()) && !contractIds.contains(detail.getContractId())) {
  198 + contractIds.add(detail.getContractId());
  199 + }
  200 + if (StringUtils.isNotBlank(detail.getWorkshopId()) && !workshopIds.contains(detail.getWorkshopId())) {
  201 + workshopIds.add(detail.getWorkshopId());
  202 + }
168 203 }
169   - Map<String, SysDept> deptMap = new HashMap<>();
  204 + // 获取厂房数据
  205 + List<Workshop> workshopList = workshopService.listByIds(workshopIds);
  206 + Map<String, String> workshopMap = workshopList.stream().collect(Collectors.toMap(Workshop::getId, Workshop::getName));
170 207 // 获取部门数据
171 208 List<SysDept> deptList = sysDeptService.listByIds(deptIds);
172   - if (CollectionUtils.isNotEmpty(deptList)) {
173   - deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getId, Function.identity()));
174   - }
175   - Map<String, Customer> customerMap = new HashMap<>();
  209 + Map<String, SysDept> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getId, Function.identity()));
176 210 // 获取公司数据
177 211 List<Customer> customerList = customerService.listByIds(customerIds);
178   - if (CollectionUtils.isNotEmpty(customerList)) {
179   - customerMap = customerList.stream().collect(Collectors.toMap(Customer::getId, Function.identity()));
180   - }
  212 + Map<String, Customer> customerMap = customerList.stream().collect(Collectors.toMap(Customer::getId, Function.identity()));
  213 + // 客户简称数据
  214 + List<CustomerShort> customerShortList = customerShortService.listByCustomerId(customerIds);
  215 + Map<String, String> customerShortMap = customerShortList.stream()
  216 + .collect(Collectors.toMap(CustomerShort::getCustomerId, CustomerShort::getShortName, (v1, v2) -> v1));
  217 + // 客户资信数据
  218 + List<CustomerCredit> customerCreditList = customerCreditService.listByCustomerId(customerIds);
  219 + Map<String, CustomerCredit> customerCreditMap = customerCreditList.stream()
  220 + .collect(Collectors.toMap(CustomerCredit::getCompanyId, Function.identity(), (v1, v2) -> v1));
  221 + // 企业类型数据字典
  222 + List<SysDataDicItem> enterpriseTypeList = sysDataDicItemService.findByDicCode("ENTERPRISE_TYPE");
  223 + Map<String, String> enterpriseTypeMap = enterpriseTypeList.stream()
  224 + .collect(Collectors.toMap(SysDataDicItem::getCode, SysDataDicItem::getName, (v1, v2) -> v1));
  225 + // 原材料与产品数量比
  226 + List<SysDataDicItem> materialAndQuantityRatioList = sysDataDicItemService.findByDicCode("RAW_TO_PROD_RATIO");
  227 + Map<String, String> materialAndQuantityRatioMap = materialAndQuantityRatioList.stream()
  228 + .collect(Collectors.toMap(SysDataDicItem::getCode, SysDataDicItem::getName, (v1, v2) -> v1));
181 229 for (ShipmentDetailStatistics detail : shipmentDetailInfo) {
  230 + // 厂房
  231 + String workshopName = workshopMap.get(detail.getWorkshopId());
  232 + detail.setWorkshopName(workshopName);
  233 + // 办事处
182 234 SysDept sysDept = deptMap.get(detail.getDeptId());
183 235 if (sysDept != null) {
184 236 detail.setDeptName(sysDept.getName());
185 237 }
  238 + // 区域
186 239 SysDept region = deptMap.get(detail.getRegion());
187 240 if (region != null) {
188 241 detail.setRegionName(region.getName());
189 242 }
  243 + // 客户类型
190 244 Customer orderingUnit = customerMap.get(detail.getOrderingUnit());
191 245 if (orderingUnit != null) {
192 246 detail.setOrderingUnitName(orderingUnit.getName());
  247 + CustomerCredit customerCredit = customerCreditMap.get(orderingUnit.getId());
  248 + if (customerCredit != null) {
  249 + String enterpriseType = enterpriseTypeMap.get(customerCredit.getEnterpriseType());
  250 + detail.setCustomerType(enterpriseType);
  251 + }
193 252 }
  253 + // 备货单位
194 254 Customer stockUpCompany = customerMap.get(detail.getStockUpCompany());
195 255 if (stockUpCompany != null) {
196 256 detail.setStockUpCompanyName(stockUpCompany.getName());
197 257 }
  258 + // 简称
  259 + String shortName = customerShortMap.get(detail.getOrderingUnit());
  260 + if (StringUtils.isNotBlank(shortName)) {
  261 + detail.setCustomerShortName(shortName);
  262 + }
  263 + // 回程运费
  264 + if ("PROCESS_STD_AGMT".equals(detail.getContractType())) {
  265 + // 加工
  266 + detail.setReturnFreight(detail.getShippingCost());
  267 + detail.setShippingCost(null);
  268 + }
  269 + // 加工、经销
  270 + if (StringUtils.isNotBlank(detail.getMaterialProductRatio())) {
  271 + String materialProductRatio = materialAndQuantityRatioMap.get(detail.getMaterialProductRatio());
  272 + if ("10".equals(detail.getMaterialProductRatio())) {
  273 + detail.setProcessingOrDistribution(materialProductRatio + "加工");
  274 + } else {
  275 + detail.setProcessingOrDistribution(detail.getMaterialProductRatioRemarks() + "加工");
  276 + }
  277 + }
198 278 }
199 279 return shipmentDetailInfo;
200 280 }
... ...
... ... @@ -25,8 +25,8 @@ public interface ShipmentDetailStatisticsMapper extends BaseMapper<ShipmentDetai
25 25 /**
26 26 * 获取发货明细数据
27 27 *
28   - * @param shipmentOrderId 发货单ID
29   - * @return List<ShipmentDetailStatistics>
  28 + * @param QueryShipmentDetailStatisticsVo 发货单ID集合
  29 + * @return List<ShipmentDetailStatistics>
30 30 */
31   - List<ShipmentDetailStatistics> getShipmentDetailInfo(String shipmentOrderId);
  31 + List<ShipmentDetailStatistics> getShipmentDetailInfo(@Param("vo") QueryShipmentDetailStatisticsVo vo);
32 32 }
... ...
... ... @@ -54,8 +54,16 @@ public interface ShipmentDetailStatisticsService extends BaseMpService<ShipmentD
54 54 /**
55 55 * 获取发货明细数据
56 56 *
57   - * @param shipmentOrderId 发货单ID
58   - * @return List<ShipmentDetailStatistics>
  57 + * @param QueryShipmentDetailStatisticsVo 查询条件
  58 + * @return List<ShipmentDetailStatistics>
59 59 */
60   - List<ShipmentDetailStatistics> getShipmentDetailInfo(String shipmentOrderId);
  60 + PageResult<ShipmentDetailStatistics> pageShipmentDetail(Integer pageIndex, Integer pageSize, QueryShipmentDetailStatisticsVo vo);
  61 +
  62 + /**
  63 + * 获取发货明细数据
  64 + *
  65 + * @param QueryShipmentDetailStatisticsVo 查询条件
  66 + * @return List<ShipmentDetailStatistics>
  67 + */
  68 + List<ShipmentDetailStatistics> queryShipmentDetail(QueryShipmentDetailStatisticsVo vo);
61 69 }
... ...
... ... @@ -58,6 +58,14 @@ public class CreateShipmentDetailStatisticsVo implements BaseVo, Serializable {
58 58 private String orderingUnitName;
59 59
60 60 /**
  61 + * 合同类型
  62 + */
  63 + @ApiModelProperty(value = "合同类型", required = true)
  64 + @NotBlank(message = "请输入合同类型!")
  65 + @Length(message = "合同类型最多允许20个字符!")
  66 + private String contractType;
  67 +
  68 + /**
61 69 * 牌号
62 70 */
63 71 @ApiModelProperty(value = "牌号", required = true)
... ... @@ -68,23 +76,21 @@ public class CreateShipmentDetailStatisticsVo implements BaseVo, Serializable {
68 76 /**
69 77 * 厚度
70 78 */
71   - @ApiModelProperty(value = "厚度", required = true)
72   - @NotNull(message = "请输入厚度!")
  79 + @ApiModelProperty(value = "厚度")
73 80 @TypeMismatch(message = "厚度格式有误!")
74 81 private Double thickness;
75 82
76 83 /**
77 84 * 宽度
78 85 */
79   - @ApiModelProperty(value = "宽度", required = true)
80   - @NotNull(message = "请输入宽度!")
  86 + @ApiModelProperty(value = "宽度")
81 87 @TypeMismatch(message = "宽度格式有误!")
82 88 private Double width;
83 89
84 90 /**
85 91 * 长度
86 92 */
87   - @ApiModelProperty(value = "长度", required = true)
  93 + @ApiModelProperty(value = "长度")
88 94 @NotNull(message = "请输入长度!")
89 95 @TypeMismatch(message = "长度格式有误!")
90 96 private Double length;
... ... @@ -92,7 +98,7 @@ public class CreateShipmentDetailStatisticsVo implements BaseVo, Serializable {
92 98 /**
93 99 * 状态
94 100 */
95   - @ApiModelProperty(value = "状态", required = true)
  101 + @ApiModelProperty(value = "状态")
96 102 @NotBlank(message = "请输入状态!")
97 103 @Length(message = "状态最多允许50个字符!")
98 104 private String status;
... ... @@ -125,56 +131,49 @@ public class CreateShipmentDetailStatisticsVo implements BaseVo, Serializable {
125 131 /**
126 132 * 厚度公差正
127 133 */
128   - @ApiModelProperty(value = "厚度公差正", required = true)
129   - @NotNull(message = "请输入厚度公差正!")
  134 + @ApiModelProperty(value = "厚度公差正")
130 135 @TypeMismatch(message = "厚度公差正格式有误!")
131 136 private Double thicknessTolPos;
132 137
133 138 /**
134 139 * 厚度公差负
135 140 */
136   - @ApiModelProperty(value = "厚度公差负", required = true)
137   - @NotNull(message = "请输入厚度公差负!")
  141 + @ApiModelProperty(value = "厚度公差负")
138 142 @TypeMismatch(message = "厚度公差负格式有误!")
139 143 private Double thicknessTolNeg;
140 144
141 145 /**
142 146 * 宽度公差正
143 147 */
144   - @ApiModelProperty(value = "宽度公差正", required = true)
145   - @NotNull(message = "请输入宽度公差正!")
  148 + @ApiModelProperty(value = "宽度公差正")
146 149 @TypeMismatch(message = "宽度公差正格式有误!")
147 150 private Double widthTolPos;
148 151
149 152 /**
150 153 * 宽度公差负
151 154 */
152   - @ApiModelProperty(value = "宽度公差负", required = true)
153   - @NotNull(message = "请输入宽度公差负!")
  155 + @ApiModelProperty(value = "宽度公差负")
154 156 @TypeMismatch(message = "宽度公差负格式有误!")
155 157 private Double widthTolNeg;
156 158
157 159 /**
158 160 * 长度公差正
159 161 */
160   - @ApiModelProperty(value = "长度公差正", required = true)
161   - @NotNull(message = "请输入长度公差正!")
  162 + @ApiModelProperty(value = "长度公差正")
162 163 @TypeMismatch(message = "长度公差正格式有误!")
163 164 private Double lengthTolPos;
164 165
165 166 /**
166 167 * 长度公差负
167 168 */
168   - @ApiModelProperty(value = "长度公差负", required = true)
169   - @NotNull(message = "请输入长度公差负!")
  169 + @ApiModelProperty(value = "长度公差负")
170 170 @TypeMismatch(message = "长度公差负格式有误!")
171 171 private Double lengthTolNeg;
172 172
173 173 /**
174 174 * 超协价
175 175 */
176   - @ApiModelProperty(value = "超协价", required = true)
177   - @NotBlank(message = "请输入超协价!")
  176 + @ApiModelProperty(value = "超协价")
178 177 @Length(message = "超协价最多允许20个字符!")
179 178 private String assessmentExceedsAgreement;
180 179
... ...
... ... @@ -5,6 +5,7 @@ import com.lframework.starter.web.core.vo.PageVo;
5 5 import com.lframework.starter.web.core.vo.BaseVo;
6 6 import io.swagger.annotations.ApiModelProperty;
7 7 import java.io.Serializable;
  8 +import java.util.List;
8 9
9 10 @Data
10 11 public class QueryShipmentDetailStatisticsVo extends PageVo implements BaseVo, Serializable {
... ... @@ -12,6 +13,12 @@ public class QueryShipmentDetailStatisticsVo extends PageVo implements BaseVo, S
12 13 private static final long serialVersionUID = 1L;
13 14
14 15 /**
  16 + * 发货明细ID集合
  17 + */
  18 + @ApiModelProperty("发货明细ID集合")
  19 + private List<String> ids;
  20 +
  21 + /**
15 22 * 生产厂
16 23 */
17 24 @ApiModelProperty("生产厂")
... ... @@ -29,4 +36,15 @@ public class QueryShipmentDetailStatisticsVo extends PageVo implements BaseVo, S
29 36 @ApiModelProperty("订货单名称")
30 37 private String orderingUnitName;
31 38
  39 + /**
  40 + * 订单编号
  41 + */
  42 + @ApiModelProperty("订单编号")
  43 + private String orderNo;
  44 +
  45 + /**
  46 + * 发货单编号
  47 + */
  48 + @ApiModelProperty("发货单编号")
  49 + private String shipmentOrderNo;
32 50 }
... ...
... ... @@ -114,11 +114,70 @@
114 114 </select>
115 115
116 116 <select id="getShipmentDetailInfo" resultType="com.lframework.xingyun.sc.entity.ShipmentDetailStatistics">
117   - select ol.*, o.*,w.name as workshop_name,sd.actual_shipment_quantity,sd.yield_batch_no
  117 + select
  118 + sd.id,
  119 + sd.actual_shipment_quantity,
  120 + sd.yield_batch_no,
  121 + sd.num,
  122 + ol.brand,
  123 + ol.thickness,
  124 + ol.width,
  125 + ol.length,
  126 + ol.status,
  127 + ol.quantity,
  128 + ol.sales_price,
  129 + ol.thickness_tol_pos,
  130 + ol.thickness_tol_neg,
  131 + ol.width_tol_pos,
  132 + ol.width_tol_neg,
  133 + ol.length_tol_pos,
  134 + ol.length_tol_neg,
  135 + ol.assessment_exceeds_agreement,
  136 + ol.industry,
  137 + ol.packaging_fee,
  138 + ol.quality,
  139 + o.dept_id,
  140 + o.region,
  141 + o.ordering_unit,
  142 + o.shipping_cost,
  143 + o.delivery_method,
  144 + o.stock_up_company_id,
  145 + o.order_no,
  146 + o.invoicing_status,
  147 + o.order_date,
  148 + o.settlement_terms,
  149 + case
  150 + when o.supply_unit = 'GJ' then '安徽楚江高精铜带有限公司'
  151 + when o.supply_unit = 'XC' then '安徽楚江科技新材料股份有限公司'
  152 + else ''
  153 + end as supplier,
  154 + o.workshop_id,
  155 + so.code as shipment_order_no,
  156 + so.create_time as shipment_date,
  157 + sc.id as contract_id,
  158 + sc.type as contract_type,
  159 + sc.packaging_requirements,
  160 + cl.material_product_ratio,
  161 + cl.material_product_ratio_remarks
118 162 from shipments_plan_detail sd
119   - left join tbl_purchase_order_line ol on sd.order_spec_id = ol.id
120   - left join purchase_order_info o on ol.purchase_order_id = o.id
121   - left join base_data_workshop w on o.workshop_id = w.id
122   - where sd.shipment_order_id = #{shipmentOrderId}
  163 + inner join shipments_order_info so on sd.shipment_order_id = so.id
  164 + left join tbl_purchase_order_line ol on sd.order_spec_id = ol.id
  165 + left join purchase_order_info o on ol.purchase_order_id = o.id
  166 + left join tbl_contract_distributor_standard sc on o.contract_id = sc.id
  167 + left join tbl_contract_std_processing_line cl on sc.id = cl.contract_id
  168 + <where>
  169 + <if test="vo.ids != null and vo.ids.size() > 0">
  170 + and sd.id in
  171 + <foreach collection="vo.ids" open="(" separator="," close=")" item="item">
  172 + #{item}
  173 + </foreach>
  174 + </if>
  175 + <if test="vo.orderNo != null and vo.orderNo != ''">
  176 + AND o.order_no LIKE CONCAT('%', #{vo.orderNo}, '%')
  177 + </if>
  178 + <if test="vo.shipmentOrderNo != null and vo.shipmentOrderNo != ''">
  179 + AND so.code LIKE CONCAT('%', #{vo.shipmentOrderNo}, '%')
  180 + </if>
  181 + </where>
123 182 </select>
124 183 </mapper>
... ...