|
|
@ -22,6 +22,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.UUID; |
|
|
@ -48,7 +49,6 @@ public class WarehouseOutLocationService extends MybatisBaseService<WarehouseOut |
|
|
|
t=t.add(dto.getCount()); |
|
|
|
} |
|
|
|
//分配
|
|
|
|
// WarehouseOutLocationVo warehouseOutLocationVo = baseMapper.totalCountBySkuSid(dtos.get(0).getSourceBillSid(), dtos.get(0).getGoodsSkuSid());
|
|
|
|
//总得
|
|
|
|
WarehouseOutBillDetail warehouseOutBillDetail = warehouseOutBillDetailService.getOne(new QueryWrapper<WarehouseOutBillDetail>() |
|
|
|
.eq("sourceBillSid", dtos.get(0).getSourceBillSid()) |
|
|
@ -64,24 +64,35 @@ public class WarehouseOutLocationService extends MybatisBaseService<WarehouseOut |
|
|
|
} |
|
|
|
for (WarehouseOutLocationDto dto : dtos) { |
|
|
|
WarehouseInventory warehouseInventory = warehouseInventoryService.getOne(new QueryWrapper<WarehouseInventory>().eq("sid", dto.getInventorySid())); |
|
|
|
warehouseInventory.setAllocateCount(warehouseInventory.getAllocateCount().add(dto.getCount().subtract(dto.getInitialCount()))); |
|
|
|
warehouseInventoryService.saveOrUpdate(warehouseInventory); |
|
|
|
int i = dto.getInitialCount().compareTo(new BigDecimal(0)); |
|
|
|
if (i == 0) { |
|
|
|
WarehouseOutLocation warehouseOutLocation = new WarehouseOutLocation(); |
|
|
|
BeanUtil.copyProperties(dto, warehouseOutLocation, "sid"); |
|
|
|
warehouseOutLocation.setGoodsSkuCode(warehouseOutBillDetail.getGoodsSkuCode()); |
|
|
|
warehouseOutLocation.setSpec(dto.getSpec()); |
|
|
|
warehouseOutLocation.setSid(UUID.randomUUID().toString()); |
|
|
|
baseMapper.insert(warehouseOutLocation); |
|
|
|
} else { |
|
|
|
WarehouseOutLocation warehouseOutLocation = new WarehouseOutLocation(); |
|
|
|
BeanUtil.copyProperties(dto, warehouseOutLocation); |
|
|
|
warehouseOutLocation.setSid(dto.getLocationSid()); |
|
|
|
warehouseOutLocation.setGoodsSkuCode(warehouseOutBillDetail.getGoodsSkuCode()); |
|
|
|
warehouseOutLocation.setSpec(dto.getSpec()); |
|
|
|
baseMapper.update(warehouseOutLocation,new QueryWrapper<WarehouseOutLocation>().eq("sid",dto.getLocationSid())); |
|
|
|
int b=dto.getCount().compareTo(new BigDecimal(0)); |
|
|
|
if(b==0){ |
|
|
|
WarehouseOutLocation w=baseMapper.selectOne(new QueryWrapper<WarehouseOutLocation>().eq("sid",dto.getSid())); |
|
|
|
if(null!=w){ |
|
|
|
warehouseInventory.setAllocateCount(warehouseInventory.getAllocateCount().subtract(w.getCount())); |
|
|
|
warehouseInventoryService.saveOrUpdate(warehouseInventory); |
|
|
|
baseMapper.delete(new QueryWrapper<WarehouseOutLocation>().eq("sid",dto.getSid())); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
warehouseInventory.setAllocateCount(warehouseInventory.getAllocateCount().add(dto.getCount().subtract(dto.getInitialCount()))); |
|
|
|
warehouseInventoryService.saveOrUpdate(warehouseInventory); |
|
|
|
int i = dto.getInitialCount().compareTo(new BigDecimal(0)); |
|
|
|
if (i == 0) { |
|
|
|
WarehouseOutLocation warehouseOutLocation = new WarehouseOutLocation(); |
|
|
|
BeanUtil.copyProperties(dto, warehouseOutLocation, "sid"); |
|
|
|
warehouseOutLocation.setGoodsSkuCode(warehouseOutBillDetail.getGoodsSkuCode()); |
|
|
|
warehouseOutLocation.setSpec(dto.getSpec()); |
|
|
|
warehouseOutLocation.setSid(UUID.randomUUID().toString()); |
|
|
|
baseMapper.insert(warehouseOutLocation); |
|
|
|
} else { |
|
|
|
WarehouseOutLocation warehouseOutLocation = new WarehouseOutLocation(); |
|
|
|
BeanUtil.copyProperties(dto, warehouseOutLocation); |
|
|
|
warehouseOutLocation.setSid(dto.getLocationSid()); |
|
|
|
warehouseOutLocation.setGoodsSkuCode(warehouseOutBillDetail.getGoodsSkuCode()); |
|
|
|
warehouseOutLocation.setSpec(dto.getSpec()); |
|
|
|
baseMapper.update(warehouseOutLocation,new QueryWrapper<WarehouseOutLocation>().eq("sid",dto.getLocationSid())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (warehouseOutBillDetail.getOrderCount().compareTo(t)==0 ) { |
|
|
|
warehouseOutBillDetail.setRackState("2"); |
|
|
@ -102,9 +113,9 @@ public class WarehouseOutLocationService extends MybatisBaseService<WarehouseOut |
|
|
|
return rb.success().setData(warehouseOutLocationVo); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<WarehouseOutLocationVo> totalCountBySkuSid(String sid, String skuSid) { |
|
|
|
ResultBean<WarehouseOutLocationVo> rb = ResultBean.fireFail(); |
|
|
|
WarehouseOutLocationVo warehouseOutLocationVo = baseMapper.totalCountBySkuSid(sid, skuSid); |
|
|
|
public ResultBean<List<WarehouseOutLocationVo>> totalCountBySkuSid(String sid, String skuSid) { |
|
|
|
ResultBean<List<WarehouseOutLocationVo>> rb = ResultBean.fireFail(); |
|
|
|
List<WarehouseOutLocationVo> warehouseOutLocationVo = baseMapper.sleLocationBySkuSid(sid, skuSid); |
|
|
|
return rb.success().setData(warehouseOutLocationVo); |
|
|
|
} |
|
|
|
|
|
|
|