Commit d7094d2e23ff45d9b6b212d35a1118d34edef33a

Authored by tongzhonghao
2 parents 57831ab8 2ebec422

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

src/main/java/com/huaheng/api/mes/dto/Header.java
... ... @@ -73,6 +73,12 @@ public class Header {
73 73 private String superiorName;
74 74  
75 75 /**
  76 + * 日计划导入日期
  77 + */
  78 + @ApiModelProperty(value = "日计划导入日期")
  79 + private Date dailyScheduleImportDate;
  80 +
  81 + /**
76 82 * 计划开工日期
77 83 */
78 84 @ApiModelProperty(value = "计划开工日期")
... ... @@ -112,11 +118,30 @@ public class Header {
112 118 private String shipmentNote;
113 119  
114 120 /**
115   - * 日计划导入日期
  121 + * 调入仓库名称
116 122 */
117   - @ApiModelProperty(value = "日计划导入日期")
118   - private Date dailyScheduleImportDate;
  123 + @ApiModelProperty(value = "调入仓库名称")
  124 + private String transferWarehouseName;
119 125  
  126 + /**
  127 + * 调入仓库编码
  128 + */
  129 + @ApiModelProperty(value = "调入仓库编码")
  130 + private String transferWarehouseCode;
  131 +
  132 +
  133 + /**
  134 + * 删除人
  135 + */
  136 + @ApiModelProperty(value = "删除人")
  137 + private String delete;
  138 +
  139 +
  140 + /**
  141 + * 删除人工号
  142 + */
  143 + @ApiModelProperty(value = "删除人工号")
  144 + private String deleteCode;
120 145  
121 146  
122 147 public String getProductionWorker() {
... ...
src/main/java/com/huaheng/api/mes/service/MesServiceImpl.java
... ... @@ -18,16 +18,18 @@ import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail;
18 18 import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService;
19 19 import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader;
20 20 import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService;
  21 +import com.huaheng.pc.receipt.receiptHeaderHistory.service.ReceiptHeaderHistoryService;
21 22 import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail;
22 23 import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService;
23 24 import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader;
24 25 import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService;
  26 +import com.huaheng.pc.shipment.shipmentHeaderHistory.service.ShipmentHeaderHistoryService;
25 27 import com.huaheng.pc.task.taskDetail.service.TaskDetailService;
26   -import org.apache.poi.ss.formula.functions.T;
27 28 import org.springframework.stereotype.Service;
28 29 import org.springframework.transaction.annotation.Transactional;
29 30  
30 31 import javax.annotation.Resource;
  32 +import java.math.BigDecimal;
31 33 import java.util.ArrayList;
32 34 import java.util.List;
33 35 import java.util.stream.Collectors;
... ... @@ -39,6 +41,10 @@ public class MesServiceImpl implements IMesService {
39 41 private ReceiptHeaderService receiptHeaderService;
40 42  
41 43 @Resource
  44 + private ShipmentHeaderHistoryService shipmentHeaderHistoryService;
  45 + @Resource
  46 + private ReceiptHeaderHistoryService receiptHeaderHistoryService;
  47 + @Resource
42 48 private ReceiptDetailService receiptDetailService;
43 49  
44 50 @Resource
... ... @@ -66,21 +72,21 @@ public class MesServiceImpl implements IMesService {
66 72 List<Detail> details = receiptDTO.getShipemtnDetails();
67 73  
68 74 LambdaQueryWrapper<ReceiptHeader> query = Wrappers.lambdaQuery();
69   - query.eq(ReceiptHeader::getCode,header.getReferCode())
70   - .eq(ReceiptHeader::getReceiptType,header.getRefeCodeType());
  75 + query.eq(ReceiptHeader::getCode, header.getReferCode())
  76 + .eq(ReceiptHeader::getReceiptType, header.getRefeCodeType());
71 77 List<ReceiptHeader> list = receiptHeaderService.list(query);
72   - if(list.size()>0){
73   - return AjaxResult.error("添加入库单: 上游单号referCode重复[ "+header.getReferCode()+" ],请勿重复添加。");
  78 + if (list.size() > 0) {
  79 + return AjaxResult.error("添加入库单: 上游单号referCode重复[ " + header.getReferCode() + " ],请勿重复添加。");
74 80 }
75 81  
76 82 AjaxResult ajaxResult = new AjaxResult();
77 83 boolean isNull = enterIsNull(ajaxResult, header, details);
78   - if (isNull){
  84 + if (isNull) {
79 85 return ajaxResult;
80 86 }
81 87 List<Material> materialList = new ArrayList<>();
82 88 ReceiptHeader receiptHeader = new ReceiptHeader();
83   - if(StringUtils.isNotEmpty(header.getMOMID())){
  89 + if (StringUtils.isNotEmpty(header.getMOMID())) {
84 90 receiptHeader.setMOMID(header.getMOMID());
85 91 }
86 92 receiptHeader.setCode(header.getReferCode());
... ... @@ -103,30 +109,30 @@ public class MesServiceImpl implements IMesService {
103 109 receiptHeader.setCreatedBy("MOM");
104 110  
105 111 boolean success = receiptHeaderService.save(receiptHeader);
106   - if(!success) {
  112 + if (!success) {
107 113 throw new ServiceException("生成入库单头失败");
108 114 }
109 115 List<ReceiptDetail> shipemtnDetailList = new ArrayList<>();
110   - for(Detail detail : details) {
  116 + for (Detail detail : details) {
111 117 ReceiptDetail receiptDetail = new ReceiptDetail();
112 118 // 查询入库单据表头
113 119 LambdaQueryWrapper<Material> materialQueryWrapper = Wrappers.lambdaQuery();
114 120 materialQueryWrapper.eq(Material::getCode, detail.getMaterialCode());
115 121 Material material = materialService.getOne(materialQueryWrapper);
116   - if(StringUtils.isNotEmpty(detail.getDetailID())){
  122 + if (StringUtils.isNotEmpty(detail.getDetailID())) {
117 123 receiptDetail.setMOMID(detail.getDetailID());
118 124 }
119 125 receiptDetail.setIsVirtualBom(detail.getIsVirtual());
120 126 receiptDetail.setMaterialCode(detail.getMaterialCode());
121 127 receiptDetail.setMaterialName(detail.getMaterialName());
122   - if (material == null){
  128 + if (material == null) {
123 129 Material newMaterial = new Material();
124 130 newMaterial.setCode(detail.getMaterialCode());
125 131 newMaterial.setName(detail.getMaterialName());
126 132 newMaterial.setWarehouseCode("CS0001");
127 133 newMaterial.setCompanyCode("BHF");
128 134 materialList.add(newMaterial);
129   - }else {
  135 + } else {
130 136 receiptDetail.setMaterialSpec(material.getSpec());
131 137 receiptDetail.setMaterialUnit(material.getUnit());
132 138 }
... ... @@ -145,13 +151,13 @@ public class MesServiceImpl implements IMesService {
145 151 shipemtnDetailList.add(receiptDetail);
146 152 }
147 153 success = receiptDetailService.saveBatch(shipemtnDetailList);
148   - if(!success) {
  154 + if (!success) {
149 155 throw new ServiceException("生成入库单详情失败");
150 156 }
151 157 if (materialList.size() > 0) {
152 158 materialList = materialList.stream().distinct().collect(Collectors.toList());
153 159 success = materialService.saveBatch(materialList);
154   - if(!success) {
  160 + if (!success) {
155 161 throw new ServiceException("保存物料信息失败");
156 162 }
157 163 }
... ... @@ -165,22 +171,19 @@ public class MesServiceImpl implements IMesService {
165 171 List<Detail> details = receiptDTO.getShipemtnDetails();
166 172  
167 173 LambdaQueryWrapper<ShipmentHeader> query = Wrappers.lambdaQuery();
168   - query.eq(ShipmentHeader::getCode,header.getReferCode())
169   - .eq(ShipmentHeader::getShipmentType,header.getRefeCodeType());
  174 + query.eq(ShipmentHeader::getCode, header.getReferCode()).eq(ShipmentHeader::getShipmentType, header.getRefeCodeType());
170 175 List<ShipmentHeader> list = shipmentHeaderService.list(query);
171   - if(list.size()>0){
172   - return AjaxResult.error("添加出库单: 上游单号referCode重复[ "+header.getReferCode()+" ],请勿重复添加。");
  176 + if (list.size() > 0) {
  177 + return AjaxResult.error("添加出库单: 上游单号referCode重复[ " + header.getReferCode() + " ],请勿重复添加。");
173 178 }
174   -
175 179 AjaxResult ajaxResult = new AjaxResult();
176 180 boolean inNull = enterIsNull(ajaxResult, header, details);
177   - if (inNull){
  181 + if (inNull) {
178 182 return ajaxResult;
179 183 }
180   -
181 184 ShipmentHeader shipmentHeader = new ShipmentHeader();
182 185 // shipmentHeader.setId(header.getId());
183   - if(StringUtils.isNotEmpty(header.getMOMID())) {
  186 + if (StringUtils.isNotEmpty(header.getMOMID())) {
184 187 shipmentHeader.setMOMID(header.getMOMID());
185 188 }
186 189 shipmentHeader.setCode(header.getReferCode());
... ... @@ -198,9 +201,19 @@ public class MesServiceImpl implements IMesService {
198 201 shipmentHeader.setCreatorName(header.getCreatorName());
199 202 shipmentHeader.setRequestedStartDate(header.getRequestedStartDate());
200 203 shipmentHeader.setSuperiorCode(header.getSuperiorCode());
  204 + if (StringUtils.isNotEmpty(header.getTransferWarehouseName())) {
  205 + shipmentHeader.setTransferWarehouseName(header.getTransferWarehouseName());
  206 + }
  207 + if (StringUtils.isNotEmpty(header.getTransferWarehouseCode())) {
  208 + shipmentHeader.setTransferWarehouseCode(header.getTransferWarehouseCode());
  209 + }
201 210 shipmentHeader.setSuperiorName(header.getSuperiorName());
202 211 shipmentHeader.setShipmentNote(header.getShipmentNote());
203 212 shipmentHeader.setRequestedDeliveryDate(header.getRequestedDeliveryDate());
  213 + if (StringUtils.isNotEmpty(header.getTransferWarehouseCode())) {
  214 + shipmentHeader.setTransferWarehouseCode(header.getTransferWarehouseCode());
  215 + }
  216 + shipmentHeader.setDailyScheduleImportDate(header.getDailyScheduleImportDate());
204 217 shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_CONTAINER_BUILD);
205 218 shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_CONTAINER_BUILD);
206 219 shipmentHeader.setTotalLines(details.size());
... ... @@ -208,24 +221,24 @@ public class MesServiceImpl implements IMesService {
208 221 shipmentHeader.setCompanyCode("BHF");
209 222 shipmentHeader.setCreatedBy("MOM");
210 223 boolean success = shipmentHeaderService.save(shipmentHeader);
211   - if(!success) {
  224 + if (!success) {
212 225 throw new ServiceException("生成出库单头失败");
213 226 }
214 227 List<ShipmentDetail> shipmentDetailList = new ArrayList<>();
215   - details.forEach(detail->{
  228 + details.forEach(detail -> {
216 229 ShipmentDetail shipmentDetail = new ShipmentDetail();
217   - if(StringUtils.isNotEmpty(detail.getDetailID())){
  230 + if (StringUtils.isNotEmpty(detail.getDetailID())) {
218 231 shipmentDetail.setMOMID(detail.getDetailID());
219 232 }
220 233 Material material = materialService.getOne(new LambdaQueryWrapper<Material>().eq(Material::getCode, detail.getMaterialCode()));
221   - if (material==null) {
  234 + if (material == null) {
222 235 Material newMaterial = new Material();
223 236 newMaterial.setCode(detail.getMaterialCode());
224 237 newMaterial.setName(detail.getMaterialName());
225 238 newMaterial.setWarehouseCode("CS0001");
226 239 newMaterial.setCompanyCode("BHF");
227 240 materialService.save(newMaterial);
228   - }else {
  241 + } else {
229 242 shipmentDetail.setMaterialSpec(material.getSpec());
230 243 shipmentDetail.setMaterialUnit(material.getUnit());
231 244 }
... ... @@ -248,143 +261,246 @@ public class MesServiceImpl implements IMesService {
248 261 shipmentDetailList.add(shipmentDetail);
249 262 });
250 263 success = shipmentDetailService.saveBatch(shipmentDetailList);
251   - if(!success) {
  264 + if (!success) {
252 265 throw new ServiceException("生成出库单详情失败");
253 266 }
254 267 return AjaxResult.success(receiptDTO);
255 268 }
256 269  
  270 + /**
  271 + * 取消入库
  272 + */
257 273 @Override
258 274 @Transactional(rollbackFor = Exception.class)
259 275 public AjaxResult cancelEnterWarehouse(ReceiptDTO receiptDTO) {
260 276 Header header = receiptDTO.getShipmentHeader();
261   - List<Detail> details = receiptDTO.getShipemtnDetails();
262   -
263   - if (StringUtils.isEmpty(header.getReferCode())){
  277 + //List<Detail> details = receiptDTO.getShipemtnDetails();
  278 + if (StringUtils.isEmpty(header.getReferCode())) {
264 279 return AjaxResult.error().setMsg("单据单号不能为空!!!");
265 280 }
266   - for (Detail detailIsNull:details){
267   - if(StringUtils.isEmpty(detailIsNull.getDetailID())){
268   - return AjaxResult.error().setMsg("单据明细ID不能为空!!!");
269   - }
270   - }
271   -
272 281 // 查询入库单据表头
273   - LambdaQueryWrapper<ReceiptHeader> receiptHeaderWrapper = Wrappers.lambdaQuery();
274   - receiptHeaderWrapper.eq(ReceiptHeader::getId, header.getId());
275   - ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptHeaderWrapper);
  282 + ReceiptHeader receiptHeader = receiptHeaderService.getOne(new LambdaQueryWrapper<ReceiptHeader>().eq(ReceiptHeader::getCode, header.getReferCode()));
276 283 if (receiptHeader == null) {
277   - return AjaxResult.error().setMsg("没有找到对应单据!!!");
  284 + return AjaxResult.error().setMsg("没有找到对应单据," + header.getReferCode());
  285 + }
  286 + //if (receiptHeader.getFirstStatus() >= QuantityConstant.RECEIPT_HEADER_POOL) {
  287 + // return AjaxResult.error("订单状态大于100不能删除");
  288 + //}
  289 + List<ReceiptDetail> list = receiptDetailService.list(new LambdaQueryWrapper<ReceiptDetail>().eq(ReceiptDetail::getReceiptId, receiptHeader.getId()));
  290 + BigDecimal finishQty = BigDecimal.ZERO;
  291 + for (ReceiptDetail receiptDetail : list) {
  292 + finishQty = finishQty.add(receiptDetail.getTaskQty());
  293 + }
  294 + if (finishQty.compareTo(BigDecimal.ZERO) > 0) {
  295 + return AjaxResult.error("入库单删除错误:已收数量不为零不能删除!");
  296 + }
  297 + String name = "未知";
  298 + if (StringUtils.isNotEmpty(header.getDelete())) {
  299 + name = header.getDelete();
278 300 }
279   - // 查询入库单据明细
280   - LambdaQueryWrapper<ReceiptDetail> receiptDetailWrapper = Wrappers.lambdaQuery();
281   - receiptDetailWrapper.eq(ReceiptDetail::getReceiptId, receiptHeader.getId());
  301 + //新增入库单历史
  302 + receiptHeaderHistoryService.saveById(receiptHeader.getId().toString(), name);
282 303  
283   - List<ReceiptDetail> receiptDetailList = receiptDetailService.list(receiptDetailWrapper);
284   - if (receiptDetailList == null) {
285   - return AjaxResult.error().setMsg("没有找到对应单据明细!!!");
  304 + if (!receiptHeaderService.removeById(receiptHeader)) {
  305 + throw new ServiceException("删除头表失败");
286 306 }
287   - // 获取删除明细
288   - List<ReceiptDetail> removeReceiptDetails = new ArrayList<>();
289   - receiptDetailList.forEach(receiptDetail-> details.forEach(detail->{
290   - if (detail.getDetailID().equals(receiptDetail.getMOMID())){
291   - removeReceiptDetails.add(receiptDetail);
292   - }
293   - }));
294   - ArrayList<Integer> ids = new ArrayList<>();
295   - if (removeReceiptDetails.size() > 0){
296   - removeReceiptDetails.forEach(receiptDetail->{
297   - ids.add(receiptDetail.getId());
298   - });
299   - }
300   - if (ids.size() < 1 || removeReceiptDetails.size() < 1){
301   - return AjaxResult.error().setMsg("没有匹配到对应要取消的入库单单据明细!!!");
302   - }
303   - boolean success = receiptDetailService.removeByIds(ids);
304   - if(!success) {
305   - throw new ServiceException("删除入库单详情失败");
306   - }
307   - // 出库单明细数量和要删除的明细数量一致,则删除主表
308   - boolean isRemove = removeReceiptDetails.size() == receiptDetailList.size();
309   - if (isRemove){
310   - success = receiptHeaderService.removeById(receiptHeader.getId());
311   - if(!success) {
312   - throw new ServiceException("删除入库单失败");
  307 + List<Integer> receiptDetailIds = new ArrayList<>();
  308 + for (ReceiptDetail receiptDetail : list) {
  309 + receiptDetailIds.add(receiptDetail.getId());
  310 + }
  311 + if (receiptDetailIds.size() > 0) {
  312 + if (!receiptDetailService.removeByIds(receiptDetailIds)) {
  313 + throw new ServiceException("删除明细表失败");
313 314 }
314   - }else{
315   - receiptHeader.setCreatorName(header.getCreatorName());
316   - receiptHeader.setCreatorCode(header.getCreatorCode());
317   - receiptHeader.setLastUpdatedBy(header.getCreatorName());
318   - receiptHeader.setWarehouse(header.getWarehouse());
319   - receiptHeader.setWarehouseName(header.getWarehouseName());
320   - receiptHeaderService.updateById(receiptHeader);
321 315 }
322 316 return AjaxResult.success("取消入库单成功");
323 317 }
324 318  
  319 + /**
  320 + * 取消出库
  321 + */
325 322 @Override
326 323 @Transactional(rollbackFor = Exception.class)
327 324 public AjaxResult cancelOutWarehouse(ReceiptDTO receiptDTO) {
328 325 Header header = receiptDTO.getShipmentHeader();
329   - List<Detail> details = receiptDTO.getShipemtnDetails();
  326 + if (StringUtils.isEmpty(header.getReferCode())) {
  327 + return AjaxResult.error().setMsg("单据单号不能为空!!!");
  328 + }
  329 + // 查询入库单据表头
  330 + ShipmentHeader shipmentHeader = shipmentHeaderService.getOne(new LambdaQueryWrapper<ShipmentHeader>().eq(ShipmentHeader::getCode, header.getReferCode()));
  331 + if (shipmentHeader == null) {
  332 + return AjaxResult.error().setMsg("没有找到对应单据," + header.getReferCode());
  333 + }
  334 + List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(new LambdaQueryWrapper<ShipmentDetail>().eq(ShipmentDetail::getShipmentId, shipmentHeader.getId()));
  335 + BigDecimal finishQty = BigDecimal.ZERO;
  336 + for (ShipmentDetail shipmentDetail : shipmentDetailList) {
  337 + finishQty = finishQty.add(shipmentDetail.getTaskQty());
  338 + }
  339 + if (finishQty.compareTo(BigDecimal.ZERO) > 0) {
  340 + return AjaxResult.error("出库单删除错误:单据出库数量不为零不能删除!");
  341 + }
330 342  
331   - AjaxResult ajaxResult = isNull(header, details);
332   - if (StringUtils.isNotEmpty(ajaxResult.getMsg())){
333   - return ajaxResult;
  343 + String name = "未知";
  344 + if (StringUtils.isNotEmpty(header.getDelete())) {
  345 + name = header.getDelete();
334 346 }
  347 + //新增出库单历史
  348 + shipmentHeaderHistoryService.saveById(shipmentHeader.getId().toString(), name);
335 349  
336   - // 查询出库单据表头
337   - LambdaQueryWrapper<ShipmentHeader> shipmentHeaderWrapper = Wrappers.lambdaQuery();
338   - shipmentHeaderWrapper.eq(ShipmentHeader::getCode, header.getSuperiorCode());
339   - ShipmentHeader shipmentHeader = shipmentHeaderService.getOne(shipmentHeaderWrapper);
340   - if (shipmentHeader == null) {
341   - return ajaxResult.setCode(RetCode.FAIL).setMsg("没有找到对应单据!!!");
342   - }
343   - // 查询出库单据明细
344   - LambdaQueryWrapper<ShipmentDetail> shipmentDetailWrapper = Wrappers.lambdaQuery();
345   - shipmentDetailWrapper.eq(ShipmentDetail::getShipmentId, header.getId());
346   - List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(shipmentDetailWrapper);
347   - if (shipmentDetailList == null) {
348   - return ajaxResult.setCode(RetCode.FAIL).setMsg("没有找到对应单据明细!!!");
349   - }
350   - // 获取删除明细
351   - List<ShipmentDetail> removeShipmentDetails = new ArrayList<>();
352   - shipmentDetailList.forEach(shipmentDetai-> details.forEach(detail->{
353   - if (detail.getMaterialCode().equals(shipmentDetai.getMaterialCode()) && detail.getTotalQty().intValue() == (shipmentDetai.getTaskQty().intValue())){
354   - removeShipmentDetails.add(shipmentDetai);
  350 + List<Integer> shipmentDetailIds = new ArrayList<>();
  351 + if (!shipmentHeaderService.removeById(shipmentHeader)) {
  352 + throw new ServiceException("删除头表失败");
  353 + }
  354 + for (ShipmentDetail shipmentDetail : shipmentDetailList) {
  355 + shipmentDetailIds.add(shipmentDetail.getId());
  356 + }
  357 + if (shipmentDetailIds.size() > 0) {
  358 + if (!shipmentDetailService.removeByIds(shipmentDetailIds)) {
  359 + throw new ServiceException("删除明细表失败");
355 360 }
356   - }));
357   - if (removeShipmentDetails.size() > 0){
358   - ArrayList<Integer> ids = new ArrayList<>();
359   - removeShipmentDetails.forEach(shipmentDetail-> ids.add(shipmentDetail.getId()));
360   - shipmentDetailService.removeByIds(ids);
361   - }else {
362   - return ajaxResult.setCode(RetCode.FAIL).setMsg("没有匹配到对应要取消的出库单单据明细!!!");
363   - }
364   - // 出库单明细数量和要删除的明细数量一致,则删除主表
365   - boolean isRemove = removeShipmentDetails.size() == shipmentDetailList.size();
366   - if (isRemove){
367   - shipmentHeaderService.removeById(shipmentHeader);
368   - }else{
369   - shipmentHeader.setCreatorName(header.getCreatorName());
370   - shipmentHeader.setCreatorCode(header.getCreatorCode());
371   - shipmentHeader.setLastUpdatedBy(header.getCreatorName());
372   - shipmentHeader.setWarehouse(header.getWarehouse());
373   - shipmentHeader.setWarehouseName(header.getWarehouseName());
374   - shipmentHeaderService.updateById(shipmentHeader);
375 361 }
376 362 return AjaxResult.success("取消出库单成功");
377 363 }
378 364  
379 365  
  366 + ///**
  367 + // * 取消入库
  368 + // */
  369 + //@Override
  370 + //@Transactional(rollbackFor = Exception.class)
  371 + //public AjaxResult cancelEnterWarehouse(ReceiptDTO receiptDTO) {
  372 + // Header header = receiptDTO.getShipmentHeader();
  373 + // List<Detail> details = receiptDTO.getShipemtnDetails();
  374 + //
  375 + // if (StringUtils.isEmpty(header.getReferCode())){
  376 + // return AjaxResult.error().setMsg("单据单号不能为空!!!");
  377 + // }
  378 + // for (Detail detailIsNull:details){
  379 + // if(StringUtils.isEmpty(detailIsNull.getDetailID())){
  380 + // return AjaxResult.error().setMsg("单据明细ID不能为空!!!");
  381 + // }
  382 + // }
  383 + //
  384 + // // 查询入库单据表头
  385 + // LambdaQueryWrapper<ReceiptHeader> receiptHeaderWrapper = Wrappers.lambdaQuery();
  386 + // receiptHeaderWrapper.eq(ReceiptHeader::getId, header.getId());
  387 + // ReceiptHeader receiptHeader = receiptHeaderService.getById(receiptHeaderWrapper);
  388 + // if (receiptHeader == null) {
  389 + // return AjaxResult.error().setMsg("没有找到对应单据!!!");
  390 + // }
  391 + // // 查询入库单据明细
  392 + // LambdaQueryWrapper<ReceiptDetail> receiptDetailWrapper = Wrappers.lambdaQuery();
  393 + // receiptDetailWrapper.eq(ReceiptDetail::getReceiptId, receiptHeader.getId());
  394 + //
  395 + // List<ReceiptDetail> receiptDetailList = receiptDetailService.list(receiptDetailWrapper);
  396 + // if (receiptDetailList == null) {
  397 + // return AjaxResult.error().setMsg("没有找到对应单据明细!!!");
  398 + // }
  399 + // // 获取删除明细
  400 + // List<ReceiptDetail> removeReceiptDetails = new ArrayList<>();
  401 + // receiptDetailList.forEach(receiptDetail-> details.forEach(detail->{
  402 + // if (detail.getDetailID().equals(receiptDetail.getMOMID())){
  403 + // removeReceiptDetails.add(receiptDetail);
  404 + // }
  405 + // }));
  406 + // ArrayList<Integer> ids = new ArrayList<>();
  407 + // if (removeReceiptDetails.size() > 0){
  408 + // removeReceiptDetails.forEach(receiptDetail->{
  409 + // ids.add(receiptDetail.getId());
  410 + // });
  411 + // }
  412 + // if (ids.size() < 1 || removeReceiptDetails.size() < 1){
  413 + // return AjaxResult.error().setMsg("没有匹配到对应要取消的入库单单据明细!!!");
  414 + // }
  415 + // boolean success = receiptDetailService.removeByIds(ids);
  416 + // if(!success) {
  417 + // throw new ServiceException("删除入库单详情失败");
  418 + // }
  419 + // // 出库单明细数量和要删除的明细数量一致,则删除主表
  420 + // boolean isRemove = removeReceiptDetails.size() == receiptDetailList.size();
  421 + // if (isRemove){
  422 + // success = receiptHeaderService.removeById(receiptHeader.getId());
  423 + // if(!success) {
  424 + // throw new ServiceException("删除入库单失败");
  425 + // }
  426 + // }else{
  427 + // receiptHeader.setCreatorName(header.getCreatorName());
  428 + // receiptHeader.setCreatorCode(header.getCreatorCode());
  429 + // receiptHeader.setLastUpdatedBy(header.getCreatorName());
  430 + // receiptHeader.setWarehouse(header.getWarehouse());
  431 + // receiptHeader.setWarehouseName(header.getWarehouseName());
  432 + // receiptHeaderService.updateById(receiptHeader);
  433 + // }
  434 + // return AjaxResult.success("取消入库单成功");
  435 + //}
  436 + //
  437 + ///**
  438 + // * 取消入库
  439 + // */
  440 + //@Override
  441 + //@Transactional(rollbackFor = Exception.class)
  442 + //public AjaxResult cancelOutWarehouse(ReceiptDTO receiptDTO) {
  443 + // Header header = receiptDTO.getShipmentHeader();
  444 + // List<Detail> details = receiptDTO.getShipemtnDetails();
  445 + //
  446 + // AjaxResult ajaxResult = isNull(header, details);
  447 + // if (StringUtils.isNotEmpty(ajaxResult.getMsg())) {
  448 + // return ajaxResult;
  449 + // }
  450 + //
  451 + // // 查询出库单据表头
  452 + // LambdaQueryWrapper<ShipmentHeader> shipmentHeaderWrapper = Wrappers.lambdaQuery();
  453 + // shipmentHeaderWrapper.eq(ShipmentHeader::getCode, header.getSuperiorCode());
  454 + // ShipmentHeader shipmentHeader = shipmentHeaderService.getOne(shipmentHeaderWrapper);
  455 + // if (shipmentHeader == null) {
  456 + // return ajaxResult.setCode(RetCode.FAIL).setMsg("没有找到对应单据!!!");
  457 + // }
  458 + // // 查询出库单据明细
  459 + // LambdaQueryWrapper<ShipmentDetail> shipmentDetailWrapper = Wrappers.lambdaQuery();
  460 + // shipmentDetailWrapper.eq(ShipmentDetail::getShipmentId, header.getId());
  461 + // List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(shipmentDetailWrapper);
  462 + // if (shipmentDetailList == null) {
  463 + // return ajaxResult.setCode(RetCode.FAIL).setMsg("没有找到对应单据明细!!!");
  464 + // }
  465 + // // 获取删除明细
  466 + // List<ShipmentDetail> removeShipmentDetails = new ArrayList<>();
  467 + // shipmentDetailList.forEach(shipmentDetai-> details.forEach(detail->{
  468 + // if (detail.getMaterialCode().equals(shipmentDetai.getMaterialCode()) && detail.getTotalQty().intValue() == (shipmentDetai.getTaskQty().intValue())){
  469 + // removeShipmentDetails.add(shipmentDetai);
  470 + // }
  471 + // }));
  472 + // if (removeShipmentDetails.size() > 0) {
  473 + // ArrayList<Integer> ids = new ArrayList<>();
  474 + // removeShipmentDetails.forEach(shipmentDetail -> ids.add(shipmentDetail.getId()));
  475 + // shipmentDetailService.removeByIds(ids);
  476 + // } else {
  477 + // return ajaxResult.setCode(RetCode.FAIL).setMsg("没有匹配到对应要取消的出库单单据明细!!!");
  478 + // }
  479 + // // 出库单明细数量和要删除的明细数量一致,则删除主表
  480 + // boolean isRemove = removeShipmentDetails.size() == shipmentDetailList.size();
  481 + // if (isRemove) {
  482 + // shipmentHeaderService.removeById(shipmentHeader);
  483 + // } else {
  484 + // shipmentHeader.setCreatorName(header.getCreatorName());
  485 + // shipmentHeader.setCreatorCode(header.getCreatorCode());
  486 + // shipmentHeader.setLastUpdatedBy(header.getCreatorName());
  487 + // shipmentHeader.setWarehouse(header.getWarehouse());
  488 + // shipmentHeader.setWarehouseName(header.getWarehouseName());
  489 + // shipmentHeaderService.updateById(shipmentHeader);
  490 + // }
  491 + // return AjaxResult.success("取消出库单成功");
  492 + //}
  493 +
  494 +
380 495 /**
381 496 * 出库单参数_判空处理
  497 + *
382 498 * @param ajaxResult
383 499 * @param shipmentHeader
384 500 * @param shipemtnDetails
385 501 */
386   - private boolean outIsNull (AjaxResult ajaxResult, Header shipmentHeader, List<Detail> shipemtnDetails){
387   - if (isNullData(ajaxResult, shipmentHeader, shipemtnDetails)){
  502 + private boolean outIsNull(AjaxResult ajaxResult, Header shipmentHeader, List<Detail> shipemtnDetails) {
  503 + if (isNullData(ajaxResult, shipmentHeader, shipemtnDetails)) {
388 504 return true;
389 505 }
390 506  
... ... @@ -393,7 +509,7 @@ public class MesServiceImpl implements IMesService {
393 509 return true;
394 510 }
395 511  
396   - shipemtnDetails.forEach(shipemtnDetail->{
  512 + shipemtnDetails.forEach(shipemtnDetail -> {
397 513 if (StringUtils.isEmpty(shipemtnDetail.getMaterialCode())) {
398 514 ajaxResult.setCode(RetCode.FAIL).setMsg("物料编码不能为空!!!");
399 515 }
... ... @@ -409,7 +525,7 @@ public class MesServiceImpl implements IMesService {
409 525 ajaxResult.setCode(RetCode.FAIL).setMsg("总数量不能为空!!!");
410 526 }
411 527 });
412   - if (isNull || StringUtils.isNotEmpty(ajaxResult.getMsg())){
  528 + if (isNull || StringUtils.isNotEmpty(ajaxResult.getMsg())) {
413 529 return ajaxResult;
414 530 }
415 531 return ajaxResult;
... ... @@ -417,13 +533,14 @@ public class MesServiceImpl implements IMesService {
417 533  
418 534 /**
419 535 * 入库单参数_判空处理
  536 + *
420 537 * @param ajaxResult
421 538 * @param shipmentHeader
422 539 * @param shipemtnDetails
423 540 */
424   - private boolean enterIsNull(AjaxResult ajaxResult, Header shipmentHeader, List<Detail> shipemtnDetails){
  541 + private boolean enterIsNull(AjaxResult ajaxResult, Header shipmentHeader, List<Detail> shipemtnDetails) {
425 542  
426   - if (isNullData(ajaxResult, shipmentHeader, shipemtnDetails)){
  543 + if (isNullData(ajaxResult, shipmentHeader, shipemtnDetails)) {
427 544 return true;
428 545 }
429 546  
... ... @@ -433,11 +550,11 @@ public class MesServiceImpl implements IMesService {
433 550 } else if (StringUtils.isEmpty(shipmentHeader.getReferCode())) {
434 551 ajaxResult.setCode(RetCode.FAIL).setMsg("单据单号不能为空!!!");
435 552 return true;
436   - }else if (shipmentHeader.getTotalQty() == null || shipmentHeader.getTotalQty().intValue() <= 0) {
  553 + } else if (shipmentHeader.getTotalQty() == null || shipmentHeader.getTotalQty().intValue() <= 0) {
437 554 ajaxResult.setCode(RetCode.FAIL).setMsg("数量不能为空!!!");
438 555 }
439 556  
440   - shipemtnDetails.forEach(shipemtnDetail->{
  557 + shipemtnDetails.forEach(shipemtnDetail -> {
441 558 if (StringUtils.isEmpty(shipemtnDetail.getMaterialCode())) {
442 559 ajaxResult.setCode(RetCode.FAIL).setMsg("物料编码不能为空!!!");
443 560 } else if (shipemtnDetail.getTotalQty() == null || shipemtnDetail.getQty().intValue() <= 0) {
... ...
src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/ReceiptHeaderController.java
... ... @@ -280,7 +280,7 @@ public class ReceiptHeaderController extends BaseController {
280 280 }
281 281  
282 282 //新增入库单历史
283   - receiptHeaderHistoryService.saveById(String.valueOf(id));
  283 + receiptHeaderHistoryService.saveById(String.valueOf(id), "");
284 284  
285 285 if (!receiptHeaderService.removeById(receiptHeader)) {
286 286 throw new ServiceException("删除头表失败");
... ...
src/main/java/com/huaheng/pc/receipt/receiptHeaderHistory/service/ReceiptHeaderHistoryService.java
... ... @@ -2,9 +2,11 @@ package com.huaheng.pc.receipt.receiptHeaderHistory.service;
2 2  
3 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 6 import com.huaheng.common.constant.QuantityConstant;
6 7 import com.huaheng.common.exception.service.ServiceException;
7 8 import com.huaheng.common.support.Convert;
  9 +import com.huaheng.common.utils.StringUtils;
8 10 import com.huaheng.common.utils.security.ShiroUtils;
9 11 import com.huaheng.framework.web.domain.AjaxResult;
10 12 import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail;
... ... @@ -13,22 +15,19 @@ import com.huaheng.pc.receipt.receiptDetailHistory.domain.ReceiptDetailHistory;
13 15 import com.huaheng.pc.receipt.receiptDetailHistory.service.ReceiptDetailHistoryService;
14 16 import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader;
15 17 import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService;
16   -//import org.apache.commons.beanutils.BeanUtils;
  18 +import com.huaheng.pc.receipt.receiptHeaderHistory.domain.ReceiptHeaderHistory;
  19 +import com.huaheng.pc.receipt.receiptHeaderHistory.mapper.ReceiptHeaderHistoryMapper;
17 20 import org.springframework.beans.BeanUtils;
18 21 import org.springframework.stereotype.Service;
  22 +import org.springframework.transaction.annotation.Transactional;
  23 +
19 24 import javax.annotation.Resource;
20 25 import java.math.BigDecimal;
21 26 import java.util.ArrayList;
22   -
23 27 import java.util.Arrays;
24 28 import java.util.List;
25 29 import java.util.stream.Collectors;
26 30  
27   -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
28   -import com.huaheng.pc.receipt.receiptHeaderHistory.domain.ReceiptHeaderHistory;
29   -import com.huaheng.pc.receipt.receiptHeaderHistory.mapper.ReceiptHeaderHistoryMapper;
30   -import org.springframework.transaction.annotation.Transactional;
31   -
32 31 @Service
33 32 public class ReceiptHeaderHistoryService extends ServiceImpl<ReceiptHeaderHistoryMapper, ReceiptHeaderHistory> {
34 33  
... ... @@ -42,61 +41,61 @@ public class ReceiptHeaderHistoryService extends ServiceImpl&lt;ReceiptHeaderHistor
42 41 private ReceiptHeaderHistoryMapper receiptHeaderHistoryMapper;
43 42  
44 43 @Transactional
45   - public AjaxResult add(String ids){
  44 + public AjaxResult add(String ids) {
46 45 List<Integer> idList = Arrays.asList(Convert.toIntArray(ids));
47 46 for (Integer id : idList) {
48 47 ReceiptHeader receiptHeader = receiptHeaderService.getById(id);
49   - if (receiptHeader == null) {
  48 + if (receiptHeader == null) {
50 49 return AjaxResult.error("没有找到单据" + String.valueOf(id));
51 50 }
52   - if((receiptHeader.getFirstStatus()>= QuantityConstant.RECEIPT_HEADER_POSTING && receiptHeader.getLastStatus()>=QuantityConstant.RECEIPT_HEADER_POSTING)||
53   - (receiptHeader.getFirstStatus()<QuantityConstant.RECEIPT_HEADER_POOL &receiptHeader.getLastStatus()<QuantityConstant.RECEIPT_HEADER_POOL)){
  51 + if ((receiptHeader.getFirstStatus() >= QuantityConstant.RECEIPT_HEADER_POSTING && receiptHeader.getLastStatus() >= QuantityConstant.RECEIPT_HEADER_POSTING) ||
  52 + (receiptHeader.getFirstStatus() < QuantityConstant.RECEIPT_HEADER_POOL & receiptHeader.getLastStatus() < QuantityConstant.RECEIPT_HEADER_POOL)) {
54 53 ReceiptHeaderHistory receiptHeaderHistory = new ReceiptHeaderHistory();
55 54 List<ReceiptDetailHistory> receiptDetailHistoryList = new ArrayList<>();
56 55 //查询入库单明细
57 56 LambdaQueryWrapper<ReceiptDetail> lambdaQueryWrapper = Wrappers.lambdaQuery();
58 57 lambdaQueryWrapper.eq(ReceiptDetail::getReceiptId, id);
59 58 List<ReceiptDetail> list = receiptDetailService.list(lambdaQueryWrapper);
60   - //复制到入库历史实体
  59 + //复制到入库历史实体
61 60 // ConvertUtils.register(new DateConverter(null), java.util.Date.class);
62 61 // BeanUtils.copyProperties(receiptHeaderHistory, receiptHeader);
63   - receiptHeaderHistory.setId(receiptHeader.getId());
64   - receiptHeaderHistory.setWarehouseCode(receiptHeader.getWarehouseCode());
65   - receiptHeaderHistory.setCompanyCode(receiptHeader.getCompanyCode());
66   - receiptHeaderHistory.setCode(receiptHeader.getCode());
67   - receiptHeaderHistory.setReceiptType(receiptHeader.getReceiptType());
68   - receiptHeaderHistory.setFirstStatus(receiptHeader.getFirstStatus());
69   - receiptHeaderHistory.setLastStatus(receiptHeader.getLastStatus());
70   - receiptHeaderHistory.setTotalQty(BigDecimal.valueOf(23));
71   - receiptHeaderHistory.setTotalLines(receiptHeader.getTotalLines());
72   - receiptHeaderHistory.setReceiptNote(receiptHeader.getReceiptNote());
73   - receiptHeaderHistory.setCreated(receiptHeader.getCreated());
74   - receiptHeaderHistory.setCreatedBy(receiptHeader.getCreatedBy());
75   - receiptHeaderHistory.setLastUpdated(receiptHeader.getLastUpdated());
76   - receiptHeaderHistory.setLastUpdatedBy(receiptHeader.getLastUpdatedBy());
77   - receiptHeaderHistory.setVersion(receiptHeader.getVersion());
78   - receiptHeaderHistory.setProcessStamp(receiptHeader.getProcessStamp());
79   - receiptHeaderHistory.setDeleted(receiptHeader.getDeleted());
  62 + receiptHeaderHistory.setId(receiptHeader.getId());
  63 + receiptHeaderHistory.setWarehouseCode(receiptHeader.getWarehouseCode());
  64 + receiptHeaderHistory.setCompanyCode(receiptHeader.getCompanyCode());
  65 + receiptHeaderHistory.setCode(receiptHeader.getCode());
  66 + receiptHeaderHistory.setReceiptType(receiptHeader.getReceiptType());
  67 + receiptHeaderHistory.setFirstStatus(receiptHeader.getFirstStatus());
  68 + receiptHeaderHistory.setLastStatus(receiptHeader.getLastStatus());
  69 + receiptHeaderHistory.setTotalQty(BigDecimal.valueOf(23));
  70 + receiptHeaderHistory.setTotalLines(receiptHeader.getTotalLines());
  71 + receiptHeaderHistory.setReceiptNote(receiptHeader.getReceiptNote());
  72 + receiptHeaderHistory.setCreated(receiptHeader.getCreated());
  73 + receiptHeaderHistory.setCreatedBy(receiptHeader.getCreatedBy());
  74 + receiptHeaderHistory.setLastUpdated(receiptHeader.getLastUpdated());
  75 + receiptHeaderHistory.setLastUpdatedBy(receiptHeader.getLastUpdatedBy());
  76 + receiptHeaderHistory.setVersion(receiptHeader.getVersion());
  77 + receiptHeaderHistory.setProcessStamp(receiptHeader.getProcessStamp());
  78 + receiptHeaderHistory.setDeleted(receiptHeader.getDeleted());
80 79  
81   - for (ReceiptDetail receiptDetail: list) {
82   - ReceiptDetailHistory receiptDetailHistory = new ReceiptDetailHistory();
83   - BeanUtils.copyProperties(receiptDetailHistory, receiptDetail);
84   - receiptDetailHistoryList.add(receiptDetailHistory);
85   - }
  80 + for (ReceiptDetail receiptDetail : list) {
  81 + ReceiptDetailHistory receiptDetailHistory = new ReceiptDetailHistory();
  82 + BeanUtils.copyProperties(receiptDetailHistory, receiptDetail);
  83 + receiptDetailHistoryList.add(receiptDetailHistory);
  84 + }
86 85  
87 86  
88 87 receiptHeaderHistory.setLastUpdatedBy(ShiroUtils.getName());
89   - if (!receiptHeaderService.removeById(receiptHeader.getId())){
  88 + if (!receiptHeaderService.removeById(receiptHeader.getId())) {
90 89 throw new ServiceException("删除头表失败");
91 90 }
92   - if(!this.save(receiptHeaderHistory)){
  91 + if (!this.save(receiptHeaderHistory)) {
93 92 throw new ServiceException("新增历史入库单失败");
94 93 }
95 94 // 当存在明细时删除
96   - if (list.size()!= 0){
  95 + if (list.size() != 0) {
97 96 //删除入库明细
98 97 List<Integer> receiptDetailIds = new ArrayList<>();
99   - for (int i=0; i<receiptDetailHistoryList.size();i++){
  98 + for (int i = 0; i < receiptDetailHistoryList.size(); i++) {
100 99 receiptDetailHistoryList.get(i).setLastUpdatedBy(ShiroUtils.getName());
101 100 receiptDetailHistoryList.get(i).setReceiptId(receiptHeaderHistory.getId());
102 101 receiptDetailIds.add(receiptDetailHistoryList.get(i).getId());
... ... @@ -104,11 +103,12 @@ public class ReceiptHeaderHistoryService extends ServiceImpl&lt;ReceiptHeaderHistor
104 103 if (!receiptDetailService.removeByIds(receiptDetailIds)) {
105 104 throw new ServiceException("删除明细表失败");
106 105 }
107   - if (!receiptDetailHistoryService.saveBatch(receiptDetailHistoryList)){
  106 + if (!receiptDetailHistoryService.saveBatch(receiptDetailHistoryList)) {
108 107 throw new ServiceException("新增明细失败");
109   - } }
  108 + }
  109 + }
110 110  
111   - }else {
  111 + } else {
112 112 return AjaxResult.error("入库单没有完成,无法删除");
113 113 }
114 114 }
... ... @@ -118,14 +118,21 @@ public class ReceiptHeaderHistoryService extends ServiceImpl&lt;ReceiptHeaderHistor
118 118  
119 119 /**
120 120 * 根据删除的入库单主表ID新增历史入库单记录
  121 + *
121 122 * @param id
122 123 */
123 124 @Transactional
124   - public void saveById(String id) {
  125 + public void saveById(String id, String name) {
125 126 ReceiptHeader receiptHeader = receiptHeaderService.getById(id);
126 127 ReceiptHeaderHistory receiptHeaderHistory = new ReceiptHeaderHistory();
127 128 BeanUtils.copyProperties(receiptHeader, receiptHeaderHistory);
128   - receiptHeaderHistory.setOrigin("WMS删除:"+ShiroUtils.getName());
  129 + if (StringUtils.isNotEmpty(name) && "回传".equals(name)) {
  130 + receiptHeaderHistory.setOrigin("回传");
  131 + } else if (StringUtils.isNotEmpty(name) && !"回传".equals(name)) {
  132 + receiptHeaderHistory.setOrigin("MOM删除:" + name);
  133 + } else {
  134 + receiptHeaderHistory.setOrigin("WMS删除:" + ShiroUtils.getName());
  135 + }
129 136 this.save(receiptHeaderHistory);
130 137 List<ReceiptDetailHistory> receiptDetailHistoryList = new ArrayList<>();
131 138 List<ReceiptDetail> receiptDetailList = receiptDetailService.list(new LambdaQueryWrapper<ReceiptDetail>().eq(ReceiptDetail::getReceiptId, receiptHeader.getId()));
... ... @@ -135,7 +142,7 @@ public class ReceiptHeaderHistoryService extends ServiceImpl&lt;ReceiptHeaderHistor
135 142 receiptDetailHistoryList.add(receiptDetailHistory);
136 143 }
137 144 List<ReceiptDetailHistory> newList = receiptDetailHistoryList.stream().peek(detail -> detail.setReceiptId(receiptHeaderHistory.getId())).collect(Collectors.toList());
138   - if (!receiptDetailHistoryService.saveBatch(newList)){
  145 + if (!receiptDetailHistoryService.saveBatch(newList)) {
139 146 throw new ServiceException("批量新增失败");
140 147 }
141 148  
... ...
src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java
... ... @@ -100,13 +100,15 @@ public class ShipmentHeaderController extends BaseController {
100 100 @Log(title = "出库-出库单", operating = "查看出库主单", action = BusinessType.GRANT)
101 101 @PostMapping("/list")
102 102 @ResponseBody
103   - public TableDataInfo list(ShipmentHeader shipmentHeader, String createdBegin, String createdEnd, String deliveryDate, String startDate) {
  103 + public TableDataInfo list(ShipmentHeader shipmentHeader, String createdBegin, String createdEnd, String deliveryDate, String startDate, String importDate) {
104 104 LambdaQueryWrapper<ShipmentHeader> lambdaQueryWrapper = Wrappers.lambdaQuery();
105 105 PageDomain pageDomain = TableSupport.buildPageRequest();
106 106 Integer pageNum = pageDomain.getPageNum();
107 107 Integer pageSize = pageDomain.getPageSize();
108 108 Date date1 = null;
109 109 Date date2 = null;
  110 + Date date3 = null;
  111 +
110 112 try {
111 113 if (StringUtils.isNotNull(deliveryDate)) {
112 114 date1 = new SimpleDateFormat("yyyy-MM-dd").parse(deliveryDate);
... ... @@ -126,6 +128,15 @@ public class ShipmentHeaderController extends BaseController {
126 128 } catch (java.text.ParseException e) {
127 129 }
128 130  
  131 + try {
  132 + if (StringUtils.isNotNull(importDate)) {
  133 + date3 = new SimpleDateFormat("yyyy-MM-dd").parse(importDate);
  134 + } else {
  135 + date3 = null;
  136 + }
  137 + } catch (java.text.ParseException e) {
  138 + }
  139 +
129 140 Date startTime1 = date1;
130 141 Date endTime1 = null;
131 142 if (startTime1 != null) {
... ... @@ -140,6 +151,13 @@ public class ShipmentHeaderController extends BaseController {
140 151 endTime2 = DateUtils.dateAddNum(startTime2, 1, 0, -1);
141 152 }
142 153  
  154 + Date startTime3 = date3;
  155 + Date endTime3 = null;
  156 + if (startTime3 != null) {
  157 + //获取当前时间
  158 + endTime3 = DateUtils.dateAddNum(startTime3, 1, 0, -1);
  159 + }
  160 +
143 161 lambdaQueryWrapper.ge(StringUtils.isNotEmpty(createdBegin), ShipmentHeader::getCreated, createdBegin)
144 162 .le(StringUtils.isNotEmpty(createdEnd), ShipmentHeader::getCreated, createdEnd)
145 163 .eq(ShipmentHeader::getWarehouseCode, ShiroUtils.getWarehouseCode())
... ... @@ -155,9 +173,11 @@ public class ShipmentHeaderController extends BaseController {
155 173 .like(StringUtils.isNotEmpty(shipmentHeader.getProcessType()), ShipmentHeader::getProcessType, shipmentHeader.getProcessType())
156 174 .eq(StringUtils.isNotEmpty(shipmentHeader.getShipmentType()), ShipmentHeader::getShipmentType, shipmentHeader.getShipmentType())
157 175 .eq(StringUtils.isNotEmpty(shipmentHeader.getReferCode()), ShipmentHeader::getReferCode, shipmentHeader.getReferCode())
  176 + .like(StringUtils.isNotEmpty(shipmentHeader.getTransferWarehouseName()), ShipmentHeader::getTransferWarehouseName, shipmentHeader.getTransferWarehouseName())
158 177 .eq(StringUtils.isNotEmpty(shipmentHeader.getReferCodeType()), ShipmentHeader::getReferCodeType, shipmentHeader.getReferCodeType())
159 178 .between(StringUtils.isNotNull(startTime1), ShipmentHeader::getRequestedDeliveryDate, startTime1, endTime1)
160 179 .between(StringUtils.isNotNull(startTime2), ShipmentHeader::getRequestedStartDate, startTime2, endTime2)
  180 + .between(StringUtils.isNotNull(startTime3), ShipmentHeader::getDailyScheduleImportDate, startTime3, endTime3)
161 181 .eq(shipmentHeader.getFirstStatus() != null, ShipmentHeader::getFirstStatus, shipmentHeader.getFirstStatus())
162 182 .eq(shipmentHeader.getLastStatus() != null, ShipmentHeader::getLastStatus, shipmentHeader.getLastStatus())
163 183 .eq(StringUtils.isNotNull(shipmentHeader.getPushSuccessStatus()), ShipmentHeader::getPushSuccessStatus, shipmentHeader.getPushSuccessStatus())
... ... @@ -331,7 +351,7 @@ public class ShipmentHeaderController extends BaseController {
331 351 }
332 352  
333 353 //新增出库单历史
334   - shipmentHeaderHistoryService.saveById(String.valueOf(id));
  354 + shipmentHeaderHistoryService.saveById(String.valueOf(id), "");
335 355  
336 356  
337 357 List<Integer> shipmentDetailIds = new ArrayList<>();
... ...
src/main/java/com/huaheng/pc/shipment/shipmentHeader/domain/ShipmentHeader.java
... ... @@ -3,10 +3,11 @@ package com.huaheng.pc.shipment.shipmentHeader.domain;
3 3 import com.baomidou.mybatisplus.annotation.*;
4 4 import io.swagger.annotations.ApiModel;
5 5 import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
  7 +
6 8 import java.io.Serializable;
7 9 import java.math.BigDecimal;
8 10 import java.util.Date;
9   -import lombok.Data;
10 11  
11 12 @ApiModel(value = "com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader")
12 13 @Data
... ... @@ -146,6 +147,13 @@ public class ShipmentHeader implements Serializable {
146 147 // private String requestedDeliveryType;
147 148  
148 149 /**
  150 + * 日计划导入日期
  151 + */
  152 + @TableField(value = "dailyScheduleImportDate")
  153 + @ApiModelProperty(value = "日计划导入日期")
  154 + private Date dailyScheduleImportDate;
  155 +
  156 + /**
149 157 * 计划发车日期
150 158 */
151 159 @TableField(value = "scheduledShipDate")
... ... @@ -229,6 +237,12 @@ public class ShipmentHeader implements Serializable {
229 237 @ApiModelProperty(value = "总行数")
230 238 private Integer totalLines;
231 239  
  240 + /**
  241 + * 调入仓库名称
  242 + */
  243 + @TableField(value = "transferWarehouseName")
  244 + @ApiModelProperty(value = "调入仓库名称")
  245 + private String transferWarehouseName;
232 246  
233 247 /**
234 248 * 调整单号
... ... @@ -484,32 +498,31 @@ public class ShipmentHeader implements Serializable {
484 498  
485 499 /**
486 500 * 回传错误次数
  501 + *
487 502 * @return
488 503 */
489 504 @TableField(value = "pushErrorCount")
490   - @ApiModelProperty(value="回传错误次数")
  505 + @ApiModelProperty(value = "回传错误次数")
491 506 public Integer pushErrorCount;
492 507  
493 508 /**
494 509 * 错误消息
495 510 */
496 511 @TableField(value = "ErrorMsg")
497   - @ApiModelProperty(value="错误消息")
  512 + @ApiModelProperty(value = "错误消息")
498 513 public String errorMsg;
499 514  
500 515 /**
501 516 * 回传状态,0默认,1成功,2失败
502 517 */
503 518 @TableField(value = "pushSuccessStatus")
504   - @ApiModelProperty(value="回传状态,0默认,1成功,2失败,3提前过账")
  519 + @ApiModelProperty(value = "回传状态,0默认,1成功,2失败,3提前过账")
505 520 public Integer pushSuccessStatus;
506 521  
507 522 /**
508   - * 日计划导入日期
  523 + * 调入仓库编码
509 524 */
510   - @TableField(value = "dailyScheduleImportDate")
511   - @ApiModelProperty(value="日计划导入日期")
512   - public Date dailyScheduleImportDate;
513   -
514   -
  525 + @TableField(value = "transferWarehouseCode")
  526 + @ApiModelProperty(value = "调入仓库编码")
  527 + private String transferWarehouseCode;
515 528 }
... ...
src/main/java/com/huaheng/pc/shipment/shipmentHeaderHistory/service/ShipmentHeaderHistoryService.java
... ... @@ -3,8 +3,8 @@ package com.huaheng.pc.shipment.shipmentHeaderHistory.service;
3 3 import com.baomidou.mybatisplus.extension.service.IService;
4 4 import com.huaheng.pc.shipment.shipmentHeaderHistory.domain.ShipmentHeaderHistory;
5 5  
6   -public interface ShipmentHeaderHistoryService extends IService<ShipmentHeaderHistory>{
  6 +public interface ShipmentHeaderHistoryService extends IService<ShipmentHeaderHistory> {
7 7  
8 8  
9   - void saveById(String id);
  9 + void saveById(String id, String name);
10 10 }
... ...
src/main/java/com/huaheng/pc/shipment/shipmentHeaderHistory/service/ShipmentHeaderHistoryServiceImpl.java
... ... @@ -4,11 +4,11 @@ package com.huaheng.pc.shipment.shipmentHeaderHistory.service;
4 4 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
5 5 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 6 import com.huaheng.common.exception.service.ServiceException;
  7 +import com.huaheng.common.utils.StringUtils;
7 8 import com.huaheng.common.utils.security.ShiroUtils;
8 9 import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail;
9 10 import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService;
10 11 import com.huaheng.pc.shipment.shipmentDetailHistory.domain.ShipmentDetailHistory;
11   -import com.huaheng.pc.shipment.shipmentDetailHistory.mapper.ShipmentDetailHistoryMapper;
12 12 import com.huaheng.pc.shipment.shipmentDetailHistory.service.ShipmentDetailHistoryService;
13 13 import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader;
14 14 import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService;
... ... @@ -41,14 +41,21 @@ public class ShipmentHeaderHistoryServiceImpl extends ServiceImpl&lt;ShipmentHeader
41 41  
42 42 /**
43 43 * 根据删除的出库单主表ID新增历史出库单记录
  44 + *
44 45 * @param id
45 46 */
46 47 @Override
47   - public void saveById(String id) {
  48 + public void saveById(String id, String name) {
48 49 ShipmentHeader shipmentHeader = shipmentHeaderService.getById(id);
49 50 ShipmentHeaderHistory shipmentHeaderHistory = new ShipmentHeaderHistory();
50 51 BeanUtils.copyProperties(shipmentHeader, shipmentHeaderHistory);
51   - shipmentHeaderHistory.setOrigin("WMS删除:"+ ShiroUtils.getName());
  52 + if (StringUtils.isNotEmpty(name) && "回传".equals(name)) {
  53 + shipmentHeaderHistory.setOrigin("回传");
  54 + } else if (StringUtils.isNotEmpty(name) && !"回传".equals(name)) {
  55 + shipmentHeaderHistory.setOrigin("MOM删除:" + name);
  56 + } else {
  57 + shipmentHeaderHistory.setOrigin("WMS删除:" + ShiroUtils.getName());
  58 + }
52 59 shipmentHeaderHistoryMapper.insert(shipmentHeaderHistory);
53 60 List<ShipmentDetailHistory> shipmentDetailHistoryList = new ArrayList<>();
54 61 List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(new LambdaQueryWrapper<ShipmentDetail>().eq(ShipmentDetail::getShipmentId, shipmentHeader.getId()));
... ... @@ -58,7 +65,7 @@ public class ShipmentHeaderHistoryServiceImpl extends ServiceImpl&lt;ShipmentHeader
58 65 shipmentDetailHistoryList.add(shipmentDetailHistory);
59 66 }
60 67 List<ShipmentDetailHistory> newList = shipmentDetailHistoryList.stream().peek(detail -> detail.setShipmentId(shipmentHeaderHistory.getId())).collect(Collectors.toList());
61   - if (!shipmentDetailHistoryService.saveBatch(newList)){
  68 + if (!shipmentDetailHistoryService.saveBatch(newList)) {
62 69 throw new ServiceException("批量新增失败");
63 70 }
64 71 }
... ...
src/main/resources/templates/shipment/shipmentHeader/report.html
1 1 <!DOCTYPE HTML>
2   -<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org">
3 3 <meta charset="utf-8">
4 4 <head th:include="include :: header"></head>
5 5 <body class="white-bg" style="padding:5px 0;" id="ddd">
... ... @@ -11,25 +11,37 @@
11 11 <thead style="display:table-header-group;">
12 12 <tr>
13 13 <td colspan="7">
14   - <span style="padding-top:40px;width: 40%; float:left;" th:text="${#dates.format(shipmentHeader.created,'yyyy-MM-dd HH:mm:ss')}"></span>
  14 + <span style="padding-top:40px;width: 40%; float:left;"
  15 + th:text="${#dates.format(shipmentHeader.created,'yyyy-MM-dd HH:mm:ss')}"></span>
15 16 <h2 style="width:20%;text-align:center;float:left;padding-top:10px;">出库单</h2>
16   - <span style="padding-top:20px;width:38%;float:right; text-align: right"><img id="shipmentCode" th:src="@{'/image/'+${shipmentHeader.code}}"></span>
  17 + <span style="padding-top:20px;width:38%;float:right; text-align: right"><img id="shipmentCode"
  18 + th:src="@{'/image/'+${shipmentHeader.code}}"></span>
17 19 </td>
18 20 </tr>
19 21 <tr style="padding:15px 0 5px 0;border-bottom:1px solid #606060">
20 22 <td colspan="7">
21   -<!-- <div style="width:40%; float:left;">客户名称:<span th:text="${shipmentHeader['customerName']}"></span></div>-->
22   - <div style="width:40%; float:left;">生产车间:<span th:text="${shipmentHeader['workshop']}"></span></div>
23   - <div style="width:40%; float:left;">仓库:<span th:text="${shipmentHeader['warehouseName']}"></span></div>
24   - <div style="width:40%; float:left;">通知单号:<span th:text="${shipmentHeader['noticeNo']}"></span></div>
25   - <div style="width:40%; float:left;">母件名称:<span th:text="${shipmentHeader['superiorName']}"></span></div>
  23 + <!-- <div style="width:40%; float:left;">客户名称:<span th:text="${shipmentHeader['customerName']}"></span></div>-->
  24 + <div style="width:40%; float:left;">生产车间:<span th:text="${shipmentHeader['workshop']}"></span>
  25 + </div>
  26 + <div style="width:40%; float:left;">仓库:<span th:text="${shipmentHeader['warehouseName']}"></span>
  27 + </div>
  28 + <div style="width:40%; float:left;">通知单号:<span th:text="${shipmentHeader['noticeNo']}"></span>
  29 + </div>
  30 + <div style="width:40%; float:left;">母件名称:<span
  31 + th:text="${shipmentHeader['superiorName']}"></span></div>
26 32 <span></span>
27   - <div style="width:40%; float:left;">母件编码:<span th:text="${shipmentHeader['superiorCode']}"></span></div>
28   - <div style="width:40%; float:left;">备注:<span th:text="${shipmentHeader['shipmentNote']}"></span></div>
  33 + <div style="width:40%; float:left;">母件编码:<span
  34 + th:text="${shipmentHeader['superiorCode']}"></span></div>
  35 + <div style="width:40%; float:left;">备注:<span th:text="${shipmentHeader['shipmentNote']}"></span>
  36 + </div>
  37 + <div style="width:40%; float:left;">调入仓库名称:<span
  38 + th:text="${shipmentHeader['transferWarehouseName']}"></span>
  39 + </div>
29 40 <div style="width:50%; float:right; text-align:right">
30 41 <span>明细条数:<span th:text="${shipmentHeader['totalLines']}"></span></span>
31 42 <span style="padding-left:20px;">明细总数:<span th:text="${shipmentHeader['totalQty']}"></span></span>
32   - <span class="noprint" style="padding-left:20px;"><button type="button" onClick="a()"><i class="fa fa-print"></i> 打印</button></span>
  43 + <span class="noprint" style="padding-left:20px;"><button type="button" onClick="a()"><i
  44 + class="fa fa-print"></i> 打印</button></span>
33 45 </div>
34 46 </td>
35 47 </tr>
... ... @@ -98,13 +110,15 @@
98 110 </script>
99 111 <style type="text/css">
100 112 @media print {
101   - .noprint{display:none;}
  113 + .noprint {
  114 + display: none;
  115 + }
102 116 }
103 117 </style>
104 118 <script type="text/javascript" src="../../../js/jquery-1.4.4.min.js"></script>
105 119 <script type="text/javascript" src="../../../js/jquery.jqprint-0.3.js"></script>
106 120 <script type="text/javascript">
107   - function a(){
  121 + function a() {
108 122 $("#ddd").jqprint();
109 123 }
110 124 </script>
... ...
src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html
... ... @@ -66,6 +66,9 @@
66 66 调整单号:<input type="text" name="processType"/>
67 67 </li>
68 68 <li>
  69 + 调入仓库名称:<input type="text" name="transferWarehouseName"/>
  70 + </li>
  71 + <li>
69 72 头 状 态:<select name="firstStatus"
70 73 th:with="firstStatus=${@dict.getType('shipmentHeaderStatus')}">
71 74 <option value="">所有</option>
... ... @@ -97,14 +100,22 @@
97 100 备注:<input type="text" name="shipmentNote"/>
98 101 </li>
99 102 <li class="time">
  103 +
  104 + <label>日计划导入日期: </label>
  105 + <input type="text" class="time-input" id="dailyScheduleImportDate"
  106 + placeholder="日计划导入日期"
  107 + name="importDate" autocomplete="off"/>
  108 +
100 109 <label>计划开工日期: </label>
101 110 <input type="text" class="time-input" id="requestedStartDate"
102 111 placeholder="计划开工日期"
103 112 name="startDate" autocomplete="off"/>
  113 +
104 114 <label>计划完成日期: </label>
105 115 <input type="text" class="time-input" id="requestedDeliveryDate"
106 116 placeholder="计划完成日期"
107 117 name="deliveryDate" autocomplete="off"/>
  118 +
108 119 <label>创建时间: </label>
109 120 <input type="text" class="time-input" id="startTime" placeholder="开始时间"
110 121 name="createdBegin" autocomplete="off"/>
... ... @@ -300,6 +311,15 @@
300 311 var shipmentId = "";
301 312 var shipmentCode = "";
302 313  
  314 + //日计划导入日期
  315 + layui.use('laydate', function () {
  316 + var laydate = layui.laydate;
  317 + var day1 = new Date();
  318 + day1.setTime(day1.getTime() + 24 * 60 * 60 * 1000 * 1);
  319 + // laydate.render({ elem: '#requestedDeliveryDate', theme: 'molv',value: new Date(day1), isInitValue: true});
  320 + laydate.render({elem: '#dailyScheduleImportDate', theme: 'molv'});
  321 + });
  322 +
303 323 //计划完工日期
304 324 layui.use('laydate', function () {
305 325 var laydate = layui.laydate;
... ... @@ -456,6 +476,11 @@
456 476 return actions.join('');
457 477 }
458 478 },
  479 +
  480 + {
  481 + field: 'dailyScheduleImportDate',
  482 + title: '日计划导入日期',
  483 + },
459 484 {
460 485 field: 'requestedStartDate',
461 486 title: '计划开工日期',
... ... @@ -468,11 +493,16 @@
468 493 field: 'workshop',
469 494 title: '生产车间',
470 495 },
  496 +
471 497 {
472 498 field: 'shipmentNote',
473 499 title: '备注',
474 500 },
475 501 {
  502 + field: 'transferWarehouseName',
  503 + title: '调入仓库名称',
  504 + },
  505 + {
476 506 field: 'errorMsg',
477 507 title: '错误信息',
478 508 formatter: function (value, row, index) {
... ...