|
|
|
@ -34,6 +34,8 @@ import com.gaotao.modules.trans.service.TransHeaderService; |
|
|
|
import com.gaotao.modules.trans.service.TransNoControlService; |
|
|
|
import com.gaotao.modules.warehouse.dao.InventoryStockMapper; |
|
|
|
import com.gaotao.modules.warehouse.entity.InventoryStock; |
|
|
|
import com.gaotao.modules.warehouse.entity.Location; |
|
|
|
import com.gaotao.modules.warehouse.service.LocationService; |
|
|
|
import jakarta.transaction.Transactional; |
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
import org.apache.shiro.SecurityUtils; |
|
|
|
@ -71,6 +73,8 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
|
private AccessSiteMapper accessSiteMapper; |
|
|
|
@Autowired |
|
|
|
private HandlingUnitIdGeneratorService handlingUnitIdGeneratorService; |
|
|
|
@Autowired |
|
|
|
private LocationService locationService; |
|
|
|
|
|
|
|
@Value("${custom.ifs-url}") |
|
|
|
private String ifsUrl; |
|
|
|
@ -321,10 +325,22 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
|
private void genInventoryStock(TransDetailDto inData, TransHeader transHeader, PoReceiptDetail receiptDetail) { |
|
|
|
// 直接在此方法中实现库存创建逻辑,使用带行锁的库存操作,防止并发 |
|
|
|
String site = inData.getSite(); |
|
|
|
String warehouseId = transHeader.getWarehouseId(); |
|
|
|
String locationId = inData.getLocationNo(); |
|
|
|
|
|
|
|
// 根据库位获取仓库ID |
|
|
|
String warehouseId = null; |
|
|
|
Location location = locationService.getByLocationIdAndSite(site, locationId); |
|
|
|
if (location != null) { |
|
|
|
warehouseId = location.getWarehouseId(); |
|
|
|
} |
|
|
|
|
|
|
|
// 如果根据库位获取不到仓库,则使用transHeader中的仓库ID作为备用 |
|
|
|
if (StringUtils.isBlank(warehouseId)) { |
|
|
|
warehouseId = transHeader.getWarehouseId(); |
|
|
|
} |
|
|
|
|
|
|
|
String partNo = inData.getPartNo(); |
|
|
|
String batchNo = inData.getBatchNo(); |
|
|
|
String locationId = inData.getLocationNo(); |
|
|
|
String wdr = inData.getWdr(); |
|
|
|
BigDecimal transQty = inData.getTransQty(); |
|
|
|
String huFlag = inData.getNeedHandlingUnit(); |
|
|
|
|