|
@@ -1,6 +1,7 @@
|
|
|
package com.ruoyi.ams.asn.service.impl;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.lang.Assert;
|
|
|
import com.ruoyi.ams.asn.domain.WmsDocAsnDetails;
|
|
|
import com.ruoyi.ams.asn.domain.WmsDocAsnExportTime;
|
|
|
import com.ruoyi.ams.asn.domain.WmsDocAsnHeader;
|
|
@@ -212,9 +213,31 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
|
|
|
*/
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public int deleteWmsDocAsnHeaderByAsnNos(String[] asnNos) {
|
|
|
+ public AjaxResult deleteWmsDocAsnHeaderByAsnNos(String[] asnNos) {
|
|
|
+
|
|
|
+ List<String> asnNosList = Arrays.asList(asnNos);
|
|
|
+ ArrayList<WmsDocAsnHeader> WmsDocAsnHeaders = new ArrayList<>();
|
|
|
+ ArrayList<String> asnNoWrongStatus = new ArrayList<>();
|
|
|
+ // 判断入库单状态为00新建状态才进行删除
|
|
|
+ asnNosList.stream().forEach(asnNo->{
|
|
|
+ WmsDocAsnHeader wmsDocAsnHeader = wmsDocAsnHeaderMapper.selectWmsDocAsnHeaderByAsnNo(asnNo);
|
|
|
+ String asnStatus = wmsDocAsnHeader.getAsnStatus();
|
|
|
+ if (asnStatus.equals(Constant.ASN_STS.STS00.getValue())){
|
|
|
+ WmsDocAsnHeaders.add(wmsDocAsnHeader);
|
|
|
+ } else asnNoWrongStatus.add(wmsDocAsnHeader.getAsnNo());//获取状态不符合的单号
|
|
|
+ });
|
|
|
+ // 获取到符合条件的入库单号
|
|
|
+ asnNos = WmsDocAsnHeaders.stream().map(w -> w.getAsnNo()).toArray(String[]::new);
|
|
|
+ //判断是否有符合条件的入库单
|
|
|
+ Assert.isTrue(asnNos.length>0,"所选入库单状态异常不能删除");
|
|
|
wmsDocAsnHeaderMapper.deleteWmsDocAsnDetailsByAsnNos(asnNos);
|
|
|
- return wmsDocAsnHeaderMapper.deleteWmsDocAsnHeaderByAsnNos(asnNos);
|
|
|
+ wmsDocAsnHeaderMapper.deleteWmsDocAsnHeaderByAsnNos(asnNos);
|
|
|
+
|
|
|
+ if (asnNoWrongStatus.size()>0){
|
|
|
+ return AjaxResult.success("入库单"+Arrays.deepToString(asnNos)+"已删除;"+"入库单"+asnNoWrongStatus.toString()+"状态异常未删除");
|
|
|
+ }
|
|
|
+
|
|
|
+ return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
/**
|