|
|
@ -8,12 +8,10 @@ import com.win.module.eam.controller.itemoutlocation.vo.ItemOutLocationExportReq |
|
|
|
import com.win.module.eam.controller.itemoutlocation.vo.ItemOutLocationPageReqVO; |
|
|
|
import com.win.module.eam.controller.itemoutlocation.vo.ItemOutLocationUpdateReqVO; |
|
|
|
import com.win.module.eam.controller.transaction.vo.TransactionCreateReqVO; |
|
|
|
import com.win.module.eam.convert.iteminlocation.ItemInLocationConvert; |
|
|
|
import com.win.module.eam.convert.itemoutlocation.ItemOutLocationConvert; |
|
|
|
import com.win.module.eam.dal.dataobject.inventorywarning.InventoryWarningDO; |
|
|
|
import com.win.module.eam.dal.dataobject.item.ItemDO; |
|
|
|
import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO; |
|
|
|
import com.win.module.eam.dal.dataobject.iteminlocation.ItemInLocationDO; |
|
|
|
import com.win.module.eam.dal.dataobject.itemoutlocation.ItemOutLocationDO; |
|
|
|
import com.win.module.eam.dal.dataobject.location.LocationDO; |
|
|
|
import com.win.module.eam.dal.mysql.inventorywarning.InventoryWarningMapper; |
|
|
@ -25,6 +23,7 @@ import com.win.module.eam.enums.itemAccount.ItemAccountStatusEnum; |
|
|
|
import com.win.module.eam.enums.transaction.TransactionEnum; |
|
|
|
import com.win.module.eam.enums.transactionType.ProcureStatusEnum; |
|
|
|
import com.win.module.eam.service.transaction.TransactionService; |
|
|
|
import dm.jdbc.util.StringUtil; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -124,11 +123,30 @@ public class ItemOutLocationServiceImpl implements ItemOutLocationService { |
|
|
|
QueryWrapper<InventoryWarningDO> inventoryWarningDOQueryWrapper = new QueryWrapper<>(); |
|
|
|
inventoryWarningDOQueryWrapper.eq("number", number); |
|
|
|
inventoryWarningDOQueryWrapper.eq("location_number", locationNumber); |
|
|
|
inventoryWarningDOQueryWrapper.ne("procure_status", ProcureStatusEnum.YESPURCHASED.getCode()); |
|
|
|
// inventoryWarningDOQueryWrapper.ne("procure_status", ProcureStatusEnum.YESPURCHASED.getCode());
|
|
|
|
List<InventoryWarningDO> inventoryWarningDOList = inventoryWarningMapper.selectList(inventoryWarningDOQueryWrapper); |
|
|
|
if(inventoryWarningDOList.isEmpty()){ |
|
|
|
//数据为空时 直接插入记录
|
|
|
|
inventoryWarningDO.setCreateTime(LocalDateTime.now()); |
|
|
|
result = inventoryWarningMapper.insert(inventoryWarningDO); |
|
|
|
}else{ |
|
|
|
//存在一条记录是 判断是否为已完成的记录
|
|
|
|
if(inventoryWarningDOList.size()==1){ |
|
|
|
if(StringUtil.isNotEmpty(inventoryWarningDOList.get(0).getProcureStatus()) |
|
|
|
&& ProcureStatusEnum.YESPURCHASED.getCode().equals(inventoryWarningDOList.get(0).getProcureStatus())){ |
|
|
|
result = inventoryWarningMapper.insert(inventoryWarningDO); |
|
|
|
} |
|
|
|
} |
|
|
|
//存在多条记录是 判断是否都为已完成的状态
|
|
|
|
Boolean res = false; |
|
|
|
for (InventoryWarningDO warningDO : inventoryWarningDOList) { |
|
|
|
if(!ProcureStatusEnum.YESPURCHASED.getCode().equals(warningDO.getProcureStatus())){ |
|
|
|
res=true; |
|
|
|
} |
|
|
|
} |
|
|
|
if(inventoryWarningDOList.size()>1&&res==false){ |
|
|
|
result = inventoryWarningMapper.insert(inventoryWarningDO); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|